ccmsg.c File Reference

#include <config.h>
#include <isc/mem.h>
#include <isc/result.h>
#include <isc/task.h>
#include <isc/util.h>
#include <isccc/events.h>
#include <isccc/ccmsg.h>

Go to the source code of this file.

Defines

#define CCMSG_MAGIC   ISC_MAGIC('C', 'C', 'm', 's')
#define VALID_CCMSG(foo)   ISC_MAGIC_VALID(foo, CCMSG_MAGIC)

Functions

static void recv_length (isc_task_t *, isc_event_t *)
static void recv_message (isc_task_t *, isc_event_t *)
void isccc_ccmsg_init (isc_mem_t *mctx, isc_socket_t *sock, isccc_ccmsg_t *ccmsg)
void isccc_ccmsg_setmaxsize (isccc_ccmsg_t *ccmsg, unsigned int maxsize)
 Associate a cc message state with a given memory context and TCP socket.
isc_result_t isccc_ccmsg_readmessage (isccc_ccmsg_t *ccmsg, isc_task_t *task, isc_taskaction_t action, void *arg)
 Set the maximum packet size to "maxsize".
void isccc_ccmsg_cancelread (isccc_ccmsg_t *ccmsg)
 Schedule an event to be delivered when a command channel message is readable, or when an error occurs on the socket.
void isccc_ccmsg_invalidate (isccc_ccmsg_t *ccmsg)
 Cancel a readmessage() call. The event will still be posted with a CANCELED result code.


Detailed Description

Definition in file ccmsg.c.


Define Documentation

#define CCMSG_MAGIC   ISC_MAGIC('C', 'C', 'm', 's')

Definition at line 46 of file ccmsg.c.

Referenced by isccc_ccmsg_init().

#define VALID_CCMSG ( foo   )     ISC_MAGIC_VALID(foo, CCMSG_MAGIC)

Definition at line 47 of file ccmsg.c.

Referenced by isccc_ccmsg_cancelread(), isccc_ccmsg_invalidate(), isccc_ccmsg_readmessage(), isccc_ccmsg_setmaxsize(), recv_length(), and recv_message().


Function Documentation

static void recv_length ( isc_task_t task,
isc_event_t ev_in 
) [static]

Definition at line 54 of file ccmsg.c.

References isc_region::base, isccc_ccmsg::buffer, ccmsg, isccc_ccmsg::event, INSIST, isc_buffer_init, isc_event_free(), isc_mem_get, ISC_R_NOMEMORY, ISC_R_RANGE, ISC_R_SUCCESS, ISC_R_UNEXPECTEDEND, isc_socket_recv(), isc_task_send(), isc_region::length, isccc_ccmsg::maxsize, isccc_ccmsg::mctx, recv_message(), isccc_ccmsg::result, isc_socketevent::result, isccc_ccmsg::size, isccc_ccmsg::sock, isccc_ccmsg::task, and VALID_CCMSG.

static void recv_message ( isc_task_t task,
isc_event_t ev_in 
) [static]

Definition at line 109 of file ccmsg.c.

References isc_socketevent::address, isccc_ccmsg::address, isccc_ccmsg::buffer, ccmsg, isccc_ccmsg::event, INSIST, isc_buffer_add, isc_event_free(), ISC_R_SUCCESS, isc_task_send(), isc_socketevent::n, isccc_ccmsg::result, isc_socketevent::result, isccc_ccmsg::task, and VALID_CCMSG.

void isccc_ccmsg_init ( isc_mem_t mctx,
isc_socket_t sock,
isccc_ccmsg_t ccmsg 
)

Definition at line 136 of file ccmsg.c.

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

Referenced by newconnection(), and rndc_connected().

void isccc_ccmsg_setmaxsize ( isccc_ccmsg_t ccmsg,
unsigned int  maxsize 
)

Associate a cc message state with a given memory context and TCP socket.

Requires:

Ensures:

Definition at line 157 of file ccmsg.c.

References isccc_ccmsg::maxsize, REQUIRE, and VALID_CCMSG.

Referenced by rndc_connected().

isc_result_t isccc_ccmsg_readmessage ( isccc_ccmsg_t ccmsg,
isc_task_t task,
isc_taskaction_t  action,
void *  arg 
)

Set the maximum packet size to "maxsize".

Requires:

Definition at line 165 of file ccmsg.c.

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

Referenced by control_senddone(), newconnection(), rndc_connected(), and rndc_recvnonce().

void isccc_ccmsg_cancelread ( isccc_ccmsg_t ccmsg  ) 

Schedule an event to be delivered when a command channel message is readable, or when an error occurs on the socket.

Requires:

Returns:

Notes:

Definition at line 203 of file ccmsg.c.

References ISC_SOCKCANCEL_RECV, isc_socket_cancel(), REQUIRE, isccc_ccmsg::sock, and VALID_CCMSG.

Referenced by maybe_free_connection(), and rndc_recvnonce().

void isccc_ccmsg_invalidate ( isccc_ccmsg_t ccmsg  ) 

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

Requires:

Definition at line 224 of file ccmsg.c.

References isc_buffer::base, isccc_ccmsg::buffer, isc_mem_put, isc_buffer::length, isccc_ccmsg::magic, isccc_ccmsg::mctx, REQUIRE, and VALID_CCMSG.

Referenced by control_recvmessage(), main(), and newconnection().


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