pub trait ProtocolHandler: Send + Sync {
Show 13 methods
// Required methods
fn parse_request(&self, buf: &[u8]) -> Option<String>;
fn parse_response(&self, buf: &[u8]) -> Option<String>;
// Provided methods
fn extract_full_command(&self, buf: &[u8]) -> Option<String> { ... }
fn format_response_detail(&self, buf: &[u8]) -> Option<String> { ... }
fn to_replay_command(&self, ev: &ProxyEvent) -> String { ... }
fn needs_request_buffering(&self) -> bool { ... }
fn needs_response_buffering(&self) -> bool { ... }
fn request_complete(&self, _buf: &[u8]) -> bool { ... }
fn response_complete(&self, _buf: &[u8]) -> bool { ... }
fn is_frame_based(&self) -> bool { ... }
fn message_length(&self, _buf: &[u8]) -> Option<usize> { ... }
fn capture_handshake(
&self,
_payload: &[u8],
_direction: Direction,
) -> HandshakeAction { ... }
fn default_port(&self) -> u16 { ... }
}Expand description
Trait that each protocol implements for parsing and display.
Required Methods§
Sourcefn parse_request(&self, buf: &[u8]) -> Option<String>
fn parse_request(&self, buf: &[u8]) -> Option<String>
Parse request bytes → summary for event list
Sourcefn parse_response(&self, buf: &[u8]) -> Option<String>
fn parse_response(&self, buf: &[u8]) -> Option<String>
Parse response bytes → short summary
Provided Methods§
Sourcefn extract_full_command(&self, buf: &[u8]) -> Option<String>
fn extract_full_command(&self, buf: &[u8]) -> Option<String>
Extract full command from request (for Detail panel, copy, edit)
Sourcefn format_response_detail(&self, buf: &[u8]) -> Option<String>
fn format_response_detail(&self, buf: &[u8]) -> Option<String>
Format response detail (for Detail panel)
Sourcefn to_replay_command(&self, ev: &ProxyEvent) -> String
fn to_replay_command(&self, ev: &ProxyEvent) -> String
Generate a replayable command string (for yank/copy)
Sourcefn needs_request_buffering(&self) -> bool
fn needs_request_buffering(&self) -> bool
Does this protocol need request buffering across reads?
Sourcefn needs_response_buffering(&self) -> bool
fn needs_response_buffering(&self) -> bool
Does this protocol need response buffering across reads?
Sourcefn request_complete(&self, _buf: &[u8]) -> bool
fn request_complete(&self, _buf: &[u8]) -> bool
Is the request buffer complete?
Sourcefn response_complete(&self, _buf: &[u8]) -> bool
fn response_complete(&self, _buf: &[u8]) -> bool
Is the response buffer complete?
Sourcefn is_frame_based(&self) -> bool
fn is_frame_based(&self) -> bool
Is this a frame-based protocol with custom proxy logic? (AMQP)
Sourcefn message_length(&self, _buf: &[u8]) -> Option<usize>
fn message_length(&self, _buf: &[u8]) -> Option<usize>
Length of the first complete message in buf (for discarding unparseable messages). The length should include any header bytes (i.e., total bytes to drain). Returns None if the protocol doesn’t have self-describing message boundaries.
Sourcefn capture_handshake(
&self,
_payload: &[u8],
_direction: Direction,
) -> HandshakeAction
fn capture_handshake( &self, _payload: &[u8], _direction: Direction, ) -> HandshakeAction
In capture mode, should this packet be skipped? (e.g., connection handshake)
handshake_done is false until this method returns HandshakeAction::Done.
Sourcefn default_port(&self) -> u16
fn default_port(&self) -> u16
Default port for this protocol.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".