Barrelfish
|
Functions | |
u32_t | inet_addr (const char *cp) |
int | inet_aton (const char *cp, struct in_addr *addr) |
char * | inet_ntoa (struct in_addr addr) |
u16_t | htons (u16_t n) |
u16_t | ntohs (u16_t n) |
u32_t | htonl (u32_t n) |
u32_t | ntohl (u32_t n) |
Functions common to all TCP/IPv4 modules, such as the byte order functions.
u32_t htonl | ( | u32_t | n | ) |
Convert an u32_t from host- to network byte order.
n | u32_t in host byte order |
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.
n | u16_t in host byte order |
u32_t inet_addr | ( | const char * | cp | ) |
Ascii internet address interpretation routine. The value returned is in network order.
cp | IP address in ascii represenation (e.g. "127.0.0.1") |
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.
cp | IP address in ascii represenation (e.g. "127.0.0.1") |
addr | pointer to which to save the ip address in network order |
char* inet_ntoa | ( | struct in_addr | addr | ) |
Convert numeric IP address into decimal dotted ASCII representation. returns ptr to static buffer; not reentrant!
addr | ip address in network order to convert |
u32_t ntohl | ( | u32_t | n | ) |
Convert an u32_t from network- to host byte order.
n | u32_t in network byte order |
u16_t ntohs | ( | u16_t | n | ) |
Convert an u16_t from network- to host byte order.
n | u16_t in network byte order |