/src/ndpi/src/lib/protocols/ipp.c
Line | Count | Source |
1 | | /* |
2 | | * ipp.c |
3 | | * |
4 | | * Copyright (C) 2009-11 - ipoque GmbH |
5 | | * Copyright (C) 2011-25 - 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_IPP |
28 | | |
29 | | #include "ndpi_api.h" |
30 | | #include "ndpi_private.h" |
31 | | |
32 | | |
33 | | static void ndpi_int_ipp_add_connection(struct ndpi_detection_module_struct *ndpi_struct, |
34 | | struct ndpi_flow_struct *flow) |
35 | 212 | { |
36 | 212 | ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_IPP, NDPI_PROTOCOL_HTTP, NDPI_CONFIDENCE_DPI); |
37 | 212 | } |
38 | | |
39 | | static void ndpi_search_ipp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) |
40 | 2.77M | { |
41 | 2.77M | struct ndpi_packet_struct *packet = &ndpi_struct->packet; |
42 | | |
43 | 2.77M | NDPI_LOG_DBG(ndpi_struct, "search ipp\n"); |
44 | | |
45 | | /* Treat IPP as a HTTP sub-protocol */ |
46 | | |
47 | 2.77M | if(flow->detected_protocol_stack[0] == NDPI_PROTOCOL_HTTP && |
48 | 2.77M | flow->http.method == NDPI_HTTP_METHOD_POST && |
49 | 2.77M | LINE_STARTS(packet->http_url_name, "/ipp/") == 1) { |
50 | 212 | NDPI_LOG_INFO(ndpi_struct, "found ipp\n"); |
51 | 212 | ndpi_int_ipp_add_connection(ndpi_struct, flow); |
52 | 212 | return; |
53 | 212 | } |
54 | | |
55 | 2.77M | NDPI_EXCLUDE_DISSECTOR(ndpi_struct, flow); |
56 | 2.77M | } |
57 | | |
58 | | |
59 | | void init_ipp_dissector(struct ndpi_detection_module_struct *ndpi_struct) |
60 | 15.4k | { |
61 | 15.4k | register_dissector("IPP", ndpi_struct, |
62 | 15.4k | ndpi_search_ipp, |
63 | 15.4k | NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION, |
64 | 15.4k | 1, NDPI_PROTOCOL_IPP); |
65 | 15.4k | } |