unbound: dnstap/dnstap_fstrm.h File Reference

unbound 0.1

Macros | Functions
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.
void * | fstrm_create_control_frame_ready (char *contenttype, size_t *len)
| This creates an FSTRM control frame of type READY.
void * | fstrm_create_control_frame_stop (size_t *len)
| This creates an FSTRM control frame of type STOP.
void * | fstrm_create_control_frame_accept (char *contenttype, size_t *len)
| This creates an FSTRM control frame of type ACCEPT.
void * | fstrm_create_control_frame_finish (size_t *len)
| This creates an FSTRM control frame of type FINISH.
char * | fstrm_describe_control (void *pkt, size_t len)
| Return string that describes a control packet.

## 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

  contenttype | a 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.
  len | if 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

  contenttype | a 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.
  len | if 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

  len | if 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

  contenttype | a zero delimited string with the content type. for dnstap streams use DNSTAP_CONTENT_TYPE.
  len | if 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

  len | if 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

  pkt | the packet data, that is the data after the 4 zero start bytes and 4 length bytes.
  len | the 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.

References FSTRM_CONTROL_FIELD_TYPE_CONTENT_TYPE, FSTRM_CONTROL_FRAME_ACCEPT, FSTRM_CONTROL_FRAME_FINISH, FSTRM_CONTROL_FRAME_READY, FSTRM_CONTROL_FRAME_START, and FSTRM_CONTROL_FRAME_STOP.