Project

General

Profile

Optimization #4154

Rust Parsers: Abstract AppLayer events to a derive macro

Added by Jason Ish 7 months ago. Updated 7 months ago.

Status:
Assigned
Priority:
Normal
Assignee:
Target version:
Effort:
Difficulty:
Label:

Description

Most parsers duplicate code to deal with application layer events. Instead, a parser should be able to define the events in an enum and have the rest of the code generated via a derive macro.

For example, given an enum like:

#[derive(Debug, PartialEq, AppLayerEvent)]
pub enum DNSEvent {
    MalformedData,
    NotRequest,
    NotResponse,
    ZFlagSet,
}

the following utility functions will be generated:

  • from_id
  • as_i32
  • to_cstring
  • from_cstring
  • get_event_info
  • get_event_info_by_id

Related issues

Related to Feature #4153: Rust parsers: Make use of Rust derive style macros to generate common code in parsersAssignedJason IshActions
#1

Updated by Jason Ish 7 months ago

  • Related to Feature #4153: Rust parsers: Make use of Rust derive style macros to generate common code in parsers added
#3

Updated by Victor Julien 7 months ago

  • Target version set to 7.0rc1

Also available in: Atom PDF