diff options
| author | luwenpeng <[email protected]> | 2023-08-04 19:35:27 +0800 |
|---|---|---|
| committer | luwenpeng <[email protected]> | 2023-08-04 19:38:39 +0800 |
| commit | da2740daf215f7486ede97169fa3f33d8abdfb62 (patch) | |
| tree | 11a5a08f2926c4859f2d27204dcac153690161f6 /src/protocol | |
| parent | dcef6523773d81e225aadf2f782df2994ed67866 (diff) | |
[feature] Add Packet Handle
* Packet stores the encapsulation headers of each layer
* Packet uses slices to refer to the payload of each protocol layer
Diffstat (limited to 'src/protocol')
| -rw-r--r-- | src/protocol/http.rs | 20 | ||||
| -rw-r--r-- | src/protocol/ipv4.rs | 2 | ||||
| -rw-r--r-- | src/protocol/ipv6.rs | 2 | ||||
| -rw-r--r-- | src/protocol/mod.rs | 3 |
4 files changed, 26 insertions, 1 deletions
diff --git a/src/protocol/http.rs b/src/protocol/http.rs new file mode 100644 index 0000000..de6476f --- /dev/null +++ b/src/protocol/http.rs @@ -0,0 +1,20 @@ +use nom::IResult; + +#[allow(non_camel_case_types)] +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct HTTP_MESSAGE { + // TODO +} + +impl HTTP_MESSAGE { + pub fn new() -> HTTP_MESSAGE { + HTTP_MESSAGE { + // TODO + } + } + pub fn decode(input: &[u8]) -> IResult<&[u8], HTTP_MESSAGE> { + let message = HTTP_MESSAGE::new(); + // TODO + Ok((input, message)) + } +} diff --git a/src/protocol/ipv4.rs b/src/protocol/ipv4.rs index 3aaa182..4f07926 100644 --- a/src/protocol/ipv4.rs +++ b/src/protocol/ipv4.rs @@ -83,6 +83,8 @@ impl IPv4Header { let (input, source_address) = address_v4_decode(input)?; let (input, dest_address) = address_v4_decode(input)?; + // TODO IPv4 Options Decode + Ok(( input, IPv4Header { diff --git a/src/protocol/ipv6.rs b/src/protocol/ipv6.rs index 283172b..f21c4da 100644 --- a/src/protocol/ipv6.rs +++ b/src/protocol/ipv6.rs @@ -82,6 +82,8 @@ impl IPv6Header { let (input, source_address) = address_v6_decode(input)?; let (input, dest_address) = address_v6_decode(input)?; + // TODO IPv6 Ext Header Decode + Ok(( input, IPv6Header { diff --git a/src/protocol/mod.rs b/src/protocol/mod.rs index 3427b8b..31046cb 100644 --- a/src/protocol/mod.rs +++ b/src/protocol/mod.rs @@ -4,4 +4,5 @@ pub mod ipv4; pub mod ipv6; pub mod udp; pub mod tcp; -pub mod dns;
\ No newline at end of file +pub mod dns; +pub mod http;
\ No newline at end of file |
