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

Packet related methods. More...

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

Go to the source code of this file.

Typedefs

typedef struct actf_pkt actf_pkt
 A packet.

Enumerations

enum  actf_pkt_prop { ACTF_PKT_PROP_HEADER , ACTF_PKT_PROP_CTX , ACTF_PKT_N_PROPS }
 Packet properties.

Functions

const actf_fldactf_pkt_fld (const actf_pkt *pkt, const char *key)
 Search the top-level struct of all packet properties for a field with name key.
const actf_fldactf_pkt_fldn (const actf_pkt *pkt, const char *key, size_t len)
 Same as actf_pkt_fld() but with an explicit key length.
const actf_fldactf_pkt_prop_fld (const actf_pkt *pkt, const char *key, enum actf_pkt_prop prop)
 Search the top-level struct of a packet property for a field with name key.
const actf_fldactf_pkt_prop_fldn (const actf_pkt *pkt, const char *key, size_t len, enum actf_pkt_prop prop)
 Same as actf_pkt_prop_fld() but with an explicit key length.
const struct actf_fldactf_pkt_prop (const struct actf_pkt *pkt, enum actf_pkt_prop prop)
 Get the top-level struct of a packet property.
uint64_t actf_pkt_seq_num (const actf_pkt *pkt)
 Get the sequence number of a packet.
bool actf_pkt_has_seq_num (const actf_pkt *pkt)
 Check if the packet has a sequence number.
uint64_t actf_pkt_begin_tstamp (const actf_pkt *pkt)
 Get the timestamp of the beginning of a packet in cycles.
int64_t actf_pkt_begin_tstamp_ns_from_origin (const actf_pkt *pkt)
 Get the timestamp of the beginning of a packet in nanoseconds from origin.
uint64_t actf_pkt_end_tstamp (const actf_pkt *pkt)
 Get the timestamp of the end of a packet in cycles.
bool actf_pkt_has_end_tstamp (const actf_pkt *pkt)
 Check if the packet has an end timestamp.
int64_t actf_pkt_end_tstamp_ns_from_origin (const actf_pkt *pkt)
 Get the timestamp of the end of a packet in nanoseconds from origin.
uint64_t actf_pkt_disc_event_record_snapshot (const actf_pkt *pkt)
 Get the discarded event record snapshot of a packet.
bool actf_pkt_has_disc_event_record_snapshot (const actf_pkt *pkt)
 Check if the packet has a discarded event record snapshot.
uint64_t actf_pkt_dstream_id (const actf_pkt *pkt)
 Get the data stream id of the packet.
uint64_t actf_pkt_dstream_cls_id (const actf_pkt *pkt)
 Get the data stream class id of the packet.
const actf_dstream_clsactf_pkt_dstream_cls (const actf_pkt *pkt)
 Get the data stream class of the packet.
bool actf_pkt_has_dstream_id (const actf_pkt *pkt)
 Check if the packet has an explicit datastream id.

Detailed Description

Packet related methods.

Function Documentation

◆ actf_pkt_fld()

const actf_fld * actf_pkt_fld ( const actf_pkt * pkt,
const char * key )

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

The packet properties will be searched in the following order:

  1. packet header
  2. packet context
Parameters
pktthe packet
keythe key to search for
Returns
the first found field or NULL

◆ actf_pkt_prop_fld()

const actf_fld * actf_pkt_prop_fld ( const actf_pkt * pkt,
const char * key,
enum actf_pkt_prop prop )

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

Parameters
pktthe packet
keythe key to search for
propthe packet property to search through
Returns
the field or NULL

◆ actf_pkt_prop()

const struct actf_fld * actf_pkt_prop ( const struct actf_pkt * pkt,
enum actf_pkt_prop prop )

Get the top-level struct of a packet property.

Parameters
pktthe packet
propthe packet property
Returns
the top-level field of the packet property

◆ actf_pkt_seq_num()

