mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-05 23:55:35 -04:00
Modifications to fix some networking/endian issues on PPC OSX.
* added sockaddr_clear() function to zero network addresses before use. * used this function in p3connmgr. * added htonll() and ntohll() functions to rsnet.h with compile-time ENDIAN checking * use htonll() and ntohll() in serialiser. * added net_test.cc to check network/endian/inet_addr issues. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@328 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
cea158b77d
commit
31136da7cc
10 changed files with 374 additions and 40 deletions
|
@ -97,6 +97,8 @@ extern int errno; /* Define extern errno, to duplicate unix behaviour */
|
|||
#include <string>
|
||||
#include <list>
|
||||
|
||||
void sockaddr_clear(struct sockaddr_in *addr1);
|
||||
|
||||
// Same def - different functions...
|
||||
|
||||
std::ostream &showSocketError(std::ostream &out);
|
||||
|
@ -137,13 +139,7 @@ int unix_getsockopt_error(int sockfd, int *err);
|
|||
int WinToUnixError(int error);
|
||||
#endif
|
||||
|
||||
/***** From http://www.codeproject.com/KB/cpp/endianness.aspx
|
||||
|
||||
#define ntohll(x) (((int64_t)(ntohl((int32_t)((x << 32) >> 32))) << 32) |
|
||||
(uint32_t) ntohl(((int32_t)(x >> 32))))
|
||||
#define htonll(x) ntohll(x)
|
||||
|
||||
*****/
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue