Home
last modified time | relevance | path

Searched refs:len (Results 1 – 25 of 68) sorted by relevance

123

/smoltcp-0.9.1/src/storage/
Dring_buffer.rs56 self.storage.len() in capacity()
71 pub fn len(&self) -> usize { in len() method
77 self.capacity() - self.len() in window()
88 self.len() == 0 in is_empty()
99 let len = self.capacity(); in get_idx() localVariable
100 if len > 0 { in get_idx()
101 (self.read_at + idx) % len in get_idx()
207 let size = cmp::min(size, buf.len()); in enqueue_many()
221 let size = cmp::min(buf.len(), data.len()); in enqueue_slice()
226 let size = cmp::min(buf.len(), data.len()); in enqueue_slice()
[all …]
Dpacket_buffer.rs116 debug_assert!(payload_buf.len() == size); in enqueue()
189 debug_assert!(payload_buf.len() >= metadata.size); in dequeue_with()
211 debug_assert!(payload_buf.len() == meta.size); in dequeue()
263 assert_eq!(buffer.metadata_ring.len(), 1); in test_simple()
273 assert_eq!(buffer.metadata_ring.len(), 1); in test_peek()
286 assert_eq!(buffer.metadata_ring.len(), 3); in test_padding()
290 assert_eq!(buffer.metadata_ring.len(), 0); in test_padding()
311 assert_eq!(buffer.metadata_ring.len(), 3); in test_dequeue_with()
318 assert_eq!(buffer.metadata_ring.len(), 1); in test_dequeue_with()
326 assert_eq!(buffer.metadata_ring.len(), 0); in test_dequeue_with()
[all …]
Dassembler.rs126 self.contigs[self.contigs.len() - 1] in back()
138 for i in at..self.contigs.len() - 1 { in remove_contig_at()
146 self.contigs[self.contigs.len() - 1] = Contig::empty(); in remove_contig_at()
155 for i in (at + 1..self.contigs.len()).rev() { in add_contig_at()
174 if i == self.contigs.len() { in add()
213 while j < self.contigs.len() in add()
222 for x in i + 1..self.contigs.len() { in add()
241 if i + 1 < self.contigs.len() && self.contigs[i + 1].has_data() { in add()
324 while data_range.is_none() && self.index < self.assembler.contigs.len() { in next()
700 let wanted_res = if contigs.len() > ASSEMBLER_MAX_SEGMENT_COUNT { in test_random()
/smoltcp-0.9.1/src/wire/
Dipv6hopbyhop.rs75 let len = data.len(); in check_len() localVariable
77 if len < field::MIN_HEADER_SIZE { in check_len()
83 if len < of.end { in check_len()
142 let len = data[field::LENGTH]; in options_mut() localVariable
143 &mut data[field::OPTIONS(len)] in options_mut()
274 Header::new_unchecked(&bytes).options().len(), in test_overlong()
275 REPR_PACKET_PAD4[2..].len() in test_overlong()
278 Header::new_unchecked(&mut bytes).options_mut().len(), in test_overlong()
279 REPR_PACKET_PAD4[2..].len() in test_overlong()
287 Header::new_unchecked(&bytes).options().len(), in test_overlong()
[all …]
Ddns.rs104 let len = self.buffer.as_ref().len(); in check_len() localVariable
105 if len < field::HEADER_END { in check_len()
174 let len = (x & 0x3F) as usize; in parse_name() localVariable
175 if bytes.len() < 1 + len { in parse_name()
178 let label = &bytes[1..1 + len]; in parse_name()
179 bytes = &bytes[1 + len..]; in parse_name()
183 if bytes.len() < 2 { in parse_name()
188 if packet.len() <= ptr { in parse_name()
270 let len = (x & 0x3F) as usize; in parse_name_part() localVariable
271 let label = bytes.get(..len).ok_or(Error)?; in parse_name_part()
[all …]
Dsixlowpan.rs69 if index >= addr_context.len() { in resolve()
133 bytes[16 - inline.len()..].copy_from_slice(inline); in resolve()
138 bytes[16 - inline.len()..].copy_from_slice(inline); in resolve()
301 DISPATCH_FIRST_FRAGMENT_HEADER if buffer.len() >= FIRST_FRAGMENT_HEADER_SIZE => { in check_len()
304 DISPATCH_FIRST_FRAGMENT_HEADER if buffer.len() < FIRST_FRAGMENT_HEADER_SIZE => { in check_len()
307 DISPATCH_FRAGMENT_HEADER if buffer.len() >= NEXT_FRAGMENT_HEADER_SIZE => Ok(()), in check_len()
308 DISPATCH_FRAGMENT_HEADER if buffer.len() < NEXT_FRAGMENT_HEADER_SIZE => Err(Error), in check_len()
563 if buffer.len() < 2 { in check_len()
574 if offset as usize > buffer.len() { in check_len()
897 let mut len = self.ip_fields_start(); in header_len() localVariable
[all …]
Ddhcpv4.rs75 if option.data.len() > u8::MAX as _ { in emit()
79 let total_len = 2 + option.data.len(); in emit()
80 if self.buffer.len() < total_len { in emit()
88 buf[1] = option.data.len() as _; in emit()
255 let len = self.buffer.as_ref().len(); in check_len() localVariable
256 if len < field::MAGIC_NUMBER.end { in check_len()
375 if buf.len() < 2 { in options()
379 let len = buf[1] as usize; in options() localVariable
381 if buf.len() < 2 + len { in options()
387 data: &buf[2..2 + len], in options()
[all …]
Dndiscoption.rs176 let len = data.len(); in check_len() localVariable
178 if len < field::MIN_OPT_LEN { in check_len()
182 if len < data_range.end { in check_len()
221 let len = MAX_HARDWARE_ADDRESS_LEN.min(self.data_len() as usize * 8 - 2); in link_layer_addr() localVariable
223 RawHardwareAddress::from_bytes(&data[2..len + 2]) in link_layer_addr()
277 let len = self.data_len(); in data() localVariable
279 &data[field::DATA(len)] in data()
306 data[2..2 + addr.len()].copy_from_slice(addr.as_bytes()) in set_link_layer_addr()
377 let len = self.data_len(); in data_mut() localVariable
379 &mut data[field::DATA(len)] in data_mut()
[all …]
Dudp.rs59 let buffer_len = self.buffer.as_ref().len(); in check_len()
63 let field_len = self.len() as usize; in check_len()
93 pub fn len(&self) -> u16 { in len() method
128 checksum::pseudo_header(src_addr, dst_addr, IpProtocol::Udp, self.len() as u32), in verify_checksum()
129 checksum::data(&data[..self.len() as usize]), in verify_checksum()
138 let length = self.len(); in payload()
183 checksum::pseudo_header(src_addr, dst_addr, IpProtocol::Udp, self.len() as u32), in fill_checksum()
184 checksum::data(&data[..self.len() as usize]), in fill_checksum()
197 let length = self.len(); in payload_mut()
303 self.payload().len() in fmt()
[all …]
Dipv6option.rs113 let len = data.len(); in check_len() localVariable
115 if len < field::LENGTH { in check_len()
123 if len == field::LENGTH { in check_len()
129 if len < df.end { in check_len()
166 let len = self.data_len(); in data() localVariable
168 &data[field::DATA(len)] in data()
198 let len = self.data_len(); in data_mut() localVariable
200 &mut data[field::DATA(len)] in data_mut()
260 Repr::PadN(len) => { in emit()
262 opt.set_data_len(len); in emit()
[all …]
Dicmpv4.rs208 let len = self.buffer.as_ref().len(); in check_len() localVariable
209 if len < field::HEADER_END { in check_len()
426 if payload.len() < 8 { in parse()
436 payload_len: payload.len(), in parse()
449 if payload.len() < 8 { in parse()
459 payload_len: payload.len(), in parse()
474 field::ECHO_SEQNO.end + data.len() in buffer_len()
478 field::UNUSED.end + header.buffer_len() + data.len() in buffer_len()
500 let data_len = cmp::min(packet.data_mut().len(), data.len()); in emit()
513 let data_len = cmp::min(packet.data_mut().len(), data.len()); in emit()
[all …]
Dieee802154.rs122 if a.len() == 2 { in from_bytes()
126 } else if a.len() == 8 { in from_bytes()
261 if self.buffer.as_ref().len() < 3 { in check_len()
275 if offset > self.buffer.as_ref().len() { in check_len()
467 index += self.addressing_fields().unwrap().len(); in aux_security_header_start()
478 index += if let Some(len) = self.key_identifier_length() { in payload_start()
479 len as usize in payload_start()
524 let length = if let Some(len) = self.key_identifier_length() { in key_identifier()
525 len as usize in key_identifier()
535 let len = ki.len(); in key_source() localVariable
[all …]
Dmod.rs373 len: u8, field
381 data[..addr.len()].copy_from_slice(addr); in from_bytes()
384 len: addr.len() as u8, in from_bytes()
390 &self.data[..self.len as usize] in as_bytes()
393 pub const fn len(&self) -> usize { in len() method
394 self.len as usize in len()
398 self.len == 0 in is_empty()
405 if self.len() < 6 { in parse()
414 if self.len() < 8 { in parse()
Dipv6.rs116 assert!(data.len() >= 8); in from_parts()
129 assert!(data.len() >= 8); in write_parts()
313 b[..Self::IPV4_MAPPED_PREFIX.len()].copy_from_slice(&Self::IPV4_MAPPED_PREFIX); in from()
314 b[Self::IPV4_MAPPED_PREFIX.len()..].copy_from_slice(&address.0); in from()
468 let len = self.buffer.as_ref().len(); in check_len() localVariable
469 if len < field::DST_ADDR.end || len < self.total_len() { in check_len()
1096 assert_eq!(packet.payload_len() as usize, REPR_PAYLOAD_BYTES.len()); in test_packet_deconstruction()
1139 let start = expected_bytes.len() - REPR_PAYLOAD_BYTES.len(); in test_packet_construction()
1152 Packet::new_unchecked(&bytes).payload().len(), in test_overlong()
1153 REPR_PAYLOAD_BYTES.len() in test_overlong()
[all …]
Dicmpv6.rs267 let len = self.buffer.as_ref().len(); in check_len() localVariable
268 if len < field::HEADER_END || len < self.header_len() { in check_len()
365 checksum::pseudo_header(src_addr, dst_addr, IpProtocol::Icmpv6, data.len() as u32), in verify_checksum()
477 checksum::pseudo_header(src_addr, dst_addr, IpProtocol::Icmpv6, data.len() as u32), in fill_checksum()
559 if payload.len() < 8 { in parse()
566 payload_len: payload.len(), in parse()
634 field::UNUSED.end + header.buffer_len() + data.len() in buffer_len()
637 field::ECHO_SEQNO.end + data.len() in buffer_len()
716 let data_len = cmp::min(packet.payload_mut().len(), data.len()); in emit()
729 let data_len = cmp::min(packet.payload_mut().len(), data.len()); in emit()
/smoltcp-0.9.1/src/iface/
Dfragmentation.rs74 if self.buffer.len() < size { in set_total_size()
79 if self.buffer.len() < size { in set_total_size()
97 if self.buffer.len() < offset { in add_with()
101 let len = f(&mut self.buffer[offset..])?; in add_with() localVariable
102 assert!(offset + len <= self.buffer.len()); in add_with()
106 len, in add_with()
110 self.assembler.add(offset, len); in add_with()
122 if self.buffer.len() < offset + data.len() { in add()
127 if self.buffer.len() < offset + data.len() { in add()
128 self.buffer.resize(offset + data.len(), 0); in add()
[all …]
/smoltcp-0.9.1/src/phy/sys/
Dbpf.rs115 let len = libc::read( in recv() localVariable
118 buffer.len(), in recv()
121 if len == -1 || len < BPF_HDRLEN as isize { in recv()
125 let len = len as usize; in recv() localVariable
130 len - BPF_HDRLEN, in recv()
133 Ok(len) in recv()
139 let len = libc::write( in send() localVariable
142 buffer.len(), in send()
145 if len == -1 { in send()
149 Ok(len as usize) in send()
Draw_socket.rs80 let len = libc::recv( in recv() localVariable
83 buffer.len(), in recv()
86 if len == -1 { in recv()
89 Ok(len as usize) in recv()
95 let len = libc::send( in send() localVariable
98 buffer.len(), in send()
101 if len == -1 { in send()
104 Ok(len as usize) in send()
Dtuntap_interface.rs86 let len = libc::read( in recv() localVariable
89 buffer.len(), in recv()
91 if len == -1 { in recv()
94 Ok(len as usize) in recv()
100 let len = libc::write( in send() localVariable
103 buffer.len(), in send()
105 if len == -1 { in send()
108 Ok(len as usize) in send()
/smoltcp-0.9.1/src/phy/
Dfault_injector.rs46 let index = (xorshift32(&mut self.rng_seed) as usize) % buffer.len(); in corrupt()
215 let len = super::RxToken::consume(rx_token, |buffer| { in receive() localVariable
216 if (self.config.max_size > 0 && buffer.len() > self.config.max_size) in receive()
217 || buffer.len() > self.rx_buf.len() in receive()
222 self.rx_buf[..buffer.len()].copy_from_slice(buffer); in receive()
223 Some(buffer.len()) in receive()
226 let buf = &mut self.rx_buf[..len]; in receive()
289 fn consume<R, F>(mut self, len: usize, f: F) -> R in consume()
296 } else if self.config.max_size > 0 && len > self.config.max_size { in consume()
307 return f(&mut self.junk[..len]); in consume()
[all …]
/smoltcp-0.9.1/src/iface/interface/
Dsixlowpan.rs73 Ok(len) => &f.decompress_buf[..len], in process_sixlowpan()
173 let mut decompressed_size = 40 + iphc.payload().len(); in decompress_sixlowpan()
200 if buffer.len() < decompressed_size { in decompress_sixlowpan()
241 &mut buffer[..udp_repr.0.header_len() + iphc.payload().len() in decompress_sixlowpan()
252 let len = iphc.payload().len(); in decompress_sixlowpan() localVariable
253 buffer[..len].copy_from_slice(iphc.payload()); in decompress_sixlowpan()
336 total_size += udp_repr.header_len() + payload.len(); in dispatch_ieee802154()
365 if pkt.buffer.len() < total_size { in dispatch_ieee802154()
387 &mut b[..udp_repr.header_len() + payload.len()], in dispatch_ieee802154()
393 payload.len(), in dispatch_ieee802154()
[all …]
/smoltcp-0.9.1/examples/
Dsixlowpan.rs122 buffer[..data.len()].copy_from_slice(data); in main()
123 Some((data.len(), endpoint)) in main()
127 if let Some((len, endpoint)) = client { in main()
130 str::from_utf8(&buffer[..len]).unwrap() in main()
132 socket.send_slice(&buffer[..len], endpoint).unwrap(); in main()
153 (data.len(), data) in main()
/smoltcp-0.9.1/src/socket/
Draw.rs186 packet_buf.len() in send()
218 self.send(data.len())?.copy_from_slice(data); in send_slice()
235 packet_buf.len() in recv()
245 let length = min(data.len(), buffer.len()); in recv_slice()
262 packet_buf.len() in peek()
275 let length = min(data.len(), buffer.len()); in peek_slice()
295 let total_len = header_len + payload.len(); in process()
554 assert_eq!(&slice, &$packet[..slice.len()]);
563 buffer[..$packet.len()].copy_from_slice(&$packet[..]);
579 assert_eq!(&slice, &$packet[..slice.len()]);
[all …]
Ddns.rs187 let index = queries.len() - 1; in find_free_query()
212 if name[name.len() - 1] == b'.' { in start_query()
213 name = &name[..name.len() - 1]; in start_query()
226 if s.len() > 63 { in start_query()
237 .push(s.len() as u8) in start_query()
358 let size = payload.len(); in process()
544 if pq.server_idx >= servers.len() { in dispatch()
593 udp_repr.header_len() + payload.len(), in dispatch()
599 payload.len(), in dispatch()
666 dest.push(label.len() as u8).map_err(|_| wire::Error)?; in copy_name()
/smoltcp-0.9.1/fuzz/
Dutils.rs30 if matches.opt_present("h") || matches.free.len() != free.len() { in parse_options()
37 process::exit(if matches.free.len() != free.len() { in parse_options()

123