uint64_t actf_pkt_seq_num ( const actf_pkt * pkt)

Get the sequence number of a packet.

The sequence number is only relevant if actf_pkt_has_seq_num() returns true.

Parameters
pktthe packet
Returns
the packet's sequence number

◆ actf_pkt_has_seq_num()

bool actf_pkt_has_seq_num ( const actf_pkt * pkt)

Check if the packet has a sequence number.

Parameters
pktthe packet
Returns
whether the packet has a sequence number

◆ actf_pkt_begin_tstamp()

uint64_t actf_pkt_begin_tstamp ( const actf_pkt * pkt)

Get the timestamp of the beginning of a packet 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_pkt_begin_tstamp_ns_from_origin() instead.

Parameters
pktthe packet
Returns
the raw timestamp of the beginning of the packet.

◆ actf_pkt_begin_tstamp_ns_from_origin()

int64_t actf_pkt_begin_tstamp_ns_from_origin ( const actf_pkt * pkt)

Get the timestamp of the beginning of a packet in nanoseconds from origin.

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

Parameters
pktthe packet
Returns
the nanosecond timestamp of the packet

◆ actf_pkt_end_tstamp()

uint64_t actf_pkt_end_tstamp ( const actf_pkt * pkt)

Get the timestamp of the end of a packet in cycles.

The returned timestamp is the raw timestamp in cycles without clock class offsets applied to it. The timestamp is only relevant if actf_pkt_has_end_tstamp() returns true. In most cases, you probably want to use actf_pkt_end_tstamp_ns_from_origin() instead.

Parameters
pktthe packet
Returns
the raw timestamp of the end of the packet or zero if the packet has no end timestamp.

◆ actf_pkt_has_end_tstamp()

bool actf_pkt_has_end_tstamp ( const actf_pkt * pkt)

Check if the packet has an end timestamp.

Parameters
pktthe packet
Returns
whether the packet has an end timestamp

◆ actf_pkt_end_tstamp_ns_from_origin()

int64_t actf_pkt_end_tstamp_ns_from_origin ( const actf_pkt * pkt)

Get the timestamp of the end of a packet in nanoseconds from origin.

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

Parameters
pktthe packet
Returns
the nanosecond timestamp of the packet or zero if the packet has no end timestamp.

◆ actf_pkt_disc_event_record_snapshot()

uint64_t actf_pkt_disc_event_record_snapshot ( const actf_pkt * pkt)

Get the discarded event record snapshot of a packet.

The discarded event record snapshot is only relevant if actf_pkt_has_disc_event_record_snapshot() returns true.

Parameters
pktthe packet
Returns
the packet's discarded event record snapshot

◆ actf_pkt_has_disc_event_record_snapshot()

bool actf_pkt_has_disc_event_record_snapshot ( const actf_pkt * pkt)

Check if the packet has a discarded event record snapshot.

Parameters
pktthe packet
Returns
whether the packet has a discarded event record snapshot.

◆ actf_pkt_dstream_id()

uint64_t actf_pkt_dstream_id ( const actf_pkt * pkt)

Get the data stream id of the packet.

Parameters
pktthe packet
Returns
the data stream id of the packet

◆ actf_pkt_dstream_cls_id()

uint64_t actf_pkt_dstream_cls_id ( const actf_pkt * pkt)

Get the data stream class id of the packet.

Parameters
pktthe packet
Returns
the packet's data stream class id

◆ actf_pkt_dstream_cls()

const actf_dstream_cls * actf_pkt_dstream_cls ( const actf_pkt * pkt)

Get the data stream class of the packet.

Parameters
pktthe packet
Returns
the packet's data stream class

◆ actf_pkt_has_dstream_id()

bool actf_pkt_has_dstream_id ( const actf_pkt * pkt)

Check if the packet has an explicit datastream id.

Parameters
pktthe packet
Returns
whether the packet has an explicit datastream id