libnd_protocol_registry

Name

libnd_protocol_registry -- 

Synopsis



void        (*LND_ProtocolFunc)             (LND_Protocol *proto,
                                             void *user_data);
void        libnd_proto_registry_init       (void);
gboolean    libnd_proto_registry_register   (LND_Protocol *proto);
void        libnd_proto_registry_unregister (LND_Protocol *proto);
LND_Protocol* libnd_proto_registry_find     (LND_ProtocolLayer layer,
                                             guint32 magic);
guint       libnd_proto_registry_size       (void);
void        libnd_proto_registry_foreach_proto
                                            (LND_ProtocolFunc callback,
                                             void *user_data);

Description

Details

LND_ProtocolFunc ()

void        (*LND_ProtocolFunc)             (LND_Protocol *proto,
                                             void *user_data);

This is the signature of functions that can be passed to libnd_proto_registry_foreach_proto().

proto :

iterated protocol.

user_data :

arbitrary user data.


libnd_proto_registry_init ()

void        libnd_proto_registry_init       (void);

The function initializes the registry, sets up hashes etc.


libnd_proto_registry_register ()

gboolean    libnd_proto_registry_register   (LND_Protocol *proto);

The function registers a protocol in the registry. For normal protocol plugins, this gets called automatically when the plugin is loaded and initialized, so you don't have to do this manually.

proto :

protocol to register.

Returns :

TRUE when protocol was registered, FALSE on error or when the protocol is already found in the registry.


libnd_proto_registry_unregister ()

void        libnd_proto_registry_unregister (LND_Protocol *proto);

The given protcol is removed from the registry. The protocol is not touched otherwise.

proto :

protocol to unregister.


libnd_proto_registry_find ()

LND_Protocol* libnd_proto_registry_find     (LND_ProtocolLayer layer,
                                             guint32 magic);

The function looks up a protocol plugin for a given layer and magic. If the protocol isn't found, the raw data display plugin is returned, which you can discern by a protocol ID value of 1. The magic is the usual magic for the protocol you're looking for that is used at the layer below the protocol to identify it, e.g. one of the DLT_xxx values for a link layer protocol, or one of the ETHERTYPE_xxx values for a network layer protocol.

layer :

layer where to look for protocol

magic :

magic of protocol.

Returns :

retrieved protocol - either the one you were looking for, or the raw data protocol otherwise.


libnd_proto_registry_size ()

guint       libnd_proto_registry_size       (void);

The function returns the number of protocols in the registry.

Returns :

number of protocols.


libnd_proto_registry_foreach_proto ()

void        libnd_proto_registry_foreach_proto
                                            (LND_ProtocolFunc callback,
                                             void *user_data);

The function iterates over the registered protocols and applies a callback function to each of them.

callback :

callback to call for each protocol.

user_data :

arbitrary user data passed through to callback.