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.206.1 2004/03/06 08:15:21 marka Exp $ */
22 #define ISCCC_CCMSG_H 1
24 #include <isc/buffer.h>
26 #include <isc/socket.h>
28 typedef struct isccc_ccmsg {
29 /* private (don't touch!) */
37 isc_taskaction_t action;
40 /* public (read-only) */
42 isc_sockaddr_t address;
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
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.
63 * "ccmsg" is a valid structure.
67 isccc_ccmsg_setmaxsize(isccc_ccmsg_t *ccmsg, unsigned int maxsize);
69 * Set the maximum packet size to "maxsize"
75 * 512 <= "maxsize" <= 4294967296
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.
89 * "task", "taskaction", and "arg" be valid.
93 * ISC_R_SUCCESS -- no error
94 * Anything that the isc_socket_recv() call can return. XXXMLG
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.
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.
116 isccc_ccmsg_invalidate(isccc_ccmsg_t *ccmsg);
118 * Clean up all allocated state, and invalidate the structure.
126 * "ccmsg" is invalidated and disassociated with all memory contexts,
132 #endif /* ISCCC_CCMSG_H */