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

Event related methods. More...

#include <stdint.h>
#include "fld.h"
#include "metadata.h"
#include "pkt.h"

Go to the source code of this file.

Typedefs

typedef struct actf_event actf_event
 An event.

Enumerations

enum  actf_event_prop {
  ACTF_EVENT_PROP_HEADER , ACTF_EVENT_PROP_COMMON_CTX , ACTF_EVENT_PROP_SPECIFIC_CTX , ACTF_EVENT_PROP_PAYLOAD ,
  ACTF_EVENT_N_PROPS
}
 Event properties.

Functions

const actf_fldactf_event_fld (const actf_event *ev, const char *key)
 Search the top-level struct of all event properties for a field with name key.
const actf_fldactf_event_fldn (const actf_event *ev, const char *key, size_t len)
 Same as actf_event_fld() but with an explicit key length.
const actf_fldactf_event_prop_fld (const actf_event *ev, const char *key, enum actf_event_prop prop)
 Search the top-level struct of an event property for a field with name key.
const actf_fldactf_event_prop_fldn (const actf_event *ev, const char *key, size_t len, enum actf_event_prop prop)
 Same as actf_event_prop_fld() but with an explicit key length.
const struct actf_fldactf_event_prop (const struct actf_event *ev, enum actf_event_prop prop)
 Get the top-level struct of an event property.
uint64_t actf_event_tstamp (const actf_event *ev)
 Get the timestamp of an event in cycles.
int64_t actf_event_tstamp_ns_from_origin (const actf_event *ev)
 Get the timestamp of an event in nanoseconds from origin.
const actf_event_clsactf_event_event_cls (const actf_event *ev)
 Get the class of an event.
actf_pktactf_event_pkt (const actf_event *ev)
 Get the packet of an event.
void actf_event_copy (actf_event *dest, const actf_event *src)
 Perform a shallow copy of an event.

Detailed Description

Event related methods.

Function Documentation

◆ actf_event_fld()

const actf_fld * actf_event_fld ( const actf_event * ev,
const char * key )

Search the top-level struct of all event properties for a field with name key.

The event properties will be searched in the following order:

  1. event header
  2. event common context
  3. event specific context
  4. event payload
Parameters
evthe event
keythe key to search for
Returns
the first found field or NULL

◆ actf_event_prop_fld()

const actf_fld * actf_event_prop_fld ( const actf_event * ev,
const char * key,
enum actf_event_prop prop )

Search the top-level struct of an event property for a field with name key.

Parameters
evthe event
keythe key to search for
propthe event property to search through
Returns
the field or NULL

◆ actf_event_prop()

const struct actf_fld * actf_event_prop ( const struct actf_event * ev,
enum actf_event_prop prop )

Get the top-level struct of an event property.

Parameters
evthe event
propthe event property
Returns
the top-level field of the event property

◆ actf_event_tstamp()

uint64_t actf_event_tstamp ( const actf_event * ev)

Get the timestamp of an event in cycles.

The returned timestamp is the raw timestamp in cycles without clock class offsets applied to it. In most cases, you probably want to use actf_event_tstamp_ns_from_origin() instead.

Parameters
evthe event
Returns
the raw timestamp of the event or zero if the event has no timestamp.

◆ actf_event_tstamp_ns_from_origin()

int64_t actf_event_tstamp_ns_from_origin ( const actf_event * ev)

Get the timestamp of an event in nanoseconds from origin.

The returned timestamp includes any clock offset of the related clock class.

Parameters
evthe event
Returns
the nanosecond timestamp of the event or zero if the event has no timestamp.

◆ actf_event_event_cls()

const actf_event_cls * actf_event_event_cls ( const actf_event * ev)

Get the class of an event.

Parameters
evthe event
Returns
the event's class

◆ actf_event_pkt()

actf_pkt * actf_event_pkt ( const actf_event * ev)

Get the packet of an event.

Parameters
evthe event
Returns
the event's packet

◆ actf_event_copy()

void actf_event_copy ( actf_event * dest,
const actf_event * src )

Perform a shallow copy of an event.

Parameters
destthe event to be copied to
srcthe event to be copied