diff options
author | Benny Prijono <bennylp@teluu.com> | 2007-05-03 13:31:21 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2007-05-03 13:31:21 +0000 |
commit | 8f426164cc8b5ca4ea96766bf78fd2d1f28cd656 (patch) | |
tree | 8588997230cc891c042cd63ba187bb10585e20da /pjlib/src/pj/sock_symbian.cpp | |
parent | 3d5dfee8ad79256ed558c7c46ebde8849321c3ae (diff) |
Implemented ticket #246, #247, #261, #268, #250 for Symbian
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1246 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib/src/pj/sock_symbian.cpp')
-rw-r--r-- | pjlib/src/pj/sock_symbian.cpp | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/pjlib/src/pj/sock_symbian.cpp b/pjlib/src/pj/sock_symbian.cpp index 5615dde7..8d2ab077 100644 --- a/pjlib/src/pj/sock_symbian.cpp +++ b/pjlib/src/pj/sock_symbian.cpp @@ -210,8 +210,11 @@ void CPjSocketReader::ReadData(TDes8 &aDesc, TInetAddr *addr) */ PJ_DEF(pj_uint16_t) pj_ntohs(pj_uint16_t netshort) { - /* There's no difference in host/network byte order in Symbian */ +#if PJ_IS_LITTLE_ENDIAN + return pj_swap16(netshort); +#else return netshort; +#endif } /* @@ -219,8 +222,11 @@ PJ_DEF(pj_uint16_t) pj_ntohs(pj_uint16_t netshort) */ PJ_DEF(pj_uint16_t) pj_htons(pj_uint16_t hostshort) { - /* There's no difference in host/network byte order in Symbian */ +#if PJ_IS_LITTLE_ENDIAN + return pj_swap16(hostshort); +#else return hostshort; +#endif } /* @@ -228,8 +234,11 @@ PJ_DEF(pj_uint16_t) pj_htons(pj_uint16_t hostshort) */ PJ_DEF(pj_uint32_t) pj_ntohl(pj_uint32_t netlong) { - /* There's no difference in host/network byte order in Symbian */ +#if PJ_IS_LITTLE_ENDIAN + return pj_swap32(netlong); +#else return netlong; +#endif } /* @@ -237,8 +246,11 @@ PJ_DEF(pj_uint32_t) pj_ntohl(pj_uint32_t netlong) */ PJ_DEF(pj_uint32_t) pj_htonl(pj_uint32_t hostlong) { - /* There's no difference in host/network byte order in Symbian */ - return hostlong; +#if PJ_IS_LITTLE_ENDIAN + return pj_swap32(hostlong); +#else + return netlong; +#endif } /* @@ -250,7 +262,8 @@ PJ_DEF(char*) pj_inet_ntoa(pj_in_addr inaddr) static TBuf<20> str16; static char str8[20]; - TInetAddr temp_addr((TUint32)inaddr.s_addr, (TUint)0); + /* (Symbian IP address is in host byte order) */ + TInetAddr temp_addr((TUint32)pj_ntohl(inaddr.s_addr), (TUint)0); temp_addr.Output(str16); return pj_unicode_to_ansi(str16.PtrZ(), str16.Length(), @@ -294,8 +307,8 @@ PJ_DEF(int) pj_inet_aton(const pj_str_t *cp, struct pj_in_addr *inp) TInetAddr addr; addr.Init(KAfInet); if (addr.Input(ip_addr) == KErrNone) { - /* Success */ - inp->s_addr = addr.Address(); + /* Success (Symbian IP address is in host byte order) */ + inp->s_addr = pj_htonl(addr.Address()); return 1; } else { /* Error */ @@ -497,7 +510,7 @@ PJ_DEF(pj_status_t) pj_sock_bind_in( pj_sock_t sock, PJ_CHECK_STACK(); - pj_memset(&addr, 0, sizeof(addr)); + pj_bzero(&addr, sizeof(addr)); addr.sin_family = PJ_AF_INET; addr.sin_addr.s_addr = pj_htonl(addr32); addr.sin_port = pj_htons(port); |