Loading...
Searching...
No Matches
network_monitor.h File Reference

mptcpd network device monitoring. More...

`#include <mptcpd/export.h>`
`#include <stdbool.h>`
`#include <net/if.h>`
Include dependency graph for network_monitor.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Classes

struct | mptcpd_interface
| Network interface-specific information. More...
struct | mptcpd_nm_ops
| Network monitor event tracking operations. More...

## Typedefs

typedef void(* | mptcpd_nm_callback) (struct mptcpd_interface const *interface, void *callback_data)
| Network monitor iteration function type.

## Functions

MPTCPD_API void | mptcpd_nm_foreach_interface (struct mptcpd_nm const *nm, mptcpd_nm_callback callback, void *data)
| Iterate over all monitored network interfaces.
MPTCPD_API bool | mptcpd_nm_register_ops (struct mptcpd_nm *nm, struct mptcpd_nm_ops const *ops, void *user_data)
| Subscribe to mptcpd network monitor events.
MPTCPD_API bool | mptcpd_nm_monitor_loopback (struct mptcpd_nm *nm, bool enable)
| Enable monitoring of the loopback network interface.

## Detailed Description

mptcpd network device monitoring.

Copyright (c) 2017-2022, Intel Corporation

## Typedef Documentation

## mptcpd_nm_callback

typedef void(* mptcpd_nm_callback) (struct mptcpd_interface const *interface, void *callback_data)

Network monitor iteration function type.

The mptcpd network monitor will call a function of this type when iterating over the network interfaces via `mptcpd_nm_foreach_interface()`.

Parameters

  [in] | interface | Network interface information.
  [in,out] | callback_data | Data provided by the caller of `mptcpd_nm_foreach_interface()`.

## Function Documentation

## mptcpd_nm_foreach_interface()

MPTCPD_API void mptcpd_nm_foreach_interface | ( | struct mptcpd_nm const * | nm,
|  | mptcpd_nm_callback | callback,
|  | void * | data
| ) |  |

Iterate over all monitored network interfaces.

Parameters

  [in] | nm | Pointer to the mptcpd network monitor object.
  [in] | callback | Function to be called during each network interface iteration.
  [in] | data | Data to pass to the callback function during each iteration.

## mptcpd_nm_monitor_loopback()

MPTCPD_API bool mptcpd_nm_monitor_loopback | ( | struct mptcpd_nm * | nm,
|  | bool | enable
| ) |  |

Enable monitoring of the loopback network interface.

Mptcpd normally only monitors non-loopback network interfaces. Call this function to enable monitoring of loopback network interfaces.

Note
  Mptcpd monitoring of loopback network interfaces is meant primarily for testing purposes.

Parameters

  [in,out] | nm | Pointer to the mptcpd network monitor object.
  [in] | enable | Enable or disable monitoring of loopback network interfaces.

Return values

  true | Successfully enable or disabled.
  false | Invalid nm argument.

## mptcpd_nm_register_ops()

MPTCPD_API bool mptcpd_nm_register_ops | ( | struct mptcpd_nm * | nm,
|  | struct mptcpd_nm_ops const * | ops,
|  | void * | user_data
| ) |  |

Subscribe to mptcpd network monitor events.

Register a set of operations that will be called on a corresponding mptcpd network monitoring event, e.g. network interface or address addition, update, or removal.

Parameters

  [in,out] | nm | Pointer to the mptcpd network monitor object.
  [in] | ops | Set of network monitoring event handling functions.
  [in] | user_data | Data to be passed to the network event tracking operations.

Return values

  true | Registration succeeded.
  false | Registration failed.