WIZlib Library API  ver 1.0
WIZlib Library API User Menual
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sockutil.h
Go to the documentation of this file.
1 
12 #ifndef _SOCKUTIL_H
13 #define _SOCKUTIL_H
14 
15 //#include "common/common.h"
16 
44 #define WATCH_SOCK_UDP_SEND 0x01
45 #define WATCH_SOCK_TCP_SEND 0x02
46 #define WATCH_SOCK_CONN_TRY 0x04
47 #define WATCH_SOCK_CLS_TRY 0x08
48 #define WATCH_SOCK_CONN_EVT 0x10
49 #define WATCH_SOCK_CLS_EVT 0x20
50 #define WATCH_SOCK_RECV 0x40
51 #define WATCH_SOCK_MASK_LOW 0x0F
52 #define WATCH_SOCK_MASK_HIGH 0x70
53 #define WATCH_SOCK_ALL_MASK 0x7F
54 
55 typedef void (*watch_cbfunc)(uint8 id, uint8 item, int32 ret);
56 
61 #define DEVICE_INIT_WITH_MEMCHK(tx_size_v, rx_size_v) \
62 { \
63  uint8 _i, *_tx, *_rx, _tx_cnt = 0, _rx_cnt = 0; \
64  if(sizeof(tx_size_v)/sizeof(uint8) != TOTAL_SOCK_NUM || \
65  sizeof(rx_size_v)/sizeof(uint8) != TOTAL_SOCK_NUM) { \
66  printf("Device Memory Configure fail 1"); \
67  while(1); \
68  } \
69  _tx = (uint8*)tx_size_v; \
70  _rx = (uint8*)rx_size_v; \
71  for(_i=0; _i<TOTAL_SOCK_NUM; _i++) { \
72  _tx_cnt += _tx[_i]; \
73  _rx_cnt += _rx[_i]; \
74  } \
75  if(_tx_cnt+_rx_cnt != TOTAL_SOCK_MEM) { \
76  printf("Device Memory Configure fail 2"); \
77  while(1); \
78  } \
79  device_init(tx_size_v, rx_size_v); \
80 }
81 
82 int8 sockwatch_open(uint8 sock, watch_cbfunc cb);
83 int8 sockwatch_close(uint8 sock);
84 int8 sockwatch_set(uint8 sock, uint8 item);
85 int8 sockwatch_clr(uint8 sock, uint8 item);
86 int8 sockwatch_chk(uint8 sock, uint8 item);
87 void sockwatch_run(void);
88 int8 network_init(uint8 dhcp_sock, void_func ip_update, void_func ip_conflict);
89 void network_disp(wiz_NetInfo *netinfo);
90 int8 ip_check(int8 *str, uint8 *ip);
91 int8 port_check(int8 *str, uint16 *port);
92 int8 mac_check(int8 *str, uint8 *mac);
93 int8* inet_ntoa(uint32 addr);
94 int8* inet_ntoa_pad(uint32 addr);
95 uint32 inet_addr(uint8* addr);
96 uint16 htons( uint16 hostshort);
97 uint32 htonl(uint32 hostlong);
98 uint32 ntohs(uint16 netshort);
99 uint32 ntohl(uint32 netlong);
100 
101 #endif //_SOCKUTIL_H
102 
103 
104