Home
last modified time | relevance | path

Searched refs:u8 (Results 1 – 25 of 63) sorted by relevance

123

/smoltcp-0.9.1/src/wire/
Ddhcpv4.rs20 pub enum OpCode(u8) {
28 pub enum MessageType(u8) {
65 buffer: &'a mut [u8],
69 pub fn new(buffer: &'a mut [u8]) -> Self { in new()
75 if option.data.len() > u8::MAX as _ { in emit()
109 pub kind: u8,
110 pub data: &'a [u8],
116 pub struct Packet<T: AsRef<[u8]>> {
144 pub const OPT_END: u8 = 255;
145 pub const OPT_PAD: u8 = 0;
[all …]
Darp.rs26 pub struct Packet<T: AsRef<[u8]>> {
42 pub const fn SHA(hardware_len: u8, _protocol_len: u8) -> Field { in SHA() argument
48 pub const fn SPA(hardware_len: u8, protocol_len: u8) -> Field { in SPA() argument
54 pub const fn THA(hardware_len: u8, protocol_len: u8) -> Field { in THA() argument
60 pub const fn TPA(hardware_len: u8, protocol_len: u8) -> Field { in TPA() argument
66 impl<T: AsRef<[u8]>> Packet<T> {
125 pub fn hardware_len(&self) -> u8 { in hardware_len() argument
132 pub fn protocol_len(&self) -> u8 { in protocol_len() argument
146 pub fn source_hardware_addr(&self) -> &[u8] { in source_hardware_addr() argument
152 pub fn source_protocol_addr(&self) -> &[u8] { in source_protocol_addr() argument
[all …]
Dipv6routing.rs9 pub enum Type(u8) {
55 pub struct Header<T: AsRef<[u8]>> {
94 pub const fn DATA(length_field: u8) -> Field { in DATA()
137 pub const fn ADDRESSES(length_field: u8) -> Field { in ADDRESSES()
144 impl<T: AsRef<[u8]>> Header<T> {
201 pub fn header_len(&self) -> u8 { in header_len() argument
215 pub fn segments_left(&self) -> u8 { in segments_left() argument
222 impl<T: AsRef<[u8]>> Header<T> {
234 impl<T: AsRef<[u8]>> Header<T> {
239 pub fn cmpr_i(&self) -> u8 { in cmpr_i() argument
[all …]
Dethernet.rs29 pub struct Address(pub [u8; 6]);
39 pub fn from_bytes(data: &[u8]) -> Address { in from_bytes()
46 pub const fn as_bytes(&self) -> &[u8] { in as_bytes() argument
85 pub struct Frame<T: AsRef<[u8]>> {
101 impl<T: AsRef<[u8]>> Frame<T> {
167 impl<'a, T: AsRef<[u8]> + ?Sized> Frame<&'a T> {
170 pub fn payload(&self) -> &'a [u8] { in payload() argument
176 impl<T: AsRef<[u8]> + AsMut<[u8]>> Frame<T> {
200 pub fn payload_mut(&mut self) -> &mut [u8] { in payload_mut() argument
206 impl<T: AsRef<[u8]>> AsRef<[u8]> for Frame<T> {
[all …]
Dndiscoption.rs13 pub enum Type(u8) {
42 pub struct PrefixInfoFlags: u8 {
53 pub struct NdiscOption<T: AsRef<[u8]>> {
78 pub const fn DATA(length: u8) -> Field { in DATA()
146 impl<T: AsRef<[u8]>> NdiscOption<T> {
210 pub fn data_len(&self) -> u8 { in data_len() argument
217 impl<T: AsRef<[u8]>> NdiscOption<T> {
228 impl<T: AsRef<[u8]>> NdiscOption<T> {
238 impl<T: AsRef<[u8]>> NdiscOption<T> {
241 pub fn prefix_len(&self) -> u8 { in prefix_len() argument
[all …]
Dsixlowpan.rs15 pub struct AddressContext(pub [u8; ADDRESS_CONTEXT_LENGTH]);
32 FullInline(&'a [u8]),
36 InLine64bits(&'a [u8]),
40 InLine16bits(&'a [u8]),
47 Multicast48bits(&'a [u8]),
49 Multicast32bits(&'a [u8]),
51 Multicast8bits(&'a [u8]),
57 const LINK_LOCAL_PREFIX: [u8; 2] = [0xfe, 0x80];
58 const EUI64_MIDDLE_VALUE: [u8; 2] = [0xff, 0xfe];
68 let copy_context = |index: usize, bytes: &mut [u8]| -> Result<()> { in resolve()
[all …]
Dipv6.rs31 pub struct Address(pub [u8; ADDR_SIZE]);
66 pub const IPV4_MAPPED_PREFIX: [u8; IPV4_MAPPED_PREFIX_SIZE] =
82 (a0 >> 8) as u8, in new()
83 a0 as u8, in new()
84 (a1 >> 8) as u8, in new()
85 a1 as u8, in new()
86 (a2 >> 8) as u8, in new()
87 a2 as u8, in new()
88 (a3 >> 8) as u8, in new()
89 a3 as u8, in new()
[all …]
Dipv6hopbyhop.rs10 pub struct Header<T: AsRef<[u8]>> {
45 pub const fn OPTIONS(length_field: u8) -> Field { in OPTIONS()
51 impl<T: AsRef<[u8]>> Header<T> {
105 pub fn header_len(&self) -> u8 { in header_len() argument
111 impl<'a, T: AsRef<[u8]> + ?Sized> Header<&'a T> {
114 pub fn options(&self) -> &'a [u8] { in options() argument
120 impl<T: AsRef<[u8]> + AsMut<[u8]>> Header<T> {
131 pub fn set_header_len(&mut self, value: u8) { in set_header_len() argument
137 impl<'a, T: AsRef<[u8]> + AsMut<[u8]> + ?Sized> Header<&'a mut T> {
140 pub fn options_mut(&mut self) -> &mut [u8] { in options_mut() argument
[all …]
Dmld.rs18 pub enum RecordType(u8) {
40 impl<T: AsRef<[u8]>> Packet<T> {
64 pub fn qrv(&self) -> u8 { in qrv() argument
71 pub fn qqic(&self) -> u8 { in qqic() argument
88 impl<T: AsRef<[u8]>> Packet<T> {
101 impl<T: AsRef<[u8]> + AsMut<[u8]>> Packet<T> {
133 pub fn set_qrv(&mut self, value: u8) { in set_qrv() argument
141 pub fn set_qqic(&mut self, value: u8) { in set_qqic() argument
158 impl<T: AsRef<[u8]> + AsMut<[u8]>> Packet<T> {
170 pub struct AddressRecord<T: AsRef<[u8]>> {
[all …]
Dipv6option.rs6 pub enum Type(u8) {
27 pub enum FailureType(u8) {
54 let raw: u8 = other.into(); in from()
62 pub struct Ipv6Option<T: AsRef<[u8]>> {
84 pub const fn DATA(length: u8) -> Field { in DATA()
89 impl<T: AsRef<[u8]>> Ipv6Option<T> {
153 pub fn data_len(&self) -> u8 { in data_len() argument
159 impl<'a, T: AsRef<[u8]> + ?Sized> Ipv6Option<&'a T> {
165 pub fn data(&self) -> &'a [u8] { in data() argument
172 impl<T: AsRef<[u8]> + AsMut<[u8]>> Ipv6Option<T> {
[all …]
Dipv4.rs40 pub struct Address(pub [u8; ADDR_SIZE]);
56 pub const fn new(a0: u8, a1: u8, a2: u8, a3: u8) -> Address { in new() argument
64 pub fn from_bytes(data: &[u8]) -> Address { in from_bytes()
71 pub const fn as_bytes(&self) -> &[u8] { in as_bytes() argument
153 prefix_len: u8,
162 pub const fn new(address: Address, prefix_len: u8) -> Cidr { in new()
178 prefix_len: netmask.count_ones() as u8, in from_netmask()
191 pub const fn prefix_len(&self) -> u8 { in prefix_len() argument
203 ((number >> 24) & 0xff) as u8, in netmask()
204 ((number >> 16) & 0xff) as u8, in netmask()
[all …]
Dicmpv4.rs11 pub enum Message(u8) {
55 pub enum DstUnreachable(u8) {
119 pub enum Redirect(u8) {
133 pub enum TimeExceeded(u8) {
153 pub enum ParamProblem(u8) {
166 pub struct Packet<T: AsRef<[u8]>> {
185 impl<T: AsRef<[u8]>> Packet<T> {
230 pub fn msg_code(&self) -> u8 { in msg_code() argument
287 impl<'a, T: AsRef<[u8]> + ?Sized> Packet<&'a T> {
290 pub fn data(&self) -> &'a [u8] { in data() argument
[all …]
Dieee802154.rs10 pub enum FrameType(u8) {
37 pub enum AddressingMode(u8) {
76 pub fn as_bytes(&self) -> [u8; 2] { in as_bytes()
88 Short([u8; 2]),
89 Extended([u8; 8]),
113 const fn short_from_bytes(a: [u8; 2]) -> Self { in short_from_bytes()
117 const fn extended_from_bytes(a: [u8; 8]) -> Self { in extended_from_bytes()
121 pub fn from_bytes(a: &[u8]) -> Self { in from_bytes()
135 pub const fn as_bytes(&self) -> &[u8] { in as_bytes() argument
144 pub fn as_eui_64(&self) -> Option<[u8; 8]> { in as_eui_64()
[all …]
Dudp.rs12 pub struct Packet<T: AsRef<[u8]>> {
34 impl<T: AsRef<[u8]>> Packet<T> {
134 impl<'a, T: AsRef<[u8]> + ?Sized> Packet<&'a T> {
137 pub fn payload(&self) -> &'a [u8] { in payload() argument
144 impl<T: AsRef<[u8]> + AsMut<[u8]>> Packet<T> {
196 pub fn payload_mut(&mut self) -> &mut [u8] { in payload_mut() argument
203 impl<T: AsRef<[u8]>> AsRef<[u8]> for Packet<T> {
204 fn as_ref(&self) -> &[u8] { in as_ref() argument
226 T: AsRef<[u8]> + ?Sized, in parse()
260 T: AsRef<[u8]> + AsMut<[u8]>, in emit_header() argument
[all …]
Digmp.rs12 pub enum Message(u8) {
27 pub struct Packet<T: AsRef<[u8]>> {
55 impl<T: AsRef<[u8]>> Packet<T> {
99 pub fn max_resp_code(&self) -> u8 { in max_resp_code() argument
132 impl<T: AsRef<[u8]> + AsMut<[u8]>> Packet<T> {
143 pub fn set_max_resp_code(&mut self, value: u8) { in set_max_resp_code() argument
206 T: AsRef<[u8]> + ?Sized, in parse()
257 T: AsRef<[u8]> + AsMut<[u8]> + ?Sized, in emit()
295 fn max_resp_code_to_duration(value: u8) -> Duration { in max_resp_code_to_duration()
307 const fn duration_to_max_resp_code(duration: Duration) -> u8 { in duration_to_max_resp_code() argument
[all …]
Dicmpv6.rs14 pub enum Message(u8) {
51 (u8::from(*self) & 0x80) != 0x80 in is_error()
104 pub enum DstUnreachable(u8) {
144 pub enum ParamProblem(u8) {
167 pub enum TimeExceeded(u8) {
188 pub struct Packet<T: AsRef<[u8]>> {
248 impl<T: AsRef<[u8]>> Packet<T> {
289 pub fn msg_code(&self) -> u8 { in msg_code() argument
371 impl<'a, T: AsRef<[u8]> + ?Sized> Packet<&'a T> {
374 pub fn payload(&self) -> &'a [u8] { in payload() argument
[all …]
Ddns.rs16 pub enum Opcode(u8) {
23 pub enum Rcode(u8) {
80 pub struct Packet<T: AsRef<[u8]>> {
84 impl<T: AsRef<[u8]>> Packet<T> {
117 pub fn payload(&self) -> &[u8] { in payload() argument
134 Opcode::from((flags >> 11 & 0xF) as u8) in opcode()
140 Rcode::from((flags & 0xF) as u8) in rcode()
164 pub fn parse_name<'a>(&'a self, mut bytes: &'a [u8]) -> impl Iterator<Item = Result<&'a [u8]>> { in parse_name()
213 impl<T: AsRef<[u8]> + AsMut<[u8]>> Packet<T> {
214 pub fn payload_mut(&mut self) -> &mut [u8] { in payload_mut() argument
[all …]
Dndisc.rs14 pub struct RouterFlags: u8 {
22 pub struct NeighborFlags: u8 {
33 impl<T: AsRef<[u8]>> Packet<T> {
36 pub fn current_hop_limit(&self) -> u8 { in current_hop_limit() argument
76 impl<T: AsRef<[u8]>> Packet<T> {
89 impl<T: AsRef<[u8]>> Packet<T> {
102 impl<T: AsRef<[u8]>> Packet<T> {
115 impl<T: AsRef<[u8]> + AsMut<[u8]>> Packet<T> {
118 pub fn set_current_hop_limit(&mut self, value: u8) { in set_current_hop_limit() argument
157 impl<T: AsRef<[u8]> + AsMut<[u8]>> Packet<T> {
[all …]
Dtcp.rs72 pub struct Packet<T: AsRef<[u8]>> {
90 pub const fn OPTIONS(length: u8) -> Field { in OPTIONS()
104 pub const OPT_END: u8 = 0x00;
105 pub const OPT_NOP: u8 = 0x01;
106 pub const OPT_MSS: u8 = 0x02;
107 pub const OPT_WS: u8 = 0x03;
108 pub const OPT_SACKPERM: u8 = 0x04;
109 pub const OPT_SACKRNG: u8 = 0x05;
114 impl<T: AsRef<[u8]>> Packet<T> {
259 pub fn header_len(&self) -> u8 { in header_len() argument
[all …]
Dipv6fragment.rs11 pub struct Header<T: AsRef<[u8]>> {
37 impl<T: AsRef<[u8]>> Header<T> {
100 impl<T: AsRef<[u8]> + AsMut<[u8]>> Header<T> {
136 let raw = (data[3] & 0xfe) | (value as u8 & 0x1); in set_more_frags()
148 impl<'a, T: AsRef<[u8]> + ?Sized> fmt::Display for Header<&'a T> {
179 T: AsRef<[u8]> + ?Sized, in parse()
196 pub fn emit<T: AsRef<[u8]> + AsMut<[u8]> + ?Sized>(&self, header: &mut Header<&mut T>) { in emit()
220 static BYTES_HEADER_MORE_FRAG: [u8; 8] = [0x6, 0x0, 0x0, 0x1, 0x0, 0x0, 0x30, 0x39];
223 static BYTES_HEADER_LAST_FRAG: [u8; 8] = [0x6, 0x0, 0xa, 0x0, 0x0, 0x1, 0x9, 0x32];
/smoltcp-0.9.1/src/phy/
Dfault_injector.rs21 corrupt_pct: u8,
22 drop_pct: u8,
39 fn maybe(&mut self, pct: u8) -> bool { in maybe()
43 fn corrupt<T: AsMut<[u8]>>(&mut self, mut buffer: T) { in corrupt()
47 let bit = 1 << (xorshift32(&mut self.rng_seed) % 8) as u8; in corrupt()
98 rx_buf: [u8; MTU],
123 pub fn corrupt_chance(&self) -> u8 { in corrupt_chance() argument
128 pub fn drop_chance(&self) -> u8 { in drop_chance() argument
156 pub fn set_corrupt_chance(&mut self, pct: u8) { in set_corrupt_chance() argument
167 pub fn set_drop_chance(&mut self, pct: u8) { in set_drop_chance() argument
[all …]
Dloopback.rs10 pub(crate) queue: VecDeque<Vec<u8>>,
59 buffer: Vec<u8>,
65 F: FnOnce(&mut [u8]) -> R, in consume()
74 queue: &'a mut VecDeque<Vec<u8>>,
80 F: FnOnce(&mut [u8]) -> R, in consume()
Dtracer.rs97 F: FnOnce(&mut [u8]) -> R, in consume()
124 F: FnOnce(&mut [u8]) -> R, in consume()
142 buffer: &'a [u8],
152 Medium::Ethernet => crate::wire::EthernetFrame::<&'static [u8]>::pretty_print( in fmt()
161 crate::wire::Ipv4Packet::<&'static [u8]>::pretty_print( in fmt()
169 crate::wire::Ipv6Packet::<&'static [u8]>::pretty_print( in fmt()
/smoltcp-0.9.1/fuzz/fuzz_targets/
Dtcp_headers.rs40 struct TcpHeaderFuzzer([u8; 56], usize);
49 pub fn new(data: &[u8]) -> TcpHeaderFuzzer { in new()
62 fn fuzz_packet(&self, frame_data: &mut [u8]) { in fuzz_packet() argument
69 EthernetFrame::<&mut [u8]>::header_len() in fuzz_packet()
111 fn fuzz_packet(&self, _: &mut [u8]) {} in fuzz_packet() argument
114 fuzz_target!(|data: &[u8]| {
146 static mut TCP_SERVER_RX_DATA: [u8; 1024] = [0; 1024];
147 static mut TCP_SERVER_TX_DATA: [u8; 1024] = [0; 1024];
154 static mut TCP_CLIENT_RX_DATA: [u8; 1024] = [0; 1024];
155 static mut TCP_CLIENT_TX_DATA: [u8; 1024] = [0; 1024];
/smoltcp-0.9.1/src/socket/
Ddns.rs79 name: Vec<u8, DNS_MAX_NAME_SIZE>,
119 hop_limit: Option<u8>,
151 pub fn hop_limit(&self) -> Option<u8> { in hop_limit() argument
166 pub fn set_hop_limit(&mut self, hop_limit: Option<u8>) { in set_hop_limit() argument
216 let mut raw_name: Vec<u8, DNS_MAX_NAME_SIZE> = Vec::new(); in start_query()
237 .push(s.len() as u8) in start_query()
259 raw_name: &[u8], in start_query_raw() argument
354 payload: &[u8], in process() argument
505 F: FnOnce(&mut Context, (IpRepr, UdpRepr, &[u8])) -> Result<(), E>, in dispatch()
632 mut a: impl Iterator<Item = wire::Result<&'a [u8]>>, in eq_names()
[all …]

123