Changed pj_sockaddr structure and added pjnath project for ICE/STUN stuffs
git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@1080 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjlib/include/pj/sock.h b/pjlib/include/pj/sock.h
index e7bcee1..d2da570 100644
--- a/pjlib/include/pj/sock.h
+++ b/pjlib/include/pj/sock.h
@@ -175,26 +175,6 @@
*/
#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 @@
} 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.