Added ndpi_category_set_name() API call

This commit is contained in:
Luca Deri
2017-09-19 22:39:00 +02:00
parent 1a4e57e736
commit 9fb5981128
5 changed files with 84 additions and 24 deletions
+14 -1
View File
@@ -443,11 +443,24 @@ extern "C" {
/**
* Get protocol category as string
*
* @par mod = the detection module
* @par category = the category associated to the protocol
* @return the string name of the category
*
*/
const char* ndpi_category_str(ndpi_protocol_category_t category);
const char* ndpi_category_get_name(struct ndpi_detection_module_struct *ndpi_mod,
ndpi_protocol_category_t category);
/**
* Set protocol category string
*
* @par mod = the detection module
* @par category = the category associated to the protocol
* @paw name = the string name of the category
*
*/
void ndpi_category_set_name(struct ndpi_detection_module_struct *ndpi_mod,
ndpi_protocol_category_t category, char *name);
/**
* Get protocol category
+5 -1
View File
@@ -764,6 +764,7 @@ typedef enum {
NDPI_PROTOCOL_CATEGORY_NETWORK_TOOL, /* Network administration and monitor protocols */
NDPI_PROTOCOL_CATEGORY_SYSTEM_OS, /* System/Operating System level applications */
NDPI_PROTOCOL_CATEGORY_SW_UPDATE, /* Software update */
/* See #define NUM_CUSTOM_CATEGORIES */
NDPI_PROTOCOL_CATEGORY_CUSTOM_1, /* User custom category 1 */
NDPI_PROTOCOL_CATEGORY_CUSTOM_2, /* User custom category 2 */
NDPI_PROTOCOL_CATEGORY_CUSTOM_3, /* User custom category 3 */
@@ -804,6 +805,9 @@ typedef struct ndpi_proto {
#define NDPI_PROTOCOL_NULL { NDPI_PROTOCOL_UNKNOWN , NDPI_PROTOCOL_UNKNOWN }
#define NUM_CUSTOM_CATEGORIES 5
#define CUSTOM_CATEGORY_LABEL_LEN 32
struct ndpi_detection_module_struct {
NDPI_PROTOCOL_BITMASK detection_bitmask;
NDPI_PROTOCOL_BITMASK generic_http_packet_bitmask;
@@ -814,7 +818,7 @@ struct ndpi_detection_module_struct {
#ifdef NDPI_ENABLE_DEBUG_MESSAGES
void *user_data;
#endif
char custom_category_labels[NUM_CUSTOM_CATEGORIES][CUSTOM_CATEGORY_LABEL_LEN];
/* callback function buffer */
struct ndpi_call_function_struct callback_buffer[NDPI_MAX_SUPPORTED_PROTOCOLS + 1];
u_int32_t callback_buffer_size;