tcpmsg.h File Reference

#include <isc/buffer.h>
#include <isc/lang.h>
#include <isc/socket.h>

Go to the source code of this file.

Data Structures

struct  dns_tcpmsg

Defines

#define DNS_TCPMSG_H   1

Typedefs

typedef struct dns_tcpmsg dns_tcpmsg_t

Functions

ISC_LANG_BEGINDECLS void 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 TCP socket.
void dns_tcpmsg_setmaxsize (dns_tcpmsg_t *tcpmsg, unsigned int maxsize)
 Set the maximum packet size to "maxsize".
isc_result_t 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.
void dns_tcpmsg_cancelread (dns_tcpmsg_t *tcpmsg)
 Cancel a readmessage() call. The event will still be posted with a CANCELED result code.
void 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".
void dns_tcpmsg_invalidate (dns_tcpmsg_t *tcpmsg)
 Clean up all allocated state, and invalidate the structure.


Detailed Description

Definition in file tcpmsg.h.


Define Documentation

#define DNS_TCPMSG_H   1

Definition at line 21 of file tcpmsg.h.


Typedef Documentation

typedef struct dns_tcpmsg dns_tcpmsg_t


Function Documentation

ISC_LANG_BEGINDECLS void 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 TCP socket.

Requires:

Ensures:

Definition at line 133 of file tcpmsg.c.

References isc_buffer::base, dns_tcpmsg::buffer, ISC_R_UNEXPECTED, isc_buffer::length, dns_tcpmsg::magic, dns_tcpmsg::maxsize, dns_tcpmsg::mctx, REQUIRE, dns_tcpmsg::result, dns_tcpmsg::size, dns_tcpmsg::sock, dns_tcpmsg::task, and TCPMSG_MAGIC.

Referenced by client_newconn(), dns_dispatch_createtcp2(), get_worker(), and xfrin_connect_done().

void dns_tcpmsg_setmaxsize ( dns_tcpmsg_t tcpmsg,
unsigned int  maxsize 
)

Set the maximum packet size to "maxsize".

Requires:

Definition at line 154 of file tcpmsg.c.

References dns_tcpmsg::maxsize, REQUIRE, and VALID_TCPMSG.

isc_result_t 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.

Requires:

Returns:

Notes:

Definition at line 163 of file tcpmsg.c.

References dns_tcpmsg::action, dns_tcpmsg::arg, isc_region::base, isc_buffer::base, dns_tcpmsg::buffer, DNS_EVENT_TCPMSG, dns_tcpmsg::event, ISC_EVENT_INIT, isc_mem_put, ISC_R_SUCCESS, ISC_R_UNEXPECTED, isc_socket_recv(), isc_region::length, isc_buffer::length, dns_tcpmsg::mctx, recv_length(), REQUIRE, dns_tcpmsg::result, dns_tcpmsg::size, dns_tcpmsg::sock, dns_tcpmsg::task, and VALID_TCPMSG.

Referenced by client_read(), startrecv(), xfrin_recv_done(), and xfrin_send_done().

void dns_tcpmsg_cancelread ( dns_tcpmsg_t tcpmsg  ) 

Cancel a readmessage() call. The event will still be posted with a CANCELED result code.

Requires:

Definition at line 201 of file tcpmsg.c.

References ISC_SOCKCANCEL_RECV, isc_socket_cancel(), REQUIRE, dns_tcpmsg::sock, and VALID_TCPMSG.

Referenced by exit_check(), and xfrin_cancelio().

void 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".

Requires:

Definition at line 208 of file tcpmsg.c.

References isc_buffer::base, dns_tcpmsg::buffer, isc_buffer::length, REQUIRE, and VALID_TCPMSG.

Referenced by tcp_recv().

void dns_tcpmsg_invalidate ( dns_tcpmsg_t tcpmsg  ) 

Clean up all allocated state, and invalidate the structure.

Requires:

Ensures:

Definition at line 232 of file tcpmsg.c.

References isc_buffer::base, dns_tcpmsg::buffer, isc_mem_put, isc_buffer::length, dns_tcpmsg::magic, dns_tcpmsg::mctx, REQUIRE, and VALID_TCPMSG.

Referenced by dispatch_free(), exit_check(), maybe_free(), and xfrin_reset().


Generated on Tue Apr 28 17:41:10 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha