Library setup

## Functions

int | nfct_callback_register (struct nfct_handle *h, enum nf_conntrack_msg_type type, int(*cb)(enum nf_conntrack_msg_type type, struct nf_conntrack *ct, void *data), void *data)
void | nfct_callback_unregister (struct nfct_handle *h)
int | nfct_callback_register2 (struct nfct_handle *h, enum nf_conntrack_msg_type type, int(*cb)(const struct nlmsghdr *nlh, enum nf_conntrack_msg_type type, struct nf_conntrack *ct, void *data), void *data)
void | nfct_callback_unregister2 (struct nfct_handle *h)
int | nfexp_callback_register (struct nfct_handle *h, enum nf_conntrack_msg_type type, int(*cb)(enum nf_conntrack_msg_type type, struct nf_expect *exp, void *data), void *data)
void | nfexp_callback_unregister (struct nfct_handle *h)
int | nfexp_callback_register2 (struct nfct_handle *h, enum nf_conntrack_msg_type type, int(*cb)(const struct nlmsghdr *nlh, enum nf_conntrack_msg_type type, struct nf_expect *exp, void *data), void *data)
void | nfexp_callback_unregister2 (struct nfct_handle *h)
struct nfct_handle * | nfct_open (uint8_t subsys_id, unsigned subscriptions)
int | nfct_close (struct nfct_handle *cth)
int | nfct_fd (struct nfct_handle *cth)
const struct nfnl_handle * | nfct_nfnlh (struct nfct_handle *cth)

## Detailed Description

## Function Documentation

## nfct_callback_register()

int nfct_callback_register | ( | struct nfct_handle * | h,
|  | enum nf_conntrack_msg_type | type,
|  | int(* | cb )(enum nf_conntrack_msg_type type, struct nf_conntrack *ct, void *data),
|  | void * | data )

nf_callback_register - register a callback

Parameters

  h | library handler
  type | message type (see enum nf_conntrack_msg_type definition)
  cb | callback used to process conntrack received
  data | data used by the callback, if any.

This function register a callback to handle the conntrack received, in case of error -1 is returned and errno is set appropiately, otherwise 0 is returned.

Note that the data parameter is optional, if you do not want to pass any data to your callback, then use NULL.

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

## nfct_callback_register2()

int nfct_callback_register2 | ( | struct nfct_handle * | h,
|  | enum nf_conntrack_msg_type | type,
|  | int(* | cb )(const struct nlmsghdr *nlh, enum nf_conntrack_msg_type type, struct nf_conntrack *ct, void *data),
|  | void * | data )

nf_callback_register2 - register a callback

Parameters

  h | library handler
  cb | callback used to process conntrack received
  data | data used by the callback, if any.

This function register a callback to handle the conntrack received, in case of error -1 is returned and errno is set appropiately, otherwise 0 is returned.

Note that the data parameter is optional, if you do not want to pass any data to your callback, then use NULL.

NOTICE: The difference with nf_callback_register() is that this function uses the new callback interface that includes the Netlink header.

WARNING: Don't mix nf_callback_register() and nf_callback_register2() calls, use only once at a time.

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

## nfct_callback_unregister()

void nfct_callback_unregister | ( | struct nfct_handle * | h | ) |

nfct_callback_unregister - unregister a callback

Parameters

  h | library handler

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

## nfct_callback_unregister2()

void nfct_callback_unregister2 | ( | struct nfct_handle * | h | ) |

nfct_callback_unregister2 - unregister a callback

Parameters

  h | library handler

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

## nfct_close()

int nfct_close | ( | struct nfct_handle * | cth | ) |

nfct_close - close a ctnetlink handler

Parameters

  cth | handler obtained via nfct_open()

This function returns -1 on error and errno is explicitly set.

Definition at line 105 of file main.c.

## nfct_fd()

int nfct_fd | ( | struct nfct_handle * | cth | ) |

nfct_fd - get the Netlink file descriptor of one existing ctnetlink handler

Parameters

  cth | handler obtained via nfct_open()

Definition at line 144 of file main.c.

## nfct_nfnlh()

const struct nfnl_handle * nfct_nfnlh | ( | struct nfct_handle * | cth | ) |

Definition at line 149 of file main.c.

## nfct_open()

struct nfct_handle * nfct_open | ( | uint8_t | subsys_id,
|  | unsigned | subscriptions )

nfct_open - open a ctnetlink handler

Parameters

  subsys_id | can be NFNL_SUBSYS_CTNETLINK or NFNL_SUBSYS_CTNETLINK_EXP
  subscriptions | ctnetlink groups to subscribe to events

This function returns a handler to send commands to and receive replies from kernel-space. You can pass the following subsystem IDs:

- NFNL_SUBSYS_CTNETLINK: if you are only interested in conntrack operations (excluding expectations).
- NFNL_SUBSYS_CTNETLINK_EXP: if you are only interested in expectation operations (exclude conntracks).
- NFNL_SUBSYS_NONE: if you are interested in both conntrack and expectation operations.

On error, NULL is returned and errno is explicitly set.

Definition at line 84 of file main.c.

## nfexp_callback_register()

int nfexp_callback_register | ( | struct nfct_handle * | h,
|  | enum nf_conntrack_msg_type | type,
|  | int(* | cb )(enum nf_conntrack_msg_type type, struct nf_expect *exp, void *data),
|  | void * | data )

nfexp_callback_register - register a callback

Parameters

  h | library handler
  cb | callback used to process expect received
  data | data used by the callback, if any.

This function register a callback to handle the expect received, in case of error -1 is returned and errno is set appropiately, otherwise 0 is returned.

Note that the data parameter is optional, if you do not want to pass any data to your callback, then use NULL.

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

## nfexp_callback_register2()

int nfexp_callback_register2 | ( | struct nfct_handle * | h,
|  | enum nf_conntrack_msg_type | type,
|  | int(* | cb )(const struct nlmsghdr *nlh, enum nf_conntrack_msg_type type, struct nf_expect *exp, void *data),
|  | void * | data )

nfexp_callback_register2 - register a callback

Parameters

  h | library handler
  cb | callback used to process expect received
  data | data used by the callback, if any.

This function register a callback to handle the expect received, in case of error -1 is returned and errno is set appropiately, otherwise 0 is returned.

Note that the data parameter is optional, if you do not want to pass any data to your callback, then use NULL.

NOTICE: The difference with nfexp_callback_register() is that this function uses the new callback interface that includes the Netlink header.

WARNING: Don't mix nfexp_callback_register() and nfexp_callback_register2() calls, use only once at a time.

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

## nfexp_callback_unregister()

void nfexp_callback_unregister | ( | struct nfct_handle * | h | ) |

nfexp_callback_unregister - unregister a callback

Parameters

  h | library handler

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

## nfexp_callback_unregister2()

void nfexp_callback_unregister2 | ( | struct nfct_handle * | h | ) |

nfexp_callback_unregister2 - unregister a callback

Parameters

  h | library handler

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