Deleted Added
full compact
ns_parse.c (156952) ns_parse.c (170242)
1/*
2 * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (c) 1996,1999 by Internet Software Consortium.
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
15 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#ifndef lint
1/*
2 * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (c) 1996,1999 by Internet Software Consortium.
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
15 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#ifndef lint
19static const char rcsid[] = "$Id: ns_parse.c,v 1.3.2.1.4.3 2005/10/11 00:48:16 marka Exp $";
19static const char rcsid[] = "$Id: ns_parse.c,v 1.5.18.3 2005/10/11 00:25:10 marka Exp $";
20#endif
21
22/* Import. */
23
24#include "port_before.h"
25
26#include <sys/types.h>
27

--- 18 unchanged lines hidden (view full) ---

46#define RETERR(err) \
47 do { errno = (err); if (errno == errno) return (-1); } while (0)
48#endif
49
50/* Public. */
51
52/* These need to be in the same order as the nres.h:ns_flag enum. */
53struct _ns_flagdata _ns_flagdata[16] = {
20#endif
21
22/* Import. */
23
24#include "port_before.h"
25
26#include <sys/types.h>
27

--- 18 unchanged lines hidden (view full) ---

46#define RETERR(err) \
47 do { errno = (err); if (errno == errno) return (-1); } while (0)
48#endif
49
50/* Public. */
51
52/* These need to be in the same order as the nres.h:ns_flag enum. */
53struct _ns_flagdata _ns_flagdata[16] = {
54 { 0x8000, 15 }, /* qr. */
55 { 0x7800, 11 }, /* opcode. */
56 { 0x0400, 10 }, /* aa. */
57 { 0x0200, 9 }, /* tc. */
58 { 0x0100, 8 }, /* rd. */
59 { 0x0080, 7 }, /* ra. */
60 { 0x0040, 6 }, /* z. */
61 { 0x0020, 5 }, /* ad. */
62 { 0x0010, 4 }, /* cd. */
63 { 0x000f, 0 }, /* rcode. */
64 { 0x0000, 0 }, /* expansion (1/6). */
65 { 0x0000, 0 }, /* expansion (2/6). */
66 { 0x0000, 0 }, /* expansion (3/6). */
67 { 0x0000, 0 }, /* expansion (4/6). */
68 { 0x0000, 0 }, /* expansion (5/6). */
69 { 0x0000, 0 }, /* expansion (6/6). */
54 { 0x8000, 15 }, /*%< qr. */
55 { 0x7800, 11 }, /*%< opcode. */
56 { 0x0400, 10 }, /*%< aa. */
57 { 0x0200, 9 }, /*%< tc. */
58 { 0x0100, 8 }, /*%< rd. */
59 { 0x0080, 7 }, /*%< ra. */
60 { 0x0040, 6 }, /*%< z. */
61 { 0x0020, 5 }, /*%< ad. */
62 { 0x0010, 4 }, /*%< cd. */
63 { 0x000f, 0 }, /*%< rcode. */
64 { 0x0000, 0 }, /*%< expansion (1/6). */
65 { 0x0000, 0 }, /*%< expansion (2/6). */
66 { 0x0000, 0 }, /*%< expansion (3/6). */
67 { 0x0000, 0 }, /*%< expansion (4/6). */
68 { 0x0000, 0 }, /*%< expansion (5/6). */
69 { 0x0000, 0 }, /*%< expansion (6/6). */
70};
71
72int ns_msg_getflag(ns_msg handle, int flag) {
73 return(((handle)._flags & _ns_flagdata[flag].mask) >> _ns_flagdata[flag].shift);
74}
75
76int
77ns_skiprr(const u_char *ptr, const u_char *eom, ns_sect section, int count) {

--- 124 unchanged lines hidden (view full) ---

202 if (sect == ns_s_max) {
203 msg->_rrnum = -1;
204 msg->_msg_ptr = NULL;
205 } else {
206 msg->_rrnum = 0;
207 msg->_msg_ptr = msg->_sections[(int)sect];
208 }
209}
70};
71
72int ns_msg_getflag(ns_msg handle, int flag) {
73 return(((handle)._flags & _ns_flagdata[flag].mask) >> _ns_flagdata[flag].shift);
74}
75
76int
77ns_skiprr(const u_char *ptr, const u_char *eom, ns_sect section, int count) {

--- 124 unchanged lines hidden (view full) ---

202 if (sect == ns_s_max) {
203 msg->_rrnum = -1;
204 msg->_msg_ptr = NULL;
205 } else {
206 msg->_rrnum = 0;
207 msg->_msg_ptr = msg->_sections[(int)sect];
208 }
209}
210
211/*! \file */