Changeset 1647 for pjproject/trunk/pjlib/src/pj/addr_resolv_symbian.cpp
- Timestamp:
- Dec 31, 2007 11:26:21 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/src/pj/addr_resolv_symbian.cpp
r1608 r1647 21 21 #include <pj/errno.h> 22 22 #include <pj/ip_helper.h> 23 #include <pj/log.h> 23 24 #include <pj/sock.h> 24 25 #include <pj/string.h> … … 27 28 #include "os_symbian.h" 28 29 30 #define THIS_FILE "addr_resolv_symbian.cpp" 31 #define TRACE_ME 0 29 32 30 33 … … 87 90 while (reqStatus == KErrNone && i < *count) { 88 91 89 // Get the resolved TInetAddr90 TInetAddr inetAddr(nameEntry().iAddr);91 int addrlen;92 // Get the resolved TInetAddr 93 TInetAddr inetAddr(nameEntry().iAddr); 94 int addrlen; 92 95 93 // Ignore if this is not the same address family 94 if (inetAddr.Family() != (unsigned)af) { 95 resv.Next(nameEntry, reqStatus); 96 User::WaitForRequest(reqStatus); 97 continue; 98 } 96 #if TRACE_ME 97 if (1) { 98 pj_sockaddr a; 99 char ipaddr[PJ_INET6_ADDRSTRLEN+2]; 100 int namelen; 101 102 namelen = sizeof(pj_sockaddr); 103 if (PjSymbianOS::Addr2pj(inetAddr, a, &namelen, 104 PJ_FALSE) == PJ_SUCCESS) 105 { 106 PJ_LOG(5,(THIS_FILE, "resolve %.*s: %s", 107 (int)name->slen, name->ptr, 108 pj_sockaddr_print(&a, ipaddr, sizeof(ipaddr), 2))); 109 } 110 } 111 #endif 112 113 // Ignore if this is not the same address family 114 // Not a good idea, as Symbian mapps IPv4 to IPv6. 115 //fam = inetAddr.Family(); 116 //if (fam != af) { 117 // resv.Next(nameEntry, reqStatus); 118 // User::WaitForRequest(reqStatus); 119 // continue; 120 //} 121 122 // Convert IP address first to get IPv4 mapped address 123 addrlen = sizeof(ai[i].ai_addr); 124 status = PjSymbianOS::Addr2pj(inetAddr, ai[i].ai_addr, 125 &addrlen, PJ_TRUE); 126 if (status != PJ_SUCCESS) 127 return status; 128 129 // Ignore if address family doesn't match 130 if (ai[i].ai_addr.addr.sa_family != af) { 131 resv.Next(nameEntry, reqStatus); 132 User::WaitForRequest(reqStatus); 133 continue; 134 } 135 136 // Convert the official address to ANSI. 137 pj_unicode_to_ansi((const wchar_t*)nameEntry().iName.Ptr(), 138 nameEntry().iName.Length(), 139 ai[i].ai_canonname, sizeof(ai[i].ai_canonname)); 99 140 100 // Convert the official address to ANSI. 101 pj_unicode_to_ansi((const wchar_t*)nameEntry().iName.Ptr(), 102 nameEntry().iName.Length(), 103 ai[i].ai_canonname, sizeof(ai[i].ai_canonname)); 104 105 // Convert IP address 106 addrlen = sizeof(ai[i].ai_addr); 107 status = PjSymbianOS::Addr2pj(inetAddr, ai[i].ai_addr, &addrlen); 108 if (status != PJ_SUCCESS) 109 return status; 110 111 // Next 112 ++i; 113 resv.Next(nameEntry, reqStatus); 114 User::WaitForRequest(reqStatus); 141 // Next 142 ++i; 143 resv.Next(nameEntry, reqStatus); 144 User::WaitForRequest(reqStatus); 115 145 } 116 146
Note: See TracChangeset
for help on using the changeset viewer.