• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

OISF / suricata / 23374838686

21 Mar 2026 07:29AM UTC coverage: 59.341% (-20.0%) from 79.315%
23374838686

Pull #15075

github

web-flow
Merge 90b4e834f into 6587e363a
Pull Request #15075: Stack 8001 v16.4

38 of 70 new or added lines in 10 files covered. (54.29%)

34165 existing lines in 563 files now uncovered.

119621 of 201584 relevant lines covered (59.34%)

650666.92 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

83.33
/src/app-layer-frames.h
1
/* Copyright (C) 2021 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
#ifndef SURICATA_APP_LAYER_FRAMES_H
25
#define SURICATA_APP_LAYER_FRAMES_H
26

27
/** special value for matching any type */
28
#define FRAME_ANY_TYPE 62
665,075✔
29
/** max 63 to fit the 64 bit per protocol space */
30
#define FRAME_STREAM_TYPE 63
101,984✔
31

32
typedef int64_t FrameId;
33

34
enum {
35
    FRAME_FLAGE_TX_ID_SET,
36
#define FRAME_FLAG_TX_ID_SET BIT_U8(FRAME_FLAGE_TX_ID_SET)
163,789✔
37
    FRAME_FLAGE_ENDS_AT_EOF,
38
#define FRAME_FLAG_ENDS_AT_EOF BIT_U8(FRAME_FLAGE_ENDS_AT_EOF)
20,127✔
39
    FRAME_FLAGE_LOGGED,
UNCOV
40
#define FRAME_FLAG_LOGGED BIT_U8(FRAME_FLAGE_LOGGED)
×
41
};
42

43
typedef struct Frame {
44
    uint8_t type;  /**< protocol specific field type. E.g. NBSS.HDR or SMB.DATA */
45
    uint8_t flags; /**< frame flags: FRAME_FLAG_* */
46
    uint8_t event_cnt;
47
    // TODO one event per frame enough?
48
    uint8_t events[4];  /**< per frame store for events */
49
    uint64_t offset;    /**< offset from the start of the stream */
50
    int64_t len;
51
    int64_t id;
52
    uint64_t tx_id; /**< tx_id to match this frame. UINT64T_MAX if not used. */
53
    uint64_t inspect_progress; /**< inspection tracker relative to the start of the frame */
54
} Frame;
55

56
#define FRAMES_STATIC_CNT 3
84,751,859✔
57

58
typedef struct Frames {
59
    uint16_t cnt;
60
    uint16_t dyn_size;     /**< size in elements of `dframes` */
61
    uint32_t left_edge_rel;
62
    uint64_t base_id;
63
    Frame sframes[FRAMES_STATIC_CNT]; /**< static frames */
64
    Frame *dframes;                   /**< dynamically allocated space for more frames */
65
#ifdef DEBUG
66
    uint8_t ipproto;
67
    AppProto alproto;
68
#endif
69
} Frames;
70

71
typedef struct FramesContainer {
72
    Frames toserver;
73
    Frames toclient;
74
} FramesContainer;
75

76
void FramesFree(Frames *frames);
77
#ifndef SURICATA_BINDGEN_H
78
// do not let bindgen see Packet
79
void FramesPrune(Flow *f, Packet *p);
80
#endif
81

82
Frame *AppLayerFrameNewByPointer(Flow *f, const StreamSlice *stream_slice,
83
        const uint8_t *frame_start, const int64_t len, int dir, uint8_t frame_type);
84
Frame *SCAppLayerFrameNewByRelativeOffset(Flow *f, const void *stream_slice,
85
        const uint32_t frame_start_rel, const int64_t len, int dir, uint8_t frame_type);
86
Frame *AppLayerFrameNewByAbsoluteOffset(Flow *f, const StreamSlice *stream_slice,
87
        const uint64_t frame_start, const int64_t len, int dir, uint8_t frame_type);
88
void AppLayerFrameDump(Flow *f);
89

90
Frame *FrameGetByIndex(Frames *frames, const uint32_t idx);
91
Frame *FrameGetById(Frames *frames, const int64_t id);
92
Frame *FrameGetLastOpenByType(Frames *frames, const uint8_t frame_type);
93

94
Frame *AppLayerFrameGetById(const Flow *f, const int direction, const FrameId frame_id);
95
Frame *AppLayerFrameGetLastOpenByType(Flow *f, const int direction, const uint8_t frame_type);
96

97
void AppLayerFrameAddEvent(Frame *frame, uint8_t e);
98
void SCAppLayerFrameAddEventById(const Flow *f, const int dir, const FrameId id, uint8_t e);
99
void AppLayerFrameSetLength(Frame *frame, int64_t len);
100
void SCAppLayerFrameSetLengthById(const Flow *f, const int dir, const FrameId id, int64_t len);
101
void AppLayerFrameSetTxId(Frame *r, uint64_t tx_id);
102
void SCAppLayerFrameSetTxIdById(const Flow *f, const int dir, const FrameId id, uint64_t tx_id);
103

104
void AppLayerFramesSlide(Flow *f, const uint32_t slide, const uint8_t direction);
105

106
FramesContainer *AppLayerFramesGetContainer(const Flow *f);
107
FramesContainer *AppLayerFramesSetupContainer(Flow *f);
108

109
void FrameConfigInit(void);
110
void FrameConfigDeInit(void);
111
void FrameConfigEnableAll(void);
112
void FrameConfigEnable(const AppProto p, const uint8_t type);
113

114
#endif
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc