ioLibrary for Cortex M series
|
Functions | |
int8_t | network_init (uint8_t dhcp_sock, void_func ip_update, void_func ip_conflict) |
void | network_disp (wiz_NetInfo *netinfo) |
int8_t | ip_check (int8_t *str, uint8_t *ip) |
int8_t | port_check (int8_t *str, uint16_t *port) |
int8_t | mac_check (int8_t *str, uint8_t *mac) |
int8_t * | inet_ntoa (uint32_t addr) |
int8_t * | inet_ntoa_pad (uint32_t addr) |
uint32_t | inet_addr (uint8_t *addr) |
uint16_t | swaps (uint16_t i) |
uint32_t | swapl (uint32_t l) |
uint16_t | htons (uint16_t hostshort) |
uint32_t | htonl (uint32_t hostlong) |
uint32_t | ntohs (uint16_t netshort) |
uint32_t | ntohl (uint32_t netlong) |
Initialize Network. This function should be called in the main function. If not, you have to handle network initialization manually.
dhcp_sock | The socket number which will be used at dhcp action |
ip_update | The hook function to be called back when IP Addr update. |
ip_conflict | The hook function to be called back when IP Addr conflict. |
Definition at line 35 of file sockutil.c.
References DBGA, DEFAULT_MAC_ADDR, wiz_NetInfo_t::dhcp, wiz_NetInfo_t::mac, mac_check(), NETINFO_STATIC, NETINIT_ADDR_SET, network_disp(), RET_NOK, RET_OK, and SetNetInfo().
void network_disp | ( | wiz_NetInfo * | netinfo) |
Display Current Network Information. Current IP Addr, Subnet Mask, Gateway Addr,
DNS Server Addr, DHCP mode is displayed.
netinfo | The wiz_NetInfo struct pointer to display, if input NULL value, it will display current configuration value. |
Definition at line 89 of file sockutil.c.
References GetNetInfo(), wiz_NetInfo_t::gw, wiz_NetInfo_t::ip, LOG, LOGA, wiz_NetInfo_t::mac, and wiz_NetInfo_t::sn.
Referenced by network_init().
int8_t ip_check | ( | int8_t * | str, |
uint8_t * | ip | ||
) |
Check a string is right IP Address, and if right, copy the address to the 'ip' variable as array.
str | The string to investigate if it is right IP Address. |
ip | The array pointer in which the address will enter when it is right IP address. |
Definition at line 282 of file sockutil.c.
References RET_NOK, RET_OK, and str_check().
int8_t port_check | ( | int8_t * | str, |
uint16_t * | port | ||
) |
Check a string is right TCP Port number, and if right, copy the number to the 'port' variable.
str | The string to investigate if it is right TCP Port. |
port | The variable pointer in which the number will enter when it is right TCP Port. |
Definition at line 319 of file sockutil.c.
int8_t mac_check | ( | int8_t * | str, |
uint8_t * | mac | ||
) |
Check a string is right MAC Address, and if right, copy the address to the 'mac' variable as array.
str | The string to investigate if it is right MAC Address. |
mac | The array pointer in which the address will enter when it is right MAC address. |
Definition at line 340 of file sockutil.c.
References RET_NOK, RET_OK, and str_check().
Referenced by network_init().
int8_t* inet_ntoa | ( | uint32_t | addr) |
Convert a 32bit Address into a Dotted Decimal Format string.
addr | 32bit address. |
Definition at line 373 of file sockutil.c.
int8_t* inet_ntoa_pad | ( | uint32_t | addr) |
Convert a 32bit Address into a Dotted Decimal Format string. This is differ from inet_ntoa in fixed length.
addr | 32bit address. |
Definition at line 388 of file sockutil.c.
uint32_t inet_addr | ( | uint8_t * | addr) |
Converts a string containing an (Ipv4) Internet Protocol decimal dotted address into a 32bit address.
addr | Dotted Decimal Format string. |
Definition at line 402 of file sockutil.c.
uint16_t swaps | ( | uint16_t | i) |
Swap the byte order of 16bit(short) wide variable.
i | 16bit value to swap |
Definition at line 430 of file sockutil.c.
Referenced by htons().
uint32_t swapl | ( | uint32_t | l) |
Swap the byte order of 32bit(long) wide variable.
l | 32bit value to convert |
Definition at line 444 of file sockutil.c.
uint16_t htons | ( | uint16_t | hostshort) |
htons function converts a unsigned short from host to TCP/IP network byte order (which is big-endian).
hostshort | The value to convert. |
Definition at line 460 of file sockutil.c.
References swaps().
Referenced by ntohs().
uint32_t htonl | ( | uint32_t | hostlong) |
htonl function converts a unsigned long from host to TCP/IP network byte order (which is big-endian).
hostlong | The value to convert. |
Definition at line 476 of file sockutil.c.
References swapl().
uint32_t ntohs | ( | uint16_t | netshort) |
ntohs function converts a unsigned short from TCP/IP network byte order to host byte order (which is little-endian on Intel processors).
netshort | The value to convert. |
Definition at line 493 of file sockutil.c.
References htons().
uint32_t ntohl | ( | uint32_t | netlong) |
converts a unsigned long from TCP/IP network byte order to host byte order (which is little-endian on Intel processors).
netlong | The value to convert. |
Definition at line 509 of file sockutil.c.
References swapl().