Skip to main content

Module raw

Module raw 

Source
Expand description

Raw Layer Implementation

The Raw layer represents arbitrary payload data that doesn’t match any known protocol. It’s useful for:

  • Carrying application-level payloads
  • Storing unparsed or unknown protocol data
  • Building custom packets with arbitrary content

§Example

use stackforge_core::layer::raw::{RawLayer, RawBuilder};
use stackforge_core::LayerIndex;

// Build a raw payload
let data = RawBuilder::new()
    .load(b"Hello, World!")
    .build();

assert_eq!(&data, b"Hello, World!");

// Build from string
let text = RawBuilder::from_str("GET / HTTP/1.1\r\n").build();
assert_eq!(&text, b"GET / HTTP/1.1\r\n");

// Build with hex data
let hex = RawBuilder::from_hex("deadbeef").unwrap().build();
assert_eq!(&hex, &[0xde, 0xad, 0xbe, 0xef]);

Structs§

RawBuilder
Builder for constructing Raw layer payloads.
RawLayer
A layer representing raw (unparsed) payload data.

Constants§

RAW_FIELDS
Field names for the Raw layer.

Functions§

raw_show_fields
Display fields for Raw layer in show() output.