-
Notifications
You must be signed in to change notification settings - Fork 0
/
rpl_nameser.h
137 lines (111 loc) · 2.63 KB
/
rpl_nameser.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/* rpl_nameser.h -- replacement nameserver declarations
*
* Copyright Dean Scarff
*
* Licensed under the Apache License, Version 2.0 (the "License"); you
* may not use this file except in compliance with the License.
*/
#ifndef RPL_NAMESER_H
#define RPL_NAMESER_H
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdint.h>
#if !HAVE_DECL_NS_MAXDNAME
#define NS_MAXDNAME 255 /* RFC3696 p. 4 */
#endif
#if !HAVE_DECL_NS_MAXCDNAME
#define NS_MAXCDNAME 255 /* RFC1035 */
#endif
#if !HAVE_DECL_NS_MAXLABEL
#define NS_MAXLABEL 63 /* RFC1035 */
#endif
#if !HAVE_DECL_NS_HFIXEDSZ
#define NS_HFIXEDSZ 12 /* RFC1035 4.1.1 */
#endif
#if !HAVE_DECL_NS_PACKETSZ
#define NS_PACKETSZ 512 /* RFC1035 2.3.4 */
#endif
#if !HAVE_DECL_NS_DEFAULTPORT
#define NS_DEFAULTPORT 53 /* RFC1035 4.2.1 */
#endif
#if !HAVE_DECL_NS_CMPRSFLGS
#define NS_CMPRSFLGS 0xc0 /* RFC1035 4.1.4 */
#endif
#if !HAVE_DECL_NS_SIG_EXPIR
#define NS_SIG_EXPIR 8 /* RFC2535 4.1.5 */
#endif
#if !HAVE_DECL_NS_SIG_SIGNED
#define NS_SIG_SIGNED 12 /* RFC2535 4.1.5 */
#endif
#if !HAVE_DECL_NS_SIG_FOOT
#define NS_SIG_FOOT 16 /* RFC2535 4.1.6 */
#endif
#if !HAVE_DECL_NS_SIG_SIGNER
#define NS_SIG_SIGNER 18 /* RFC2535 4.1.7 */
#endif
#if !HAVE_DECL_NS_ALG_MD5RSA
#define NS_ALG_MD5RSA 1 /* RFC2535 3.2 */
#endif
#if !HAVE_DECL_NS_MD5RSA_MAX_BASE64
#define NS_MD5RSA_MAX_BASE64 684 /* RFC2537 2 */
#endif
#if !HAVE_DECLS_NS_O_QUERY
#define ns_o_query 0 /* RFC1035 4.1.1 */
#endif
#if !HAVE_DECL_NS_C_IN
#define ns_c_in 1 /* RFC1035 3.2.4 */
#endif
#if !HAVE_DECL_NS_T_SOA
#define ns_t_soa 6 /* RFC1035 3.2.2 */
#endif
#if !HAVE_DECL_NS_T_SOA
#define ns_t_sig 24 /* RFC2535 4 */
#endif
#ifndef HAVE_NS_GET16
#undef ns_get16
static inline uint16_t
ns_get16(const unsigned char *src)
{
uint16_t x = (uint16_t)(*src) << 8;
x |= (uint16_t)(src[1]);
return x;
}
#endif /* !defined(HAVE_NS_GET16) */
#ifndef HAVE_NS_GET32
#undef ns_get32
static inline uint32_t
ns_get32(const unsigned char *src)
{
uint32_t x;
x = (uint32_t)src[0] << 24;
x |= (uint32_t)src[1] << 16;
x |= (uint32_t)src[2] << 8;
x |= (uint32_t)src[3];
return x;
}
#endif /* !defined(HAVE_NS_GET32) */
#ifndef HAVE_NS_PUT16
#undef ns_put16
static inline void
ns_put16(uint16_t src, unsigned char *dst)
{
dst[1] = (unsigned char)src;
dst[0] = (unsigned char)(src >> 8);
}
#endif /* !defined(HAVE_NS_PUT16) */
#ifndef HAVE_NS_PUT32
#undef ns_put32
static inline void
ns_put32(uint32_t src, unsigned char *dst)
{
dst[3] = (unsigned char)src;
src >>= 8;
dst[2] = (unsigned char)src;
src >>= 8;
dst[1] = (unsigned char)src;
src >>= 8;
dst[0] = (unsigned char)src;
}
#endif /* !defined(HAVE_NS_PUT32) */
#endif /* !defined(RPL_NAMESER_H) */