Electroneum
comm_point Struct Reference

#include <netevent.h>

Collaboration diagram for comm_point:

Public Types

enum  {
  comm_ssl_shake_none = 0, comm_ssl_shake_read, comm_ssl_shake_write, comm_ssl_shake_hs_read,
  comm_ssl_shake_hs_write
}
 
enum  comm_point_type {
  comm_udp, comm_tcp_accept, comm_tcp, comm_http,
  comm_local, comm_raw
}
 

Public Attributes

struct internal_event * ev
 
int fd
 
struct timeval * timeout
 
struct sldns_bufferbuffer
 
int tcp_is_reading
 
size_t tcp_byte_count
 
struct comm_pointtcp_parent
 
struct comm_reply repinfo
 
int max_tcp_count
 
int cur_tcp_count
 
struct comm_point ** tcp_handlers
 
struct comm_pointtcp_free
 
void * ssl
 
enum comm_point:: { ... }  ssl_shake_state
 
int http_in_headers
 
int http_in_chunk_headers
 
int http_is_chunked
 
struct sldns_bufferhttp_temp
 
size_t http_stored
 
struct dt_env * dtenv
 
enum comm_point::comm_point_type type
 
int do_not_close
 
int tcp_do_close
 
int tcp_do_toggle_rw
 
int tcp_timeout_msec
 
int tcp_check_nb_connect
 
int inuse
 
comm_point_callback_typecallback
 
void * cb_arg
 

Detailed Description

Communication point to the network These behaviours can be accomplished by setting the flags and passing return values from the callback. udp frontside: called after readdone. sendafter. tcp frontside: called readdone, sendafter. close. udp behind: called after readdone. No send after. tcp behind: write done, read done, then called. No send after.

Definition at line 154 of file netevent.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

handshake state for init and renegotiate

Enumerator
comm_ssl_shake_none 

no handshake, it has been done

comm_ssl_shake_read 

ssl initial handshake wants to read

comm_ssl_shake_write 

ssl initial handshake wants to write

comm_ssl_shake_hs_read 

ssl_write wants to read

comm_ssl_shake_hs_write 

ssl_read wants to write

Definition at line 193 of file netevent.h.

◆ comm_point_type

is this a UDP, TCP-accept or TCP socket.

Enumerator
comm_udp 

UDP socket - handle datagrams.

comm_tcp_accept 

TCP accept socket - only creates handlers if readable.

comm_tcp 

TCP handler socket - handle byteperbyte readwrite.

comm_http 

HTTP handler socket

comm_local 

AF_UNIX socket - for internal commands.

comm_raw 

raw - not DNS format - for pipe readers and writers

Definition at line 224 of file netevent.h.

Member Data Documentation

◆ buffer

struct sldns_buffer* comm_point::buffer

buffer pointer. Either to perthread, or own buffer or NULL

Definition at line 165 of file netevent.h.

◆ callback

comm_point_callback_type* comm_point::callback

callback when done. tcp_accept does not get called back, is NULL then. If a timeout happens, callback with timeout=1 is called. If an error happens, callback is called with error set nonzero. If not NETEVENT_NOERROR, it is an errno value. If the connection is closed (by remote end) then the callback is called with error set to NETEVENT_CLOSED=-1. If a timeout happens on the connection, the error is set to NETEVENT_TIMEOUT=-2. The reply_info can be copied if the reply needs to happen at a later time. It consists of a struct with commpoint and address. It can be passed to a msg send routine some time later. Note the reply information is temporary and must be copied. NULL is passed for_reply info, in cases where error happened.

declare as: int my_callback(struct comm_point* c, void* my_arg, int error, struct comm_reply *reply_info);

if the routine returns 0, nothing is done. Notzero, the buffer will be sent back to client. For UDP this is done without changing the commpoint. In TCP it sets write state.

Definition at line 301 of file netevent.h.

◆ cb_arg

void* comm_point::cb_arg

argument to pass to callback.

Definition at line 303 of file netevent.h.

◆ cur_tcp_count

int comm_point::cur_tcp_count

