Skip to content
Snippets Groups Projects
Commit 7ec331f7 authored by Joshua Colp's avatar Joshua Colp
Browse files

Return trunk to a state where it compiles under Darwin. The byte order stuff...

Return trunk to a state where it compiles under Darwin. The byte order stuff is ugly, if anyone wants to clean it up... by all means do so.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@55763 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent e57e5aca
No related branches found
No related tags found
No related merge requests found
...@@ -48,9 +48,21 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") ...@@ -48,9 +48,21 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#define MAX_SIZE 4096 #define MAX_SIZE 4096
#ifdef __PDP_ENDIAN
#if __BYTE_ORDER == __PDP_ENDIAN
#define DETERMINED_BYTE_ORDER __LITTLE_ENDIAN
#endif
#endif
#if __BYTE_ORDER == __BIG_ENDIAN
#define DETERMINED_BYTE_ORDER __BIG_ENDIAN
#endif
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define DETERMINED_BYTE_ORDER __LITTLE_ENDIAN
#endif
typedef struct { typedef struct {
unsigned id:16; /*!< query identification number */ unsigned id:16; /*!< query identification number */
#if __BYTE_ORDER == __BIG_ENDIAN #if DETERMINED_BYTE_ORDER == __BIG_ENDIAN
/* fields in third byte */ /* fields in third byte */
unsigned qr:1; /*!< response flag */ unsigned qr:1; /*!< response flag */
unsigned opcode:4; /*!< purpose of message */ unsigned opcode:4; /*!< purpose of message */
...@@ -64,7 +76,7 @@ typedef struct { ...@@ -64,7 +76,7 @@ typedef struct {
unsigned cd:1; /*!< checking disabled by resolver */ unsigned cd:1; /*!< checking disabled by resolver */
unsigned rcode:4; /*!< response code */ unsigned rcode:4; /*!< response code */
#endif #endif
#if __BYTE_ORDER == __LITTLE_ENDIAN || __BYTE_ORDER == __PDP_ENDIAN #if DETERMINED_BYTE_ORDER == __LITTLE_ENDIAN
/* fields in third byte */ /* fields in third byte */
unsigned rd:1; /*!< recursion desired */ unsigned rd:1; /*!< recursion desired */
unsigned tc:1; /*!< truncated message */ unsigned tc:1; /*!< truncated message */
...@@ -178,7 +190,7 @@ static int dns_parse_answer(void *context, ...@@ -178,7 +190,7 @@ static int dns_parse_answer(void *context,
return 0; return 0;
} }
#if !HAVE_RES_NINIT #ifndef HAVE_RES_NINIT
AST_MUTEX_DEFINE_STATIC(res_lock); AST_MUTEX_DEFINE_STATIC(res_lock);
#endif #endif
...@@ -190,13 +202,13 @@ int ast_search_dns(void *context, ...@@ -190,13 +202,13 @@ int ast_search_dns(void *context,
const char *dname, int class, int type, const char *dname, int class, int type,
int (*callback)(void *context, unsigned char *answer, int len, unsigned char *fullanswer)) int (*callback)(void *context, unsigned char *answer, int len, unsigned char *fullanswer))
{ {
#if HAVE_RES_NINIT #ifdef HAVE_RES_NINIT
struct __res_state dnsstate; struct __res_state dnsstate;
#endif #endif
unsigned char answer[MAX_SIZE]; unsigned char answer[MAX_SIZE];
int res, ret = -1; int res, ret = -1;
#if HAVE_RES_NINIT #ifdef HAVE_RES_NINIT
res_ninit(&dnsstate); res_ninit(&dnsstate);
res = res_nsearch(&dnsstate, dname, class, type, answer, sizeof(answer)); res = res_nsearch(&dnsstate, dname, class, type, answer, sizeof(answer));
#else #else
...@@ -217,7 +229,7 @@ int ast_search_dns(void *context, ...@@ -217,7 +229,7 @@ int ast_search_dns(void *context,
else else
ret = 1; ret = 1;
} }
#if HAVE_RES_NINIT #ifdef HAVE_RES_NINIT
res_nclose(&dnsstate); res_nclose(&dnsstate);
#else #else
#ifndef __APPLE__ #ifndef __APPLE__
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment