Add BIND 9.2.4rc7.
[dragonfly.git] / contrib / bind-9.2.4rc7 / lib / isccc / include / isccc / ccmsg.h
blobc2487ce728664b703ab2b0293ce144025945686e
1 /*
2 * Portions Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
3 * Portions Copyright (C) 2001 Internet Software Consortium.
4 * Portions Copyright (C) 2001 Nominum, Inc.
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL
11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
12 * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY
13 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 /* $Id: ccmsg.h,v 1.3.2.1 2004/03/09 06:12:27 marka Exp $ */
21 #ifndef ISCCC_CCMSG_H
22 #define ISCCC_CCMSG_H 1
24 #include <isc/buffer.h>
25 #include <isc/lang.h>
26 #include <isc/socket.h>
28 typedef struct isccc_ccmsg {
29 /* private (don't touch!) */
30 unsigned int magic;
31 isc_uint32_t size;
32 isc_buffer_t buffer;
33 unsigned int maxsize;
34 isc_mem_t *mctx;
35 isc_socket_t *sock;
36 isc_task_t *task;
37 isc_taskaction_t action;
38 void *arg;
39 isc_event_t event;
40 /* public (read-only) */
41 isc_result_t result;
42 isc_sockaddr_t address;
43 } isccc_ccmsg_t;
45 ISC_LANG_BEGINDECLS
47 void
48 isccc_ccmsg_init(isc_mem_t *mctx, isc_socket_t *sock, isccc_ccmsg_t *ccmsg);
50 * Associate a cc message state with a given memory context and
51 * TCP socket.
53 * Requires:
55 * "mctx" and "sock" be non-NULL and valid types.
57 * "sock" be a read/write TCP socket.
59 * "ccmsg" be non-NULL and an uninitialized or invalidated structure.
61 * Ensures:
63 * "ccmsg" is a valid structure.
66 void
67 isccc_ccmsg_setmaxsize(isccc_ccmsg_t *ccmsg, unsigned int maxsize);
69 * Set the maximum packet size to "maxsize"
71 * Requires:
73 * "ccmsg" be valid.
75 * 512 <= "maxsize" <= 4294967296
78 isc_result_t
79 isccc_ccmsg_readmessage(isccc_ccmsg_t *ccmsg,
80 isc_task_t *task, isc_taskaction_t action, void *arg);
82 * Schedule an event to be delivered when a command channel message is
83 * readable, or when an error occurs on the socket.
85 * Requires:
87 * "ccmsg" be valid.
89 * "task", "taskaction", and "arg" be valid.
91 * Returns:
93 * ISC_R_SUCCESS -- no error
94 * Anything that the isc_socket_recv() call can return. XXXMLG
96 * Notes:
98 * The event delivered is a fully generic event. It will contain no
99 * actual data. The sender will be a pointer to the isccc_ccmsg_t.
100 * The result code inside that structure should be checked to see
101 * what the final result was.
104 void
105 isccc_ccmsg_cancelread(isccc_ccmsg_t *ccmsg);
107 * Cancel a readmessage() call. The event will still be posted with a
108 * CANCELED result code.
110 * Requires:
112 * "ccmsg" be valid.
115 void
116 isccc_ccmsg_invalidate(isccc_ccmsg_t *ccmsg);
118 * Clean up all allocated state, and invalidate the structure.
120 * Requires:
122 * "ccmsg" be valid.
124 * Ensures:
126 * "ccmsg" is invalidated and disassociated with all memory contexts,
127 * sockets, etc.
130 ISC_LANG_ENDDECLS
132 #endif /* ISCCC_CCMSG_H */