Commit 8d1d0c84 authored by Håvard Moås's avatar Håvard Moås
Browse files

Update IPFIXLIB to attempt to get correct representation of uint64's, havard.mork@gmail.com

git-svn-id: file:///home/svn/mapi/branches/haavardm-mapi@42 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent ea39eb95
......@@ -636,6 +636,27 @@ void nprintf(FILE *stream, char *fmt, HashBucket *theFlow, int direction) {
putc('\n', stream);
}
unsigned long long ntohll(unsigned long long n) {
#if __BYTE_ORDER == __BIG_ENDIAN
return n;
#else
return (((unsigned long long)ntohl(n)) << 32) + ntohl(n >> 32);
#endif
}
/**
* This method does not really belong here, but where else to put
* it...
*/
unsigned long long htonll(unsigned long long n) {
#if __BYTE_ORDER == __BIG_ENDIAN
return n;
#else
return (((unsigned long long)htonl(n)) << 32) + htonl(n >> 32);
#endif
}
/* ********* NetFlow v9/IPFIX ***************************** */
......@@ -788,7 +809,7 @@ static void copyInt32(u_int32_t _t32, char *outBuffer, u_int *outBufferBegin, u_
}
static void copyInt64(u_int64_t _t64, char *outBuffer, u_int *outBufferBegin, u_int *outBufferMax) {
u_int64_t t64 = htonl(_t64);
u_int64_t t64 = htonll(_t64);
if((*outBufferBegin)+sizeof(t64) < (*outBufferMax)) {
memcpy(&outBuffer[(*outBufferBegin)], &t64, sizeof(t64));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment