]>
git.saurik.com Git - apple/mdnsresponder.git/blob - mDNSMacOSX/BonjourTop/source/bjtypes.h
5 // Created by Terrin Eager on 4/24/12.
10 #ifndef TestTB_bjtypes_h
11 #define TestTB_bjtypes_h
15 typedef unsigned char BJ_UINT8
;
17 typedef short int BJ_INT16
;
18 typedef unsigned short int BJ_UINT16
;
21 typedef unsigned int BJ_UINT32
;
23 typedef long long BJ_INT64
;
24 typedef unsigned long long BJ_UINT64
;
26 #define DNS_NAME_OFFSET_MASK 0xc0
28 #define MAX_FRAME_SIZE 0x2800
31 enum BJ_COMPARE
{BJ_GT
,BJ_LT
,BJ_EQUAL
};
33 #define PF_GET_UINT8(pBuffer,offset) ( (BJ_UINT8)pBuffer[offset] )
34 #define PF_GET_UINT16(pBuffer,offset) ((((BJ_UINT16)pBuffer[offset]) << 8) | ((BJ_UINT16)pBuffer[offset+1]))
35 #define PF_GET_UINT32(pBuffer,offset) ((pBuffer[offset] << 24) | (pBuffer[offset+1] << 16) | (pBuffer[offset+2] << 8) | (pBuffer[offset+3]))
38 inline void endian_swap(BJ_UINT8
& x
)
43 inline void endian_swap(BJ_UINT32
& x
)
46 ((x
<<8) & 0x00FF0000) |
47 ((x
>>8) & 0x0000FF00) |
52 inline void endian_swap(BJ_UINT64
& x
)
55 ((x
<<40) & 0x00FF000000000000) |
56 ((x
<<24) & 0x0000FF0000000000) |
57 ((x
<<8) & 0x000000FF00000000) |
58 ((x
>>8) & 0x00000000FF000000) |
59 ((x
>>24) & 0x0000000000FF0000) |
60 ((x
>>40) & 0x000000000000FF00) |