summaryrefslogtreecommitdiff
path: root/nuttx/include
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-10-31 23:27:55 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-10-31 23:27:55 +0000
commitbe3873f03972b44e95458345b5ab73b1b75e2eee (patch)
tree2fc5881e116bb36f5d6c6f2ae8ed86456b96c2cf /nuttx/include
parenta76a953e2fb34a521faac9c66207c08f77da9ce5 (diff)
downloadpx4-nuttx-be3873f03972b44e95458345b5ab73b1b75e2eee.tar.gz
px4-nuttx-be3873f03972b44e95458345b5ab73b1b75e2eee.tar.bz2
px4-nuttx-be3873f03972b44e95458345b5ab73b1b75e2eee.zip
in progress update
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@360 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/include')
-rw-r--r--nuttx/include/net/uip/dhcpc.h8
-rw-r--r--nuttx/include/net/uip/resolv.h8
-rw-r--r--nuttx/include/net/uip/uip.h76
-rw-r--r--nuttx/include/netinet/in.h22
4 files changed, 25 insertions, 89 deletions
diff --git a/nuttx/include/net/uip/dhcpc.h b/nuttx/include/net/uip/dhcpc.h
index 13b717e43..12f3f0a9b 100644
--- a/nuttx/include/net/uip/dhcpc.h
+++ b/nuttx/include/net/uip/dhcpc.h
@@ -56,10 +56,10 @@ struct dhcpc_state
{
uint16 lease_time[2];
uint8 serverid[4];
- uint16 ipaddr[2];
- uint16 netmask[2];
- uint16 dnsaddr[2];
- uint16 default_router[2];
+ struct in_addr ipaddr;
+ struct in_addr netmask;
+ struct in_addr dnsaddr;
+ struct in_addr default_router;
};
/****************************************************************************
diff --git a/nuttx/include/net/uip/resolv.h b/nuttx/include/net/uip/resolv.h
index c9547f13e..9d9f57f55 100644
--- a/nuttx/include/net/uip/resolv.h
+++ b/nuttx/include/net/uip/resolv.h
@@ -49,12 +49,12 @@ extern "C" {
EXTERN int resolv_init(void);
#ifdef CONFIG_NET_IPv6
-EXTERN void resolv_conf(const struct sockaddr_in6 *dnsserver);
-EXTERN void resolv_getserver(const struct sockaddr_in6 *dnsserver);
+EXTERN void resolv_conf(const struct in6_addr *dnsserver);
+EXTERN void resolv_getserver(const struct in_addr *dnsserver);
EXTERN int resolv_query(const char *name, struct sockaddr_in6 *addr);
#else
-EXTERN void resolv_conf(const struct sockaddr_in *dnsserver);
-EXTERN void resolv_getserver(struct sockaddr_in *dnsserver);
+EXTERN void resolv_conf(const struct in_addr *dnsserver);
+EXTERN void resolv_getserver(struct in_addr *dnsserver);
EXTERN int resolv_query(const char *name, struct sockaddr_in *addr);
#endif
diff --git a/nuttx/include/net/uip/uip.h b/nuttx/include/net/uip/uip.h
index 3b2c90299..9f6a662d4 100644
--- a/nuttx/include/net/uip/uip.h
+++ b/nuttx/include/net/uip/uip.h
@@ -836,9 +836,9 @@ extern void uip_udpdisable(struct uip_udp_conn *conn);
/* Convert an IPv4 address of the form uint16[2] to an in_addr_t */
#ifdef CONFIG_ENDIAN_BIG
-# define uip_ip4addr_conv(addr) (((in_addr_t)((uint16*)addr)[1] << 16) | (in_addr_t)((uint16*)addr)[0])
-#else
# define uip_ip4addr_conv(addr) (((in_addr_t)((uint16*)addr)[0] << 16) | (in_addr_t)((uint16*)addr)[1])
+#else
+# define uip_ip4addr_conv(addr) (((in_addr_t)((uint16*)addr)[1] << 16) | (in_addr_t)((uint16*)addr)[0])
#endif
/* Construct an IPv6 address from eight 16-bit words.
@@ -922,7 +922,7 @@ extern void uip_udpdisable(struct uip_udp_conn *conn);
* uip_ipaddr(&mask, 255,255,255,0);
* uip_ipaddr(&ipaddr1, 192,16,1,2);
* uip_ipaddr(&ipaddr2, 192,16,1,3);
- * if(uip_ipaddr_maskcmp(&ipaddr1, &ipaddr2, &mask)) {
+ * if(uip_ipaddr_maskcmp(ipaddr1, ipaddr2, &mask)) {
* printf("They are the same");
* }
*
@@ -933,7 +933,7 @@ extern void uip_udpdisable(struct uip_udp_conn *conn);
#ifndef CONFIG_NET_IPv6
# define uip_ipaddr_maskcmp(addr1, addr2, mask) \
- ((uip_ip4addr_conv(addr1) & (in_addr_t)mask) == ((in_addr_t)addr2 & (in_addr_t)mask))
+ (((in_addr_t)(addr1) & (in_addr_t)(mask)) == ((in_addr_t)(addr2) & (in_addr_t)(mask)))
#else /* !CONFIG_NET_IPv6 */
#endif /* !CONFIG_NET_IPv6 */
@@ -963,74 +963,6 @@ extern void uip_udpdisable(struct uip_udp_conn *conn);
(in_addr_t)(dest) = (in_addr_t)(src) & (in_addr_t)(mask); \
} while(0)
-/* Pick the first octet of an IP address.
- *
- * Picks out the first octet of an IP address.
- *
- * Example:
- *
- * uip_ipaddr_t ipaddr;
- * uint8 octet;
- *
- * uip_ipaddr(&ipaddr, 1,2,3,4);
- * octet = uip_ipaddr1(&ipaddr);
- *
- * In the example above, the variable "octet" will contain the value 1.
- */
-
-#define uip_ipaddr1(addr) (htons(((uint16 *)(addr))[0]) >> 8)
-
-/* Pick the second octet of an IP address.
- *
- * Picks out the second octet of an IP address.
- *
- * Example:
- *
- * uip_ipaddr_t ipaddr;
- * uint8 octet;
- *
- * uip_ipaddr(&ipaddr, 1,2,3,4);
- * octet = uip_ipaddr2(&ipaddr);
- *
- * In the example above, the variable "octet" will contain the value 2.
- */
-
-#define uip_ipaddr2(addr) (htons(((uint16 *)(addr))[0]) & 0xff)
-
-/* Pick the third octet of an IP address.
- *
- * Picks out the third octet of an IP address.
- *
- * Example:
- *
- * uip_ipaddr_t ipaddr;
- * uint8 octet;
- *
- * uip_ipaddr(&ipaddr, 1,2,3,4);
- * octet = uip_ipaddr3(&ipaddr);
- *
- * In the example above, the variable "octet" will contain the value 3.
- */
-
-#define uip_ipaddr3(addr) (htons(((uint16 *)(addr))[1]) >> 8)
-
-/* Pick the fourth octet of an IP address.
- *
- * Picks out the fourth octet of an IP address.
- *
- * Example:
- *
- * uip_ipaddr_t ipaddr;
- * uint8 octet;
- *
- * uip_ipaddr(&ipaddr, 1,2,3,4);
- * octet = uip_ipaddr4(&ipaddr);
- *
- * In the example above, the variable "octet" will contain the value 4.
- */
-
-#define uip_ipaddr4(addr) (htons(((uint16 *)(addr))[1]) & 0xff)
-
/* Print out a uIP log message.
*
* This function must be implemented by the module that uses uIP, and
diff --git a/nuttx/include/netinet/in.h b/nuttx/include/netinet/in.h
index dd518388a..163e16ab1 100644
--- a/nuttx/include/netinet/in.h
+++ b/nuttx/include/netinet/in.h
@@ -48,22 +48,26 @@
/* Values for protocol argument to socket() */
-#define IPPROTO_TCP 1
-#define IPPROTO_UDP 2
+#define IPPROTO_TCP 1
+#define IPPROTO_UDP 2
/* Special values of in_addr_t */
-#define INADDR_ANY ((in_addr_t)0x00000000) /* Address to accept any incoming messages */
-#define INADDR_BROADCAST ((in_addr_t)0xffffffff) /* Address to send to all hosts */
-#define INADDR_NONE ((in_addr_t)0xffffffff) /* Address indicating an error return */
+#define INADDR_ANY ((in_addr_t)0x00000000) /* Address to accept any incoming messages */
+#define INADDR_BROADCAST ((in_addr_t)0xffffffff) /* Address to send to all hosts */
+#define INADDR_NONE ((in_addr_t)0xffffffff) /* Address indicating an error return */
+#define INADDR_LOOPBACK ((in_addr_t)0x7f000001) /* Inet 127.0.0.1. */
-#define IN6ADDR_ANY_INIT {{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}}}
+/* Special initializer for in6_addr_t */
+
+#define IN6ADDR_ANY_INIT {{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}}}
+#define IN6ADDR_LOOPBACK_INIT {{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}}}
/* struct in6_addr union selectors */
-#define s6_addr in6_u.u6_addr8
-#define s6_addr16 in6_u.u6_addr16
-#define s6_addr32 in6_u.u6_addr32
+#define s6_addr in6_u.u6_addr8
+#define s6_addr16 in6_u.u6_addr16
+#define s6_addr32 in6_u.u6_addr32
/****************************************************************************
* Public Type Definitions