<p>Hi Daniel,<br>
I must have not had enough coffee... testing the Solaris macros above only work on big endian machines. I've included the relevant parts of sys/byteorder.h below. Would it be acceptable to change these functions to <code>_ntohll</code> and <code>_htonll</code> to avoid the namespace conflict? The challenge with checking __OS_solaris is that this was a relatively recent addition, I think only available in Solaris 11 and the Ilumos derivatives.</p>
<pre><code>#include <sys/isa_defs.h>
#include <sys/int_types.h>
#if defined(__GNUC__) && defined(_ASM_INLINES) && \
(defined(__i386) || defined(__amd64))
#include <asm/byteorder.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* macros for conversion between host and (internet) network byte order
*/
#if defined(_BIG_ENDIAN) && !defined(ntohl) && !defined(__lint)
/* big-endian */
#define ntohl(x) (x)
#define ntohs(x) (x)
#define htonl(x) (x)
#define htons(x) (x)
#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
#define ntohll(x) (x)
#define htonll(x) (x)
#endif /* !_XPG4_2 || __EXTENSIONS__ */
#elif !defined(ntohl) /* little-endian */
#ifndef _IN_PORT_T
#define _IN_PORT_T
typedef uint16_t in_port_t;
#endif
#ifndef _IN_ADDR_T
#define _IN_ADDR_T
typedef uint32_t in_addr_t;
#endif
#if !defined(_XPG4_2) || defined(__EXTENSIONS__) || defined(_XPG5)
extern uint32_t htonl(uint32_t);
extern uint16_t htons(uint16_t);
extern uint32_t ntohl(uint32_t);
extern uint16_t ntohs(uint16_t);
#else
extern in_addr_t htonl(in_addr_t);
extern in_port_t htons(in_port_t);
extern in_addr_t ntohl(in_addr_t);
extern in_port_t ntohs(in_port_t);
#endif /* !_XPG4_2 || __EXTENSIONS__ || _XPG5 */
#if defined(_LP64) || defined(_LONGLONG_TYPE)
#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
extern uint64_t htonll(uint64_t);
extern uint64_t ntohll(uint64_t);
#endif /* !_XPG4_2 || __EXTENSIONS__ */
#endif /* _LP64 || _LONGLONG_TYPE */
#endif
</code></pre>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/665#issuecomment-228072219">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe/AF36ZeGQn9Ko7A3Q3UV8NLMslXtmMTSfks5qOptxgaJpZM4IyLDj">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AF36ZW92XJMLLEvUu3MOADnAY1f957Y1ks5qOptxgaJpZM4IyLDj.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
<link itemprop="url" href="https://github.com/kamailio/kamailio/issues/665#issuecomment-228072219"></link>
<meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>