Kea  2.1.7-git
isc::util::io Namespace Reference

Namespaces

 internal
 

Classes

class  BaseSocketSessionForwarder
 The "base" class of SocketSessionForwarder. More...
 
class  SocketSession
 Socket session object. More...
 
class  SocketSessionError
 An exception indicating general errors that takes place in the socket session related class objects. More...
 
class  SocketSessionForwarder
 The forwarder of socket sessions. More...
 
class  SocketSessionReceiver
 The receiver of socket sessions. More...
 

Functions

ssize_t read_data (const int fd, void *buffer_v, const size_t length)
 
int recv_fd (const int sock)
 Receives a file descriptor. More...
 
int send_fd (const int sock, const int fd)
 Sends a file descriptor. More...
 
bool write_data (const int fd, const void *buffer_v, const size_t length)
 

Variables

const size_t DEFAULT_HEADER_BUFLEN
 
const int FD_OTHER_ERROR = -1
 
const int FD_SYSTEM_ERROR = -2
 
const size_t INITIAL_BUFSIZE = 512
 
const int MAX_DATASIZE = 65535
 
const int SOCKSESSION_BUFSIZE = (DEFAULT_HEADER_BUFLEN + MAX_DATASIZE) * 2
 

Function Documentation

◆ read_data()

ssize_t isc::util::io::read_data ( const int  fd,
void *  buffer_v,
const size_t  length 
)

Definition at line 50 of file fd.cc.

Referenced by isc::util::unittests::check_output().

◆ recv_fd()

int isc::util::io::recv_fd ( const int  sock)

Receives a file descriptor.

This receives a file descriptor sent over an unix domain socket. This is the counterpart of send_fd().

Returns
FD_SYSTEM_ERROR when there's an error at the operating system level (such as a system call failure). The global 'errno' variable indicates the specific error. FD_OTHER_ERROR when there's a different error.
Parameters
sockThe unix domain socket to read from. Tested and it does not work with a pipe.

Definition at line 71 of file fd_share.cc.

References FD_OTHER_ERROR, and FD_SYSTEM_ERROR.

Referenced by isc::util::io::SocketSessionReceiver::pop().

◆ send_fd()

int isc::util::io::send_fd ( const int  sock,
const int  fd 
)

Sends a file descriptor.

This sends a file descriptor over an unix domain socket. This is the counterpart of recv_fd().

Returns
FD_SYSTEM_ERROR when there's an error at the operating system level (such as a system call failure). The global 'errno' variable indicates the specific error.
Parameters
sockThe unix domain socket to send to. Tested and it does not work with a pipe.
fdThe file descriptor to send. It should work with any valid file descriptor.

Definition at line 134 of file fd_share.cc.

References FD_OTHER_ERROR, and FD_SYSTEM_ERROR.

Referenced by isc::util::io::SocketSessionForwarder::push().

◆ write_data()

bool isc::util::io::write_data ( const int  fd,
const void *  buffer_v,
const size_t  length 
)

Definition at line 19 of file fd.cc.

Referenced by isc::util::unittests::provide_input().

Variable Documentation

◆ DEFAULT_HEADER_BUFLEN

const size_t isc::util::io::DEFAULT_HEADER_BUFLEN
Initial value:
= sizeof(uint16_t) + sizeof(uint32_t) * 6 +
sizeof(struct sockaddr_storage) * 2

Definition at line 52 of file socketsession.cc.

◆ FD_OTHER_ERROR

const int isc::util::io::FD_OTHER_ERROR = -1

Definition at line 21 of file fd_share.h.

Referenced by recv_fd(), and send_fd().

◆ FD_SYSTEM_ERROR

const int isc::util::io::FD_SYSTEM_ERROR = -2

Definition at line 20 of file fd_share.h.

Referenced by isc::util::io::SocketSessionReceiver::pop(), recv_fd(), and send_fd().

◆ INITIAL_BUFSIZE

const size_t isc::util::io::INITIAL_BUFSIZE = 512

Definition at line 71 of file socketsession.cc.

◆ MAX_DATASIZE

const int isc::util::io::MAX_DATASIZE = 65535

Definition at line 59 of file socketsession.cc.

◆ SOCKSESSION_BUFSIZE

const int isc::util::io::SOCKSESSION_BUFSIZE = (DEFAULT_HEADER_BUFLEN + MAX_DATASIZE) * 2