Coverage Report

Created: 2026-10-31 07:18

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/ndpi/src/lib/protocols/nexon.c
Line
Count
Source
1
/*
2
 * nexon.c
3
 *
4
 * Copyright (C) 2009-11 - ipoque GmbH
5
 * Copyright (C) 2011-26 - ntop.org
6
 *
7
 * This file is part of nDPI, an open source deep packet inspection
8
 * library based on the OpenDPI and PACE technology by ipoque GmbH
9
 *
10
 * nDPI is free software: you can redistribute it and/or modify
11
 * it under the terms of the GNU Lesser General Public License as published by
12
 * the Free Software Foundation, either version 3 of the License, or
13
 * (at your option) any later version.
14
 *
15
 * nDPI is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 * GNU Lesser General Public License for more details.
19
 *
20
 * You should have received a copy of the GNU Lesser General Public License
21
 * along with nDPI.  If not, see <http://www.gnu.org/licenses/>.
22
 * 
23
 */
24
25
#include "ndpi_protocol_ids.h"
26
27
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_NEXON
28
29
#include "ndpi_api.h"
30
#include "ndpi_private.h"
31
32
static void ndpi_int_nexon_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
33
131
{
34
131
  ndpi_set_detected_protocol(ndpi_struct, &flow->core, NDPI_PROTOCOL_NEXON, NDPI_PROTOCOL_UNKNOWN, NDPI_CONFIDENCE_DPI);
35
131
}
36
37
38
static void ndpi_search_nexon(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
39
3.19M
{
40
3.19M
  struct ndpi_packet_struct *packet = &ndpi_struct->packet;
41
  
42
3.19M
  NDPI_LOG_DBG(ndpi_struct, "search nexon\n");
43
44
3.19M
  if(packet->payload_packet_len == 24 &&
45
3.19M
     ntohl(get_u_int32_t(packet->payload, 0)) == 0x18000000 &&
46
3.19M
     ntohl(get_u_int32_t(packet->payload, 4)) == 0x64000000) {
47
64
    NDPI_LOG_INFO(ndpi_struct, "found nexon\n");
48
64
    ndpi_int_nexon_add_connection(ndpi_struct, flow);
49
64
    return;
50
64
  }
51
3.19M
  if(packet->payload_packet_len == 20 &&
52
3.19M
     ntohl(get_u_int32_t(packet->payload, 4)) == 0x163A992E) {
53
67
    NDPI_LOG_INFO(ndpi_struct, "found nexon\n");
54
67
    ndpi_int_nexon_add_connection(ndpi_struct, flow);
55
67
    return;
56
67
  }
57
58
  /* TODO: detect UDP traffic */
59
60
3.19M
  NDPI_EXCLUDE_DISSECTOR(ndpi_struct, flow);
61
62
3.19M
}
63
64
65
void init_nexon_dissector(struct ndpi_detection_module_struct *ndpi_struct)
66
15.3k
{
67
15.3k
  ndpi_register_dissector("Nexon", ndpi_struct,
68
15.3k
                     ndpi_search_nexon,
69
15.3k
                     NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
70
15.3k
                     DISSECTOR_LICENSE_LGPL,
71
15.3k
                     1, NDPI_PROTOCOL_NEXON);
72
15.3k
}