Skip to the content.

MMT Attributes

[TOC]


Definition

An attribute is a value connected to a protocol that represents a protocol field or a value calculated based on the arriving protocol packets. An attribute can be part of the protocol’s header/data like TCP source port, source IP address, etc. It can be a virtual value calculated from the protocol packets like TCP RTT, jitter, packet loss, etc.

Attribute scopes

Attribute extraction

The extraction of an attribute can be one of the following:

Attribute notification

Indicates at what points during the packet journey in the core, the user registered attribute handlers are called. This can be:

API

User API

   int register_extraction_attribute(mmt_handler_t * mmt_handler, uint32_t protocol_id, uint32_t attribute_id);

   int register_extraction_attribute_by_name(mmt_handler_t * mmt_handler, char * protocol_name, char * attribute_name);

Allow registering an attribute for extraction. An attribute is identified by the protocol and attribute ids or names. If the registration succeeds, a positive value will be returned.

   int is_registered_attribute(mmt_handler_t * mmt_handler, uint32_t protocol_id, uint32_t attribute_id);

Allows verifying if an attribute, identified by its protocol and attribute identifiers, is already registered. It will return a positive value if the attribute is found registered.

   int unregister_extraction_attribute(mmt_handler_t * mmt_handler, uint32_t protocol_id, uint32_t attribute_id);

   int unregister_extraction_attribute_by_name(mmt_handler_t * mmt_handler, char * protocol_name, char * attribute_name);

Allow unregistering an already registered attribute. If the unregistration succeeds, a positive value will be returned.

   int register_attribute_handler(mmt_handler_t * mmt_handler, uint32_t protocol_id, uint32_t attribute_id, 
                                  attribute_handler_function handler_fct, void * handler_condition, void * user);

   int register_attribute_handler_by_name(mmt_handler_t * mmt_handler, char * protocol_name, char * attribute_name, 
                                          attribute_handler_function handler_fct, void * handler_condition, void * user);

Allow registering an attribute handler that is a callback that will be called each time the given attribute identified by its protocol and attribute ids or names is found. If needed, the user can provide a pointer to an argument that will be passed to the callback function when it is called.

   int unregister_attribute_handler(mmt_handler_t * mmt_handler, uint32_t protocol_id, uint32_t attribute_id);

   int unregister_attribute_handler_by_name(mmt_handler_t * mmt_handler, char * protocol_name, char * attribute_name);

Allow unregistering an already registered attribute handler. If the unregistration succeeds, a positive value will be returned.

   int is_registered_attribute_handler(mmt_handler_t * mmt_handler, uint32_t protocol_id, uint32_t attribute_id, attribute_handler_function handler_fct);

Allows verifying if an attribute handler is registered with the attribute identified by its protocol and attribute identifiers. It will return a positive value if the attribute handler is found registered.

   int has_registered_attribute_handler(mmt_handler_t * mmt_handler, uint32_t protocol_id, uint32_t attribute_id);

Allows verifying if an attribute identified by its protocol and attribute identifiers has any attribute handlers. It will return a positive value if the attribute has any registered handler.

   void * get_attribute_extracted_data(const ipacket_t * ipacket, uint32_t protocol_id, uint32_t attribute_id);

   void * get_attribute_extracted_data_by_name(const ipacket_t * ipacket, char * protocol_name, char * attribute_name);

   void * get_attribute_extracted_data_at_index(const ipacket_t * ipacket, uint32_t protocol_id, uint32_t attribute_id, unsigned index);

Returns a pointer to the data corresponding to the attribute identified by its protocol and attribute ids or names if it was extracted in the last processed packet. NULL is returned otherwise. If the index is given, only the protocol at that index will be checked. Indicating the index is recommended.

Developer API

   int register_attribute_with_protocol(protocol_t * protocol_struct, attribute_metadata_t attribute_meta_data);

Allows to register the attribute defined by its meta-data structure with the protocol identified by a pointer to its opaque structure. It returns a positive value on success (valid attribute and not already registered), zero otherwise.

Open Issues