Index: pjproject/trunk/aconfigure
===================================================================
--- pjproject/trunk/aconfigure	(revision 1584)
+++ pjproject/trunk/aconfigure	(revision 1585)
@@ -8495,6 +8495,6 @@
 
 
-echo "$as_me:$LINENO: checking if inet_aton is available" >&5
-echo $ECHO_N "checking if inet_aton is available... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking if inet_aton() is available" >&5
+echo $ECHO_N "checking if inet_aton() is available... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -8503,5 +8503,7 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <arpa/inet.h>
+#include <sys/types.h>
+				     #include <sys/socket.h>
+				     #include <arpa/inet.h>
 int
 main ()
@@ -8536,4 +8538,172 @@
   cat >>confdefs.h <<\_ACEOF
 #define PJ_SOCK_HAS_INET_ATON 1
+_ACEOF
+
+		   echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+echo "$as_me:$LINENO: checking if inet_pton() is available" >&5
+echo $ECHO_N "checking if inet_pton() is available... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+				     #include <sys/socket.h>
+				     #include <arpa/inet.h>
+int
+main ()
+{
+inet_pton(0, 0, 0);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  cat >>confdefs.h <<\_ACEOF
+#define PJ_SOCK_HAS_INET_PTON 1
+_ACEOF
+
+		   echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+echo "$as_me:$LINENO: checking if inet_ntop() is available" >&5
+echo $ECHO_N "checking if inet_ntop() is available... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+				     #include <sys/socket.h>
+				     #include <arpa/inet.h>
+int
+main ()
+{
+inet_ntop(0, 0, 0, 0);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  cat >>confdefs.h <<\_ACEOF
+#define PJ_SOCK_HAS_INET_NTOP 1
+_ACEOF
+
+		   echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+echo "$as_me:$LINENO: checking if getaddrinfo() is available" >&5
+echo $ECHO_N "checking if getaddrinfo() is available... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+				     #include <sys/socket.h>
+				     #include <netdb.h>
+int
+main ()
+{
+getaddrinfo(0, 0, 0, 0);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  cat >>confdefs.h <<\_ACEOF
+#define PJ_SOCK_HAS_GETADDRINFO 1
 _ACEOF
 
@@ -11234,7 +11404,7 @@
 echo "$as_me:$LINENO: result:
 
-The configuration for current target has been written to 'build.mak', and 'os-auto.mak' in various build directories.
-
-Customizations can be put in:
+Configurations for current target have been written to 'build.mak', and 'os-auto.mak' in various build directories, and pjlib/include/pj/compat/os_auto.h.
+
+Further customizations can be put in:
   - 'user.mak'
   - 'pjlib/include/pj/config_site.h'
@@ -11244,7 +11414,7 @@
 echo "${ECHO_T}
 
-The configuration for current target has been written to 'build.mak', and 'os-auto.mak' in various build directories.
-
-Customizations can be put in:
+Configurations for current target have been written to 'build.mak', and 'os-auto.mak' in various build directories, and pjlib/include/pj/compat/os_auto.h.
+
+Further customizations can be put in:
   - 'user.mak'
   - 'pjlib/include/pj/config_site.h'
Index: pjproject/trunk/aconfigure.ac
===================================================================
--- pjproject/trunk/aconfigure.ac	(revision 1584)
+++ pjproject/trunk/aconfigure.ac	(revision 1585)
@@ -183,8 +183,40 @@
 
 dnl # Determine if inet_aton() is available
-AC_MSG_CHECKING([if inet_aton is available])
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <arpa/inet.h>]],
+AC_MSG_CHECKING([if inet_aton() is available])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
+				     #include <sys/socket.h>
+				     #include <arpa/inet.h>]],
 		    		  [inet_aton(0, 0);])],
 		  [AC_DEFINE(PJ_SOCK_HAS_INET_ATON,1)
+		   AC_MSG_RESULT(yes)],
+		  [AC_MSG_RESULT(no)])
+
+dnl # Determine if inet_pton() is available
+AC_MSG_CHECKING([if inet_pton() is available])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
+				     #include <sys/socket.h>
+				     #include <arpa/inet.h>]],
+		    		  [inet_pton(0, 0, 0);])],
+		  [AC_DEFINE(PJ_SOCK_HAS_INET_PTON,1)
+		   AC_MSG_RESULT(yes)],
+		  [AC_MSG_RESULT(no)])
+
+dnl # Determine if inet_ntop() is available
+AC_MSG_CHECKING([if inet_ntop() is available])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
+				     #include <sys/socket.h>
+				     #include <arpa/inet.h>]],
+		    		  [inet_ntop(0, 0, 0, 0);])],
+		  [AC_DEFINE(PJ_SOCK_HAS_INET_NTOP,1)
+		   AC_MSG_RESULT(yes)],
+		  [AC_MSG_RESULT(no)])
+
+dnl # Determine if getaddrinfo() is available
+AC_MSG_CHECKING([if getaddrinfo() is available])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
+				     #include <sys/socket.h>
+				     #include <netdb.h>]],
+		    		  [getaddrinfo(0, 0, 0, 0);])],
+		  [AC_DEFINE(PJ_SOCK_HAS_GETADDRINFO,1)
 		   AC_MSG_RESULT(yes)],
 		  [AC_MSG_RESULT(no)])