current number of tcp handler in-use for this accept socket

Definition at line 181 of file netevent.h.

◆ do_not_close

int comm_point::do_not_close

if set the connection is NOT closed on delete.

Definition at line 243 of file netevent.h.

◆ dtenv

struct dt_env* comm_point::dtenv

the dnstap environment

Definition at line 221 of file netevent.h.

◆ ev

struct internal_event* comm_point::ev

behind the scenes structure, with say libevent info. alloced.

Definition at line 156 of file netevent.h.

◆ fd

int comm_point::fd

file descriptor for communication point

Definition at line 159 of file netevent.h.

◆ http_in_chunk_headers

int comm_point::http_in_chunk_headers

Currently reading in chunk headers, 0=not, 1=firstline, 2=unused (more lines), 3=trailer headers after chunk

Definition at line 211 of file netevent.h.

◆ http_in_headers

int comm_point::http_in_headers

Currently reading in http headers

Definition at line 208 of file netevent.h.

◆ http_is_chunked

int comm_point::http_is_chunked

chunked transfer

Definition at line 213 of file netevent.h.

◆ http_stored

size_t comm_point::http_stored

http stored content in buffer

Definition at line 217 of file netevent.h.

◆ http_temp

struct sldns_buffer* comm_point::http_temp

http temp buffer (shared buffer for temporary work)

Definition at line 215 of file netevent.h.

◆ inuse

int comm_point::inuse

number of queries outstanding on this socket, used by outside network for udp ports

Definition at line 275 of file netevent.h.

◆ max_tcp_count

int comm_point::max_tcp_count

the number of TCP handlers for this tcp-accept socket

Definition at line 179 of file netevent.h.

◆ repinfo

struct comm_reply comm_point::repinfo

sockaddr from peer, for TCP handlers

Definition at line 175 of file netevent.h.

◆ ssl

void* comm_point::ssl

the SSL object with rw bio (owned) or for commaccept ctx ref

Definition at line 191 of file netevent.h.

◆ ssl_shake_state

enum { ... } comm_point::ssl_shake_state

handshake state for init and renegotiate

◆ tcp_byte_count

size_t comm_point::tcp_byte_count

The current read/write count for TCP

Definition at line 171 of file netevent.h.

◆ tcp_check_nb_connect

int comm_point::tcp_check_nb_connect

if set, checks for pending error from nonblocking connect() call.

Definition at line 260 of file netevent.h.

◆ tcp_do_close

int comm_point::tcp_do_close

if set, the connection is closed on error, on timeout, and after read/write completes. No callback is done.

Definition at line 247 of file netevent.h.

◆ tcp_do_toggle_rw

int comm_point::tcp_do_toggle_rw

if set, read/write completes: read/write state of tcp is toggled. buffer reset/bytecount reset. this flag cleared. So that when that is done the callback is called.

Definition at line 254 of file netevent.h.

◆ tcp_free

struct comm_point* comm_point::tcp_free

linked list of free tcp_handlers to use for new queries. For tcp_accept the first entry, for tcp_handlers the next one.

Definition at line 187 of file netevent.h.

◆ tcp_handlers

struct comm_point** comm_point::tcp_handlers

malloced array of tcp handlers for a tcp-accept, of size max_tcp_count.

Definition at line 184 of file netevent.h.

◆ tcp_is_reading

int comm_point::tcp_is_reading

Read/Write state for TCP

Definition at line 169 of file netevent.h.

◆ tcp_parent

struct comm_point* comm_point::tcp_parent

parent communication point (for TCP sockets)

Definition at line 173 of file netevent.h.

◆ tcp_timeout_msec

int comm_point::tcp_timeout_msec

timeout in msec for TCP wait times for this connection

Definition at line 257 of file netevent.h.

◆ timeout

struct timeval* comm_point::timeout

timeout (NULL if it does not). Malloced.

Definition at line 162 of file netevent.h.

◆ type

enum comm_point::comm_point_type comm_point::type

variable with type of socket, UDP,TCP-accept,TCP,pipe


The documentation for this struct was generated from the following file: