-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Quentin JEROME <[email protected]>
- Loading branch information
Showing
17 changed files
with
554 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
use super::gen::{self, *}; | ||
use super::{rust_shim_kernel_impl, CoRe}; | ||
|
||
#[allow(non_camel_case_types)] | ||
pub type sock_fprog = CoRe<gen::sock_fprog>; | ||
|
||
impl sock_fprog { | ||
rust_shim_kernel_impl!(pub, sock_fprog, len, u16); | ||
rust_shim_kernel_impl!(pub, sock_fprog, filter, sock_filter); | ||
|
||
pub unsafe fn size(&self) -> Option<usize> { | ||
Some(self.len()? as usize * core::mem::size_of::<gen::sock_filter>()) | ||
} | ||
} | ||
|
||
#[allow(non_camel_case_types)] | ||
pub type sock_fprog_kern = CoRe<gen::sock_fprog_kern>; | ||
|
||
impl sock_fprog_kern { | ||
rust_shim_kernel_impl!(pub, sock_fprog_kern, len, u16); | ||
rust_shim_kernel_impl!(pub, sock_fprog_kern, filter, sock_filter); | ||
|
||
pub unsafe fn byte_size_from_len(len: u16) -> usize { | ||
len as usize * core::mem::size_of::<gen::sock_filter>() | ||
} | ||
|
||
pub unsafe fn byte_size(&self) -> Option<usize> { | ||
Some(Self::byte_size_from_len(self.len()?)) | ||
} | ||
} | ||
|
||
#[allow(non_camel_case_types)] | ||
pub type sock_filter = CoRe<gen::sock_filter>; | ||
|
||
impl sock_filter { | ||
rust_shim_kernel_impl!(pub, sock_filter, code, u16); | ||
rust_shim_kernel_impl!(pub, sock_filter, jt, u8); | ||
rust_shim_kernel_impl!(pub, sock_filter, jf, u8); | ||
rust_shim_kernel_impl!(pub, sock_filter, k, u32); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
use core::str::FromStr; | ||
use kunai_macros::{BpfError, StrEnum}; | ||
use syn::{Attribute, MetaNameValue}; | ||
|
||
|
Oops, something went wrong.