#define LND_PROTO_MAGICS enum LND_ProtocolLayer; LND_Protocol* libnd_proto_new (const char *name, LND_ProtocolLayer layer, guint32 magic); void libnd_proto_free (LND_Protocol *proto); gboolean libnd_proto_is_raw (LND_Protocol *proto); const char* libnd_proto_layer_to_string (LND_ProtocolLayer layer); |
typedef enum { LND_PROTO_LAYER_LINK = (1 << 0), LND_PROTO_LAYER_NET = (1 << 1), LND_PROTO_LAYER_TRANS = (1 << 2), LND_PROTO_LAYER_APP = (1 << 3), } LND_ProtocolLayer; |
LND_Protocol* libnd_proto_new (const char *name, LND_ProtocolLayer layer, guint32 magic); |
The function creates a new protocol with dummy operations hooked into the function pointers. Commonly used magic values are the DLT_xxx constants from bpf.h for the linklevel, ETHERTYPE_xxx for the network layer, IPPROTO_xxx for the transport layer, and ports as given in /etc/services for the application layer.
name of the protocol.
layer in the network stack that the new protocol lives at.
the magic value by which the protocol is commonly identified by the layer below.
new protocol, or NULL on error.
void libnd_proto_free (LND_Protocol *proto); |
The function releases all memory associated with a protocol.
protocol to free.
gboolean libnd_proto_is_raw (LND_Protocol *proto); |
Use this function to determine whether a protocol is the built-in raw data protocol.
protocol to test.
TRUE if proto is the raw protocol, FALSE otherwise.
const char* libnd_proto_layer_to_string (LND_ProtocolLayer layer); |
Mainly for debugging purposes, this function returns a statically allocated string for the protocol layer identifier given in layer.
layer identifier.