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:
drbob 2008-02-03 12:07:59 +00:00
parent cea158b77d
commit 31136da7cc
10 changed files with 374 additions and 40 deletions

View file

@ -123,8 +123,7 @@ bool getRawUInt64(void *data, uint32_t size, uint32_t *offset, uint64_t *out)
uint64_t netorder_num;
memcpy(&netorder_num, buf, sizeof(uint64_t));
//(*out) = ntohll(netorder_num);
(*out) = netorder_num;
(*out) = ntohll(netorder_num);
(*offset) += 8;
return true;
}
@ -140,8 +139,7 @@ bool setRawUInt64(void *data, uint32_t size, uint32_t *offset, uint64_t in)
void *buf = (void *) &(((uint8_t *) data)[*offset]);
/* convert the data to the right format */
//uint64_t netorder_num = htonll(in);
uint64_t netorder_num = in;
uint64_t netorder_num = htonll(in);
/* pack it in */
memcpy(buf, &netorder_num, sizeof(uint64_t));