Changeset 3543
- Timestamp:
- Apr 26, 2011 3:07:24 AM (14 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/include/pj/compat/os_auto.h.in
r3423 r3543 176 176 # if TARGET_OS_IPHONE 177 177 # include "Availability.h" 178 /* Use CFHost API for pj_getaddrinfo() (see ticket #1246) */ 179 # define PJ_GETADDRINFO_USE_CFHOST 1 178 180 # ifdef __IPHONE_4_0 179 /* Append ".local" suffix to the system's hostname? (see ticket #1104) */180 # define PJ_GETHOSTNAME_APPEND_LOCAL_SUFFIX 1181 181 /* Is multitasking support available? (see ticket #1107) */ 182 182 # define PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT 1 -
pjproject/trunk/pjlib/src/pj/addr_resolv_sock.c
r3234 r3543 25 25 #include <pj/compat/socket.h> 26 26 27 #if defined(PJ_GETADDRINFO_USE_CFHOST) && PJ_GETADDRINFO_USE_CFHOST!=0 28 # include <CoreFoundation/CFString.h> 29 # include <CFNetwork/CFHost.h> 30 #endif 27 31 28 32 PJ_DEF(pj_status_t) pj_gethostbyname(const pj_str_t *hostname, pj_hostent *phe) … … 63 67 #if defined(PJ_SOCK_HAS_GETADDRINFO) && PJ_SOCK_HAS_GETADDRINFO!=0 64 68 char nodecopy[PJ_MAX_HOSTNAME]; 65 struct addrinfo hint, *res, *orig_res;66 69 pj_bool_t has_addr = PJ_FALSE; 67 70 unsigned i; 71 #if defined(PJ_GETADDRINFO_USE_CFHOST) && PJ_GETADDRINFO_USE_CFHOST!=0 72 CFStringRef hostname; 73 CFHostRef hostRef; 74 pj_status_t status = PJ_SUCCESS; 75 #else 68 76 int rc; 77 struct addrinfo hint, *res, *orig_res; 78 #endif 69 79 70 80 PJ_ASSERT_RETURN(nodename && count && *count && ai, PJ_EINVAL); … … 106 116 nodecopy[nodename->slen] = '\0'; 107 117 118 #if defined(PJ_GETADDRINFO_USE_CFHOST) && PJ_GETADDRINFO_USE_CFHOST!=0 119 hostname = CFStringCreateWithCStringNoCopy(kCFAllocatorDefault, nodecopy, 120 kCFStringEncodingASCII, 121 kCFAllocatorNull); 122 hostRef = CFHostCreateWithName(kCFAllocatorDefault, hostname); 123 if (CFHostStartInfoResolution(hostRef, kCFHostAddresses, nil)) { 124 CFArrayRef addrRef = CFHostGetAddressing(hostRef, nil); 125 i = 0; 126 if (addrRef != nil) { 127 CFIndex idx, naddr; 128 129 naddr = CFArrayGetCount(addrRef); 130 for (idx = 0; idx < naddr && i < *count; idx++) { 131 struct sockaddr *addr; 132 133 addr = (struct sockaddr *) 134 CFDataGetBytePtr(CFArrayGetValueAtIndex(addrRef, idx)); 135 /* This should not happen. */ 136 pj_assert(addr); 137 138 /* Ignore unwanted address families */ 139 if (af!=PJ_AF_UNSPEC && addr->sa_family != af) 140 continue; 141 142 /* Store canonical name */ 143 pj_ansi_strcpy(ai[i].ai_canonname, nodecopy); 144 145 /* Store address */ 146 PJ_ASSERT_ON_FAIL(sizeof(*addr) <= sizeof(pj_sockaddr), 147 continue); 148 pj_memcpy(&ai[i].ai_addr, addr, sizeof(*addr)); 149 PJ_SOCKADDR_RESET_LEN(&ai[i].ai_addr); 150 151 i++; 152 } 153 } 154 155 *count = i; 156 } else { 157 status = PJ_ERESOLVE; 158 } 159 160 CFRelease(hostRef); 161 CFRelease(hostname); 162 163 return status; 164 #else 108 165 /* Call getaddrinfo() */ 109 166 pj_bzero(&hint, sizeof(hint)); … … 146 203 /* Done */ 147 204 return PJ_SUCCESS; 205 #endif 148 206 149 207 #else /* PJ_SOCK_HAS_GETADDRINFO */ -
pjproject/trunk/pjlib/src/pj/sock_bsd.c
r3492 r3543 457 457 } else { 458 458 hostname.slen = strlen(buf); 459 #if defined(PJ_GETHOSTNAME_APPEND_LOCAL_SUFFIX) && \460 PJ_GETHOSTNAME_APPEND_LOCAL_SUFFIX!=0461 {462 const pj_str_t suffix = {".local", 6};463 464 if (hostname.slen < suffix.slen ||465 pj_ansi_strnicmp(hostname.ptr + hostname.slen -466 suffix.slen, suffix.ptr, suffix.slen))467 {468 if (hostname.slen + suffix.slen + 1 < sizeof(buf))469 pj_strcat(&hostname, &suffix);470 else471 hostname.slen = 0;472 hostname.ptr[hostname.slen] = '\0';473 }474 }475 #endif476 459 } 477 460 } -
pjproject/trunk/pjnath/src/pjturn-client/client_main.c
r2589 r3543 186 186 187 187 188 static int shutdown()188 static int client_shutdown() 189 189 { 190 190 unsigned i; … … 626 626 627 627 on_return: 628 shutdown();628 client_shutdown(); 629 629 return status ? 1 : 0; 630 630 }
Note: See TracChangeset
for help on using the changeset viewer.