Conversation
if no config option is found, as is done for udp Ticket: 6304
Ticket: 6647 Allows keywords using integers to use strings in signature parsing based on a rust enumeration with a derive.
Ticket: 2695
Including the one for websocket over HTTP/2
82a964e to
aff2215
Compare
| _ => #name::Unknown(v), | ||
| } | ||
| } | ||
| pub(crate) fn into_u(&self) -> #utype_str { |
There was a problem hiding this comment.
Because they are standard keywords ?
There was a problem hiding this comment.
Maybe into_u8 and from_u8 to be a little more verbose given the name of the proc macro.
Also, any other enums we can implement this on to show its broader use case?
There was a problem hiding this comment.
any other enums we can implement this on to show its broader use case?
For example http2.errorcode, http2.frametype (checking all http2-specific keywords)
| _ => None | ||
| } | ||
| } | ||
| pub(crate) fn to_detect_ctx(s: &str) -> Option<DetectUintData<#utype_str>> { |
There was a problem hiding this comment.
I think this derive needs a new name as it does more than just to/from strings.
It is helpful when a derive generates the implementation of a trait, like AppLayerEvent as it gives you a place to document the interface that is being generated. AppLayerFrameType is another example.
There was a problem hiding this comment.
More on using a trait. If we create a trait, StringEnumU8, then we should be able to get this method out of the derive, as I think derives should be the minimal amount of code needed.
We could then do something like:
impl From<&dyn StringEnumU8> for DetectUintData {
type Error = ();
fn try_from(value: &dyn MyTrait) -> Result<Self, Self::Error> {
}
}
allowing anything implementing StringEnumU8 to be converted to a DetectUintData through standard interfaces.
There was a problem hiding this comment.
Ok to make a trait.
Not getting your second comment
How can we get the method out of the derive ?
There was a problem hiding this comment.
How can we get the method out of the derive ?
Just implement the From trait for DetectUintData alongside DetectUintData.
There was a problem hiding this comment.
I think I get what you mean.
But I do not really do impl From<&dyn StringEnumU8> for DetectUintData { because I resort to generic integer parsing if this is not an enum string...
So I think the prototype fn to_detect_ctx(s: &str) -> Option<DetectUintData<T>> is right as it takes a string as input
|
ERROR: ERROR: QA failed on SURI_TLPW1_files_sha256. Pipeline 17182 |
|
Replaced by #10093 |
Link to redmine ticket:
https://redmine.openinfosecfoundation.org/issues/2695
https://redmine.openinfosecfoundation.org/issues/6647
Describe changes:
OISF/suricata-verify#1550 justrebased and force-pushed
#10075 with
I think this is good enough for a first version even if there may be improvements (that can happen in later tickets) :
This is a big one as websockets over HTTP/2 only use a single HTTP/2 stream and not the whole TCP connection which keeps having newer regular HTTP/2 streams