summaryrefslogtreecommitdiff
path: root/pjlib/include/pj/sock.h
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2007-03-18 17:39:27 +0000
committerBenny Prijono <bennylp@teluu.com>2007-03-18 17:39:27 +0000
commit25c436a6432ebac429285c81f990653a4c52dd3c (patch)
tree8f145c79bd09aa7bd7390100f809ca72bf2f069b /pjlib/include/pj/sock.h
parent331af12f95e6c79555ce45e5ea9c387fd70915dc (diff)
Changed pj_sockaddr structure and added pjnath project for ICE/STUN stuffs
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1080 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib/include/pj/sock.h')
-rw-r--r--pjlib/include/pj/sock.h50
1 files changed, 30 insertions, 20 deletions
diff --git a/pjlib/include/pj/sock.h b/pjlib/include/pj/sock.h
index e7bcee13..d2da570c 100644
--- a/pjlib/include/pj/sock.h
+++ b/pjlib/include/pj/sock.h
@@ -175,26 +175,6 @@ typedef enum pj_socket_sd_type
*/
#define PJ_INVALID_SOCKET (-1)
-/**
- * Structure describing a generic socket address.
- * If PJ_SOCKADDR_HAS_LEN is not zero, then sa_zero_len member is added
- * to this struct. As far the application is concerned, the value of
- * this member will always be zero. Internally, PJLIB may modify the value
- * before calling OS socket API, and reset the value back to zero before
- * returning the struct to application.
- */
-typedef struct pj_sockaddr
-{
-#if defined(PJ_SOCKADDR_HAS_LEN) && PJ_SOCKADDR_HAS_LEN!=0
- pj_uint8_t sa_zero_len;
- pj_uint8_t sa_family;
-#else
- pj_uint16_t sa_family; /**< Common data: address family. */
-#endif
- char sa_data[14]; /**< Address data. */
-} pj_sockaddr;
-
-
#undef s_addr
/**
@@ -276,6 +256,36 @@ typedef struct pj_sockaddr_in6
} pj_sockaddr_in6;
+/**
+ * This structure describes common attributes found in transport addresses.
+ * If PJ_SOCKADDR_HAS_LEN is not zero, then sa_zero_len member is added
+ * to this struct. As far the application is concerned, the value of
+ * this member will always be zero. Internally, PJLIB may modify the value
+ * before calling OS socket API, and reset the value back to zero before
+ * returning the struct to application.
+ */
+typedef struct pj_addr_hdr
+{
+#if defined(PJ_SOCKADDR_HAS_LEN) && PJ_SOCKADDR_HAS_LEN!=0
+ pj_uint8_t sa_zero_len;
+ pj_uint8_t sa_family;
+#else
+ pj_uint16_t sa_family; /**< Common data: address family. */
+#endif
+} pj_addr_hdr;
+
+
+/**
+ * This union describes a generic socket address.
+ */
+typedef union pj_sockaddr
+{
+ pj_addr_hdr addr; /**< Generic transport address. */
+ pj_sockaddr_in ipv4; /**< IPv4 transport address. */
+ pj_sockaddr_in6 ipv6; /**< IPv6 transport address. */
+} pj_sockaddr;
+
+
/*****************************************************************************
*
* SOCKET ADDRESS MANIPULATION.