libtins
4.0
|
Defines inner PDU allocators. More...
Functions | |
template<typename PDUType , typename AllocatedType > | |
void | register_allocator (typename Internals::pdu_tag_mapper< PDUType >::type::identifier_type id) |
Registers an allocator for the provided PDU type. More... | |
Defines inner PDU allocators.
void Tins::Allocators::register_allocator | ( | typename Internals::pdu_tag_mapper< PDUType >::type::identifier_type | id | ) |
Registers an allocator for the provided PDU type.
Registering a certain allocator for a PDU type is useful for extending the library. Once an allocator is registered, it will be taken into account while constructing a PDU from a buffer.
If PDU finds that it cannot define which is the protocol that should be allocated based on its protocol identifier, it will try using the registered allocators if any.
Note that some PDU types are grouped together. For example, registering an allocator for EthernetII will make it work for the rest of the link layer protocols, sine they should all work the same way.