.. table:: **Index values for multi-integers keyword**
- ========= ================================================
- Value Description
- ========= ================================================
- [default] Match with any index
- any Match with any index
- all Match only if all indexes match
- all1 Match only if all and at least one indexes match
- nb Matches a number of times
- or_absent Match with any index or no values
- 0>= Match specific index
- 0< Match specific index with back to front indexing
- oob_or Match with specific index or index out of bounds
- ========= ================================================
-
-The index ``all`` will match if there is no value.
-The index ``all1`` will not match if there is no value and behaves
-like ``all`` if there is at least one value.
+ ============= ===========================================================
+ Value Description
+ ============= ===========================================================
+ [default] Match with any index
+ any Match with any index
+ all Match only if all and at least one indexes match
+ all_or_absent Match only if all indexes match or matches on an empty list
+ nb x Matches a number of times
+ or_absent Match with any index or matches on an empty list
+ 0>= Match specific index
+ 0< Match specific index with back to front indexing
+ oob_or x Match with specific index or index out of bounds
+ ============= ===========================================================
+
+**Please note that:**
+
+The index ``all`` will not match if there is no value.
+
+The index ``all_or_absent`` will match if there is no value
+and behaves like ``all`` if there is at least one value.
+
These keywords will wait for transaction completion to run, to
be sure to have the final number of elements.
#[derive(Debug, PartialEq)]
pub enum DetectUintIndex {
Any,
+ AllOrAbsent,
All,
- All1,
OrAbsent,
Index((bool, i32)),
NumberMatches(DetectUintData<u32>),
let index = if parts.len() >= 2 {
match parts[1] {
"all" => DetectUintIndex::All,
- "all1" => DetectUintIndex::All1,
+ "all_or_absent" => DetectUintIndex::AllOrAbsent,
"any" => DetectUintIndex::Any,
"or_absent" => DetectUintIndex::OrAbsent,
// not only a literal, but some numeric value
}
return 0;
}
- DetectUintIndex::All => {
+ DetectUintIndex::AllOrAbsent => {
if !eof {
return 0;
}
}
return 1;
}
- DetectUintIndex::All1 => {
+ DetectUintIndex::All => {
if !eof {
return 0;
}
pub const DETECT_VLAN_ID_ANY: i8 = i8::MIN;
pub const DETECT_VLAN_ID_ALL: i8 = i8::MAX;
-pub const DETECT_VLAN_ID_ALL1: i8 = i8::MAX - 1;
+pub const DETECT_VLAN_ID_ALL_OR_ABSENT: i8 = i8::MAX - 1;
pub const DETECT_VLAN_ID_OR_ABSENT: i8 = i8::MAX - 2;
pub const DETECT_VLAN_ID_ERROR: i8 = i8::MAX - 3;
pub static VLAN_MAX_LAYERS: i32 = 3;
// keep previous behavior that vlan.id: all matched only if there was vlan
return Some(DetectUintArrayData {
du: a.du.clone(),
- index: DetectUintIndex::All1,
+ index: DetectUintIndex::All,
start: a.start,
end: a.end,
});
let index = match ctx.layer {
DETECT_VLAN_ID_ANY => DetectUintIndex::Any,
DETECT_VLAN_ID_ALL => DetectUintIndex::All,
- DETECT_VLAN_ID_ALL1 => DetectUintIndex::All1,
+ DETECT_VLAN_ID_ALL_OR_ABSENT => DetectUintIndex::AllOrAbsent,
DETECT_VLAN_ID_OR_ABSENT => DetectUintIndex::OrAbsent,
i => DetectUintIndex::Index((false, i.into())),
};
let layer = match ctx.index {
DetectUintIndex::Any => DETECT_VLAN_ID_ANY,
DetectUintIndex::All => DETECT_VLAN_ID_ALL,
- DetectUintIndex::All1 => DETECT_VLAN_ID_ALL1,
+ DetectUintIndex::AllOrAbsent => DETECT_VLAN_ID_ALL_OR_ABSENT,
DetectUintIndex::OrAbsent => DETECT_VLAN_ID_OR_ABSENT,
DetectUintIndex::Index((_, i)) => i as i8,
DetectUintIndex::NumberMatches(_) => DETECT_VLAN_ID_ERROR,
match ctx.index {
DetectUintIndex::Any => true,
DetectUintIndex::All => true,
- DetectUintIndex::All1 => true,
+ DetectUintIndex::AllOrAbsent => true,
DetectUintIndex::OrAbsent => true,
// do not prefilter for precise index with "or out of bounds"
DetectUintIndex::Index((oob, _)) => !oob,
arg2: 0,
mode: DetectUintMode::DetectUintModeEqual,
},
- index: DetectUintIndex::All1,
+ index: DetectUintIndex::All,
start: 0,
end: 0,
}