]>
Commit | Line | Data |
---|---|---|
8a97ab44 A |
1 | /* |
2 | * Copyright (c) 1999 by Internet Software Consortium, Inc. | |
3 | * | |
4 | * Permission to use, copy, modify, and distribute this software for any | |
5 | * purpose with or without fee is hereby granted, provided that the above | |
6 | * copyright notice and this permission notice appear in all copies. | |
7 | * | |
8 | * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS | |
9 | * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES | |
10 | * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE | |
11 | * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL | |
12 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR | |
13 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS | |
14 | * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS | |
15 | * SOFTWARE. | |
16 | */ | |
17 | ||
18 | /* | |
19 | * $Id: res_update.h,v 1.1 2006/03/01 19:01:39 majka Exp $ | |
20 | */ | |
21 | ||
22 | #ifndef _RES_UPDATE_H_ | |
23 | #define _RES_UPDATE_H_ | |
24 | ||
25 | #include <sys/types.h> | |
26 | #include <arpa/nameser.h> | |
27 | #ifndef __APPLE__ | |
28 | #include <isc/list.h> | |
29 | #else | |
30 | #define LIST(type) struct { type *head, *tail; } | |
31 | #define LINK(type) struct { type *prev, *next; } | |
32 | #define INIT_LIST(list) do { (list).head = NULL; (list).tail = NULL; } while (0) | |
33 | #define HEAD(list) ((list).head) | |
34 | #define TAIL(list) ((list).tail) | |
35 | #define EMPTY(list) ((list).head == NULL) | |
36 | #define PREV(elt, link) ((elt)->link.prev) | |
37 | #define NEXT(elt, link) ((elt)->link.next) | |
38 | #define INIT_LINK_TYPE(elt, link, type) \ | |
39 | do { \ | |
40 | (elt)->link.prev = (type *)(-1); \ | |
41 | (elt)->link.next = (type *)(-1); \ | |
42 | } while (0) | |
43 | #define INIT_LINK(elt, link) INIT_LINK_TYPE(elt, link, void) | |
44 | #define APPEND(list, elt, link) \ | |
45 | do { \ | |
46 | if ((list).tail != NULL) \ | |
47 | (list).tail->link.next = (elt); \ | |
48 | else \ | |
49 | (list).head = (elt); \ | |
50 | (elt)->link.prev = (list).tail; \ | |
51 | (elt)->link.next = NULL; \ | |
52 | (list).tail = (elt); \ | |
53 | } while (0) | |
54 | #define PREPEND(list, elt, link) \ | |
55 | do { \ | |
56 | if ((list).head != NULL) \ | |
57 | (list).head->link.prev = (elt); \ | |
58 | else \ | |
59 | (list).tail = (elt); \ | |
60 | (elt)->link.prev = NULL; \ | |
61 | (elt)->link.next = (list).head; \ | |
62 | (list).head = (elt); \ | |
63 | } while (0) | |
64 | #define UNLINK_TYPE(list, elt, link, type) \ | |
65 | do { \ | |
66 | if ((elt)->link.next != NULL) \ | |
67 | (elt)->link.next->link.prev = (elt)->link.prev; \ | |
68 | else \ | |
69 | (list).tail = (elt)->link.prev; \ | |
70 | if ((elt)->link.prev != NULL) \ | |
71 | (elt)->link.prev->link.next = (elt)->link.next; \ | |
72 | else \ | |
73 | (list).head = (elt)->link.next; \ | |
74 | INIT_LINK_TYPE(elt, link, type); \ | |
75 | } while (0) | |
76 | #define UNLINK(list, elt, link) \ | |
77 | UNLINK_TYPE(list, elt, link, void) | |
78 | #define LINKED(elt, link) ((void *)((elt)->link.prev) != (void *)(-1)) | |
79 | #endif | |
80 | #include <resolv.h> | |
81 | ||
82 | /* | |
83 | * This RR-like structure is particular to UPDATE. | |
84 | */ | |
85 | struct ns_updrec { | |
86 | LINK(struct ns_updrec) r_link, r_glink; | |
87 | ns_sect r_section; /* ZONE/PREREQUISITE/UPDATE */ | |
88 | char * r_dname; /* owner of the RR */ | |
89 | ns_class r_class; /* class number */ | |
90 | ns_type r_type; /* type number */ | |
91 | u_int32_t r_ttl; /* time to live */ | |
92 | u_char * r_data; /* rdata fields as text string */ | |
93 | u_int r_size; /* size of r_data field */ | |
94 | int r_opcode; /* type of operation */ | |
95 | /* following fields for private use by the resolver/server routines */ | |
96 | struct databuf *r_dp; /* databuf to process */ | |
97 | struct databuf *r_deldp; /* databuf's deleted/overwritten */ | |
98 | u_int r_zone; /* zone number on server */ | |
99 | }; | |
100 | typedef struct ns_updrec ns_updrec; | |
101 | typedef LIST(ns_updrec) ns_updque; | |
102 | ||
103 | #define res_mkupdate res_9_mkupdate | |
104 | #define res_update res_9_update | |
105 | #define res_mkupdrec res_9_mkupdrec | |
106 | #define res_freeupdrec res_9_freeupdrec | |
107 | #define res_nmkupdate res_9_nmkupdate | |
108 | #define res_nupdate res_9_nupdate | |
109 | ||
110 | int res_mkupdate __P((ns_updrec *, u_char *, int)); | |
111 | int res_update __P((ns_updrec *)); | |
112 | ns_updrec * res_mkupdrec __P((int, const char *, u_int, u_int, u_long)); | |
113 | void res_freeupdrec __P((ns_updrec *)); | |
114 | int res_nmkupdate __P((res_state, ns_updrec *, u_char *, int)); | |
115 | int res_nupdate __P((res_state, ns_updrec *, ns_tsig_key *)); | |
116 | ||
117 | #endif /*_RES_UPDATE_H_*/ |