2 * Portions Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC")
3 * Portions Copyright (C) 2001 Internet Software Consortium.
5 * Permission to use, copy, modify, and/or 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.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL
10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
11 * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY
12 * 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 OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 * Portions Copyright (C) 2001 Nominum, Inc.
19 * Permission to use, copy, modify, and/or distribute this software for any
20 * purpose with or without fee is hereby granted, provided that the above
21 * copyright notice and this permission notice appear in all copies.
23 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL
24 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
25 * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY
26 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
27 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
28 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
29 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
32 /* $Id: ccmsg.h,v 1.11 2007/08/28 07:20:43 tbox Exp $ */
35 #define ISCCC_CCMSG_H 1
37 /*! \file isccc/ccmsg.h */
39 #include <isc/buffer.h>
41 #include <isc/socket.h>
43 /*% ISCCC Message Structure */
44 typedef struct isccc_ccmsg {
45 /* private (don't touch!) */
53 isc_taskaction_t action;
56 /* public (read-only) */
58 isc_sockaddr_t address;
64 isccc_ccmsg_init(isc_mem_t *mctx, isc_socket_t *sock, isccc_ccmsg_t *ccmsg);
66 * Associate a cc message state with a given memory context and
71 *\li "mctx" and "sock" be non-NULL and valid types.
73 *\li "sock" be a read/write TCP socket.
75 *\li "ccmsg" be non-NULL and an uninitialized or invalidated structure.
79 *\li "ccmsg" is a valid structure.
83 isccc_ccmsg_setmaxsize(isccc_ccmsg_t *ccmsg, unsigned int maxsize);
85 * Set the maximum packet size to "maxsize"
89 *\li "ccmsg" be valid.
91 *\li 512 <= "maxsize" <= 4294967296
95 isccc_ccmsg_readmessage(isccc_ccmsg_t *ccmsg,
96 isc_task_t *task, isc_taskaction_t action, void *arg);
98 * Schedule an event to be delivered when a command channel message is
99 * readable, or when an error occurs on the socket.
103 *\li "ccmsg" be valid.
105 *\li "task", "taskaction", and "arg" be valid.
109 *\li #ISC_R_SUCCESS -- no error
110 *\li Anything that the isc_socket_recv() call can return. XXXMLG
114 *\li The event delivered is a fully generic event. It will contain no
115 * actual data. The sender will be a pointer to the isccc_ccmsg_t.
116 * The result code inside that structure should be checked to see
117 * what the final result was.
121 isccc_ccmsg_cancelread(isccc_ccmsg_t *ccmsg);
123 * Cancel a readmessage() call. The event will still be posted with a
124 * CANCELED result code.
128 *\li "ccmsg" be valid.
132 isccc_ccmsg_invalidate(isccc_ccmsg_t *ccmsg);
134 * Clean up all allocated state, and invalidate the structure.
138 *\li "ccmsg" be valid.
142 *\li "ccmsg" is invalidated and disassociated with all memory contexts,
148 #endif /* ISCCC_CCMSG_H */