actf 0.0.1
An acute CTF reader
Loading...
Searching...
No Matches
/home/adwe/code/actf/print.h File Reference

Event and field printer utility. More...

#include <stdio.h>
#include "event.h"
#include "types.h"

Go to the source code of this file.

Macros

#define ACTF_PRINT_ALL
 Print all packet and event properties.

Typedefs

typedef struct actf_printer actf_printer
 A printer.

Enumerations

enum  actf_printer_flags {
  ACTF_PRINT_PKT_HEADER = (1 << 0) , ACTF_PRINT_PKT_CTX = (1 << 1) , ACTF_PRINT_EVENT_HEADER = (1 << 2) , ACTF_PRINT_EVENT_COMMON_CTX = (1 << 3) ,
  ACTF_PRINT_EVENT_SPECIFIC_CTX = (1 << 4) , ACTF_PRINT_EVENT_PAYLOAD = (1 << 5) , ACTF_PRINT_PROP_LABELS = (1 << 6) , ACTF_PRINT_TSTAMP_DELTA = (1 << 7) ,
  ACTF_PRINT_TSTAMP_CC = (1 << 8) , ACTF_PRINT_TSTAMP_UTC = (1 << 9) , ACTF_PRINT_TSTAMP_DATE = (1 << 10) , ACTF_PRINT_TSTAMP_SEC = (1 << 11)
}
 Printer flags. More...

Functions

actf_printeractf_printer_init (int flags)
 Initialize a printer with provided flags.
void actf_printer_free (actf_printer *p)
 Free a printer.
int actf_print_fld (actf_printer *p, const actf_fld *fld)
 Print a field to stdout.
int actf_fprint_fld (actf_printer *p, FILE *stream, const actf_fld *fld)
 Print a field to a stream.
int actf_print_event (actf_printer *p, const actf_event *ev)
 Print an event to stdout.
int actf_fprint_event (actf_printer *p, FILE *stream, const actf_event *ev)
 Print an event to a stream.

Detailed Description

Event and field printer utility.

Macro Definition Documentation

◆ ACTF_PRINT_ALL

#define ACTF_PRINT_ALL
Value:
@ ACTF_PRINT_PKT_CTX
Print packet context.
Definition print.h:42
@ ACTF_PRINT_EVENT_PAYLOAD
Print event payload.
Definition print.h:50
@ ACTF_PRINT_EVENT_COMMON_CTX
Print event common context.
Definition print.h:46
@ ACTF_PRINT_EVENT_HEADER
Print event header.
Definition print.h:44
@ ACTF_PRINT_PKT_HEADER
Print packet header.
Definition print.h:40
@ ACTF_PRINT_EVENT_SPECIFIC_CTX
Print event specific context.
Definition print.h:48

Print all packet and event properties.

Enumeration Type Documentation

◆ actf_printer_flags

Printer flags.

Enumerator
ACTF_PRINT_PKT_HEADER 

Print packet header.

ACTF_PRINT_PKT_CTX 

Print packet context.

ACTF_PRINT_EVENT_HEADER 

Print event header.

ACTF_PRINT_EVENT_COMMON_CTX 

Print event common context.

ACTF_PRINT_EVENT_SPECIFIC_CTX 

Print event specific context.

ACTF_PRINT_EVENT_PAYLOAD 

Print event payload.

ACTF_PRINT_PROP_LABELS 

Print property labels of packets and events.

ACTF_PRINT_TSTAMP_DELTA 

Print a timestamp delta for events.

ACTF_PRINT_TSTAMP_CC 

Print the timestamp in cycles.

ACTF_PRINT_TSTAMP_UTC 

Print the timestamp in UTC (default is localtime).

ACTF_PRINT_TSTAMP_DATE 

Print the full date with the timestamp.

ACTF_PRINT_TSTAMP_SEC 

Print the timestamp in seconds.nanoseconds.

Function Documentation

◆ actf_printer_init()

actf_printer * actf_printer_init ( int flags)

Initialize a printer with provided flags.

Events and fields are printed in utf-8. Strings in a different encoding will be converted to utf-8 using iconv with transliteration (//TRANSLIT) enabled. If an error occurs during conversion, a '?' will be printed instead.

The returned printer must be freed using actf_printer_free().

Parameters
flagsactf_printer_flags ORed together detailing how/what to print
Returns
a printer or NULL with errno set

◆ actf_printer_free()

void actf_printer_free ( actf_printer * p)

Free a printer.

Parameters
pthe printer

◆ actf_print_fld()

int actf_print_fld ( actf_printer * p,
const actf_fld * fld )

Print a field to stdout.

Parameters
pthe printer
fldthe field
Returns
ACTF_OK on success or an error code.

◆ actf_fprint_fld()

int actf_fprint_fld ( actf_printer * p,
FILE * stream,
const actf_fld * fld )

Print a field to a stream.

Parameters
pthe printer
streamthe stream
fldthe field
Returns
ACTF_OK on success or an error code.

◆ actf_print_event()

int actf_print_event ( actf_printer * p,
const actf_event * ev )

Print an event to stdout.

Parameters
pthe printer
evthe event
Returns
ACTF_OK on success or an error code.

◆ actf_fprint_event()

int actf_fprint_event ( actf_printer * p,
FILE * stream,
const actf_event * ev )

Print an event to a stream.

Parameters
pthe printer
streamthe stream
evthe event
Returns
ACTF_OK on success or an error code.