1 2 3 #ifndef __NDPI_UTILS_H__ 4 #define __NDPI_UTILS_H__ 5 6 #include "ndpi_define.h" 7 8 #define MYDBG(m, ...) \ 9 printf(" DBG[%s:%s:%u]: \t" m "\n", __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__); 10 11 // #define NDPI_ENABLE_DEBUG_POINTER_MESSAGES 12 // #define NDPI_ENABLE_DEBUG_INFO_MESSAGES 13 // #define NDPI_ENABLE_DEBUG_TRACE_MESSAGES 14 15 extern void printRawData(const uint8_t *ptr, size_t len); 16 //extern uint8_t add_segment_to_buffer( struct ndpi_flow_struct *flow, struct ndpi_tcphdr const * tcph, uint32_t waited); 17 //extern uint8_t check_for_sequence( struct ndpi_flow_struct *flow, struct ndpi_tcphdr const * tcph); 18 19 /* **************************************** */ 20 21 /* Can't call libc functions from kernel space, define some stub instead */ 22 23 #define ndpi_isalpha(ch) (((ch) >= 'a' && (ch) <= 'z') || ((ch) >= 'A' && (ch) <= 'Z')) 24 #define ndpi_isdigit(ch) ((ch) >= '0' && (ch) <= '9') 25 #define ndpi_isspace(ch) (((ch) >= '\t' && (ch) <= '\r') || ((ch) == ' ')) 26 #define ndpi_isprint(ch) ((ch) >= 0x20 && (ch) <= 0x7e) 27 #define ndpi_ispunct(ch) (((ch) >= '!' && (ch) <= '/') || \ 28 ((ch) >= ':' && (ch) <= '@') || \ 29 ((ch) >= '[' && (ch) <= '`') || \ 30 ((ch) >= '{' && (ch) <= '~')) 31 32 #endif 33