@@ -546,7 +578,7 @@
 AC_MSG_RESULT([
 
-The configuration for current target has been written to 'build.mak', and 'os-auto.mak' in various build directories.
-
-Customizations can be put in:
+Configurations for current target have been written to 'build.mak', and 'os-auto.mak' in various build directories, and pjlib/include/pj/compat/os_auto.h.
+
+Further customizations can be put in:
   - 'user.mak'
   - 'pjlib/include/pj/config_site.h'
Index: pjproject/trunk/build.symbian/pjlibU.def
===================================================================
--- pjproject/trunk/build.symbian/pjlibU.def	(revision 1584)
+++ pjproject/trunk/build.symbian/pjlibU.def	(revision 1585)
@@ -13,285 +13,286 @@
 	pj_AF_PACKET                             @ 12 NONAME
 	pj_AF_UNIX                               @ 13 NONAME
-	pj_GUID_STRING_LENGTH                    @ 14 NONAME
-	pj_IPTOS_LOWDELAY                        @ 15 NONAME
-	pj_IPTOS_MINCOST                         @ 16 NONAME
-	pj_IPTOS_RELIABILITY                     @ 17 NONAME
-	pj_IPTOS_THROUGHPUT                      @ 18 NONAME
-	pj_IP_TOS                                @ 19 NONAME
-	pj_MSG_DONTROUTE                         @ 20 NONAME
-	pj_MSG_OOB                               @ 21 NONAME
-	pj_MSG_PEEK                              @ 22 NONAME
-	pj_NO_MEMORY_EXCEPTION                   @ 23 NONAME
-	pj_SOCK_DGRAM                            @ 24 NONAME
-	pj_SOCK_RAW                              @ 25 NONAME
-	pj_SOCK_RDM                              @ 26 NONAME
-	pj_SOCK_STREAM                           @ 27 NONAME
-	pj_SOL_IP                                @ 28 NONAME
-	pj_SOL_IPV6                              @ 29 NONAME
-	pj_SOL_SOCKET                            @ 30 NONAME
-	pj_SOL_TCP                               @ 31 NONAME
-	pj_SOL_UDP                               @ 32 NONAME
-	pj_SO_RCVBUF                             @ 33 NONAME
-	pj_SO_SNDBUF                             @ 34 NONAME
-	pj_SO_TYPE                               @ 35 NONAME
-	pj_ansi_to_unicode                       @ 36 NONAME
-	pj_array_erase                           @ 37 NONAME
-	pj_array_find                            @ 38 NONAME
-	pj_array_insert                          @ 39 NONAME
-	pj_atexit                                @ 40 NONAME
-	pj_atomic_add                            @ 41 NONAME
-	pj_atomic_add_and_get                    @ 42 NONAME
-	pj_atomic_create                         @ 43 NONAME
-	pj_atomic_dec                            @ 44 NONAME
-	pj_atomic_dec_and_get                    @ 45 NONAME
-	pj_atomic_destroy                        @ 46 NONAME
-	pj_atomic_get                            @ 47 NONAME
-	pj_atomic_inc                            @ 48 NONAME
-	pj_atomic_inc_and_get                    @ 49 NONAME
-	pj_atomic_set                            @ 50 NONAME
-	pj_caching_pool_destroy                  @ 51 NONAME
-	pj_caching_pool_init                     @ 52 NONAME
-	pj_create_random_string                  @ 53 NONAME
-	pj_create_unique_string                  @ 54 NONAME
-	pj_dump_config                           @ 55 NONAME
-	pj_elapsed_cycle                         @ 56 NONAME
-	pj_elapsed_msec                          @ 57 NONAME
-	pj_elapsed_nanosec                       @ 58 NONAME
-	pj_elapsed_time                          @ 59 NONAME
-	pj_elapsed_usec                          @ 60 NONAME
-	pj_enter_critical_section                @ 61 NONAME
-	pj_enum_ip_interface                     @ 62 NONAME
-	pj_enum_ip_route                         @ 63 NONAME
-	pj_exception_id_alloc                    @ 64 NONAME
-	pj_exception_id_free                     @ 65 NONAME
-	pj_exception_id_name                     @ 66 NONAME
-	pj_fifobuf_alloc                         @ 67 NONAME
-	pj_fifobuf_free                          @ 68 NONAME
-	pj_fifobuf_init                          @ 69 NONAME
-	pj_fifobuf_max_size                      @ 70 NONAME
-	pj_fifobuf_unalloc                       @ 71 NONAME
-	pj_file_close                            @ 72 NONAME
-	pj_file_delete                           @ 73 NONAME
-	pj_file_exists                           @ 74 NONAME
-	pj_file_flush                            @ 75 NONAME
-	pj_file_getpos                           @ 76 NONAME
-	pj_file_getstat                          @ 77 NONAME
-	pj_file_move                             @ 78 NONAME
-	pj_file_open                             @ 79 NONAME
-	pj_file_read                             @ 80 NONAME
-	pj_file_setpos                           @ 81 NONAME
-	pj_file_size                             @ 82 NONAME
-	pj_file_write                            @ 83 NONAME
-	pj_generate_unique_string                @ 84 NONAME
-	pj_get_netos_error                       @ 85 NONAME
-	pj_get_os_error                          @ 86 NONAME
-	pj_get_timestamp                         @ 87 NONAME
-	pj_get_timestamp_freq                    @ 88 NONAME
-	pj_get_version                           @ 89 NONAME
-	pj_gethostaddr                           @ 90 NONAME
-	pj_gethostbyname                         @ 91 NONAME
-	pj_gethostip                             @ 92 NONAME
-	pj_gethostname                           @ 93 NONAME
-	pj_getpid                                @ 94 NONAME
-	pj_gettimeofday                          @ 95 NONAME
-	pj_hash_calc                             @ 96 NONAME
-	pj_hash_calc_tolower                     @ 97 NONAME
-	pj_hash_count                            @ 98 NONAME
-	pj_hash_create                           @ 99 NONAME
-	pj_hash_first                            @ 100 NONAME
-	pj_hash_get                              @ 101 NONAME
-	pj_hash_next                             @ 102 NONAME
-	pj_hash_set                              @ 103 NONAME
-	pj_hash_set_np                           @ 104 NONAME
-	pj_hash_this                             @ 105 NONAME
-	pj_htonl                                 @ 106 NONAME
-	pj_htons                                 @ 107 NONAME
-	pj_inet_addr                             @ 108 NONAME
-	pj_inet_addr2                            @ 109 NONAME
-	pj_inet_aton                             @ 110 NONAME
-	pj_inet_ntoa                             @ 111 NONAME
-	pj_init                                  @ 112 NONAME
-	pj_ioqueue_accept                        @ 113 NONAME
-	pj_ioqueue_connect                       @ 114 NONAME
-	pj_ioqueue_create                        @ 115 NONAME
-	pj_ioqueue_destroy                       @ 116 NONAME
-	pj_ioqueue_get_user_data                 @ 117 NONAME
-	pj_ioqueue_is_pending                    @ 118 NONAME
-	pj_ioqueue_name                          @ 119 NONAME
-	pj_ioqueue_op_key_init                   @ 120 NONAME
-	pj_ioqueue_poll                          @ 121 NONAME
-	pj_ioqueue_post_completion               @ 122 NONAME
-	pj_ioqueue_recv                          @ 123 NONAME
-	pj_ioqueue_recvfrom                      @ 124 NONAME
-	pj_ioqueue_register_sock                 @ 125 NONAME
-	pj_ioqueue_send                          @ 126 NONAME
-	pj_ioqueue_sendto                        @ 127 NONAME
-	pj_ioqueue_set_lock                      @ 128 NONAME
-	pj_ioqueue_set_user_data                 @ 129 NONAME
-	pj_ioqueue_unregister                    @ 130 NONAME
-	pj_leave_critical_section                @ 131 NONAME
-	pj_list_erase                            @ 132 NONAME
-	pj_list_find_node                        @ 133 NONAME
-	pj_list_insert_after                     @ 134 NONAME
-	pj_list_insert_before                    @ 135 NONAME
-	pj_list_insert_nodes_after               @ 136 NONAME
-	pj_list_insert_nodes_before              @ 137 NONAME
-	pj_list_merge_first                      @ 138 NONAME
-	pj_list_merge_last                       @ 139 NONAME
-	pj_list_search                           @ 140 NONAME
-	pj_list_size                             @ 141 NONAME
-	pj_lock_acquire                          @ 142 NONAME
-	pj_lock_create_null_mutex                @ 143 NONAME
-	pj_lock_create_recursive_mutex           @ 144 NONAME
-	pj_lock_create_semaphore                 @ 145 NONAME
-	pj_lock_create_simple_mutex              @ 146 NONAME
-	pj_lock_destroy                          @ 147 NONAME
-	pj_lock_release                          @ 148 NONAME
-	pj_lock_tryacquire                       @ 149 NONAME
-	pj_log                                   @ 150 NONAME
-	pj_log_1                                 @ 151 NONAME
-	pj_log_2                                 @ 152 NONAME
-	pj_log_3                                 @ 153 NONAME
-	pj_log_4                                 @ 154 NONAME
-	pj_log_5                                 @ 155 NONAME
-	pj_log_get_decor                         @ 156 NONAME
-	pj_log_get_level                         @ 157 NONAME
-	pj_log_get_log_func                      @ 158 NONAME
-	pj_log_set_decor                         @ 159 NONAME
-	pj_log_set_level                         @ 160 NONAME
-	pj_log_set_log_func                      @ 161 NONAME
-	pj_log_write                             @ 162 NONAME
-	pj_mutex_create                          @ 163 NONAME
-	pj_mutex_create_recursive                @ 164 NONAME
-	pj_mutex_create_simple                   @ 165 NONAME
-	pj_mutex_destroy                         @ 166 NONAME
-	pj_mutex_lock                            @ 167 NONAME
-	pj_mutex_trylock                         @ 168 NONAME
-	pj_mutex_unlock                          @ 169 NONAME
-	pj_ntohl                                 @ 170 NONAME
-	pj_ntohs                                 @ 171 NONAME
-	pj_pool_alloc                            @ 172 NONAME
-	pj_pool_alloc_from_block                 @ 173 NONAME
-	pj_pool_allocate_find                    @ 174 NONAME
-	pj_pool_calloc                           @ 175 NONAME
-	pj_pool_create                           @ 176 NONAME
-	pj_pool_create_int                       @ 177 NONAME
-	pj_pool_create_on_buf                    @ 178 NONAME
-	pj_pool_destroy_int                      @ 179 NONAME
-	pj_pool_factory_default_policy           @ 180 NONAME
-	pj_pool_factory_get_default_policy       @ 181 NONAME
-	pj_pool_get_capacity                     @ 182 NONAME
-	pj_pool_get_used_size                    @ 183 NONAME
-	pj_pool_getobjname                       @ 184 NONAME
-	pj_pool_init_int                         @ 185 NONAME
-	pj_pool_release                          @ 186 NONAME
-	pj_pool_reset                            @ 187 NONAME
-	pj_rand                                  @ 188 NONAME
-	pj_rbtree_erase                          @ 189 NONAME
-	pj_rbtree_find                           @ 190 NONAME
-	pj_rbtree_first                          @ 191 NONAME
-	pj_rbtree_init                           @ 192 NONAME
-	pj_rbtree_insert                         @ 193 NONAME
-	pj_rbtree_last                           @ 194 NONAME
-	pj_rbtree_max_height                     @ 195 NONAME
-	pj_rbtree_min_height                     @ 196 NONAME
-	pj_rbtree_next                           @ 197 NONAME
-	pj_rbtree_prev                           @ 198 NONAME
-	pj_register_strerror                     @ 199 NONAME
-	pj_rwmutex_create                        @ 200 NONAME
-	pj_rwmutex_destroy                       @ 201 NONAME
-	pj_rwmutex_lock_read                     @ 202 NONAME
-	pj_rwmutex_lock_write                    @ 203 NONAME
-	pj_rwmutex_unlock_read                   @ 204 NONAME
-	pj_rwmutex_unlock_write                  @ 205 NONAME
-	pj_sem_create                            @ 206 NONAME
-	pj_sem_destroy                           @ 207 NONAME
-	pj_sem_post                              @ 208 NONAME
-	pj_sem_trywait                           @ 209 NONAME
-	pj_sem_wait                              @ 210 NONAME
-	pj_set_netos_error                       @ 211 NONAME
-	pj_set_os_error                          @ 212 NONAME
-	pj_shutdown                              @ 213 NONAME
-	pj_sock_accept                           @ 214 NONAME
-	pj_sock_bind                             @ 215 NONAME
-	pj_sock_bind_in                          @ 216 NONAME
-	pj_sock_close                            @ 217 NONAME
-	pj_sock_connect                          @ 218 NONAME
-	pj_sock_getpeername                      @ 219 NONAME
-	pj_sock_getsockname                      @ 220 NONAME
-	pj_sock_getsockopt                       @ 221 NONAME
-	pj_sock_listen                           @ 222 NONAME
-	pj_sock_recv                             @ 223 NONAME
-	pj_sock_recvfrom                         @ 224 NONAME
-	pj_sock_select                           @ 225 NONAME
-	pj_sock_send                             @ 226 NONAME
-	pj_sock_sendto                           @ 227 NONAME
-	pj_sock_setsockopt                       @ 228 NONAME
-	pj_sock_shutdown                         @ 229 NONAME
-	pj_sock_socket                           @ 230 NONAME
-	pj_sockaddr_in_init                      @ 231 NONAME
-	pj_sockaddr_in_set_str_addr              @ 232 NONAME
-	pj_srand                                 @ 233 NONAME
-	pj_str                                   @ 234 NONAME
-	pj_strassign                             @ 235 NONAME
-	pj_strcat                                @ 236 NONAME
-	pj_strcat2                               @ 237 NONAME
-	pj_strcmp                                @ 238 NONAME
-	pj_strcmp2                               @ 239 NONAME
-	pj_strcpy                                @ 240 NONAME
-	pj_strcpy2                               @ 241 NONAME
-	pj_strdup                                @ 242 NONAME
-	pj_strdup2                               @ 243 NONAME
-	pj_strdup2_with_null                     @ 244 NONAME
-	pj_strdup3                               @ 245 NONAME
-	pj_strdup_with_null                      @ 246 NONAME
-	pj_strerror                              @ 247 NONAME
-	pj_stricmp                               @ 248 NONAME
-	pj_stricmp2                              @ 249 NONAME
-	pj_strltrim                              @ 250 NONAME
-	pj_strncmp                               @ 251 NONAME
-	pj_strncmp2                              @ 252 NONAME
-	pj_strncpy                               @ 253 NONAME
-	pj_strncpy_with_null                     @ 254 NONAME
-	pj_strnicmp                              @ 255 NONAME
-	pj_strnicmp2                             @ 256 NONAME
-	pj_strrtrim                              @ 257 NONAME
-	pj_strtoul                               @ 258 NONAME
-	pj_strtoul2                              @ 259 NONAME
-	pj_strtrim                               @ 260 NONAME
-	pj_symbianos_poll                        @ 261 NONAME
-	pj_symbianos_set_params                  @ 262 NONAME
-	pj_thread_create                         @ 263 NONAME
-	pj_thread_destroy                        @ 264 NONAME
-	pj_thread_get_name                       @ 265 NONAME
-	pj_thread_join                           @ 266 NONAME
-	pj_thread_local_alloc                    @ 267 NONAME
-	pj_thread_local_free                     @ 268 NONAME
-	pj_thread_local_get                      @ 269 NONAME
-	pj_thread_local_set                      @ 270 NONAME
-	pj_thread_register                       @ 271 NONAME
-	pj_thread_resume                         @ 272 NONAME
-	pj_thread_sleep                          @ 273 NONAME
-	pj_thread_this                           @ 274 NONAME
-	pj_time_decode                           @ 275 NONAME
-	pj_time_encode                           @ 276 NONAME
-	pj_time_gmt_to_local                     @ 277 NONAME
-	pj_time_local_to_gmt                     @ 278 NONAME
-	pj_time_val_normalize                    @ 279 NONAME
-	pj_timer_entry_init                      @ 280 NONAME
-	pj_timer_heap_cancel                     @ 281 NONAME
-	pj_timer_heap_count                      @ 282 NONAME
-	pj_timer_heap_create                     @ 283 NONAME
-	pj_timer_heap_destroy                    @ 284 NONAME
-	pj_timer_heap_earliest_time              @ 285 NONAME
-	pj_timer_heap_mem_size                   @ 286 NONAME
-	pj_timer_heap_poll                       @ 287 NONAME
-	pj_timer_heap_schedule                   @ 288 NONAME
-	pj_timer_heap_set_lock                   @ 289 NONAME
-	pj_timer_heap_set_max_timed_out_per_poll @ 290 NONAME
-	pj_unicode_to_ansi                       @ 291 NONAME
-	pj_utoa                                  @ 292 NONAME
-	pj_utoa_pad                              @ 293 NONAME
-	platform_strerror                        @ 294 NONAME
-	snprintf                                 @ 295 NONAME
-	vsnprintf                                @ 296 NONAME
+	pj_AF_UNSPEC                             @ 14 NONAME
+	pj_GUID_STRING_LENGTH                    @ 15 NONAME
+	pj_IPTOS_LOWDELAY                        @ 16 NONAME
+	pj_IPTOS_MINCOST                         @ 17 NONAME
+	pj_IPTOS_RELIABILITY                     @ 18 NONAME
+	pj_IPTOS_THROUGHPUT                      @ 19 NONAME
+	pj_IP_TOS                                @ 20 NONAME
+	pj_MSG_DONTROUTE                         @ 21 NONAME
+	pj_MSG_OOB                               @ 22 NONAME
+	pj_MSG_PEEK                              @ 23 NONAME
+	pj_NO_MEMORY_EXCEPTION                   @ 24 NONAME
+	pj_SOCK_DGRAM                            @ 25 NONAME
+	pj_SOCK_RAW                              @ 26 NONAME
+	pj_SOCK_RDM                              @ 27 NONAME
+	pj_SOCK_STREAM                           @ 28 NONAME
+	pj_SOL_IP                                @ 29 NONAME
+	pj_SOL_IPV6                              @ 30 NONAME
+	pj_SOL_SOCKET                            @ 31 NONAME
+	pj_SOL_TCP                               @ 32 NONAME
+	pj_SOL_UDP                               @ 33 NONAME
+	pj_SO_RCVBUF                             @ 34 NONAME
+	pj_SO_SNDBUF                             @ 35 NONAME
+	pj_SO_TYPE                               @ 36 NONAME
+	pj_ansi_to_unicode                       @ 37 NONAME
+	pj_array_erase                           @ 38 NONAME
+	pj_array_find                            @ 39 NONAME
+	pj_array_insert                          @ 40 NONAME
+	pj_atexit                                @ 41 NONAME
+	pj_atomic_add                            @ 42 NONAME
+	pj_atomic_add_and_get                    @ 43 NONAME
+	pj_atomic_create                         @ 44 NONAME
+	pj_atomic_dec                            @ 45 NONAME
+	pj_atomic_dec_and_get                    @ 46 NONAME
+	pj_atomic_destroy                        @ 47 NONAME
+	pj_atomic_get                            @ 48 NONAME
+	pj_atomic_inc                            @ 49 NONAME
+	pj_atomic_inc_and_get                    @ 50 NONAME
+	pj_atomic_set                            @ 51 NONAME
+	pj_caching_pool_destroy                  @ 52 NONAME
+	pj_caching_pool_init                     @ 53 NONAME
+	pj_create_random_string                  @ 54 NONAME
+	pj_create_unique_string                  @ 55 NONAME
+	pj_dump_config                           @ 56 NONAME
+	pj_elapsed_cycle                         @ 57 NONAME
+	pj_elapsed_msec                          @ 58 NONAME
+	pj_elapsed_nanosec                       @ 59 NONAME
+	pj_elapsed_time                          @ 60 NONAME
+	pj_elapsed_usec                          @ 61 NONAME
+	pj_enter_critical_section                @ 62 NONAME
+	pj_enum_ip_interface                     @ 63 NONAME
+	pj_enum_ip_route                         @ 64 NONAME
+	pj_exception_id_alloc                    @ 65 NONAME
+	pj_exception_id_free                     @ 66 NONAME
+	pj_exception_id_name                     @ 67 NONAME
+	pj_fifobuf_alloc                         @ 68 NONAME
+	pj_fifobuf_free                          @ 69 NONAME
+	pj_fifobuf_init                          @ 70 NONAME
+	pj_fifobuf_max_size                      @ 71 NONAME
+	pj_fifobuf_unalloc                       @ 72 NONAME
+	pj_file_close                            @ 73 NONAME
+	pj_file_delete                           @ 74 NONAME
+	pj_file_exists                           @ 75 NONAME
+	pj_file_flush                            @ 76 NONAME
+	pj_file_getpos                           @ 77 NONAME
+	pj_file_getstat                          @ 78 NONAME
+	pj_file_move                             @ 79 NONAME
+	pj_file_open                             @ 80 NONAME
+	pj_file_read                             @ 81 NONAME
+	pj_file_setpos                           @ 82 NONAME
+	pj_file_size                             @ 83 NONAME
+	pj_file_write                            @ 84 NONAME
+	pj_generate_unique_string                @ 85 NONAME
+	pj_get_netos_error                       @ 86 NONAME
+	pj_get_os_error                          @ 87 NONAME
+	pj_get_timestamp                         @ 88 NONAME
+	pj_get_timestamp_freq                    @ 89 NONAME
+	pj_get_version                           @ 90 NONAME
+	pj_gethostaddr                           @ 91 NONAME
+	pj_gethostbyname                         @ 92 NONAME
+	pj_gethostip                             @ 93 NONAME
+	pj_gethostname                           @ 94 NONAME
+	pj_getpid                                @ 95 NONAME
+	pj_gettimeofday                          @ 96 NONAME
+	pj_hash_calc                             @ 97 NONAME
+	pj_hash_calc_tolower                     @ 98 NONAME
+	pj_hash_count                            @ 99 NONAME
+	pj_hash_create                           @ 100 NONAME
+	pj_hash_first                            @ 101 NONAME
+	pj_hash_get                              @ 102 NONAME
+	pj_hash_next                             @ 103 NONAME
+	pj_hash_set                              @ 104 NONAME
+	pj_hash_set_np                           @ 105 NONAME
+	pj_hash_this                             @ 106 NONAME
+	pj_htonl                                 @ 107 NONAME
+	pj_htons                                 @ 108 NONAME
+	pj_inet_addr                             @ 109 NONAME
+	pj_inet_addr2                            @ 110 NONAME
+	pj_inet_aton                             @ 111 NONAME
+	pj_inet_ntoa                             @ 112 NONAME
+	pj_init                                  @ 113 NONAME
+	pj_ioqueue_accept                        @ 114 NONAME
+	pj_ioqueue_connect                       @ 115 NONAME
+	pj_ioqueue_create                        @ 116 NONAME
+	pj_ioqueue_destroy                       @ 117 NONAME
+	pj_ioqueue_get_user_data                 @ 118 NONAME
+	pj_ioqueue_is_pending                    @ 119 NONAME
+	pj_ioqueue_name                          @ 120 NONAME
+	pj_ioqueue_op_key_init                   @ 121 NONAME
+	pj_ioqueue_poll                          @ 122 NONAME
+	pj_ioqueue_post_completion               @ 123 NONAME
+	pj_ioqueue_recv                          @ 124 NONAME
+	pj_ioqueue_recvfrom                      @ 125 NONAME
+	pj_ioqueue_register_sock                 @ 126 NONAME
+	pj_ioqueue_send                          @ 127 NONAME
+	pj_ioqueue_sendto                        @ 128 NONAME
+	pj_ioqueue_set_lock                      @ 129 NONAME
+	pj_ioqueue_set_user_data                 @ 130 NONAME
+	pj_ioqueue_unregister                    @ 131 NONAME
+	pj_leave_critical_section                @ 132 NONAME
+	pj_list_erase                            @ 133 NONAME
+	pj_list_find_node                        @ 134 NONAME
+	pj_list_insert_after                     @ 135 NONAME
+	pj_list_insert_before                    @ 136 NONAME
+	pj_list_insert_nodes_after               @ 137 NONAME
+	pj_list_insert_nodes_before              @ 138 NONAME
+	pj_list_merge_first                      @ 139 NONAME
+	pj_list_merge_last                       @ 140 NONAME
+	pj_list_search                           @ 141 NONAME
+	pj_list_size                             @ 142 NONAME
+	pj_lock_acquire                          @ 143 NONAME
+	pj_lock_create_null_mutex                @ 144 NONAME
+	pj_lock_create_recursive_mutex           @ 145 NONAME
+	pj_lock_create_semaphore                 @ 146 NONAME
+	pj_lock_create_simple_mutex              @ 147 NONAME
+	pj_lock_destroy                          @ 148 NONAME
+	pj_lock_release                          @ 149 NONAME
+	pj_lock_tryacquire                       @ 150 NONAME
+	pj_log                                   @ 151 NONAME
+	pj_log_1                                 @ 152 NONAME
+	pj_log_2                                 @ 153 NONAME
+	pj_log_3                                 @ 154 NONAME
+	pj_log_4                                 @ 155 NONAME
+	pj_log_5                                 @ 156 NONAME
+	pj_log_get_decor                         @ 157 NONAME
+	pj_log_get_level                         @ 158 NONAME
+	pj_log_get_log_func                      @ 159 NONAME
+	pj_log_set_decor                         @ 160 NONAME
+	pj_log_set_level                         @ 161 NONAME
+	pj_log_set_log_func                      @ 162 NONAME
+	pj_log_write                             @ 163 NONAME
+	pj_mutex_create                          @ 164 NONAME
+	pj_mutex_create_recursive                @ 165 NONAME
+	pj_mutex_create_simple                   @ 166 NONAME
+	pj_mutex_destroy                         @ 167 NONAME
+	pj_mutex_lock                            @ 168 NONAME
+	pj_mutex_trylock                         @ 169 NONAME
+	pj_mutex_unlock                          @ 170 NONAME
+	pj_ntohl                                 @ 171 NONAME
+	pj_ntohs                                 @ 172 NONAME
+	pj_pool_alloc                            @ 173 NONAME
+	pj_pool_alloc_from_block                 @ 174 NONAME
+	pj_pool_allocate_find                    @ 175 NONAME
+	pj_pool_calloc                           @ 176 NONAME
+	pj_pool_create                           @ 177 NONAME
+	pj_pool_create_int                       @ 178 NONAME
+	pj_pool_create_on_buf                    @ 179 NONAME
+	pj_pool_destroy_int                      @ 180 NONAME
+	pj_pool_factory_default_policy           @ 181 NONAME
+	pj_pool_factory_get_default_policy       @ 182 NONAME
+	pj_pool_get_capacity                     @ 183 NONAME
+	pj_pool_get_used_size                    @ 184 NONAME
+	pj_pool_getobjname                       @ 185 NONAME
+	pj_pool_init_int                         @ 186 NONAME
+	pj_pool_release                          @ 187 NONAME
+	pj_pool_reset                            @ 188 NONAME
+	pj_rand                                  @ 189 NONAME
+	pj_rbtree_erase                          @ 190 NONAME
+	pj_rbtree_find                           @ 191 NONAME
+	pj_rbtree_first                          @ 192 NONAME
+	pj_rbtree_init                           @ 193 NONAME
+	pj_rbtree_insert                         @ 194 NONAME
+	pj_rbtree_last                           @ 195 NONAME
+	pj_rbtree_max_height                     @ 196 NONAME
+	pj_rbtree_min_height                     @ 197 NONAME
+	pj_rbtree_next                           @ 198 NONAME
+	pj_rbtree_prev                           @ 199 NONAME
+	pj_register_strerror                     @ 200 NONAME
+	pj_rwmutex_create                        @ 201 NONAME
+	pj_rwmutex_destroy                       @ 202 NONAME
+	pj_rwmutex_lock_read                     @ 203 NONAME
+	pj_rwmutex_lock_write                    @ 204 NONAME
+	pj_rwmutex_unlock_read                   @ 205 NONAME
+	pj_rwmutex_unlock_write                  @ 206 NONAME
+	pj_sem_create                            @ 207 NONAME
+	pj_sem_destroy                           @ 208 NONAME
+	pj_sem_post                              @ 209 NONAME
+	pj_sem_trywait                           @ 210 NONAME
+	pj_sem_wait                              @ 211 NONAME
+	pj_set_netos_error                       @ 212 NONAME
+	pj_set_os_error                          @ 213 NONAME
+	pj_shutdown                              @ 214 NONAME
+	pj_sock_accept                           @ 215 NONAME
+	pj_sock_bind                             @ 216 NONAME
+	pj_sock_bind_in                          @ 217 NONAME
+	pj_sock_close                            @ 218 NONAME
+	pj_sock_connect                          @ 219 NONAME
+	pj_sock_getpeername                      @ 220 NONAME
+	pj_sock_getsockname                      @ 221 NONAME
+	pj_sock_getsockopt                       @ 222 NONAME
+	pj_sock_listen                           @ 223 NONAME
+	pj_sock_recv                             @ 224 NONAME
+	pj_sock_recvfrom                         @ 225 NONAME
+	pj_sock_select                           @ 226 NONAME
+	pj_sock_send                             @ 227 NONAME
+	pj_sock_sendto                           @ 228 NONAME
+	pj_sock_setsockopt                       @ 229 NONAME
+	pj_sock_shutdown                         @ 230 NONAME
+	pj_sock_socket                           @ 231 NONAME
+	pj_sockaddr_in_init                      @ 232 NONAME
+	pj_sockaddr_in_set_str_addr              @ 233 NONAME
+	pj_srand                                 @ 234 NONAME
+	pj_str                                   @ 235 NONAME
+	pj_strassign                             @ 236 NONAME
+	pj_strcat                                @ 237 NONAME
+	pj_strcat2                               @ 238 NONAME
+	pj_strcmp                                @ 239 NONAME
+	pj_strcmp2                               @ 240 NONAME
+	pj_strcpy                                @ 241 NONAME
+	pj_strcpy2                               @ 242 NONAME
+	pj_strdup                                @ 243 NONAME
+	pj_strdup2                               @ 244 NONAME
+	pj_strdup2_with_null                     @ 245 NONAME
+	pj_strdup3                               @ 246 NONAME
+	pj_strdup_with_null                      @ 247 NONAME
+	pj_strerror                              @ 248 NONAME
+	pj_stricmp                               @ 249 NONAME
+	pj_stricmp2                              @ 250 NONAME
+	pj_strltrim                              @ 251 NONAME
+	pj_strncmp                               @ 252 NONAME
+	pj_strncmp2                              @ 253 NONAME
+	pj_strncpy                               @ 254 NONAME
+	pj_strncpy_with_null                     @ 255 NONAME
+	pj_strnicmp                              @ 256 NONAME
+	pj_strnicmp2                             @ 257 NONAME
+	pj_strrtrim                              @ 258 NONAME
+	pj_strtoul                               @ 259 NONAME
+	pj_strtoul2                              @ 260 NONAME
+	pj_strtrim                               @ 261 NONAME
+	pj_symbianos_poll                        @ 262 NONAME
+	pj_symbianos_set_params                  @ 263 NONAME
+	pj_thread_create                         @ 264 NONAME
+	pj_thread_destroy                        @ 265 NONAME
+	pj_thread_get_name                       @ 266 NONAME
+	pj_thread_join                           @ 267 NONAME
+	pj_thread_local_alloc                    @ 268 NONAME
+	pj_thread_local_free                     @ 269 NONAME
+	pj_thread_local_get                      @ 270 NONAME
+	pj_thread_local_set                      @ 271 NONAME
+	pj_thread_register                       @ 272 NONAME
+	pj_thread_resume                         @ 273 NONAME
+	pj_thread_sleep                          @ 274 NONAME
+	pj_thread_this                           @ 275 NONAME
+	pj_time_decode                           @ 276 NONAME
+	pj_time_encode                           @ 277 NONAME
+	pj_time_gmt_to_local                     @ 278 NONAME
+	pj_time_local_to_gmt                     @ 279 NONAME
+	pj_time_val_normalize                    @ 280 NONAME
+	pj_timer_entry_init                      @ 281 NONAME
+	pj_timer_heap_cancel                     @ 282 NONAME
+	pj_timer_heap_count                      @ 283 NONAME
+	pj_timer_heap_create                     @ 284 NONAME
+	pj_timer_heap_destroy                    @ 285 NONAME
+	pj_timer_heap_earliest_time              @ 286 NONAME
+	pj_timer_heap_mem_size                   @ 287 NONAME
+	pj_timer_heap_poll                       @ 288 NONAME
+	pj_timer_heap_schedule                   @ 289 NONAME
+	pj_timer_heap_set_lock                   @ 290 NONAME
+	pj_timer_heap_set_max_timed_out_per_poll @ 291 NONAME
+	pj_unicode_to_ansi                       @ 292 NONAME
+	pj_utoa                                  @ 293 NONAME
+	pj_utoa_pad                              @ 294 NONAME
+	platform_strerror                        @ 295 NONAME
+	snprintf                                 @ 296 NONAME
+	vsnprintf                                @ 297 NONAME
Index: pjproject/trunk/pjlib/include/pj/addr_resolv.h
===================================================================
--- pjproject/trunk/pjlib/include/pj/addr_resolv.h	(revision 1584)
+++ pjproject/trunk/pjlib/include/pj/addr_resolv.h	(revision 1585)
@@ -74,4 +74,14 @@
 #define h_addr h_addr_list[0]
 
+/** 
+ * This structure describes address information pj_getaddrinfo().
+ */
+typedef struct pj_addrinfo
+{
+    char	 ai_canonname[PJ_MAX_HOSTNAME]; /**< Canonical name for host*/
+    pj_sockaddr  ai_addr;			/**< Binary address.	    */
+} pj_addrinfo;
+
+
 /**
  * This function fills the structure of type pj_hostent for a given host name.
@@ -96,4 +106,25 @@
 
 
+/**
+ * This function translates the name of a service location (for example, 
+ * a host name) and returns a set of addresses and associated information
+ * to be used in creating a socket with which to address the specified 
+ * service.
+ *
+ * @param name	    Descriptive name or an address string, such as host
+ *		    name.
+ * @param af	    The desired address family to query.
+ * @param count	    On input, it specifies the number of elements in
+ *		    \a ai array. On output, this will be set with the
+ *		    number of address informations found for the
+ *		    specified name.
+ *
+ * @return	    PJ_SUCCESS on success, or the appropriate error code.
+ */
+PJ_DECL(pj_status_t) pj_getaddrinfo(const pj_str_t *nodename, int af,
+				    unsigned *count, pj_addrinfo ai[]);
+
+
+
 /** @} */
 
Index: pjproject/trunk/pjlib/include/pj/compat/os_auto.h.in
===================================================================
--- pjproject/trunk/pjlib/include/pj/compat/os_auto.h.in	(revision 1584)
+++ pjproject/trunk/pjlib/include/pj/compat/os_auto.h.in	(revision 1585)
@@ -73,4 +73,7 @@
 
 #undef PJ_SOCK_HAS_INET_ATON
+#undef PJ_SOCK_HAS_INET_PTON
+#undef PJ_SOCK_HAS_INET_NTOP
+#undef PJ_SOCK_HAS_GETADDRINFO
 
 /* Set 1 if native sockaddr_in has sin_len member. 
Index: pjproject/trunk/pjlib/include/pj/compat/socket.h
===================================================================
--- pjproject/trunk/pjlib/include/pj/compat/socket.h	(revision 1584)
+++ pjproject/trunk/pjlib/include/pj/compat/socket.h	(revision 1585)
@@ -32,4 +32,43 @@
 #  include <winsock.h>
 #endif
+
+/*
+ * IPv6 for Visual Studio's
+ *
+ * = Visual Studio 6 =
+ *
+ * Visual Studio 6 does not ship with IPv6 support, so you MUST
+ * download and install IPv6 Tehnology Preview (IPv6Kit) from:
+ *    http://msdn.microsoft.com/downloads/sdks/platform/tpipv6/ReadMe.asp
+ * Then put IPv6Kit\inc in your Visual Studio include path.
+ * 
+ * In addition, by default IPv6Kit does not want to install on
+ * Windows 2000 SP4. Please see:
+ *    http://msdn.microsoft.com/downloads/sdks/platform/tpipv6/faq.asp
+ * on  how to install IPv6Kit on Win2K SP4.
+ *
+ *
+ * = Visual Studio 2003, 2005 (including Express) =
+ *
+ * These VS uses Microsoft Platform SDK for Windows Server 2003 SP1, and
+ * it has built-in IPv6 support.
+ */
+#if defined(_MSC_VER) && defined(PJ_HAS_IPV6) && PJ_HAS_IPV6!=0
+#   ifndef s_addr
+#	define s_addr  S_un.S_addr
+#   endif
+
+#   include <ws2tcpip.h>
+
+#   ifndef IPPROTO_IPV6
+	/* Need to download and install IPv6Kit for this platform.
+	 * Please see the comments above about Visual Studio 6.
+	 */
+#	include <tpipv6.h>
+#   endif
+
+#   undef s_addr
+#endif	/* _MSC_VER */
+
 
 #if defined(PJ_HAS_SYS_TYPES_H) && PJ_HAS_SYS_TYPES_H != 0
Index: pjproject/trunk/pjlib/include/pj/config.h
===================================================================
--- pjproject/trunk/pjlib/include/pj/config.h	(revision 1584)
+++ pjproject/trunk/pjlib/include/pj/config.h	(revision 1585)
@@ -450,4 +450,15 @@
 
 /**
+ * \def PJ_HAS_IPV6
+ * Support IPv6 in the library. If this support is disabled, some IPv6 
+ * related functions will return PJ_EIPV6NOTSUP.
+ *
+ * Default: 0 (disabled, for now)
+ */
+#ifndef PJ_HAS_IPV6
+#  define PJ_HAS_IPV6		    0
+#endif
+
+ /**
  * Maximum hostname length.
  * Libraries sometimes needs to make copy of an address to stack buffer;
Index: pjproject/trunk/pjlib/include/pj/errno.h
===================================================================
--- pjproject/trunk/pjlib/include/pj/errno.h	(revision 1584)
+++ pjproject/trunk/pjlib/include/pj/errno.h	(revision 1585)
@@ -310,4 +310,9 @@
  */
 #define PJ_EIGNORED	    (PJ_ERRNO_START_STATUS + 20)/* 70020 */
+/**
+ * @hideinitializer
+ * IPv6 is not supported
+ */
+#define PJ_EIPV6NOTSUP	    (PJ_ERRNO_START_STATUS + 21)/* 70021 */
 
 /** @} */   /* pj_errnum */
Index: pjproject/trunk/pjlib/include/pj/sock.h
===================================================================
--- pjproject/trunk/pjlib/include/pj/sock.h	(revision 1584)
+++ pjproject/trunk/pjlib/include/pj/sock.h	(revision 1585)
@@ -61,4 +61,7 @@
  */
 
+/** Address family is unspecified. @see pj_AF_UNSPEC() */
+extern const pj_uint16_t PJ_AF_UNSPEC;
+
 /** Unix domain socket.	@see pj_AF_UNIX() */
 extern const pj_uint16_t PJ_AF_UNIX;
@@ -85,4 +88,6 @@
  */
 
+/** Get #PJ_AF_UNSPEC value */
+PJ_DECL(pj_uint16_t) pj_AF_UNSPEC(void);
 /** Get #PJ_AF_UNIX value. */
 PJ_DECL(pj_uint16_t) pj_AF_UNIX(void);
@@ -314,4 +319,15 @@
 
 /**
+ * Maximum length of text representation of an IPv4 address.
+ */
+#define PJ_INET_ADDRSTRLEN	16
+
+/**
+ * Maximum length of text representation of an IPv6 address.
+ */
+#define PJ_INET6_ADDRSTRLEN	46
+
+
+/**
  * This structure describes Internet socket address.
  * If PJ_SOCKADDR_HAS_LEN is not zero, then sin_zero_len member is added
@@ -334,4 +350,5 @@
 };
 
+
 #undef s6_addr
 
@@ -339,19 +356,17 @@
  * This structure describes IPv6 address.
  */
-typedef struct pj_in6_addr
-{
-    /** Union of address formats. */
-    union {
-	pj_uint8_t  u6_addr8[16];   /**< u6_addr8   */
-	pj_uint16_t u6_addr16[8];   /**< u6_addr16  */
-	pj_uint32_t u6_addr32[4];   /**< u6_addr32  */
-    } in6_u;
-/** Shortcut to access in6_u.u6_addr8. */
-#define s6_addr                 in6_u.u6_addr8
-/** Shortcut to access in6_u.u6_addr16. */
-#define s6_addr16               in6_u.u6_addr16
-/** Shortcut to access in6_u.u6_addr32. */
-#define s6_addr32               in6_u.u6_addr32
+typedef union pj_in6_addr
+{
+    /* This is the main entry */
+    pj_uint8_t  s6_addr[16];   /**< 8-bit array */
+
+    /* While these are used for proper alignment */
+    pj_uint32_t	u6_addr32[4];
+#if defined(PJ_HAS_INT64) && PJ_HAS_INT64!=0
+    pj_int64_t	u6_addr64[2];
+#endif
+
 } pj_in6_addr;
+
 
 /** Initializer value for pj_in6_addr. */
@@ -372,6 +387,6 @@
 {
 #if defined(PJ_SOCKADDR_HAS_LEN) && PJ_SOCKADDR_HAS_LEN!=0
-    pj_uint8_t  sin_zero_len;	    /**< Just ignore this.	   */
-    pj_uint8_t  sin_family;	    /**< Address family.	   */
+    pj_uint8_t  sin6_zero_len;	    /**< Just ignore this.	   */
+    pj_uint8_t  sin6_family;	    /**< Address family.	   */
 #else
     pj_uint16_t	sin6_family;	    /**< Address family		    */
@@ -380,5 +395,5 @@
     pj_uint32_t	sin6_flowinfo;	    /**< IPv6 flow information	    */
     pj_in6_addr sin6_addr;	    /**< IPv6 address.		    */
-    pj_uint32_t sin6_scope_id;	    /**< IPv6 scope-id		    */
+    pj_uint32_t sin6_scope_id;	    /**< Set of interfaces for a scope	*/
 } pj_sockaddr_in6;
 
@@ -473,4 +488,42 @@
  */
 PJ_DECL(int) pj_inet_aton(const pj_str_t *cp, struct pj_in_addr *inp);
+
+/**
+ * This function converts an address in its standard text presentation form
+ * into its numeric binary form. It supports both IPv4 and IPv6 address
+ * conversion.
+ *
+ * @param af	Specify the family of the address.  The PJ_AF_INET and 
+ *		PJ_AF_INET6 address families shall be supported.  
+ * @param src	Points to the string being passed in. 
+ * @param dst	Points to a buffer into which the function stores the 
+ *		numeric address; this shall be large enough to hold the
+ *		numeric address (32 bits for PJ_AF_INET, 128 bits for
+ *		PJ_AF_INET6).  
+ *
+ * @return	PJ_SUCCESS if conversion was successful.
+ */
+PJ_DECL(pj_status_t) pj_inet_pton(int af, const pj_str_t *src, void *dst);
+
+/**
+ * This function converts a numeric address into a text string suitable
+ * for presentation. It supports both IPv4 and IPv6 address
+ * conversion.
+ *
+ * @param af	Specify the family of the address. This can be PJ_AF_INET
+ *		or PJ_AF_INET6.
+ * @param src	Points to a buffer holding an IPv4 address if the af argument
+ *		is PJ_AF_INET, or an IPv6 address if the af argument is
+ *		PJ_AF_INET6; the address must be in network byte order.  
+ * @param dst	Points to a buffer where the function stores the resulting
+ *		text string; it shall not be NULL.  
+ * @param size	Specifies the size of this buffer, which shall be large 
+ *		enough to hold the text string (PJ_INET_ADDRSTRLEN characters
+ *		for IPv4, PJ_INET6_ADDRSTRLEN characters for IPv6).
+ *
+ * @return	PJ_SUCCESS if conversion was successful..
+ */
+PJ_DECL(pj_status_t) pj_inet_ntop(int af, const void *src,
+				  char *dst, int size);
 
 /**
Index: pjproject/trunk/pjlib/src/pj/addr_resolv_sock.c
===================================================================
--- pjproject/trunk/pjlib/src/pj/addr_resolv_sock.c	(revision 1584)
+++ pjproject/trunk/pjlib/src/pj/addr_resolv_sock.c	(revision 1585)
@@ -116,2 +116,72 @@
 
 
+/* Resolve IPv4/IPv6 address */
+PJ_DEF(pj_status_t) pj_getaddrinfo(const pj_str_t *nodename, int af,
+				   unsigned *count, pj_addrinfo ai[])
+{
+#if defined(PJ_SOCK_HAS_GETADDRINFO) && PJ_SOCK_HAS_GETADDRINFO!=0
+    char nodecopy[PJ_MAX_HOSTNAME];
+    struct addrinfo hint, *res;
+    unsigned i;
+    int rc;
+
+    PJ_ASSERT_RETURN(nodename && count && *count && ai, PJ_EINVAL);
+    PJ_ASSERT_RETURN(nodename->ptr && nodename->slen, PJ_EINVAL);
+    PJ_ASSERT_RETURN(af==PJ_AF_INET || af==PJ_AF_INET6, PJ_EINVAL);
+
+    /* Copy node name to null terminated string. */
+    if (nodename->slen >= PJ_MAX_HOSTNAME)
+	return PJ_ENAMETOOLONG;
+    pj_memcpy(nodecopy, nodename->ptr, nodename->slen);
+    nodecopy[nodename->slen] = '\0';
+
+    /* Call getaddrinfo() */
+    pj_bzero(&hint, sizeof(hint));
+    hint.ai_family = af;
+
+    rc = getaddrinfo(nodecopy, NULL, &hint, &res);
+    if (rc != 0)
+	return PJ_ERESOLVE;
+
+    /* Enumerate each item in the result */
+    for (i=0; i<*count && res; res=res->ai_next) {
+	int len;
+
+	/* Ignore unwanted address families */
+	if (af!=PJ_AF_UNSPEC && res->ai_family != af)
+	    continue;
+
+	/* Ignore name that's too long */
+	len = pj_ansi_strlen(res->ai_canonname);
+	if (len >= PJ_MAX_HOSTNAME)
+	    continue;
+
+	/* Store canonical name */
+	pj_ansi_strcpy(ai[i].ai_canonname, res->ai_canonname);
+
+	/* Store address */
+	PJ_ASSERT_ON_FAIL(res->ai_addrlen <= sizeof(pj_sockaddr), continue);
+	pj_memcpy(&ai[i].ai_addr, res->ai_addr, res->ai_addrlen);
+
+	/* Next slot */
+	++i;
+    }
+
+    *count = i;
+
+    /* Done */
+    return PJ_SUCCESS;
+
+#else	/* PJ_SOCK_HAS_GETADDRINFO */
+    /* IPv6 is not supported */
+    PJ_UNUSED_ARG(nodename);
+    PJ_UNUSED_ARG(af);
+    PJ_UNUSED_ARG(ai);
+
+    PJ_ASSERT_RETURN(count, PJ_EINVAL);
+    *count = 0;
+
+    return PJ_EIPV6NOTSUP;
+#endif	/* PJ_SOCK_HAS_GETADDRINFO */
+}
+
Index: pjproject/trunk/pjlib/src/pj/errno.c
===================================================================
--- pjproject/trunk/pjlib/src/pj/errno.c	(revision 1584)
+++ pjproject/trunk/pjlib/src/pj/errno.c	(revision 1585)
@@ -72,4 +72,5 @@
     PJ_BUILD_ERR(PJ_ETOOSMALL,	   "Size is too short"),
     PJ_BUILD_ERR(PJ_EIGNORED,	   "Ignored"),
+    PJ_BUILD_ERR(PJ_EIPV6NOTSUP,   "IPv6 is not supported")
 };
 #endif	/* PJ_HAS_ERROR_STRING */
Index: pjproject/trunk/pjlib/src/pj/sock_bsd.c
===================================================================
--- pjproject/trunk/pjlib/src/pj/sock_bsd.c	(revision 1584)
+++ pjproject/trunk/pjlib/src/pj/sock_bsd.c	(revision 1585)
@@ -24,4 +24,5 @@
 #include <pj/addr_resolv.h>
 #include <pj/errno.h>
+#include <pj/unicode.h>
 
 /*
@@ -29,4 +30,5 @@
  * The values here are indexed based on pj_addr_family.
  */
+const pj_uint16_t PJ_AF_UNSPEC	= AF_UNSPEC;
 const pj_uint16_t PJ_AF_UNIX	= AF_UNIX;
 const pj_uint16_t PJ_AF_INET	= AF_INET;
@@ -185,5 +187,5 @@
 PJ_DEF(int) pj_inet_aton(const pj_str_t *cp, struct pj_in_addr *inp)
 {
-    char tempaddr[16];
+    char tempaddr[PJ_INET_ADDRSTRLEN];
 
     /* Initialize output with PJ_INADDR_NONE.
@@ -198,5 +200,5 @@
      */
     PJ_ASSERT_RETURN(cp && cp->slen && inp, 0);
-    if (cp->slen >= 16) {
+    if (cp->slen >= PJ_INET_ADDRSTRLEN) {
 	return 0;
     }
@@ -210,4 +212,174 @@
     inp->s_addr = inet_addr(tempaddr);
     return inp->s_addr == PJ_INADDR_NONE ? 0 : 1;
+#endif
+}
+
+/*
+ * Convert text to IPv4/IPv6 address.
+ */
+PJ_DEF(pj_status_t) pj_inet_pton(int af, const pj_str_t *src, void *dst)
+{
+    char tempaddr[PJ_INET6_ADDRSTRLEN];
+
+    PJ_ASSERT_RETURN(af==PJ_AF_INET || af==PJ_AF_INET6, PJ_EINVAL);
+    PJ_ASSERT_RETURN(src && src->slen && dst, PJ_EINVAL);
+
+    /* Initialize output with PJ_IN_ADDR_NONE for IPv4 (to be 
+     * compatible with pj_inet_aton()
+     */
+    if (af==PJ_AF_INET) {
+	((pj_in_addr*)dst)->s_addr = PJ_INADDR_NONE;
+    }
+
+    /* Caution:
+     *	this function might be called with cp->slen >= 46
+     *  (i.e. when called with hostname to check if it's an IP addr).
+     */
+    if (src->slen >= PJ_INET6_ADDRSTRLEN) {
+	return PJ_ENAMETOOLONG;
+    }
+
+    pj_memcpy(tempaddr, src->ptr, src->slen);
+    tempaddr[src->slen] = '\0';
+
+#if defined(PJ_SOCK_HAS_INET_PTON) && PJ_SOCK_HAS_INET_PTON != 0
+    /*
+     * Implementation using inet_pton()
+     */
+    if (inet_pton(af, tempaddr, dst) != 1) {
+	pj_status_t status = pj_get_netos_error();
+	if (status == PJ_SUCCESS)
+	    status = PJ_EUNKNOWN;
+
+	return status;
+    }
+
+    return PJ_SUCCESS;
+
+#elif defined(PJ_WIN32) || defined(PJ_WIN32_WINCE)
+    /*
+     * Implementation on Windows, using WSAStringToAddress().
+     * Should also work on Unicode systems.
+     */
+    {
+	PJ_DECL_UNICODE_TEMP_BUF(wtempaddr,PJ_INET6_ADDRSTRLEN)
+	pj_sockaddr sock_addr;
+	int addr_len = sizeof(sock_addr);
+	int rc;
+
+	sock_addr.addr.sa_family = (pj_uint16_t)af;
+	rc = WSAStringToAddress(
+		PJ_STRING_TO_NATIVE(tempaddr,wtempaddr,sizeof(wtempaddr)), 
+		af, NULL, (LPSOCKADDR)&sock_addr, &addr_len);
+	if (rc != 0) {
+	    pj_status_t status = pj_get_netos_error();
+	    if (status == PJ_SUCCESS)
+		status = PJ_EUNKNOWN;
+
+	    return status;
+	}
+
+	if (sock_addr.addr.sa_family == PJ_AF_INET) {
+	    pj_memcpy(dst, &sock_addr.ipv4.sin_addr, 4);
+	    return PJ_SUCCESS;
+	} else if (sock_addr.addr.sa_family == PJ_AF_INET6) {
+	    pj_memcpy(dst, &sock_addr.ipv6.sin6_addr, 16);
+	    return PJ_SUCCESS;
+	} else {
+	    pj_assert(!"Shouldn't happen");
+	    return PJ_EBUG;
+	}
+    }
+#elif !defined(PJ_HAS_IPV6) || PJ_HAS_IPV6==0
+    /* IPv6 support is disabled, just return error without raising assertion */
+    return PJ_EIPV6NOTSUP;
+#else
+    pj_assert(!"Not supported");
+    return PJ_EIPV6NOTSUP;
+#endif
+}
+
+/*
+ * Convert IPv4/IPv6 address to text.
+ */
+PJ_DEF(pj_status_t) pj_inet_ntop(int af, const void *src,
+				 char *dst, int size)
+
+{
+    PJ_ASSERT_RETURN(src && dst && size, PJ_EINVAL);
+    PJ_ASSERT_RETURN(af==PJ_AF_INET || af==PJ_AF_INET6, PJ_EINVAL);
+
+#if defined(PJ_SOCK_HAS_INET_NTOP) && PJ_SOCK_HAS_INET_NTOP != 0
+    /*
+     * Implementation using inet_ntop()
+     */
+    if (inet_ntop(af, src, dst, size) == NULL) {
+	pj_status_t status = pj_get_netos_error();
+	if (status == PJ_SUCCESS)
+	    status = PJ_EUNKNOWN;
+
+	return status;
+    }
+
+    return PJ_SUCCESS;
+
+#elif defined(PJ_WIN32) || defined(PJ_WIN32_WINCE)
+    /*
+     * Implementation on Windows, using WSAAddressToString().
+     * Should also work on Unicode systems.
+     */
+    {
+	PJ_DECL_UNICODE_TEMP_BUF(wtempaddr,PJ_INET6_ADDRSTRLEN)
+	pj_sockaddr sock_addr;
+	DWORD addr_len, addr_str_len;
+	int rc;
+
+	pj_bzero(&sock_addr, sizeof(sock_addr));
+	sock_addr.addr.sa_family = (pj_uint16_t)af;
+	if (af == PJ_AF_INET) {
+	    if (size < PJ_INET_ADDRSTRLEN)
+		return PJ_ETOOSMALL;
+	    pj_memcpy(&sock_addr.ipv4.sin_addr, src, 4);
+	    addr_len = sizeof(pj_sockaddr_in);
+	    addr_str_len = PJ_INET_ADDRSTRLEN;
+	} else if (af == PJ_AF_INET6) {
+	    if (size < PJ_INET6_ADDRSTRLEN)
+		return PJ_ETOOSMALL;
+	    pj_memcpy(&sock_addr.ipv6.sin6_addr, src, 16);
+	    addr_len = sizeof(pj_sockaddr_in6);
+	    addr_str_len = PJ_INET6_ADDRSTRLEN;
+	} else {
+	    pj_assert(!"Unsupported address family");
+	    return PJ_EINVAL;
+	}
+
+#if PJ_NATIVE_STRING_IS_UNICODE
+	rc = WSAAddressToString((LPSOCKADDR)&sock_addr, addr_len,
+				NULL, wtempaddr, addr_str_len);
+	if (rc == 0) {
+	    pj_unicode_to_ansi(wtempaddr, wcslen(wtempaddr), dst, size);
+	}
+#else
+	rc = WSAAddressToString((LPSOCKADDR)&sock_addr, addr_len,
+				NULL, dst, &addr_str_len);
+#endif
+
+	if (rc != 0) {
+	    pj_status_t status = pj_get_netos_error();
+	    if (status == PJ_SUCCESS)
+		status = PJ_EUNKNOWN;
+
+	    return status;
+	}
+
+	return PJ_SUCCESS;
+    }
+
+#elif !defined(PJ_HAS_IPV6) || PJ_HAS_IPV6==0
+    /* IPv6 support is disabled, just return error without raising assertion */
+    return PJ_EIPV6NOTSUP;
+#else
+    pj_assert(!"Not supported");
+    return PJ_EIPV6NOTSUP;
 #endif
 }
Index: pjproject/trunk/pjlib/src/pj/sock_common.c
===================================================================
--- pjproject/trunk/pjlib/src/pj/sock_common.c	(revision 1584)
+++ pjproject/trunk/pjlib/src/pj/sock_common.c	(revision 1585)
@@ -18,4 +18,9 @@
  */
 #include <pj/sock.h>
+
+PJ_DEF(pj_uint16_t) pj_AF_UNSPEC(void)
+{
+    return PJ_AF_UNSPEC;
+}
 
 PJ_DEF(pj_uint16_t) pj_AF_UNIX(void)
Index: pjproject/trunk/pjlib/src/pjlib-test/sock.c
===================================================================
--- pjproject/trunk/pjlib/src/pjlib-test/sock.c	(revision 1584)
+++ pjproject/trunk/pjlib/src/pjlib-test/sock.c	(revision 1585)
@@ -41,4 +41,6 @@
  *  - pj_inet_aton()
  *  - pj_inet_ntoa()
+ *  - pj_inet_pton()  (only if IPv6 is enabled)
+ *  - pj_inet_ntop()  (only if IPv6 is enabled)
  *  - pj_gethostname()
  *  - pj_sock_socket()
@@ -101,5 +103,49 @@
 
     if (pj_strcmp2(&s, (char*)p) != 0)
-	return -30;
+	return -22;
+
+#if defined(PJ_HAS_IPV6) && PJ_HAS_IPV6!=0
+    /* pj_inet_pton() */
+    /* pj_inet_ntop() */
+    {
+	const pj_str_t s_ipv4 = pj_str("127.0.0.1");
+	const pj_str_t s_ipv6 = pj_str("fe80::2ff:83ff:fe7c:8b42");
+	char buf_ipv4[PJ_INET_ADDRSTRLEN];
+	char buf_ipv6[PJ_INET6_ADDRSTRLEN];
+	pj_in_addr ipv4;
+	pj_in6_addr ipv6;
+
+	if (pj_inet_pton(pj_AF_INET(), &s_ipv4, &ipv4) != PJ_SUCCESS)
+	    return -24;
+
+	p = (unsigned char*)&ipv4;
+	if (p[0]!=A[0] || p[1]!=A[1] || p[2]!=A[2] || p[3]!=A[3]) {
+	    return -25;
+	}
+
+	if (pj_inet_pton(pj_AF_INET6(), &s_ipv6, &ipv6) != PJ_SUCCESS)
+	    return -26;
+
+	p = (unsigned char*)&ipv6;
+	if (p[0] != 0xfe || p[1] != 0x80 || p[2] != 0 || p[3] != 0 ||
+	    p[4] != 0 || p[5] != 0 || p[6] != 0 || p[7] != 0 ||
+	    p[8] != 0x02 || p[9] != 0xff || p[10] != 0x83 || p[11] != 0xff ||
+	    p[12]!=0xfe || p[13]!=0x7c || p[14] != 0x8b || p[15]!=0x42)
+	{
+	    return -27;
+	}
+
+	if (pj_inet_ntop(pj_AF_INET(), &ipv4, buf_ipv4, sizeof(buf_ipv4)) != PJ_SUCCESS)
+	    return -28;
+	if (pj_stricmp2(&s_ipv4, buf_ipv4) != 0)
+	    return -29;
+
+	if (pj_inet_ntop(pj_AF_INET6(), &ipv6, buf_ipv6, sizeof(buf_ipv6)) != PJ_SUCCESS)
+	    return -30;
+	if (pj_stricmp2(&s_ipv6, buf_ipv6) != 0)
+	    return -31;
+    }
+
+#endif	/* PJ_HAS_IPV6 */
 
     /* Test that pj_sockaddr_in_init() initialize the whole structure, 
