Ignore:
Timestamp:
Dec 2, 2007 3:36:46 PM (16 years ago)
Author:
bennylp
Message:

More ticket #415: Added pj_sockaddr_get_len() and pj_inet_ntop2(), and fixed Symbian combilation warnings with gcce

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/src/pj/sock_common.c

    r1601 r1608  
    4848 
    4949/* 
     50 * Get text representation. 
     51 */ 
     52PJ_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/* 
    5062 * Set the IP address of an IP socket address from string address,  
    5163 * with resolving the host if necessary. The string address may be in a 
     
    254266 
    255267/* 
     268 * Get socket address length. 
     269 */ 
     270PJ_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/* 
    256280 * Set port number of pj_sockaddr_in 
    257281 */ 
     
    270294    int af = addr->addr.sa_family; 
    271295 
    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); 
    274297 
    275298    if (af == PJ_AF_INET6) 
Note: See TracChangeset for help on using the changeset viewer.