Reorganized protocol families
Added new API calls ndpi_set_proto_breed() and ndpi_set_proto_category() for overwriting nDPI protocol specifications
This commit is contained in:
+24
-3
@@ -387,17 +387,16 @@ extern "C" {
|
|||||||
/**
|
/**
|
||||||
* Check if the string -bigram_to_match- match with a bigram of -automa-
|
* Check if the string -bigram_to_match- match with a bigram of -automa-
|
||||||
*
|
*
|
||||||
* @par ndpi_struct = the detection module
|
* @par ndpi_mod = the detection module
|
||||||
* @par automa = the struct ndpi_automa for the bigram
|
* @par automa = the struct ndpi_automa for the bigram
|
||||||
* @par bigram_to_match = the bigram string to match
|
* @par bigram_to_match = the bigram string to match
|
||||||
* @return 0
|
* @return 0
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int ndpi_match_bigram(struct ndpi_detection_module_struct *ndpi_struct,
|
int ndpi_match_bigram(struct ndpi_detection_module_struct *ndpi_mod,
|
||||||
ndpi_automa *automa,
|
ndpi_automa *automa,
|
||||||
char *bigram_to_match);
|
char *bigram_to_match);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write the protocol name in the buffer -buf- as master_protocol.protocol
|
* Write the protocol name in the buffer -buf- as master_protocol.protocol
|
||||||
*
|
*
|
||||||
@@ -419,6 +418,28 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
int ndpi_is_custom_category(ndpi_protocol_category_t category);
|
int ndpi_is_custom_category(ndpi_protocol_category_t category);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overwrite a protocol category defined by nDPI with the custom category
|
||||||
|
*
|
||||||
|
* @par ndpi_mod = the detection module
|
||||||
|
* @par protoId = the protocol identifier to overwrite
|
||||||
|
* @par breed = the breed to be associated to the protocol
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void ndpi_set_proto_breed(struct ndpi_detection_module_struct *ndpi_mod,
|
||||||
|
u_int16_t protoId, ndpi_protocol_breed_t breed);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overwrite a protocol category defined by nDPI with the custom category
|
||||||
|
*
|
||||||
|
* @par ndpi_mod = the detection module
|
||||||
|
* @par protoId = the protocol identifier to overwrite
|
||||||
|
* @par category = the category associated to the protocol
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void ndpi_set_proto_category(struct ndpi_detection_module_struct *ndpi_mod,
|
||||||
|
u_int16_t protoId, ndpi_protocol_category_t protoCategory);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get protocol category as string
|
* Get protocol category as string
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -432,6 +432,26 @@ ndpi_port_range * ndpi_build_default_ports(ndpi_port_range *ports,
|
|||||||
|
|
||||||
/* ********************************************************************************** */
|
/* ********************************************************************************** */
|
||||||
|
|
||||||
|
void ndpi_set_proto_breed(struct ndpi_detection_module_struct *ndpi_mod,
|
||||||
|
u_int16_t protoId, ndpi_protocol_breed_t breed) {
|
||||||
|
if(protoId >= NDPI_MAX_SUPPORTED_PROTOCOLS+NDPI_MAX_NUM_CUSTOM_PROTOCOLS)
|
||||||
|
return;
|
||||||
|
else
|
||||||
|
ndpi_mod->proto_defaults[protoId].protoBreed = breed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ********************************************************************************** */
|
||||||
|
|
||||||
|
void ndpi_set_proto_category(struct ndpi_detection_module_struct *ndpi_mod,
|
||||||
|
u_int16_t protoId, ndpi_protocol_category_t protoCategory) {
|
||||||
|
if(protoId >= NDPI_MAX_SUPPORTED_PROTOCOLS+NDPI_MAX_NUM_CUSTOM_PROTOCOLS)
|
||||||
|
return;
|
||||||
|
else
|
||||||
|
ndpi_mod->proto_defaults[protoId].protoCategory = protoCategory;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ********************************************************************************** */
|
||||||
|
|
||||||
void ndpi_set_proto_defaults(struct ndpi_detection_module_struct *ndpi_mod,
|
void ndpi_set_proto_defaults(struct ndpi_detection_module_struct *ndpi_mod,
|
||||||
ndpi_protocol_breed_t breed, u_int16_t protoId,
|
ndpi_protocol_breed_t breed, u_int16_t protoId,
|
||||||
u_int16_t tcp_master_protoId[2], u_int16_t udp_master_protoId[2],
|
u_int16_t tcp_master_protoId[2], u_int16_t udp_master_protoId[2],
|
||||||
|
|||||||
Reference in New Issue
Block a user