Coverage Report

Created: 2026-02-21 07:19

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/ndpi/example/reader_util.h
Line
Count
Source
1
/*
2
 * ndpi_util.h
3
 *
4
 * Copyright (C) 2011-26 - ntop.org
5
 *
6
 * nDPI is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU Lesser General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * nDPI is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU Lesser General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Lesser General Public License
17
 * along with nDPI.  If not, see <http://www.gnu.org/licenses/>.
18
 *
19
 */
20
21
/**
22
 * This module contains routines to help setup a simple nDPI program.
23
 *
24
 * If you concern about performance or have to integrate nDPI in your
25
 * application, you could need to reimplement them yourself.
26
 *
27
 * WARNING: this API is just a demo od nDPI usage: Use it at your own risk!
28
 */
29
#ifndef __NDPI_UTIL_H__
30
#define __NDPI_UTIL_H__
31
32
#include "../src/lib/third_party/include/uthash.h"
33
#include <pcap.h>
34
#include "ndpi_includes.h"
35
#include "ndpi_classify.h"
36
#include "ndpi_typedefs.h"
37
38
#ifdef USE_DPDK
39
#include <rte_eal.h>
40
#include <rte_ether.h>
41
#include <rte_ethdev.h>
42
#include <rte_cycles.h>
43
#include <rte_lcore.h>
44
#include <rte_mbuf.h>
45
46
#define RX_RING_SIZE     128
47
#define TX_RING_SIZE     512
48
#define NUM_MBUFS       8191
49
#define MBUF_CACHE_SIZE  250
50
#define BURST_SIZE        32
51
#define PREFETCH_OFFSET    3
52
53
extern int dpdk_port_init(int port, struct rte_mempool *mbuf_pool);
54
extern int dpdk_port_deinit(int port);
55
#endif
56
57
16.3M
#define PLEN_MAX         1504
58
16.2M
#define PLEN_BIN_LEN     32
59
8.15M
#define PLEN_NUM_BINS    48 /* 47*32 = 1504 */
60
16.5M
#define MAX_NUM_BIN_PKTS 256
61
62
/* ETTA Spec defiintions for feature readiness */
63
#define ETTA_MIN_PACKETS 10
64
4.02G
#define ETTA_MIN_OCTETS 4000
65
/** maximum line length */
66
#define LINEMAX 512
67
#define MAX_BYTE_COUNT_ARRAY_LENGTH 256
68
#define MAX_NUM_PKTS               10
69
70
#define MAX_NUM_READER_THREADS     16
71
#define IDLE_SCAN_PERIOD           10 /* msec (use TICK_RESOLUTION = 1000) */
72
#define MAX_IDLE_TIME           30000
73
#define IDLE_SCAN_BUDGET         1024
74
#define NUM_ROOTS                 512
75
#define MAX_EXTRA_PACKETS_TO_CHECK  7
76
#define MAX_NDPI_FLOWS      200000000
77
41.0M
#define TICK_RESOLUTION          1000
78
#define MAX_NUM_IP_ADDRESS          5  /* len of ip address array */
79
#define UPDATED_TREE                1
80
#define AGGRESSIVE_PERCENT      95.00
81
#define DIR_SRC                    10
82
#define DIR_DST                    20
83
#define PORT_ARRAY_SIZE            20
84
#define HOST_ARRAY_SIZE            20
85
#define FLOWS_PACKETS_THRESHOLD   0.9
86
#define FLOWS_PERCENT_THRESHOLD   1.0
87
#define FLOWS_PERCENT_THRESHOLD_2 0.2
88
#define FLOWS_THRESHOLD          1000
89
#define PKTS_PERCENT_THRESHOLD    0.1
90
#define MAX_TABLE_SIZE_1         4096
91
#define MAX_TABLE_SIZE_2         8192
92
#define INIT_VAL                   -1
93
#define SERIALIZATION_BUFSIZ     (8192 * 2)
94
95
96
#ifdef __cplusplus
97
extern "C" {
98
#endif
99
100
// inner hash table (ja -> security state)
101
typedef struct ndpi_ja_info {
102
  char * ja;
103
  ndpi_cipher_weakness unsafe_cipher;
104
  UT_hash_handle hh;
105
} ndpi_ja_info;
106
107
// external hash table (host ip -> <ip string, hash table ja4c, hash table ja3s>)
108
// used to aggregate ja3 fingerprints by hosts
109
typedef struct ndpi_host_ja_fingerprints {
110
  u_int32_t ip;
111
  char *ip_string;
112
  char *dns_name;
113
  ndpi_ja_info *host_client_info_hasht;
114
  ndpi_ja_info *host_server_info_hasht;
115
116
  UT_hash_handle hh;
117
} ndpi_host_ja_fingerprints;
118
119
120
//inner hash table
121
typedef struct ndpi_ip_dns{
122
  u_int32_t ip;
123
  char *ip_string;
124
  char *dns_name; //server name if any;
125
  UT_hash_handle hh;
126
} ndpi_ip_dns;
127
128
//hash table ja -> <host, ip, security>, used to aggregate host by ja fingerprints
129
typedef struct ndpi_ja_fingerprints_host{
130
  char *ja; //key
131
  ndpi_cipher_weakness unsafe_cipher;
132
  ndpi_ip_dns *ipToDNS_ht;
133
  UT_hash_handle hh;
134
} ndpi_ja_fingerprints_host;
135
136
struct flow_metrics {
137
  float entropy, average, stddev;
138
};
139
140
struct ndpi_entropy {
141
  // Entropy fields
142
  u_int16_t src2dst_pkt_len[MAX_NUM_PKTS];                     /*!< array of packet appdata lengths */
143
  pkt_timeval src2dst_pkt_time[MAX_NUM_PKTS];               /*!< array of arrival times          */
144
  u_int16_t dst2src_pkt_len[MAX_NUM_PKTS];                     /*!< array of packet appdata lengths */
145
  pkt_timeval dst2src_pkt_time[MAX_NUM_PKTS];               /*!< array of arrival times          */
146
  pkt_timeval src2dst_start;                                /*!< first packet arrival time       */
147
  pkt_timeval dst2src_start;                                /*!< first packet arrival time       */
148
  u_int32_t src2dst_opackets;                                  /*!< non-zero packet counts          */
149
  u_int32_t dst2src_opackets;                                  /*!< non-zero packet counts          */
150
  u_int16_t src2dst_pkt_count;                                 /*!< packet counts                   */
151
  u_int16_t dst2src_pkt_count;                                 /*!< packet counts                   */
152
  u_int32_t src2dst_l4_bytes;                                  /*!< packet counts                   */
153
  u_int32_t dst2src_l4_bytes;                                  /*!< packet counts                   */
154
  u_int32_t src2dst_byte_count[MAX_BYTE_COUNT_ARRAY_LENGTH];   /*!< number of occurences of each byte   */
155
  u_int32_t dst2src_byte_count[MAX_BYTE_COUNT_ARRAY_LENGTH];   /*!< number of occurences of each byte   */
156
  u_int32_t src2dst_num_bytes;
157
  u_int32_t dst2src_num_bytes;
158
  double src2dst_bd_mean;
159
  double src2dst_bd_variance;
160
  double dst2src_bd_mean;
161
  double dst2src_bd_variance;
162
  float score;
163
};
164
165
enum info_type {
166
    INFO_INVALID = 0,
167
    INFO_GENERIC,
168
    INFO_KERBEROS,
169
    INFO_SOFTETHER,
170
    INFO_TIVOCONNECT,
171
    INFO_FTP_IMAP_POP_SMTP,
172
    INFO_NATPMP,
173
    INFO_SIP,
174
    INFO_FASTCGI,
175
    INFO_BFCP,
176
};
177
178
typedef struct {
179
  ndpi_address_port *aps;
180
  unsigned int num_aps;
181
  unsigned int num_aps_allocated;
182
} ndpi_address_port_list;
183
184
// flow tracking
185
typedef struct ndpi_flow_info {
186
  u_int32_t flow_id;
187
  u_int32_t hashval;
188
  u_int32_t src_ip; /* network order */
189
  u_int32_t dst_ip; /* network order */
190
  struct ndpi_in6_addr src_ip6; /* network order */
191
  struct ndpi_in6_addr dst_ip6; /* network order */
192
  u_int16_t src_port; /* network order */
193
  u_int16_t dst_port; /* network order */
194
  u_int8_t detection_completed, protocol, bidirectional, check_extra_packets, current_pkt_from_client_to_server;
195
  u_int16_t vlan_id;
196
  ndpi_packet_tunnel tunnel_type;
197
  struct ndpi_flow_struct *ndpi_flow;
198
  char *src_name, *dst_name;
199
  u_int8_t ip_version;
200
  u_int32_t cwr_count, src2dst_cwr_count, dst2src_cwr_count;
201
  u_int32_t ece_count, src2dst_ece_count, dst2src_ece_count;
202
  u_int32_t urg_count, src2dst_urg_count, dst2src_urg_count;
203
  u_int32_t ack_count, src2dst_ack_count, dst2src_ack_count;
204
  u_int32_t psh_count, src2dst_psh_count, dst2src_psh_count;
205
  u_int32_t syn_count, src2dst_syn_count, dst2src_syn_count;
206
  u_int32_t fin_count, src2dst_fin_count, dst2src_fin_count;
207
  u_int32_t rst_count, src2dst_rst_count, dst2src_rst_count;
208
  u_int32_t c_to_s_init_win, s_to_c_init_win;
209
  u_int64_t first_seen_ms, last_seen_ms;
210
  u_int64_t src2dst_bytes, dst2src_bytes;
211
  u_int64_t src2dst_goodput_bytes, dst2src_goodput_bytes;
212
  u_int32_t src2dst_packets, dst2src_packets;
213
  u_int32_t has_human_readeable_strings;
214
  char human_readeable_string_buffer[32];
215
  char *risk_str;
216
217
  // result only, not used for flow identification
218
  ndpi_protocol detected_protocol;
219
  ndpi_confidence_t confidence;
220
  u_int16_t num_dissector_calls;
221
  u_int16_t dpi_packets;
222
  u_int8_t monitoring_state;
223
  u_int16_t num_packets_before_monitoring;
224
225
  // Flow data analysis
226
  pkt_timeval src2dst_last_pkt_time, dst2src_last_pkt_time, flow_last_pkt_time;
227
  struct ndpi_analyze_struct *iat_c_to_s, *iat_s_to_c, *iat_flow,
228
    *pktlen_c_to_s, *pktlen_s_to_c;
229
230
  enum info_type info_type;
231
232
  union {
233
    char info[256];
234
    
235
    struct {
236
      unsigned char auth_failed;
237
      char username[127];
238
      char password[128];
239
    } ftp_imap_pop_smtp;
240
    
241
    struct {
242
      char domain[85];
243
      char hostname[85];
244
      char username[86];
245
    } kerberos;
246
    
247
    struct {
248
      char ip[16];
249
      char port[6];
250
      char hostname[48];
251
      char fqdn[48];
252
    } softether;
253
    
254
    struct {
255
      char identity_uuid[36];
256
      char machine[48];
257
      char platform[32];
258
      char services[48];
259
    } tivoconnect;
260
    
261
    struct  {
262
      uint16_t result_code;
263
      uint16_t internal_port;
264
      uint16_t external_port;
265
      char ip[16];
266
    } natpmp;
267
268
    struct {
269
      char from[256];
270
      char from_imsi[16];
271
      char to[256];
272
      char to_imsi[16];
273
    } sip;
274
275
    struct {
276
      ndpi_http_method method;
277
      char user_agent[32];
278
      char url[64];
279
    } fast_cgi;
280
281
    struct {
282
      u_int32_t conference_id;
283
      u_int16_t user_id;
284
    } bfcp;
285
  };
286
287
  ndpi_serializer ndpi_flow_serializer;
288
289
  char host_server_name[80]; /* Hostname/SNI */
290
  char *server_hostname;
291
  char *bittorent_hash;
292
  char *dhcp_fingerprint;
293
  char *dhcp_class_ident;
294
  uint32_t idle_timeout_sec;
295
  ndpi_risk risk;
296
297
  struct {
298
    char currency[16];
299
  } mining;
300
  
301
  struct {
302
    u_int16_t ssl_version;
303
    char server_info[64],
304
      client_hassh[33], server_hassh[33], *server_names,
305
      *advertised_alpns, *negotiated_alpn, *tls_supported_versions,
306
      *tls_issuerDN, *tls_subjectDN,
307
      ja3_server[33], ja4_client[37], *ja4_client_raw,
308
      sha1_cert_fingerprint[20], ssh_key_exchange_method[24];
309
    u_int8_t sha1_cert_fingerprint_set;
310
    struct tls_heuristics browser_heuristics;
311
312
    struct {
313
      u_int16_t version;
314
    } encrypted_ch;
315
316
    time_t notBefore, notAfter;
317
    u_int16_t server_cipher;
318
    ndpi_cipher_weakness client_unsafe_cipher, server_unsafe_cipher;
319
320
    u_int32_t quic_version;
321
  } ssh_tls;
322
323
  struct {
324
    u_int8_t num_blocks;
325
    struct ndpi_tls_block *blocks;
326
  } tls;
327
  
328
  struct {
329
    char url[256], request_content_type[64], content_type[64],
330
      user_agent[256], server[128], nat_ip[32], username[64], password[64], filename[256];
331
    u_int response_status_code;
332
  } http;
333
334
  struct rtp_info rtp[2 /* directions */];
335
336
  struct {
337
    ndpi_address_port_list mapped_address, peer_address,
338
      relayed_address, response_origin, other_address;
339
    u_int16_t rtp_counters[2];
340
  } stun;
341
  
342
  struct {
343
    char *username, *password;
344
  } telnet;
345
346
  struct {
347
    char geolocation_iata_code[4];
348
    char ptr_domain_name[64];
349
    u_int16_t transaction_id;
350
  } dns;
351
352
  u_int8_t multimedia_flow_types;
353
  
354
  void *src_id, *dst_id;
355
  char *tcp_fingerprint, *ndpi_fingerprint;
356
  struct ndpi_entropy *entropy;
357
  struct ndpi_entropy *last_entropy;
358
359
  /* Payload lenght bins */
360
#ifdef DIRECTION_BINS
361
  struct ndpi_bin payload_len_bin_src2dst, payload_len_bin_dst2src;
362
#else
363
  struct ndpi_bin payload_len_bin;
364
#endif
365
  
366
  /* Flow payload */
367
  u_int16_t flow_payload_len;
368
  char *flow_payload;  
369
} ndpi_flow_info_t;
370
371
372
// flow statistics info
373
typedef struct ndpi_stats {
374
  u_int32_t guessed_flow_protocols;
375
  u_int64_t raw_packet_count;
376
  u_int64_t ip_packet_count;
377
  u_int64_t total_wire_bytes, total_ip_bytes, total_discarded_bytes;
378
  u_int32_t num_protocols;
379
  u_int64_t *protocol_counter;
380
  u_int64_t *protocol_counter_bytes;
381
  u_int32_t *protocol_flows;
382
  u_int64_t *fpc_protocol_counter;
383
  u_int64_t *fpc_protocol_counter_bytes;
384
  u_int32_t *fpc_protocol_flows;
385
  u_int64_t category_counter[NDPI_PROTOCOL_NUM_CATEGORIES];
386
  u_int64_t category_counter_bytes[NDPI_PROTOCOL_NUM_CATEGORIES];
387
  u_int32_t category_flows[NDPI_PROTOCOL_NUM_CATEGORIES];
388
  u_int64_t breed_counter[NDPI_NUM_BREEDS];
389
  u_int64_t breed_counter_bytes[NDPI_NUM_BREEDS];
390
  u_int32_t breed_flows[NDPI_NUM_BREEDS];
391
  u_int32_t ndpi_flow_count;
392
  u_int32_t flow_count[3];
393
  u_int64_t tcp_count, udp_count;
394
  u_int64_t mpls_count, pppoe_count, vlan_count, fragmented_count;
395
  u_int64_t packet_len[6];
396
  u_int16_t max_packet_len;
397
  u_int64_t dpi_packet_count[3];
398
  u_int64_t flow_confidence[NDPI_CONFIDENCE_MAX];
399
  u_int64_t fpc_flow_confidence[NDPI_FPC_CONFIDENCE_MAX];
400
  u_int64_t num_dissector_calls;
401
402
  struct ndpi_lru_cache_stats lru_stats[NDPI_LRUCACHE_MAX];
403
  struct ndpi_automa_stats automa_stats[NDPI_AUTOMA_MAX];
404
  struct ndpi_patricia_tree_stats patricia_stats[NDPI_PTREE_MAX];
405
  struct ndpi_str_hash_stats hash_stats[NDPI_STR_HASH_MAX];
406
} ndpi_stats_t;
407
408
409
// flow preferences
410
typedef struct ndpi_workflow_prefs {
411
  u_int8_t decode_tunnels;
412
  u_int8_t quiet_mode;
413
  u_int8_t ignore_vlanid;
414
  u_int32_t num_roots;
415
  u_int32_t max_ndpi_flows;
416
} ndpi_workflow_prefs_t;
417
418
struct ndpi_workflow;
419
420
/** workflow, flow, user data */
421
typedef void (*ndpi_workflow_callback_ptr) (struct ndpi_workflow *, struct ndpi_flow_info *, void *);
422
423
424
// workflow main structure
425
typedef struct ndpi_workflow {
426
  u_int64_t last_time;
427
428
  struct ndpi_workflow_prefs prefs;
429
  struct ndpi_stats stats;
430
431
  ndpi_workflow_callback_ptr flow_callback;
432
  void * flow_callback_userdata;
433
434
  /* outside referencies */
435
  pcap_t *pcap_handle;
436
437
  /* allocated by prefs */
438
  void **ndpi_flows_root;
439
  struct ndpi_detection_module_struct *ndpi_struct;
440
  struct ndpi_global_context *g_ctx;
441
  u_int32_t num_allocated_flows;
442
443
  /* CSV,TLV,JSON serialization interface */
444
  ndpi_serialization_format ndpi_serialization_format;
445
} ndpi_workflow_t;
446
447
void ndpi_stats_free(ndpi_stats_t *s);
448
int ndpi_stats_init(ndpi_stats_t *s, uint32_t num_protocols);
449
void ndpi_stats_reset(ndpi_stats_t *s);
450
451
/* TODO: remove wrappers parameters and use ndpi global, when their initialization will be fixed... */
452
struct ndpi_workflow * ndpi_workflow_init(const struct ndpi_workflow_prefs * prefs, pcap_t * pcap_handle, int do_init_flows_root, ndpi_serialization_format serialization_format, struct ndpi_global_context *g_ctx);
453
454
455
/* workflow main free function */
456
void ndpi_workflow_free(struct ndpi_workflow * workflow);
457
458
459
/** Free flow_info ndpi support structures but not the flow_info itself
460
 *
461
 *  TODO remove! Half freeing things is bad!
462
 */
463
void ndpi_free_flow_info_half(struct ndpi_flow_info *flow);
464
465
466
/* Process a packet and update the workflow  */
467
struct ndpi_proto ndpi_workflow_process_packet(struct ndpi_workflow * workflow,
468
                 const struct pcap_pkthdr *header,
469
                 const u_char *packet,
470
                 ndpi_risk *flow_risk,
471
                 struct ndpi_flow_info **flow);
472
473
474
/* Flow callback for completed flows, before the flow memory will be freed. */
475
11
static inline void ndpi_workflow_set_flow_callback(struct ndpi_workflow * workflow, ndpi_workflow_callback_ptr callback, void * userdata) {
476
11
  workflow->flow_callback = callback;
477
11
  workflow->flow_callback_userdata = userdata;
478
11
}
fuzz_ndpi_reader_pl7m.c:ndpi_workflow_set_flow_callback
Line
Count
Source
475
1
static inline void ndpi_workflow_set_flow_callback(struct ndpi_workflow * workflow, ndpi_workflow_callback_ptr callback, void * userdata) {
476
1
  workflow->flow_callback = callback;
477
1
  workflow->flow_callback_userdata = userdata;
478
1
}
Unexecuted instantiation: reader_util.c:ndpi_workflow_set_flow_callback
fuzz_ndpi_reader_pl7m_only_subclassification.c:ndpi_workflow_set_flow_callback
Line
Count
Source
475
1
static inline void ndpi_workflow_set_flow_callback(struct ndpi_workflow * workflow, ndpi_workflow_callback_ptr callback, void * userdata) {
476
1
  workflow->flow_callback = callback;
477
1
  workflow->flow_callback_userdata = userdata;
478
1
}
Unexecuted instantiation: fuzz_readerutils_workflow.cpp:ndpi_workflow_set_flow_callback(ndpi_workflow*, void (*)(ndpi_workflow*, ndpi_flow_info*, void*), void*)
fuzz_ndpi_reader_pl7m_internal.c:ndpi_workflow_set_flow_callback
Line
Count
Source
475
1
static inline void ndpi_workflow_set_flow_callback(struct ndpi_workflow * workflow, ndpi_workflow_callback_ptr callback, void * userdata) {
476
1
  workflow->flow_callback = callback;
477
1
  workflow->flow_callback_userdata = userdata;
478
1
}
fuzz_ndpi_reader_alloc_fail.c:ndpi_workflow_set_flow_callback
Line
Count
Source
475
1
static inline void ndpi_workflow_set_flow_callback(struct ndpi_workflow * workflow, ndpi_workflow_callback_ptr callback, void * userdata) {
476
1
  workflow->flow_callback = callback;
477
1
  workflow->flow_callback_userdata = userdata;
478
1
}
fuzz_ndpi_reader_pl7m_simplest.c:ndpi_workflow_set_flow_callback
Line
Count
Source
475
1
static inline void ndpi_workflow_set_flow_callback(struct ndpi_workflow * workflow, ndpi_workflow_callback_ptr callback, void * userdata) {
476
1
  workflow->flow_callback = callback;
477
1
  workflow->flow_callback_userdata = userdata;
478
1
}
fuzz_ndpi_reader_nalloc.c:ndpi_workflow_set_flow_callback
Line
Count
Source
475
1
static inline void ndpi_workflow_set_flow_callback(struct ndpi_workflow * workflow, ndpi_workflow_callback_ptr callback, void * userdata) {
476
1
  workflow->flow_callback = callback;
477
1
  workflow->flow_callback_userdata = userdata;
478
1
}
fuzz_ndpi_reader_pl7m_simplest_internal.c:ndpi_workflow_set_flow_callback
Line
Count
Source
475
1
static inline void ndpi_workflow_set_flow_callback(struct ndpi_workflow * workflow, ndpi_workflow_callback_ptr callback, void * userdata) {
476
1
  workflow->flow_callback = callback;
477
1
  workflow->flow_callback_userdata = userdata;
478
1
}
fuzz_ndpi_reader_pl7m_64k.c:ndpi_workflow_set_flow_callback
Line
Count
Source
475
1
static inline void ndpi_workflow_set_flow_callback(struct ndpi_workflow * workflow, ndpi_workflow_callback_ptr callback, void * userdata) {
476
1
  workflow->flow_callback = callback;
477
1
  workflow->flow_callback_userdata = userdata;
478
1
}
fuzz_ndpi_reader.c:ndpi_workflow_set_flow_callback
Line
Count
Source
475
1
static inline void ndpi_workflow_set_flow_callback(struct ndpi_workflow * workflow, ndpi_workflow_callback_ptr callback, void * userdata) {
476
1
  workflow->flow_callback = callback;
477
1
  workflow->flow_callback_userdata = userdata;
478
1
}
fuzz_ndpi_reader_pl7m_randomize_ports.c:ndpi_workflow_set_flow_callback
Line
Count
Source
475
1
static inline void ndpi_workflow_set_flow_callback(struct ndpi_workflow * workflow, ndpi_workflow_callback_ptr callback, void * userdata) {
476
1
  workflow->flow_callback = callback;
477
1
  workflow->flow_callback_userdata = userdata;
478
1
}
fuzz_ndpi_reader_payload_analyzer.c:ndpi_workflow_set_flow_callback
Line
Count
Source
475
1
static inline void ndpi_workflow_set_flow_callback(struct ndpi_workflow * workflow, ndpi_workflow_callback_ptr callback, void * userdata) {
476
1
  workflow->flow_callback = callback;
477
1
  workflow->flow_callback_userdata = userdata;
478
1
}
479
480
int ndpi_is_datalink_supported(int datalink_type);
481
482
/* compare two nodes in workflow */
483
int ndpi_workflow_node_cmp(const void *a, const void *b);
484
void process_ndpi_collected_info(struct ndpi_workflow * workflow, struct ndpi_flow_info *flow);
485
void ndpi_flow_info_free_data(struct ndpi_flow_info *flow);
486
void ndpi_flow_info_freer(void *node);
487
const char* print_cipher_id(u_int32_t cipher);
488
489
extern int reader_log_level;
490
491
#if defined(NDPI_ENABLE_DEBUG_MESSAGES) && !defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
492
#define LOG(log_level, args...)     \
493
  {           \
494
    if(log_level <= reader_log_level)   \
495
      printf(args);       \
496
  }
497
#else
498
24.9M
#define LOG(...) {}
499
#endif
500
501
#ifndef LINKTYPE_LINUX_SLL2
502
323k
#define LINKTYPE_LINUX_SLL2 276
503
#endif
504
505
#ifdef __cplusplus
506
}
507
#endif
508
509
#endif