diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2015-02-16 15:23:02 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2015-02-16 15:23:02 -0600 |
commit | 98895db17d83710abc2b2861f28bfc49d7dc28d0 (patch) | |
tree | 3f97bdf74dc7fb43b208506e1c2ba564061f7215 /nuttx/include | |
parent | 32d8bf804be7529fe4af62076e39c6b8acb1fcff (diff) | |
download | px4-nuttx-98895db17d83710abc2b2861f28bfc49d7dc28d0.tar.gz px4-nuttx-98895db17d83710abc2b2861f28bfc49d7dc28d0.tar.bz2 px4-nuttx-98895db17d83710abc2b2861f28bfc49d7dc28d0.zip |
Purely cosmetic changes resulting from last review IPv6 UDP change
Diffstat (limited to 'nuttx/include')
-rw-r--r-- | nuttx/include/nuttx/net/ip.h | 96 |
1 files changed, 67 insertions, 29 deletions
diff --git a/nuttx/include/nuttx/net/ip.h b/nuttx/include/nuttx/net/ip.h index f28ff315d..2082e590d 100644 --- a/nuttx/include/nuttx/net/ip.h +++ b/nuttx/include/nuttx/net/ip.h @@ -240,17 +240,23 @@ EXTERN const net_ipv6addr_t g_ipv6_llnetmask; /* Netmask for local link addres * Public Function Prototypes ****************************************************************************/ -/* Construct an IPv4 address from four bytes. +/**************************************************************************** + * Macro: net_ipaddr + * + * Description: + * Construct an IPv4 address from four bytes. * - * This function constructs an IPv4 address in network byte order. + * This function constructs an IPv4 address in network byte order. * + * Input Parameters: * addr A pointer to a in_addr_t variable that will be * filled in with the IPv4 address. * addr0 The first octet of the IPv4 address. * addr1 The second octet of the IPv4 address. * addr2 The third octet of the IPv4 address. * addr3 The forth octet of the IPv4 address. - */ + * + ****************************************************************************/ #define net_ipaddr(addr, addr0, addr1, addr2, addr3) \ do { \ @@ -258,17 +264,32 @@ EXTERN const net_ipv6addr_t g_ipv6_llnetmask; /* Netmask for local link addres (uint32_t)(addr2) << 8 | (uint32_t)(addr3)); \ } while (0) -/* Convert an IPv4 address of the form uint16_t[2] to an in_addr_t */ +/**************************************************************************** + * Macro: net_ip4addr_conv32 + * + * Description: + * Convert an IPv4 address of the form uint16_t[2] to an in_addr_t + * + ****************************************************************************/ #ifdef CONFIG_ENDIAN_BIG -# define net_ip4addr_conv32(addr) (((in_addr_t)((uint16_t*)addr)[0] << 16) | (in_addr_t)((uint16_t*)addr)[1]) +# define net_ip4addr_conv32(addr) \ + (((in_addr_t)((uint16_t*)addr)[0] << 16) | \ + (in_addr_t)((uint16_t*)addr)[1]) #else -# define net_ip4addr_conv32(addr) (((in_addr_t)((uint16_t*)addr)[1] << 16) | (in_addr_t)((uint16_t*)addr)[0]) +# define net_ip4addr_conv32(addr) \ + (((in_addr_t)((uint16_t*)addr)[1] << 16) | \ + (in_addr_t)((uint16_t*)addr)[0]) #endif -/* Extract individual bytes from a 32-bit IPv4 IP address that is in network - * byte order. - */ +/**************************************************************************** + * Macro: ip4_addr1, ip4_addr2, ip4_addr3, and ip4_addr4 + * + * Description: + * Extract individual bytes from a 32-bit IPv4 IP address that is in + * network byte order. + * + ****************************************************************************/ #ifdef CONFIG_ENDIAN_BIG /* Big-endian byte order: 11223344 */ @@ -286,10 +307,13 @@ EXTERN const net_ipv6addr_t g_ipv6_llnetmask; /* Netmask for local link addres # define ip4_addr4(ipaddr) (((ipaddr) >> 24) & 0xff) #endif -/* Construct an IPv6 address from eight 16-bit words. +/**************************************************************************** + * Macro: ip6_addr + * + * Description: + * Construct an IPv6 address from eight 16-bit words. * - * This function constructs an IPv6 address. - */ + ****************************************************************************/ #define ip6_addr(addr, addr0,addr1,addr2,addr3,addr4,addr5,addr6,addr7) \ do { \ @@ -303,7 +327,12 @@ EXTERN const net_ipv6addr_t g_ipv6_llnetmask; /* Netmask for local link addres ((uint16_t*)(addr))[7] = HTONS((addr7)); \ } while (0) -/* Copy an IP address from one place to another. +/**************************************************************************** + * Macro: net_ipv4addr_copy, net_ipv4addr_hdrcopy, net_ipv6addr_copy, and + * net_ipv6addr_hdrcopy + * + * Description: + * Copy an IP address from one place to another. * * Example: * @@ -312,9 +341,11 @@ EXTERN const net_ipv6addr_t g_ipv6_llnetmask; /* Netmask for local link addres * net_ipaddr(&ipaddr1, 192,16,1,2); * net_ipaddr_copy(&ipaddr2, &ipaddr1); * - * dest The destination for the copy. - * src The source from where to copy. - */ + * Input Parameters: + * dest - The destination for the copy. + * src - The source from where to copy. + * + ****************************************************************************/ #ifdef CONFIG_NET_IPv4 # define net_ipv4addr_copy(dest, src) \ @@ -335,21 +366,28 @@ EXTERN const net_ipv6addr_t g_ipv6_llnetmask; /* Netmask for local link addres net_ipv6addr_copy(dest, src) #endif -/* Compare two IP addresses +/**************************************************************************** + * Macro: net_ipv4addr_cmp, net_ipv4addr_hdrcmp, net_ipv6addr_cmp, and + * net_ipv6addr_hdrcmp * - * Example: + * Description: + * Compare two IP addresses * - * in_addr_t ipaddr1, ipaddr2; + * Example: * - * net_ipaddr(&ipaddr1, 192,16,1,2); - * if (net_ipv4addr_cmp(ipaddr2, ipaddr1)) - * { - * printf("They are the same"); - * } + * in_addr_t ipaddr1, ipaddr2; + * + * net_ipaddr(&ipaddr1, 192,16,1,2); + * if (net_ipv4addr_cmp(ipaddr2, ipaddr1)) + * { + * printf("They are the same"); + * } * - * addr1 The first IP address. - * addr2 The second IP address. - */ + * Input Parameters: + * addr1 - The first IP address. + * addr2 - The second IP address. + * + ****************************************************************************/ #ifdef CONFIG_NET_IPv4 # define net_ipv4addr_cmp(addr1, addr2) \ @@ -387,7 +425,7 @@ EXTERN const net_ipv6addr_t g_ipv6_llnetmask; /* Netmask for local link addres * printf("They are the same"); * } * - * Parameters: + * Input Parameters: * addr1 - The first IP address. * addr2 - The second IP address. * mask - The netmask. @@ -427,7 +465,7 @@ bool net_ipv6addr_maskcmp(const net_ipv6addr_t addr1, * In the example above, the variable "ipaddr2" will contain the IP * address 192.168.1.0. * - * Parameters: + * Input Parameters: * dest Where the result is to be placed. * src The IP address. * mask The netmask. |