aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorLuca Deri <deri@ntop.org>2015-11-26 23:47:55 +0100
committerLuca Deri <deri@ntop.org>2015-11-26 23:47:55 +0100
commitcb68d4d00a22f6c367b4b18a35bd827ae2609d09 (patch)
treeee697e404eca3400960b3437bace33d3504c0b3b /src/lib
parent98ef945d2ef6e2ab072076b5ab68c5b7d05a7098 (diff)
Win32 compilation fixes
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/ndpi_main.c16
-rw-r--r--src/lib/protocols/dns.c10
-rw-r--r--src/lib/protocols/kakaotalk_voice.c2
3 files changed, 19 insertions, 9 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c
index bdcac35e0..51a2c66b0 100644
--- a/src/lib/ndpi_main.c
+++ b/src/lib/ndpi_main.c
@@ -1833,6 +1833,22 @@ u_int ndpi_get_num_supported_protocols(struct ndpi_detection_module_struct *ndpi
/* ******************************************************************** */
+#ifdef WIN32
+char * strsep(char **sp, char *sep)
+{
+ char *p, *s;
+ if (sp == NULL || *sp == NULL || **sp == '\0') return(NULL);
+ s = *sp;
+ p = s + strcspn(s, sep);
+ if (*p != '\0') *p++ = '\0';
+ *sp = p;
+ return(s);
+}
+#endif
+
+/* ******************************************************************** */
+
+
int ndpi_handle_rule(struct ndpi_detection_module_struct *ndpi_mod, char* rule, u_int8_t do_add) {
char *at, *proto, *elem;
ndpi_proto_defaults_t *def;
diff --git a/src/lib/protocols/dns.c b/src/lib/protocols/dns.c
index a1f813603..3b4322823 100644
--- a/src/lib/protocols/dns.c
+++ b/src/lib/protocols/dns.c
@@ -85,10 +85,6 @@ static u_int16_t get16(int *i, const u_int8_t *payload) {
/* *********************************************** */
-struct dns_packet_header {
- u_int16_t transaction_id, flags, num_queries, answer_rrs, authority_rrs, additional_rrs;
-} __attribute__((packed));
-
void ndpi_search_dns(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
{
struct ndpi_packet_struct *packet = &flow->packet;
@@ -107,9 +103,9 @@ void ndpi_search_dns(struct ndpi_detection_module_struct *ndpi_struct, struct nd
}
if(((dport == 53) || (sport == 53) || (dport == 5355))
- && (packet->payload_packet_len > sizeof(struct dns_packet_header))) {
+ && (packet->payload_packet_len > sizeof(struct ndpi_dns_packet_header))) {
int i = packet->tcp ? 2 : 0;
- struct dns_packet_header header, *dns = (struct dns_packet_header*)&packet->payload[i];
+ struct ndpi_dns_packet_header header, *dns = (struct ndpi_dns_packet_header*)&packet->payload[i];
u_int8_t is_query, ret_code, is_dns = 0;
u_int32_t a_record[NDPI_MAX_DNS_REQUESTS] = { 0 }, query_offset, num_a_records = 0;
@@ -121,7 +117,7 @@ void ndpi_search_dns(struct ndpi_detection_module_struct *ndpi_struct, struct nd
header.additional_rrs = ntohs(dns->additional_rrs);
is_query = (header.flags & 0x8000) ? 0 : 1;
ret_code = is_query ? 0 : (header.flags & 0x0F);
- i += sizeof(struct dns_packet_header);
+ i += sizeof(struct ndpi_dns_packet_header);
query_offset = i;
if(is_query) {
diff --git a/src/lib/protocols/kakaotalk_voice.c b/src/lib/protocols/kakaotalk_voice.c
index daa97cc36..c6972c7a1 100644
--- a/src/lib/protocols/kakaotalk_voice.c
+++ b/src/lib/protocols/kakaotalk_voice.c
@@ -30,8 +30,6 @@
#ifdef NDPI_SERVICE_KAKAOTALK_VOICE
void ndpi_search_kakaotalk_voice(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) {
struct ndpi_packet_struct *packet = &flow->packet;
- unsigned char *vers;
- int ver_offs;
if(packet->iph
&& packet->udp