~ubuntu-branches/ubuntu/utopic/dnsmasq/utopic

« back to all changes in this revision

Viewing changes to src/dns-protocol.h

  • Committer: Package Import Robot
  • Author(s): Simon Kelley
  • Date: 2014-04-23 15:14:42 UTC
  • mfrom: (0.5.8) (12.2.17 sid)
  • Revision ID: package-import@ubuntu.com-20140423151442-22uqxwgu9wi56gd7
Tags: 2.70-1
New upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* dnsmasq is Copyright (c) 2000-2013 Simon Kelley
 
1
/* dnsmasq is Copyright (c) 2000-2014 Simon Kelley
2
2
 
3
3
   This program is free software; you can redistribute it and/or modify
4
4
   it under the terms of the GNU General Public License as published by
36
36
 
37
37
#define C_IN            1               /* the arpa internet */
38
38
#define C_CHAOS         3               /* for chaos net (MIT) */
 
39
#define C_HESIOD        4               /* hesiod */
39
40
#define C_ANY           255             /* wildcard match */
40
41
 
41
42
#define T_A             1
42
 
#define T_NS            2               
 
43
#define T_NS            2
 
44
#define T_MD            3
 
45
#define T_MF            4             
43
46
#define T_CNAME         5
44
47
#define T_SOA           6
 
48
#define T_MB            7
 
49
#define T_MG            8
 
50
#define T_MR            9
45
51
#define T_PTR           12
 
52
#define T_MINFO         14
46
53
#define T_MX            15
47
54
#define T_TXT           16
 
55
#define T_RP            17
 
56
#define T_AFSDB         18
 
57
#define T_RT            21
48
58
#define T_SIG           24
 
59
#define T_PX            26
49
60
#define T_AAAA          28
 
61
#define T_NXT           30
50
62
#define T_SRV           33
51
63
#define T_NAPTR         35
 
64
#define T_KX            36
 
65
#define T_DNAME         39
52
66
#define T_OPT           41
 
67
#define T_DS            43
 
68
#define T_RRSIG         46
 
69
#define T_NSEC          47
 
70
#define T_DNSKEY        48
 
71
#define T_NSEC3         50
53
72
#define T_TKEY          249             
54
73
#define T_TSIG          250
55
74
#define T_AXFR          252
59
78
#define EDNS0_OPTION_MAC            65001 /* dyndns.org temporary assignment */
60
79
#define EDNS0_OPTION_CLIENT_SUBNET  8     /* IANA */
61
80
 
62
 
 
63
81
struct dns_header {
64
82
  u16 id;
65
83
  u8  hb3,hb4;
78
96
#define HB4_RCODE    0x0f
79
97
 
80
98
#define OPCODE(x)          (((x)->hb3 & HB3_OPCODE) >> 3)
 
99
#define SET_OPCODE(x, code) (x)->hb3 = ((x)->hb3 & ~HB3_OPCODE) | code
 
100
 
81
101
#define RCODE(x)           ((x)->hb4 & HB4_RCODE)
82
102
#define SET_RCODE(x, code) (x)->hb4 = ((x)->hb4 & ~HB4_RCODE) | code
83
103
  
117
137
        (cp) += 4; \
118
138
}
119
139
 
 
140
#define CHECK_LEN(header, pp, plen, len) \
 
141
    ((size_t)((pp) - (unsigned char *)(header) + (len)) <= (plen))
 
142
 
 
143
#define ADD_RDLEN(header, pp, plen, len) \
 
144
  (!CHECK_LEN(header, pp, plen, len) ? 0 : (((pp) += (len)), 1))