2 * Portions Copyright (C) 2004, 2005 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.4.18.2 2005/04/29 00:17:13 marka Exp $ */
22 #define ISCCC_CCMSG_H 1
26 #include <isc/buffer.h>
28 #include <isc/socket.h>
30 /*% ISCCC Message Structure */
31 typedef struct isccc_ccmsg {
32 /* private (don't touch!) */
40 isc_taskaction_t action;
43 /* public (read-only) */
45 isc_sockaddr_t address;
51 isccc_ccmsg_init(isc_mem_t *mctx, isc_socket_t *sock, isccc_ccmsg_t *ccmsg);
53 * Associate a cc message state with a given memory context and
58 *\li "mctx" and "sock" be non-NULL and valid types.
60 *\li "sock" be a read/write TCP socket.
62 *\li "ccmsg" be non-NULL and an uninitialized or invalidated structure.
66 *\li "ccmsg" is a valid structure.
70 isccc_ccmsg_setmaxsize(isccc_ccmsg_t *ccmsg, unsigned int maxsize);
72 * Set the maximum packet size to "maxsize"
76 *\li "ccmsg" be valid.
78 *\li 512 <= "maxsize" <= 4294967296
82 isccc_ccmsg_readmessage(isccc_ccmsg_t *ccmsg,
83 isc_task_t *task, isc_taskaction_t action, void *arg);
85 * Schedule an event to be delivered when a command channel message is
86 * readable, or when an error occurs on the socket.
90 *\li "ccmsg" be valid.
92 *\li "task", "taskaction", and "arg" be valid.
96 *\li #ISC_R_SUCCESS -- no error
97 *\li Anything that the isc_socket_recv() call can return. XXXMLG
101 *\li The event delivered is a fully generic event. It will contain no
102 * actual data. The sender will be a pointer to the isccc_ccmsg_t.
103 * The result code inside that structure should be checked to see
104 * what the final result was.
108 isccc_ccmsg_cancelread(isccc_ccmsg_t *ccmsg);
110 * Cancel a readmessage() call. The event will still be posted with a
111 * CANCELED result code.
115 *\li "ccmsg" be valid.
119 isccc_ccmsg_invalidate(isccc_ccmsg_t *ccmsg);
121 * Clean up all allocated state, and invalidate the structure.
125 *\li "ccmsg" be valid.
129 *\li "ccmsg" is invalidated and disassociated with all memory contexts,
135 #endif /* ISCCC_CCMSG_H */