dnstap_fstrm.h File Reference

Definitions for the Frame Streams data transport protocol for dnstap message logs. More...

Macros

#define FSTRM_CONTENT_TYPE_LENGTH_MAX   256
 max length of Frame Streams content type field string
 
#define FSTRM_CONTROL_FRAME_ACCEPT   0x01
 control frame value to denote the control frame ACCEPT
 
#define FSTRM_CONTROL_FRAME_START   0x02
 control frame value to denote the control frame START
 
#define FSTRM_CONTROL_FRAME_STOP   0x03
 control frame value to denote the control frame STOP
 
#define FSTRM_CONTROL_FRAME_READY   0x04
 control frame value to denote the control frame READY
 
#define FSTRM_CONTROL_FRAME_FINISH   0x05
 control frame value to denote the control frame FINISH
 
#define FSTRM_CONTROL_FIELD_TYPE_CONTENT_TYPE   0x01
 the constant that denotes the control field type that is the string for the content type of the stream.
 
#define DNSTAP_CONTENT_TYPE   "protobuf:dnstap.Dnstap"
 the content type for DNSTAP frame streams
 

Functions

void * fstrm_create_control_frame_start (char *contenttype, size_t *len)
 This creates an FSTRM control frame of type START. More...
 
void * fstrm_create_control_frame_ready (char *contenttype, size_t *len)
 This creates an FSTRM control frame of type READY. More...
 
void * fstrm_create_control_frame_stop (size_t *len)
 This creates an FSTRM control frame of type STOP. More...
 
void * fstrm_create_control_frame_accept (char *contenttype, size_t *len)
 This creates an FSTRM control frame of type ACCEPT. More...
 
void * fstrm_create_control_frame_finish (size_t *len)
 This creates an FSTRM control frame of type FINISH. More...
 
char * fstrm_describe_control (void *pkt, size_t len)
 Return string that describes a control packet. More...
 

Detailed Description

Definitions for the Frame Streams data transport protocol for dnstap message logs.

Function Documentation

◆ fstrm_create_control_frame_start()

void* fstrm_create_control_frame_start ( char *  contenttype,
size_t *  len 
)

This creates an FSTRM control frame of type START.

Parameters
contenttypea zero delimited string with the content type. eg. use the constant DNSTAP_CONTENT_TYPE, which is defined as "protobuf:dnstap.Dnstap", for a dnstap frame stream.
lenif a buffer is returned this is the length of that buffer.
Returns
NULL on malloc failure. Returns a malloced buffer with the protocol message. The buffer starts with the 4 bytes of 0 that indicate a control frame. The buffer should be sent without preceding it with the 'len' variable (like data frames are), but straight the content of the buffer, because the lengths are included in the buffer. This is so that the zero control indicator can be included before the control frame length.

References FSTRM_CONTROL_FIELD_TYPE_CONTENT_TYPE, and FSTRM_CONTROL_FRAME_START.

Referenced by dtio_control_start_send().

◆ fstrm_create_control_frame_ready()

void* fstrm_create_control_frame_ready ( char *  contenttype,
size_t *  len 
)

This creates an FSTRM control frame of type READY.

Parameters
contenttypea zero delimited string with the content type. eg. use the constant DNSTAP_CONTENT_TYPE, which is defined as "protobuf:dnstap.Dnstap", for a dnstap frame stream.
lenif a buffer is returned this is the length of that buffer.
Returns
NULL on malloc failure. Returns a malloced buffer with the protocol message. The buffer starts with the 4 bytes of 0 that indicate a control frame. The buffer should be sent without preceding it with the 'len' variable (like data frames are), but straight the content of the buffer, because the lengths are included in the buffer. This is so that the zero control indicator can be included before the control frame length.

References FSTRM_CONTROL_FIELD_TYPE_CONTENT_TYPE, and FSTRM_CONTROL_FRAME_READY.

Referenced by dtio_control_ready_send().

◆ fstrm_create_control_frame_stop()

void* fstrm_create_control_frame_stop ( size_t *  len)

This creates an FSTRM control frame of type STOP.

Parameters
lenif a buffer is returned this is the length of that buffer.
Returns
NULL on malloc failure. Returns a malloced buffer with the protocol message. The buffer starts with the 4 bytes of 0 that indicate a control frame. The buffer should be sent without preceding it with the 'len' variable (like data frames are), but straight the content of the buffer, because the lengths are included in the buffer. This is so that the zero control indicator can be included before the control frame length.

References FSTRM_CONTROL_FRAME_STOP.

Referenced by dtio_control_stop_flush().

◆ fstrm_create_control_frame_accept()

void* fstrm_create_control_frame_accept ( char *  contenttype,
size_t *  len 
)

This creates an FSTRM control frame of type ACCEPT.

Parameters
contenttypea zero delimited string with the content type. for dnstap streams use DNSTAP_CONTENT_TYPE.
lenif a buffer is returned this is the length of that buffer.
Returns
NULL on malloc failure. Returns a malloced buffer with the protocol message. The buffer starts with the 4 bytes of 0 that indicate a control frame. The buffer should be sent without preceding it with the 'len' variable (like data frames are), but straight the content of the buffer, because the lengths are included in the buffer. This is so that the zero control indicator can be included before the control frame length.

References FSTRM_CONTROL_FIELD_TYPE_CONTENT_TYPE, and FSTRM_CONTROL_FRAME_ACCEPT.

Referenced by reply_with_accept().

◆ fstrm_create_control_frame_finish()

void* fstrm_create_control_frame_finish ( size_t *  len)

This creates an FSTRM control frame of type FINISH.

Parameters
lenif a buffer is returned this is the length of that buffer.
Returns
NULL on malloc failure. Returns a malloced buffer with the protocol message. The buffer starts with the 4 bytes of 0 that indicate a control frame. The buffer should be sent without preceding it with the 'len' variable (like data frames are), but straight the content of the buffer, because the lengths are included in the buffer. This is so that the zero control indicator can be included before the control frame length.

References FSTRM_CONTROL_FRAME_FINISH.

Referenced by reply_with_finish().

◆ fstrm_describe_control()

char* fstrm_describe_control ( void *  pkt,
size_t  len 
)

Return string that describes a control packet.

For debug, logs. Like 'start content-type(protobuf:dnstap.Dnstap)' or 'stop'.

Parameters
pktthe packet data, that is the data after the 4 zero start bytes and 4 length bytes.
lenthe length of the control packet data, in pkt. This is the ntohl of the 4 bytes length preceding the data.
Returns
zero delimited string, malloced. Or NULL on malloc failure.