Index: pjproject/trunk/pjlib/src/pj/os_symbian.h
===================================================================
--- pjproject/trunk/pjlib/src/pj/os_symbian.h	(revision 1525)
+++ pjproject/trunk/pjlib/src/pj/os_symbian.h	(revision 1601)
@@ -20,4 +20,6 @@
 #define __OS_SYMBIAN_H__
 
+#include <pj/assert.h>
+#include <pj/errno.h>
 #include <pj/sock.h>
 #include <pj/os.h>
@@ -52,6 +54,6 @@
 
     // Construct CPjSocket
-    CPjSocket(RSocket &sock)
-	: sock_(sock), connected_(false), sockReader_(NULL)
+    CPjSocket(int af, RSocket &sock)
+	: af_(af), sock_(sock), connected_(false), sockReader_(NULL)
     { 
     }
@@ -60,4 +62,10 @@
     ~CPjSocket();
 
+    // Get address family
+    int GetAf() const 
+    {
+    	return af_;	
+    }
+    
     // Get the internal RSocket
     RSocket& Socket()
@@ -92,4 +100,5 @@
     
 private:
+    int		     af_;
     RSocket	     sock_;	    // Must not be reference, or otherwise
 				    // it may point to local variable!
@@ -229,21 +238,55 @@
     
     // Convert TInetAddr to pj_sockaddr_in
-    static inline void Addr2pj(const TInetAddr & sym_addr,
-			       pj_sockaddr_in &pj_addr)
-    {
-	pj_bzero(&pj_addr, sizeof(pj_sockaddr_in));
-	pj_addr.sin_family = pj_AF_INET();
-	pj_addr.sin_addr.s_addr = pj_htonl(sym_addr.Address());
-	pj_addr.sin_port = pj_htons((pj_uint16_t) sym_addr.Port());
+    static inline pj_status_t Addr2pj(const TInetAddr & sym_addr,
+			       	      pj_sockaddr &pj_addr,
+			       	      int *addr_len)
+    {
+	pj_bzero(&pj_addr, sizeof(pj_sockaddr));
+	pj_addr.addr.sa_family = (pj_uint16_t)sym_addr.Family();
+	if (pj_addr.addr.sa_family == PJ_AF_INET) {
+	    PJ_ASSERT_RETURN(*addr_len >= sizeof(pj_sockaddr_in), PJ_ETOOSMALL);
+	    pj_addr.ipv4.sin_addr.s_addr = pj_htonl(sym_addr.Address());
+	    pj_addr.ipv4.sin_port = pj_htons((pj_uint16_t) sym_addr.Port());
+	    *addr_len = sizeof(pj_sockaddr_in);
+	} else if (pj_addr.addr.sa_family == PJ_AF_INET6) {
+	    PJ_ASSERT_RETURN(*addr_len >= sizeof(pj_sockaddr_in6), PJ_ETOOSMALL);
+	    const TIp6Addr & ip6 = sym_addr.Ip6Address();
+	    pj_memcpy(&pj_addr.ipv6.sin6_addr, ip6.u.iAddr8, 16);
+	    pj_addr.ipv6.sin6_port = pj_htons((pj_uint16_t) sym_addr.Port());
+	    pj_addr.ipv6.sin6_scope_id = pj_htonl(sym_addr.Scope());
+	    pj_addr.ipv6.sin6_flowinfo = pj_htonl(sym_addr.FlowLabel());
+	    *addr_len = sizeof(pj_sockaddr_in6);
+	} else {
+	    pj_assert(!"Unsupported address family");
+	    return PJ_EAFNOTSUP;
+	}
+	
+	return PJ_SUCCESS;
     }
 
 
     // Convert pj_sockaddr_in to TInetAddr
-    static inline void pj2Addr(const pj_sockaddr_in &pj_addr,
-			       TInetAddr & sym_addr)
-    {
-	sym_addr.Init(KAfInet);
-	sym_addr.SetAddress((TUint32)pj_ntohl(pj_addr.sin_addr.s_addr));
-	sym_addr.SetPort(pj_ntohs(pj_addr.sin_port));
+    static inline pj_status_t pj2Addr(const pj_sockaddr &pj_addr,
+    				      int addrlen,
+			       	      TInetAddr & sym_addr)
+    {
+    	if (pj_addr.addr.sa_family == PJ_AF_INET) {
+    	    PJ_ASSERT_RETURN(addrlen >= sizeof(pj_sockaddr_in), PJ_EINVAL);
+	    sym_addr.Init(KAfInet);
+    	    sym_addr.SetAddress((TUint32)pj_ntohl(pj_addr.ipv4.sin_addr.s_addr));
+    	    sym_addr.SetPort(pj_ntohs(pj_addr.ipv4.sin_port));
+    	} else if (pj_addr.addr.sa_family == PJ_AF_INET6) {
+    	    TIp6Addr ip6;
+    	
+    	    PJ_ASSERT_RETURN(addrlen >= sizeof(pj_sockaddr_in6), PJ_EINVAL);
+    	    pj_memcpy(ip6.u.iAddr8, &pj_addr.ipv6.sin6_addr, 16);
+    	    sym_addr.Init(KAfInet6);
+    	    sym_addr.SetAddress(ip6);
+    	    sym_addr.SetScope(pj_ntohl(pj_addr.ipv6.sin6_scope_id));
+    	    sym_addr.SetFlowLabel(pj_ntohl(pj_addr.ipv6.sin6_flowinfo));
+    	} else {
+    	    pj_assert(!"Unsupported address family");
+    	}
+    	return PJ_SUCCESS;
     }
 
@@ -254,7 +297,11 @@
 
     // Get RHostResolver instance
-    RHostResolver & GetResolver()
-    {
-	return appHostResolver_ ? *appHostResolver_ : hostResolver_;
+    RHostResolver & GetResolver(int af)
+    {
+    	if (af==PJ_AF_INET6) {
+    	    return appHostResolver6_ ? *appHostResolver6_ : hostResolver6_;
+    	} else {
+    	    return appHostResolver_ ? *appHostResolver_ : hostResolver_;
+    	}
     }
 
@@ -304,4 +351,5 @@
     bool isResolverInitialized_;
     RHostResolver hostResolver_;
+    RHostResolver hostResolver6_;
 
     CConsoleBase* console_;
@@ -313,4 +361,5 @@
     RConnection *appConnection_;
     RHostResolver *appHostResolver_;
+    RHostResolver *appHostResolver6_;
     
 private:
