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); |
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()
.
iterated protocol.
arbitrary user data.
void libnd_proto_registry_init (void); |
The function initializes the registry, sets up hashes etc.
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.
protocol to register.
TRUE when protocol was registered, FALSE on error or when the protocol is already found in the registry.
void libnd_proto_registry_unregister (LND_Protocol *proto); |
The given protcol is removed from the registry. The protocol is not touched otherwise.
protocol to unregister.
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 where to look for protocol
magic of protocol.
retrieved protocol - either the one you were looking for, or the raw data protocol otherwise.
guint libnd_proto_registry_size (void); |
The function returns the number of protocols in the registry.
number of protocols.
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 to call for each protocol.
arbitrary user data passed through to callback.