- Timestamp:
- Dec 2, 2007 3:36:46 PM (17 years ago)
- Location:
- pjproject/trunk/pjlib
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/include/pj/compat/socket.h
r1601 r1608 69 69 70 70 # undef s_addr 71 # define PJ_SOCK_HAS_GETADDRINFO 1 71 72 #endif /* _MSC_VER */ 72 73 -
pjproject/trunk/pjlib/include/pj/sock.h
r1601 r1608 609 609 * for IPv4, PJ_INET6_ADDRSTRLEN characters for IPv6). 610 610 * 611 * @return PJ_SUCCESS if conversion was successful. .611 * @return PJ_SUCCESS if conversion was successful. 612 612 */ 613 613 PJ_DECL(pj_status_t) pj_inet_ntop(int af, const void *src, 614 614 char *dst, int size); 615 616 /** 617 * Converts numeric address into its text string representation. 618 * 619 * @param af Specify the family of the address. This can be PJ_AF_INET 620 * or PJ_AF_INET6. 621 * @param src Points to a buffer holding an IPv4 address if the af argument 622 * is PJ_AF_INET, or an IPv6 address if the af argument is 623 * PJ_AF_INET6; the address must be in network byte order. 624 * @param dst Points to a buffer where the function stores the resulting 625 * text string; it shall not be NULL. 626 * @param size Specifies the size of this buffer, which shall be large 627 * enough to hold the text string (PJ_INET_ADDRSTRLEN characters 628 * for IPv4, PJ_INET6_ADDRSTRLEN characters for IPv6). 629 * 630 * @return The address string or NULL if failed. 631 */ 632 PJ_DECL(char*) pj_inet_ntop2(int af, const void *src, 633 char *dst, int size); 634 615 635 616 636 /** … … 708 728 * @param addr Socket address. 709 729 * 710 * @return Port number, in host byte order.730 * @return Length in bytes. 711 731 */ 712 732 PJ_DECL(unsigned) pj_sockaddr_get_addr_len(const pj_sockaddr_t *addr); 733 734 /** 735 * Get the socket address length, based on its address 736 * family. For PJ_AF_INET, the length will be sizeof(pj_sockaddr_in), and 737 * for PJ_AF_INET6, the length will be sizeof(pj_sockaddr_in6). 738 * 739 * @param addr Socket address. 740 * 741 * @return Length in bytes. 742 */ 743 PJ_DECL(unsigned) pj_sockaddr_get_len(const pj_sockaddr_t *addr); 713 744 714 745 /** -
pjproject/trunk/pjlib/src/pj/addr_resolv_sock.c
r1601 r1608 62 62 #if defined(PJ_SOCK_HAS_GETADDRINFO) && PJ_SOCK_HAS_GETADDRINFO!=0 63 63 char nodecopy[PJ_MAX_HOSTNAME]; 64 struct addrinfo hint, *res ;64 struct addrinfo hint, *res, *orig_res; 65 65 unsigned i; 66 66 int rc; … … 85 85 return PJ_ERESOLVE; 86 86 87 orig_res = res; 88 87 89 /* Enumerate each item in the result */ 88 90 for (i=0; i<*count && res; res=res->ai_next) { 89 int len;90 91 91 /* Ignore unwanted address families */ 92 92 if (af!=PJ_AF_UNSPEC && res->ai_family != af) … … 94 94 95 95 /* Store canonical name (possibly truncating the name) */ 96 pj_ansi_strncpy(ai[i].ai_canonname, res->ai_canonname, 97 sizeof(ai[i].ai_canonname)); 98 ai[i].ai_canonname[sizeof(ai[i].ai_canonname)-1] = '\0'; 96 if (res->ai_canonname) { 97 pj_ansi_strncpy(ai[i].ai_canonname, res->ai_canonname, 98 sizeof(ai[i].ai_canonname)); 99 ai[i].ai_canonname[sizeof(ai[i].ai_canonname)-1] = '\0'; 100 } else { 101 pj_ansi_strcpy(ai[i].ai_canonname, nodecopy); 102 } 99 103 100 104 /* Store address */ … … 107 111 108 112 *count = i; 113 114 freeaddrinfo(orig_res); 109 115 110 116 /* Done */ -
pjproject/trunk/pjlib/src/pj/addr_resolv_symbian.cpp
r1601 r1608 92 92 93 93 // Ignore if this is not the same address family 94 if (inetAddr.Family() != af) {94 if (inetAddr.Family() != (unsigned)af) { 95 95 resv.Next(nameEntry, reqStatus); 96 96 User::WaitForRequest(reqStatus); -
pjproject/trunk/pjlib/src/pj/ioqueue_symbian.cpp
r1601 r1608 702 702 PJ_ASSERT_RETURN(addr && addrlen && *addrlen, PJ_EINVAL); 703 703 if (sock->GetAf() == PJ_AF_INET) { 704 PJ_ASSERT_RETURN(*addrlen >=sizeof(pj_sockaddr_in), PJ_EINVAL);704 PJ_ASSERT_RETURN(*addrlen>=(int)sizeof(pj_sockaddr_in), PJ_EINVAL); 705 705 } else if (sock->GetAf() == PJ_AF_INET6) { 706 PJ_ASSERT_RETURN(*addrlen >=sizeof(pj_sockaddr_in6), PJ_EINVAL);706 PJ_ASSERT_RETURN(*addrlen>=(int)sizeof(pj_sockaddr_in6), PJ_EINVAL); 707 707 } 708 708 } -
pjproject/trunk/pjlib/src/pj/ip_helper_symbian.cpp
r1601 r1608 60 60 int namelen; 61 61 62 if (iAddress.Family() != af) {62 if (iAddress.Family() != (unsigned)af) { 63 63 continue; 64 64 } … … 77 77 78 78 return PJ_SUCCESS; 79 80 on_error:81 rSock.Close();82 *p_cnt = 0;83 return PJ_RETURN_OS_ERROR(rc);84 79 } 85 80 -
pjproject/trunk/pjlib/src/pj/os_symbian.h
r1601 r1608 245 245 pj_addr.addr.sa_family = (pj_uint16_t)sym_addr.Family(); 246 246 if (pj_addr.addr.sa_family == PJ_AF_INET) { 247 PJ_ASSERT_RETURN(*addr_len >=sizeof(pj_sockaddr_in), PJ_ETOOSMALL);247 PJ_ASSERT_RETURN(*addr_len>=(int)sizeof(pj_sockaddr_in), PJ_ETOOSMALL); 248 248 pj_addr.ipv4.sin_addr.s_addr = pj_htonl(sym_addr.Address()); 249 249 pj_addr.ipv4.sin_port = pj_htons((pj_uint16_t) sym_addr.Port()); 250 250 *addr_len = sizeof(pj_sockaddr_in); 251 251 } else if (pj_addr.addr.sa_family == PJ_AF_INET6) { 252 PJ_ASSERT_RETURN(*addr_len >=sizeof(pj_sockaddr_in6), PJ_ETOOSMALL);252 PJ_ASSERT_RETURN(*addr_len>=(int)sizeof(pj_sockaddr_in6), PJ_ETOOSMALL); 253 253 const TIp6Addr & ip6 = sym_addr.Ip6Address(); 254 254 pj_memcpy(&pj_addr.ipv6.sin6_addr, ip6.u.iAddr8, 16); … … 272 272 { 273 273 if (pj_addr.addr.sa_family == PJ_AF_INET) { 274 PJ_ASSERT_RETURN(addrlen >= sizeof(pj_sockaddr_in), PJ_EINVAL);274 PJ_ASSERT_RETURN(addrlen >= (int)sizeof(pj_sockaddr_in), PJ_EINVAL); 275 275 sym_addr.Init(KAfInet); 276 276 sym_addr.SetAddress((TUint32)pj_ntohl(pj_addr.ipv4.sin_addr.s_addr)); … … 279 279 TIp6Addr ip6; 280 280 281 PJ_ASSERT_RETURN(addrlen >=sizeof(pj_sockaddr_in6), PJ_EINVAL);281 PJ_ASSERT_RETURN(addrlen>=(int)sizeof(pj_sockaddr_in6), PJ_EINVAL); 282 282 pj_memcpy(ip6.u.iAddr8, &pj_addr.ipv6.sin6_addr, 16); 283 283 sym_addr.Init(KAfInet6); -
pjproject/trunk/pjlib/src/pj/sock_common.c
r1601 r1608 48 48 49 49 /* 50 * Get text representation. 51 */ 52 PJ_DEF(char*) pj_inet_ntop2( int af, const void *src, 53 char *dst, int size) 54 { 55 pj_status_t status; 56 57 status = pj_inet_ntop(af, src, dst, size); 58 return (status==PJ_SUCCESS)? dst : NULL; 59 } 60 61 /* 50 62 * Set the IP address of an IP socket address from string address, 51 63 * with resolving the host if necessary. The string address may be in a … … 254 266 255 267 /* 268 * Get socket address length. 269 */ 270 PJ_DEF(unsigned) pj_sockaddr_get_len(const pj_sockaddr_t *addr) 271 { 272 const pj_sockaddr *a = (const pj_sockaddr*) addr; 273 PJ_ASSERT_RETURN(a->addr.sa_family == PJ_AF_INET || 274 a->addr.sa_family == PJ_AF_INET6, PJ_EAFNOTSUP); 275 return a->addr.sa_family == PJ_AF_INET6 ? 276 sizeof(pj_sockaddr_in6) : sizeof(pj_sockaddr_in); 277 } 278 279 /* 256 280 * Set port number of pj_sockaddr_in 257 281 */ … … 270 294 int af = addr->addr.sa_family; 271 295 272 PJ_ASSERT_ON_FAIL(af == PJ_AF_INET || af == PJ_AF_INET6, 273 PJ_EINVAL); 296 PJ_ASSERT_RETURN(af==PJ_AF_INET || af==PJ_AF_INET6, PJ_EINVAL); 274 297 275 298 if (af == PJ_AF_INET6) -
pjproject/trunk/pjlib/src/pj/sock_symbian.cpp
r1601 r1608 525 525 526 526 PJ_ASSERT_RETURN(sock != 0, PJ_EINVAL); 527 PJ_ASSERT_RETURN(addr && len >=sizeof(pj_sockaddr_in), PJ_EINVAL);527 PJ_ASSERT_RETURN(addr && len>=(int)sizeof(pj_sockaddr_in), PJ_EINVAL); 528 528 529 529 // Convert PJLIB's pj_sockaddr into Symbian's TInetAddr … … 676 676 677 677 // Only supports AF_INET for now 678 PJ_ASSERT_RETURN(tolen >=sizeof(pj_sockaddr_in), PJ_EINVAL);678 PJ_ASSERT_RETURN(tolen>=(int)sizeof(pj_sockaddr_in), PJ_EINVAL); 679 679 680 680 TInetAddr inetAddr;
Note: See TracChangeset
for help on using the changeset viewer.