* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
/*! \file dns/tcpmsg.h */
typedef struct dns_tcpmsg {
/* private (don't touch!) */
dns_tcpmsg_init(isc_mem_t *mctx, isc_socket_t *sock, dns_tcpmsg_t *tcpmsg);
* Associate a tcp message state with a given memory context and
*\li "mctx" and "sock" be non-NULL and valid types.
*\li "sock" be a read/write TCP socket.
*\li "tcpmsg" be non-NULL and an uninitialized or invalidated structure.
*\li "tcpmsg" is a valid structure.
dns_tcpmsg_setmaxsize(dns_tcpmsg_t *tcpmsg, unsigned int maxsize);
* Set the maximum packet size to "maxsize"
*\li 512 <= "maxsize" <= 65536
dns_tcpmsg_readmessage(dns_tcpmsg_t *tcpmsg,
isc_task_t *task, isc_taskaction_t action, void *arg);
* Schedule an event to be delivered when a DNS message is readable, or
* when an error occurs on the socket.
*\li "task", "taskaction", and "arg" be valid.
*\li ISC_R_SUCCESS -- no error
*\li Anything that the isc_socket_recv() call can return. XXXMLG
*\li The event delivered is a fully generic event. It will contain no
* actual data. The sender will be a pointer to the dns_tcpmsg_t.
* The result code inside that structure should be checked to see
* what the final result was.
dns_tcpmsg_cancelread(dns_tcpmsg_t *tcpmsg);
* Cancel a readmessage() call. The event will still be posted with a
dns_tcpmsg_keepbuffer(dns_tcpmsg_t *tcpmsg, isc_buffer_t *buffer);
* If a dns buffer is to be kept between calls, this function marks the
* internal state-machine buffer as invalid, and copies all the contents
* of the state into "buffer".
*\li "buffer" be non-NULL.
dns_tcpmsg_invalidate(dns_tcpmsg_t *tcpmsg);
* Clean up all allocated state, and invalidate the structure.
*\li "tcpmsg" is invalidated and disassociated with all memory contexts,
#endif /* DNS_TCPMSG_H */