A version of LWIP, provided for backwards compatibility.
Dependents: AA_DemoBoard DemoBoard HelloServerDemo DemoBoard_RangeIndicator ... more
inet.c File Reference
Functions common to all TCP/IPv4 modules, such as the byte order functions. More...
Go to the source code of this file.
Functions | |
u32_t | inet_addr (const char *cp) |
Ascii internet address interpretation routine. | |
int | inet_aton (const char *cp, struct in_addr *addr) |
Check whether "cp" is a valid ascii representation of an Internet address and convert to a binary address. | |
char * | inet_ntoa (struct in_addr addr) |
Convert numeric IP address into decimal dotted ASCII representation. | |
u16_t | htons (u16_t n) |
These are reference implementations of the byte swapping functions. | |
u16_t | ntohs (u16_t n) |
Convert an u16_t from network- to host byte order. | |
u32_t | htonl (u32_t n) |
Convert an u32_t from host- to network byte order. | |
u32_t | ntohl (u32_t n) |
Convert an u32_t from network- to host byte order. |
Detailed Description
Functions common to all TCP/IPv4 modules, such as the byte order functions.
Definition in file tag/13/Core/lwIP/core/ipv4/inet.c.
Function Documentation
u32_t htonl | ( | u32_t | n ) |
Convert an u32_t from host- to network byte order.
- Parameters:
-
n u32_t in host byte order
- Returns:
- n in network byte order
Definition at line 258 of file tag/13/Core/lwIP/core/ipv4/inet.c.
u16_t htons | ( | u16_t | n ) |
These are reference implementations of the byte swapping functions.
Again with the aim of being simple, correct and fully portable. Byte swapping is the second thing you would want to optimize. You will need to port it to your architecture and in your cc.h:
define LWIP_PLATFORM_BYTESWAP 1 define LWIP_PLATFORM_HTONS(x) <your_htons> define LWIP_PLATFORM_HTONL(x) <your_htonl>
Note ntohs() and ntohl() are merely references to the htonx counterparts. Convert an u16_t from host- to network byte order.
- Parameters:
-
n u16_t in host byte order
- Returns:
- n in network byte order
Definition at line 234 of file tag/13/Core/lwIP/core/ipv4/inet.c.
u32_t inet_addr | ( | const char * | cp ) |
Ascii internet address interpretation routine.
The value returned is in network order.
- Parameters:
-
cp IP address in ascii represenation (e.g. "127.0.0.1")
- Returns:
- ip address in network order
Definition at line 61 of file tag/13/Core/lwIP/core/ipv4/inet.c.
int inet_aton | ( | const char * | cp, |
struct in_addr * | addr | ||
) |
Check whether "cp" is a valid ascii representation of an Internet address and convert to a binary address.
Returns 1 if the address is valid, 0 if not. This replaces inet_addr, the return value from which cannot distinguish between failure and a local broadcast address.
- Parameters:
-
cp IP address in ascii represenation (e.g. "127.0.0.1") addr pointer to which to save the ip address in network order
- Returns:
- 1 if cp could be converted to addr, 0 on failure
Definition at line 83 of file tag/13/Core/lwIP/core/ipv4/inet.c.
char* inet_ntoa | ( | struct in_addr | addr ) |
Convert numeric IP address into decimal dotted ASCII representation.
returns ptr to static buffer; not reentrant!
- Parameters:
-
addr ip address in network order to convert
- Returns:
- pointer to a global static (!) buffer that holds the ASCII represenation of addr
Definition at line 183 of file tag/13/Core/lwIP/core/ipv4/inet.c.
u32_t ntohl | ( | u32_t | n ) |
Convert an u32_t from network- to host byte order.
- Parameters:
-
n u32_t in network byte order
- Returns:
- n in host byte order
Definition at line 273 of file tag/13/Core/lwIP/core/ipv4/inet.c.
u16_t ntohs | ( | u16_t | n ) |
Convert an u16_t from network- to host byte order.
- Parameters:
-
n u16_t in network byte order
- Returns:
- n in host byte order
Definition at line 246 of file tag/13/Core/lwIP/core/ipv4/inet.c.
Generated on Tue Jul 12 2022 16:06:29 by 1.7.2