Ignore:
Timestamp:
Dec 1, 2007 8:52:57 AM (16 years ago)
Author:
bennylp
Message:

More ticket #415: more IPv6 and some reorganization of the source codes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/include/pj/compat/socket.h

    r1585 r1601  
    186186#endif 
    187187 
     188/* Regarding sin_len member of sockaddr_in: 
     189 *  BSD systems (including MacOS X requires that the sin_len member of  
     190 *  sockaddr_in be set to sizeof(sockaddr_in), while other systems (Windows 
     191 *  and Linux included) do not. 
     192 * 
     193 *  To maintain compatibility between systems, PJLIB will automatically 
     194 *  set this field before invoking native OS socket API, and it will 
     195 *  always reset the field to zero before returning pj_sockaddr_in to 
     196 *  application (such as in pj_getsockname() and pj_recvfrom()). 
     197 * 
     198 *  Application MUST always set this field to zero. 
     199 * 
     200 *  This way we can avoid hard to find problem such as when the socket  
     201 *  address is used as hash table key. 
     202 */ 
     203#if defined(PJ_SOCKADDR_HAS_LEN) && PJ_SOCKADDR_HAS_LEN!=0 
     204#   define PJ_SOCKADDR_SET_LEN(addr,len) (((pj_addr_hdr*)(addr))->sa_zero_len=(len)) 
     205#   define PJ_SOCKADDR_RESET_LEN(addr)   (((pj_addr_hdr*)(addr))->sa_zero_len=0) 
     206#else 
     207#   define PJ_SOCKADDR_SET_LEN(addr,len)  
     208#   define PJ_SOCKADDR_RESET_LEN(addr) 
     209#endif 
    188210 
    189211#endif  /* __PJ_COMPAT_SOCKET_H__ */ 
Note: See TracChangeset for help on using the changeset viewer.