]>
git.saurik.com Git - apple/libresolv.git/blob - res_update.h
2 * Copyright (c) 1999 by Internet Software Consortium, Inc.
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.
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
19 * $Id: res_update.h,v 1.1 2006/03/01 19:01:39 majka Exp $
22 #ifndef _RES_UPDATE_H_
23 #define _RES_UPDATE_H_
25 #include <sys/types.h>
26 #include <arpa/nameser.h>
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) \
40 (elt)->link.prev = (type *)(-1); \
41 (elt)->link.next = (type *)(-1); \
43 #define INIT_LINK(elt, link) INIT_LINK_TYPE(elt, link, void)
44 #define APPEND(list, elt, link) \
46 if ((list).tail != NULL) \
47 (list).tail->link.next = (elt); \
49 (list).head = (elt); \
50 (elt)->link.prev = (list).tail; \
51 (elt)->link.next = NULL; \
52 (list).tail = (elt); \
54 #define PREPEND(list, elt, link) \
56 if ((list).head != NULL) \
57 (list).head->link.prev = (elt); \
59 (list).tail = (elt); \
60 (elt)->link.prev = NULL; \
61 (elt)->link.next = (list).head; \
62 (list).head = (elt); \
64 #define UNLINK_TYPE(list, elt, link, type) \
66 if ((elt)->link.next != NULL) \
67 (elt)->link.next->link.prev = (elt)->link.prev; \
69 (list).tail = (elt)->link.prev; \
70 if ((elt)->link.prev != NULL) \
71 (elt)->link.prev->link.next = (elt)->link.next; \
73 (list).head = (elt)->link.next; \
74 INIT_LINK_TYPE(elt, link, type); \
76 #define UNLINK(list, elt, link) \
77 UNLINK_TYPE(list, elt, link, void)
78 #define LINKED(elt, link) ((void *)((elt)->link.prev) != (void *)(-1))
82 #pragma GCC visibility push(hidden)
85 * This RR-like structure is particular to UPDATE.
88 LINK(struct ns_updrec
) r_link
, r_glink
;
89 ns_sect r_section
; /* ZONE/PREREQUISITE/UPDATE */
90 char * r_dname
; /* owner of the RR */
91 ns_class r_class
; /* class number */
92 ns_type r_type
; /* type number */
93 u_int32_t r_ttl
; /* time to live */
94 u_char
* r_data
; /* rdata fields as text string */
95 u_int r_size
; /* size of r_data field */
96 int r_opcode
; /* type of operation */
97 /* following fields for private use by the resolver/server routines */
98 struct databuf
*r_dp
; /* databuf to process */
99 struct databuf
*r_deldp
; /* databuf's deleted/overwritten */
100 u_int r_zone
; /* zone number on server */
102 typedef struct ns_updrec ns_updrec
;
103 typedef LIST(ns_updrec
) ns_updque
;
105 #define res_mkupdate res_9_mkupdate
106 #define res_update res_9_update
107 #define res_mkupdrec res_9_mkupdrec
108 #define res_freeupdrec res_9_freeupdrec
109 #define res_nmkupdate res_9_nmkupdate
110 #define res_nupdate res_9_nupdate
112 int res_mkupdate
__P((ns_updrec
*, u_char
*, int));
113 int res_update
__P((ns_updrec
*));
114 ns_updrec
* res_mkupdrec
__P((int, const char *, u_int
, u_int
, u_long
));
115 void res_freeupdrec
__P((ns_updrec
*));
116 int res_nmkupdate
__P((res_state
, ns_updrec
*, u_char
*, int));
117 int res_nupdate
__P((res_state
, ns_updrec
*, ns_tsig_key
*));
119 #pragma GCC visibility pop
121 #endif /*_RES_UPDATE_H_*/