Send commands to kernel-space and receive replies

## Functions

int | nfct_query (struct nfct_handle *h, const enum nf_conntrack_query qt, const void *data)
int | nfct_send (struct nfct_handle *h, const enum nf_conntrack_query qt, const void *data)
int | nfct_catch (struct nfct_handle *h)
int | nfexp_query (struct nfct_handle *h, const enum nf_conntrack_query qt, const void *data)
int | nfexp_send (struct nfct_handle *h, const enum nf_conntrack_query qt, const void *data)
int | nfexp_catch (struct nfct_handle *h)

## Detailed Description

## Function Documentation

## nfct_catch()

int nfct_catch | ( | struct nfct_handle * | h | ) |

nfct_catch - catch events

Parameters

  h | library handler

This function receives the event from the kernel and it invokes the callback that was registered to this handle.

On error, -1 is returned and errno is set appropiately. On success, a value greater or equal to 0 is returned indicating the callback verdict: NFCT_CB_STOP, NFCT_CB_CONTINUE or NFCT_CB_STOLEN.

Beware that this function also handles expectation events, in case they are received through this handle.

Definition at line 1057 of file conntrack/api.c.

## nfct_query()

int nfct_query | ( | struct nfct_handle * | h,
|  | const enum nf_conntrack_query | qt,
|  | const void * | data )

nfct_query - send a query to ctnetlink and handle the reply

Parameters

  h | library handler
  qt | query type
  data | data required to send the query

On error, -1 is returned and errno is explicitely set. On success, 0 is returned.

Definition at line 991 of file conntrack/api.c.

## nfct_send()

int nfct_send | ( | struct nfct_handle * | h,
|  | const enum nf_conntrack_query | qt,
|  | const void * | data )

nfct_send - send a query to ctnetlink

Parameters

  h | library handler
  qt | query type
  data | data required to send the query

Like nfct_query but we do not wait for the reply from ctnetlink. You can use nfct_send() and nfct_catch() to emulate nfct_query(). This is particularly useful when the socket is non-blocking.

On error, -1 is returned and errno is explicitely set. On success, 0 is returned.

Definition at line 1023 of file conntrack/api.c.

## nfexp_catch()

int nfexp_catch | ( | struct nfct_handle * | h | ) |

nfexp_catch - catch events

Parameters

  h | library handler

This function receives the event from the kernel and it invokes the callback that was registered to this handle.

On error, -1 is returned and errno is set appropiately. On success, a value greater or equal to 0 is returned indicating the callback verdict: NFCT_CB_STOP, NFCT_CB_CONTINUE or NFCT_CB_STOLEN.

Beware that this function is equivalent to nfct_catch(), so it handles both conntrack and expectation events.

Definition at line 760 of file expect/api.c.

## nfexp_query()

int nfexp_query | ( | struct nfct_handle * | h,
|  | const enum nf_conntrack_query | qt,
|  | const void * | data )

nfexp_query - send a query to ctnetlink

Parameters

  h | library handler
  qt | query type
  data | data required to send the query

On error, -1 is returned and errno is explicitely set. On success, 0 is returned.

Definition at line 695 of file expect/api.c.

## nfexp_send()

int nfexp_send | ( | struct nfct_handle * | h,
|  | const enum nf_conntrack_query | qt,
|  | const void * | data )

nfexp_send - send a query to ctnetlink

Parameters

  h | library handler
  qt | query type
  data | data required to send the query

Like nfexp_query but we do not wait for the reply from ctnetlink. You can use nfexp_send() and nfexp_catch() to emulate nfexp_query(). This is particularly useful when the socket is non-blocking.

On error, -1 is returned and errno is explicitely set. On success, 0 is returned.

Definition at line 727 of file expect/api.c.