Network sniffers configuration

Overview

Definition of API to configure sniffers. More…

// typedefs

typedef struct tapi_sniffer_id tapi_sniffer_id;
typedef struct tapi_sniff_list_s tapi_sniff_list_s;
typedef struct sniffl_h_t sniffl_h_t;

// structs

struct tapi_sniff_list_s;
struct tapi_sniffer_id;

// global functions

SLIST_HEAD(sniffl_h_t, tapi_sniff_list_s);
te_errno tapi_sniffer_common_snaplen_set(const char* ta, int snaplen);
tapi_sniffer_id* tapi_sniffer_add(const char* ta, const char* iface, const char* name, const char* filter, bool ofill);
te_errno tapi_sniffer_add_mult(const char* ta, const char* iface, const char* name, const char* filter, bool ofill, sniffl_h_t* snif_h);
te_errno tapi_sniffer_del(tapi_sniffer_id* id);
te_errno tapi_sniffer_stop(tapi_sniffer_id* id);
te_errno tapi_sniffer_start(tapi_sniffer_id* id);
te_errno tapi_sniffer_mark(const char* ta, tapi_sniffer_id* id, const char* description);

Detailed Documentation

Definition of API to configure sniffers.

Copyright (C) 2004-2022 OKTET Labs Ltd. All rights reserved.

Typedefs

typedef struct tapi_sniffer_id tapi_sniffer_id

Sniffer identifier

typedef struct tapi_sniff_list_s tapi_sniff_list_s

Sniffers list

Global Functions

te_errno tapi_sniffer_common_snaplen_set(const char* ta, int snaplen)

Set common sniffer snapshot length value for the agent ta.

Parameters:

ta

Agent name

snaplen

Snapshot length value

0

success

Returns:

Status code

tapi_sniffer_id* tapi_sniffer_add(const char* ta, const char* iface, const char* name, const char* filter, bool ofill)

Create and start new sniffer.

Parameters:

ta

Agent name

iface

Interface name

name

Sniffer name NULL Name will be generated automatically

filter

Filter expression NULL If NULL is specified - the filter is not applied

ofill

If false is specified, than overfill handling method is rotation. Otherwise - tail drop

Returns:

Pointer to identifier structure of the sniffer. In case of failure NULL will be returned.

te_errno tapi_sniffer_add_mult(const char* ta, const char* iface, const char* name, const char* filter, bool ofill, sniffl_h_t* snif_h)

Create and start one or more new sniffers on the agent.

Parameters:

ta

Agent name

iface

Interface name NULL Start sniffers on all interfaces expect loopback

name

Sniffer name NULL Name will be generated automatically

filter

Filter expression NULL If NULL is specified - the filter is not applied

ofill

If false is specified, than overfill handling method is rotation. Otherwise - tail drop

snif_h

Pointer to head of sniffer list

0

success

Returns:

Status code

te_errno tapi_sniffer_del(tapi_sniffer_id* id)

Stop and destroy the sniffer.

Parameters:

id

ID of the sniffer

0

success

Returns:

Status code

te_errno tapi_sniffer_stop(tapi_sniffer_id* id)

Disable the sniffer.

Parameters:

id

ID of the sniffer

0

success

Returns:

Status code

te_errno tapi_sniffer_start(tapi_sniffer_id* id)

Enable the sniffer.

Parameters:

id

ID of the sniffer

0

success

Returns:

Status code

te_errno tapi_sniffer_mark(const char* ta, tapi_sniffer_id* id, const char* description)

Insert a mark packet into the capture file for a certain sniffer.

Parameters:

ta

Agent name used to request mark for all sniffers. It is not used if the ID not NULL NULL The sniffer ID should not be NULL

id

ID of the sniffer. If ID not NULL is queried mark for one sniffer NULL If ID is NULL is queried mark for all sniffers on the agent. The ta param should not be NULL

description

Mark description in human-readable form NULL NULL may be used as description for empty description string

0

success

Returns:

Status code