Coverage Report

Created: 2025-11-16 07:09

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/suricata/src/stream.c
Line
Count
Source
1
/* Copyright (C) 2007-2017 Open Information Security Foundation
2
 *
3
 * You can copy, redistribute or modify this Program under the terms of
4
 * the GNU General Public License version 2 as published by the Free
5
 * Software Foundation.
6
 *
7
 * This program is distributed in the hope that it will be useful,
8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 * GNU General Public License for more details.
11
 *
12
 * You should have received a copy of the GNU General Public License
13
 * version 2 along with this program; if not, write to the Free Software
14
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15
 * 02110-1301, USA.
16
 */
17
18
/**
19
 * \file
20
 *
21
 * \author Victor Julien <victor@inliniac.net>
22
 */
23
24
#include "suricata-common.h"
25
#include "decode.h"
26
#include "threads.h"
27
#include "stream.h"
28
#include "util-pool.h"
29
#include "util-debug.h"
30
#include "stream-tcp.h"
31
#include "flow-util.h"
32
33
/** \brief Run callback for all segments in a single direction.
34
 *
35
 * Must be called under flow lock.
36
 * \var flag determines the direction to run callback on (either to server or to client).
37
 *
38
 * \return -1 in case of error, the number of segment in case of success
39
 */
40
int StreamSegmentForEach(const Packet *p, uint8_t flag, StreamSegmentCallback CallbackFunc, void *data)
41
0
{
42
0
    switch(p->proto) {
43
0
        case IPPROTO_TCP:
44
0
            return StreamTcpSegmentForEach(p, flag, CallbackFunc, data);
45
0
            break;
46
#ifdef DEBUG
47
        case IPPROTO_UDP:
48
            SCLogWarning("UDP is currently unsupported");
49
            break;
50
        default:
51
            SCLogWarning("This protocol is currently unsupported");
52
            break;
53
#endif
54
0
    }
55
0
    return 0;
56
0
}
57
58
/** \brief Run callback for all segments on both directions of the session
59
 *
60
 * Must be called under flow lock.
61
 *
62
 * \return -1 in case of error, the number of segments in case of success.
63
 */
64
int StreamSegmentForSession(
65
        const Packet *p, uint8_t flag, StreamSegmentCallback CallbackFunc, void *data)
66
0
{
67
0
    switch (p->proto) {
68
0
        case IPPROTO_TCP:
69
0
            return StreamTcpSegmentForSession(p, flag, CallbackFunc, data);
70
0
            break;
71
#ifdef DEBUG
72
        case IPPROTO_UDP:
73
            SCLogWarning("UDP is currently unsupported");
74
            break;
75
        default:
76
            SCLogWarning("This protocol is currently unsupported");
77
            break;
78
#endif
79
0
    }
80
0
    return 0;
81
0
}