"TFTPState",
"TFTPTransaction",
"free",
+ "IPPROTO_TCP",
+ "IPPROTO_UDP",
]
# Types of items that we'll generate. If empty, then all types of item are emitted.
# * "functions":
#
# default: []
-item_types = ["enums","structs","opaque","functions"]
+item_types = ["enums","structs","opaque","functions","constants"]
# Whether applying rules in export.rename prevents export.prefix from applying.
#
pub const APP_LAYER_EVENT_TYPE_TRANSACTION : i32 = 1;
pub const APP_LAYER_EVENT_TYPE_PACKET : i32 = 2;
-// From stream.h.
pub const STREAM_START: u8 = 0x01;
pub const STREAM_EOF: u8 = 0x02;
+pub const STREAM_TOSERVER: u8 = 0x04;
+pub const STREAM_TOCLIENT: u8 = 0x08;
pub const STREAM_GAP: u8 = 0x10;
pub const STREAM_DEPTH: u8 = 0x20;
pub const STREAM_MIDSTREAM:u8 = 0x40;
+pub const STREAM_FLUSH: u8 = 0x80;
pub const DIR_BOTH: u8 = 0b0000_1100;
const DIR_TOSERVER: u8 = 0b0000_0100;
const DIR_TOCLIENT: u8 = 0b0000_1000;
}
}
-// TODO ? export with "constants" in cbindgen
-// and use in outbuf definition for rs_mime_find_header_token
-// but other constants are now defined twice in rust and in C
+// used on the C side
pub const RS_MIME_MAX_TOKEN_LEN: usize = 255;
#[no_mangle]
#include "suricata-common.h"
#include "suricata.h"
+#include "rust.h"
#include "decode.h"
*/
#include "suricata-common.h"
+#include "rust.h"
#include "stream-tcp-private.h"
#include "stream-tcp.h"
#include "stream-tcp-reassemble.h"
#include "flow.h"
-#define STREAM_START BIT_U8(0)
-#define STREAM_EOF BIT_U8(1)
-#define STREAM_TOSERVER BIT_U8(2)
-#define STREAM_TOCLIENT BIT_U8(3)
-#define STREAM_GAP BIT_U8(4) /**< data gap encountered */
-#define STREAM_DEPTH BIT_U8(5) /**< depth reached */
-#define STREAM_MIDSTREAM BIT_U8(6)
-#define STREAM_FLUSH BIT_U8(7)
-
#define STREAM_FLAGS_FOR_PACKET(p) PKT_IS_TOSERVER((p)) ? STREAM_TOSERVER : STREAM_TOCLIENT
typedef int (*StreamSegmentCallback)(const Packet *, void *, const uint8_t *, uint32_t);
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
-#ifndef NAME_MAX
-#define NAME_MAX 255
-#endif
-
#endif /* __SURICATA_COMMON_H__ */
uint8_t *rptr = NULL;
uint32_t blen = 0;
MimeDecEntity *entity = (MimeDecEntity *) state->stack->top->data;
- uint8_t bptr[NAME_MAX];
+ uint8_t bptr[RS_MIME_MAX_TOKEN_LEN];
/* Look for mime header in current line */
ret = FindMimeHeader(buf, len, state);
field = MimeDecFindField(entity, CTNT_DISP_STR);
if (field != NULL) {
bool truncated_name = false;
- // NAME_MAX is RS_MIME_MAX_TOKEN_LEN on the rust side
if (rs_mime_find_header_token(field->value, field->value_len,
(const uint8_t *)"filename", strlen("filename"), &bptr, &blen)) {
SCLogDebug("File attachment found in disposition");
entity->ctnt_flags |= CTNT_IS_ATTACHMENT;
- if (blen > NAME_MAX) {
- blen = NAME_MAX;
+ if (blen > RS_MIME_MAX_TOKEN_LEN) {
+ blen = RS_MIME_MAX_TOKEN_LEN;
truncated_name = true;
}
field = MimeDecFindField(entity, CTNT_TYPE_STR);
if (field != NULL) {
/* Check if child entity boundary definition found */
- // NAME_MAX is RS_MIME_MAX_TOKEN_LEN on the rust side
+ // RS_MIME_MAX_TOKEN_LEN is RS_MIME_MAX_TOKEN_LEN on the rust side
if (rs_mime_find_header_token(field->value, field->value_len,
(const uint8_t *)"boundary", strlen("boundary"), &bptr, &blen)) {
state->found_child = 1;
/* Look for file name (if not already found) */
if (!(entity->ctnt_flags & CTNT_IS_ATTACHMENT)) {
bool truncated_name = false;
- // NAME_MAX is RS_MIME_MAX_TOKEN_LEN on the rust side
if (rs_mime_find_header_token(field->value, field->value_len,
(const uint8_t *)"name", strlen("name"), &bptr, &blen)) {
SCLogDebug("File attachment found");
entity->ctnt_flags |= CTNT_IS_ATTACHMENT;
- if (blen > NAME_MAX) {
- blen = NAME_MAX;
+ if (blen > RS_MIME_MAX_TOKEN_LEN) {
+ blen = RS_MIME_MAX_TOKEN_LEN;
truncated_name = true;
}
FAIL_IF_NOT(msg);
FAIL_IF_NOT(msg->anomaly_flags & ANOM_LONG_FILENAME);
- FAIL_IF_NOT(msg->filename_len == NAME_MAX);
+ FAIL_IF_NOT(msg->filename_len == RS_MIME_MAX_TOKEN_LEN);
MimeDecFreeEntity(msg);
#include "util-log-redis.h"
#endif /* HAVE_LIBHIREDIS */
+#define LOGFILE_NAME_MAX 255
+
static bool LogFileNewThreadedCtx(LogFileCtx *parent_ctx, const char *log_path, const char *append, int i);
// Threaded eve.json identifier
*thread = *parent_ctx;
if (parent_ctx->type == LOGFILE_TYPE_FILE) {
- char fname[NAME_MAX];
+ char fname[LOGFILE_NAME_MAX];
if (!LogFileThreadedName(log_path, fname, sizeof(fname), SC_ATOMIC_ADD(eve_file_id, 1))) {
SCLogError(SC_ERR_MEM_ALLOC, "Unable to create threaded filename for log");
goto error;