Home
last modified time | relevance | path

Searched refs:new (Results 1 – 25 of 59) sorted by relevance

123

/smoltcp-0.9.1/examples/
Dserver.rs27 let mut config = Config::new(); in main()
33 let mut iface = Interface::new(config, &mut device); in main()
36 .push(IpCidr::new(IpAddress::v4(192, 168, 69, 1), 24)) in main()
39 .push(IpCidr::new(IpAddress::v6(0xfdaa, 0, 0, 0, 0, 0, 0, 1), 64)) in main()
42 .push(IpCidr::new(IpAddress::v6(0xfe80, 0, 0, 0, 0, 0, 0, 1), 64)) in main()
47 .add_default_ipv4_route(Ipv4Address::new(192, 168, 69, 100)) in main()
51 .add_default_ipv6_route(Ipv6Address::new(0xfe80, 0, 0, 0, 0, 0, 0, 0x100)) in main()
55 let udp_rx_buffer = udp::PacketBuffer::new( in main()
59 let udp_tx_buffer = udp::PacketBuffer::new( in main()
63 let udp_socket = udp::Socket::new(udp_rx_buffer, udp_tx_buffer); in main()
[all …]
Dloopback.rs28 pub fn new() -> Clock { in new() method
29 Clock(Cell::new(Instant::from_millis(0))) in new()
54 pub fn new() -> Clock { in new() method
55 Clock(Arc::new(AtomicUsize::new(0))) in new()
70 let clock = mock::Clock::new(); in main()
71 let device = Loopback::new(Medium::Ethernet); in main()
86 let mut config = Config::new(); in main()
89 let mut iface = Interface::new(config, &mut device); in main()
92 .push(IpCidr::new(IpAddress::v4(127, 0, 0, 1), 8)) in main()
104 let tcp_rx_buffer = tcp::SocketBuffer::new(unsafe { &mut TCP_SERVER_RX_DATA[..] }); in main()
[all …]
Dmulticast.rs31 let mut config = Config::new(); in main()
37 let mut iface = Interface::new(config, &mut device); in main()
40 .push(IpCidr::new(IpAddress::v4(192, 168, 69, 1), 24)) in main()
43 .push(IpCidr::new(IpAddress::v6(0xfdaa, 0, 0, 0, 0, 0, 0, 1), 64)) in main()
46 .push(IpCidr::new(IpAddress::v6(0xfe80, 0, 0, 0, 0, 0, 0, 1), 64)) in main()
51 .add_default_ipv4_route(Ipv4Address::new(192, 168, 69, 100)) in main()
55 .add_default_ipv6_route(Ipv6Address::new(0xfe80, 0, 0, 0, 0, 0, 0, 0x100)) in main()
59 let mut sockets = SocketSet::new(vec![]); in main()
62 let raw_rx_buffer = raw::PacketBuffer::new(vec![raw::PacketMetadata::EMPTY; 2], vec![0; 512]); in main()
64 let raw_tx_buffer = raw::PacketBuffer::new(vec![], vec![]); in main()
[all …]
Ddns.rs34 let mut config = Config::new(); in main()
40 let mut iface = Interface::new(config, &mut device); in main()
43 .push(IpCidr::new(IpAddress::v4(192, 168, 69, 1), 24)) in main()
46 .push(IpCidr::new(IpAddress::v6(0xfdaa, 0, 0, 0, 0, 0, 0, 1), 64)) in main()
49 .push(IpCidr::new(IpAddress::v6(0xfe80, 0, 0, 0, 0, 0, 0, 1), 64)) in main()
54 .add_default_ipv4_route(Ipv4Address::new(192, 168, 69, 100)) in main()
58 .add_default_ipv6_route(Ipv6Address::new(0xfe80, 0, 0, 0, 0, 0, 0, 0x100)) in main()
63 Ipv4Address::new(8, 8, 4, 4).into(), in main()
64 Ipv4Address::new(8, 8, 8, 8).into(), in main()
66 let dns_socket = dns::Socket::new(servers, vec![]); in main()
[all …]
Dclient.rs32 let mut config = Config::new(); in main()
38 let mut iface = Interface::new(config, &mut device); in main()
41 .push(IpCidr::new(IpAddress::v4(192, 168, 69, 1), 24)) in main()
44 .push(IpCidr::new(IpAddress::v6(0xfdaa, 0, 0, 0, 0, 0, 0, 1), 64)) in main()
47 .push(IpCidr::new(IpAddress::v6(0xfe80, 0, 0, 0, 0, 0, 0, 1), 64)) in main()
52 .add_default_ipv4_route(Ipv4Address::new(192, 168, 69, 100)) in main()
56 .add_default_ipv6_route(Ipv6Address::new(0xfe80, 0, 0, 0, 0, 0, 0, 0x100)) in main()
60 let tcp_rx_buffer = tcp::SocketBuffer::new(vec![0; 1500]); in main()
61 let tcp_tx_buffer = tcp::SocketBuffer::new(vec![0; 1500]); in main()
62 let tcp_socket = tcp::Socket::new(tcp_rx_buffer, tcp_tx_buffer); in main()
[all …]
Dhttpclient.rs32 let mut config = Config::new(); in main()
38 let mut iface = Interface::new(config, &mut device); in main()
41 .push(IpCidr::new(IpAddress::v4(192, 168, 69, 1), 24)) in main()
44 .push(IpCidr::new(IpAddress::v6(0xfdaa, 0, 0, 0, 0, 0, 0, 1), 64)) in main()
47 .push(IpCidr::new(IpAddress::v6(0xfe80, 0, 0, 0, 0, 0, 0, 1), 64)) in main()
52 .add_default_ipv4_route(Ipv4Address::new(192, 168, 69, 100)) in main()
56 .add_default_ipv6_route(Ipv6Address::new(0xfe80, 0, 0, 0, 0, 0, 0, 0x100)) in main()
60 let tcp_rx_buffer = tcp::SocketBuffer::new(vec![0; 1024]); in main()
61 let tcp_tx_buffer = tcp::SocketBuffer::new(vec![0; 1024]); in main()
62 let tcp_socket = tcp::Socket::new(tcp_rx_buffer, tcp_tx_buffer); in main()
[all …]
Dsixlowpan_benchmark.rs87 let socket_addr = SocketAddrV6::new( in client()
125 static CLIENT_DONE: AtomicBool = AtomicBool::new(false);
137 let device = RawSocket::new("wpan1", Medium::Ieee802154).unwrap(); in main()
150 let mut config = Config::new(); in main()
156 let mut iface = Interface::new(config, &mut device); in main()
159 .push(IpCidr::new( in main()
166 let tcp1_rx_buffer = tcp::SocketBuffer::new(vec![0; 4096]); in main()
167 let tcp1_tx_buffer = tcp::SocketBuffer::new(vec![0; 4096]); in main()
168 let tcp1_socket = tcp::Socket::new(tcp1_rx_buffer, tcp1_tx_buffer); in main()
170 let tcp2_rx_buffer = tcp::SocketBuffer::new(vec![0; 4096]); in main()
[all …]
Dsixlowpan.rs64 let device = RawSocket::new("wpan1", Medium::Ieee802154).unwrap(); in main()
70 let mut config = Config::new(); in main()
76 let mut iface = Interface::new(config, &mut device); in main()
79 .push(IpCidr::new( in main()
87 let udp_rx_buffer = udp::PacketBuffer::new(vec![udp::PacketMetadata::EMPTY], vec![0; 1280]); in main()
88 let udp_tx_buffer = udp::PacketBuffer::new(vec![udp::PacketMetadata::EMPTY], vec![0; 1280]); in main()
89 let udp_socket = udp::Socket::new(udp_rx_buffer, udp_tx_buffer); in main()
91 let tcp_rx_buffer = tcp::SocketBuffer::new(vec![0; 4096]); in main()
92 let tcp_tx_buffer = tcp::SocketBuffer::new(vec![0; 4096]); in main()
93 let tcp_socket = tcp::Socket::new(tcp_rx_buffer, tcp_tx_buffer); in main()
[all …]
Dbenchmark.rs61 static CLIENT_DONE: AtomicBool = AtomicBool::new(false);
83 let tcp1_rx_buffer = tcp::SocketBuffer::new(vec![0; 65535]); in main()
84 let tcp1_tx_buffer = tcp::SocketBuffer::new(vec![0; 65535]); in main()
85 let tcp1_socket = tcp::Socket::new(tcp1_rx_buffer, tcp1_tx_buffer); in main()
87 let tcp2_rx_buffer = tcp::SocketBuffer::new(vec![0; 65535]); in main()
88 let tcp2_tx_buffer = tcp::SocketBuffer::new(vec![0; 65535]); in main()
89 let tcp2_socket = tcp::Socket::new(tcp2_rx_buffer, tcp2_tx_buffer); in main()
91 let mut config = Config::new(); in main()
97 let mut iface = Interface::new(config, &mut device); in main()
100 .push(IpCidr::new(IpAddress::v4(192, 168, 69, 1), 24)) in main()
[all …]
Dutils.rs26 Builder::new() in setup_logging_with_clock()
68 let mut opts = Options::new(); in create_options()
70 (opts, Vec::new()) in create_options()
104 (Some(tun), None) => TunTapInterface::new(&tun, Medium::Ip).unwrap(), in parse_tuntap_options()
105 (None, Some(tap)) => TunTapInterface::new(&tap, Medium::Ethernet).unwrap(), in parse_tuntap_options()
186 Some(pcap_filename) => Box::new(File::create(pcap_filename).expect("cannot open file")), in parse_middleware_options()
187 None => Box::new(io::sink()), in parse_middleware_options()
195 let device = PcapWriter::new( in parse_middleware_options()
205 let device = Tracer::new(device, |_timestamp, _printer| { in parse_middleware_options()
210 let mut device = FaultInjector::new(device, seed); in parse_middleware_options()
Dping.rs108 let mut config = Config::new(); in main()
114 let mut iface = Interface::new(config, &mut device); in main()
117 .push(IpCidr::new(IpAddress::v4(192, 168, 69, 1), 24)) in main()
120 .push(IpCidr::new(IpAddress::v6(0xfdaa, 0, 0, 0, 0, 0, 0, 1), 64)) in main()
123 .push(IpCidr::new(IpAddress::v6(0xfe80, 0, 0, 0, 0, 0, 0, 1), 64)) in main()
128 .add_default_ipv4_route(Ipv4Address::new(192, 168, 69, 100)) in main()
132 .add_default_ipv6_route(Ipv6Address::new(0xfe80, 0, 0, 0, 0, 0, 0, 0x100)) in main()
136 let icmp_rx_buffer = icmp::PacketBuffer::new(vec![icmp::PacketMetadata::EMPTY], vec![0; 256]); in main()
137 let icmp_tx_buffer = icmp::PacketBuffer::new(vec![icmp::PacketMetadata::EMPTY], vec![0; 256]); in main()
138 let icmp_socket = icmp::Socket::new(icmp_rx_buffer, icmp_tx_buffer); in main()
[all …]
Ddhcp_client.rs31 let mut config = Config::new(); in main()
36 let mut iface = Interface::new(config, &mut device); in main()
39 let mut dhcp_socket = dhcpv4::Socket::new(); in main()
47 let mut sockets = SocketSet::new(vec![]); in main()
77 set_ipv4_addr(&mut iface, Ipv4Cidr::new(Ipv4Address::UNSPECIFIED, 0)); in main()
/smoltcp-0.9.1/fuzz/fuzz_targets/
Dtcp_headers.rs25 pub fn new() -> Clock { in new() method
26 Clock(Arc::new(AtomicUsize::new(0))) in new()
49 pub fn new(data: &[u8]) -> TcpHeaderFuzzer { in new() method
115 let clock = mock::Clock::new();
124 Loopback::new(Medium::Ethernet),
128 smoltcp::phy::FuzzInjector::new(device, EmptyFuzzer(), TcpHeaderFuzzer::new(data))
132 let neighbor_cache = NeighborCache::new(&mut neighbor_cache_entries[..]);
134 let ip_addrs = [IpCidr::new(IpAddress::v4(127, 0, 0, 1), 8)];
135 let mut iface = InterfaceBuilder::new()
148 let tcp_rx_buffer = tcp::SocketBuffer::new(unsafe { &mut TCP_SERVER_RX_DATA[..] });
[all …]
/smoltcp-0.9.1/src/wire/
Dipv4.rs56 pub const fn new(a0: u8, a1: u8, a2: u8, a3: u8) -> Address { in new() method
162 pub const fn new(address: Address, prefix_len: u8) -> Cidr { in new() method
952 let cidr = Cidr::new(Address::new(192, 168, 1, 10), 24); in test_cidr()
995 .map(|&(a, p)| Cidr::new(Address::new(a[0], a[1], a[2], a[3]), p)) in test_cidr()
1002 .map(|&(a, p)| Cidr::new(Address::new(a[0], a[1], a[2], a[3]), p)) in test_cidr()
1007 let cidr_without_prefix = Cidr::new(cidr.address(), 0); in test_cidr()
1008 assert!(cidr_without_prefix.contains_addr(&Address::new(127, 0, 0, 1))); in test_cidr()
1017 Cidr::new(Address([0, 0, 0, 1]), 24) in test_cidr_from_netmask()
1021 Cidr::new(Address([192, 168, 0, 1]), 16) in test_cidr_from_netmask()
1025 Cidr::new(Address([172, 16, 0, 1]), 12) in test_cidr_from_netmask()
[all …]
Dip.rs97 Address::Ipv4(Ipv4Address::new(a0, a1, a2, a3)) in v4()
104 Address::Ipv6(Ipv6Address::new(a0, a1, a2, a3, a4, a5, a6, a7)) in v6()
282 pub fn new(addr: Address, prefix_len: u8) -> Cidr { in new() method
285 Address::Ipv4(addr) => Cidr::Ipv4(Ipv4Cidr::new(addr, prefix_len)), in new()
287 Address::Ipv6(addr) => Cidr::Ipv6(Ipv6Cidr::new(addr, prefix_len)), in new()
389 pub const fn new(addr: Address, port: u16) -> Endpoint { in new() method
569 pub fn new( in new() method
923 test_eq(0, Ipv4Address::new(0, 0, 0, 0)); in to_prefix_len_ipv4()
924 test_eq(1, Ipv4Address::new(128, 0, 0, 0)); in to_prefix_len_ipv4()
925 test_eq(2, Ipv4Address::new(192, 0, 0, 0)); in to_prefix_len_ipv4()
[all …]
Dipv6routing.rs146 pub const fn new(buffer: T) -> Header<T> { in new() method
155 let header = Self::new(buffer); in new_checked()
598 assert_eq!(Err(Error), Header::new(&BYTES_TYPE2[..3]).check_len()); in test_check_len()
599 assert_eq!(Err(Error), Header::new(&BYTES_SRH_FULL[..3]).check_len()); in test_check_len()
600 assert_eq!(Err(Error), Header::new(&BYTES_SRH_ELIDED[..3]).check_len()); in test_check_len()
602 assert_eq!(Err(Error), Header::new(&BYTES_TYPE2[..23]).check_len()); in test_check_len()
603 assert_eq!(Err(Error), Header::new(&BYTES_SRH_FULL[..39]).check_len()); in test_check_len()
604 assert_eq!(Err(Error), Header::new(&BYTES_SRH_ELIDED[..11]).check_len()); in test_check_len()
606 assert_eq!(Ok(()), Header::new(&BYTES_TYPE2[..]).check_len()); in test_check_len()
607 assert_eq!(Ok(()), Header::new(&BYTES_SRH_FULL[..]).check_len()); in test_check_len()
[all …]
Dipv6.rs71 pub const fn new( in new() method
344 pub const fn new(address: Address, prefix_len: u8) -> Cidr { in new() method
795 Address::new(0xfe80, 0, 0, 0, 0, 0x7f00, 0x0000, 0x0001) in test_address_format()
804 format!("{}", Address::from(Ipv4Address::new(192, 168, 1, 1))) in test_address_format()
811 Address::new(0xff02, 0, 0, 0, 0, 0, 0, 1), in test_new()
815 Address::new(0xff02, 0, 0, 0, 0, 0, 0, 2), in test_new()
818 assert_eq!(Address::new(0, 0, 0, 0, 0, 0, 0, 1), Address::LOOPBACK); in test_new()
819 assert_eq!(Address::new(0, 0, 0, 0, 0, 0, 0, 0), Address::UNSPECIFIED); in test_new()
820 assert_eq!(Address::new(0xfe80, 0, 0, 0, 0, 0, 0, 1), LINK_LOCAL_ADDR); in test_new()
866 let addr = Address::new(0x0123, 0x4567, 0x89ab, 0, 0, 0, 0, 1); in test_mask()
[all …]
/smoltcp-0.9.1/src/
Dparsers.rs25 fn new(data: &'a str) -> Parser<'a> { in new() method
382 Parser::new(s).until_eof(|p| p.accept_mac()) in from_str()
392 Parser::new(s).until_eof(|p| p.accept_ipv4()) in from_str()
402 Parser::new(s).until_eof(|p| p.accept_ipv6()) in from_str()
411 Parser::new(s).until_eof(|p| p.accept_ip()) in from_str()
421 Parser::new(s).until_eof(|p| { in from_str()
425 Ok(Ipv4Cidr::new(ip, prefix_len)) in from_str()
437 Parser::new(s).until_eof(|p| { in from_str()
441 Ok(Ipv6Cidr::new(ip, prefix_len)) in from_str()
473 Parser::new(s).until_eof(|p| p.accept_ip_endpoint()) in from_str()
[all …]
/smoltcp-0.9.1/src/iface/interface/
Dtests.rs40 let mut device = Loopback::new(Medium::Ip); in create_ip()
42 let mut config = Config::new(); in create_ip()
43 let mut iface = Interface::new(config, &mut device); in create_ip()
47 .push(IpCidr::new(IpAddress::v4(127, 0, 0, 1), 8)) in create_ip()
51 .push(IpCidr::new(IpAddress::v6(0, 0, 0, 0, 0, 0, 0, 1), 128)) in create_ip()
55 .push(IpCidr::new(IpAddress::v6(0xfdbe, 0, 0, 0, 0, 0, 0, 1), 64)) in create_ip()
59 (iface, SocketSet::new(vec![]), device) in create_ip()
65 let mut device = Loopback::new(Medium::Ethernet); in create_ethernet()
67 let mut config = Config::new(); in create_ethernet()
69 let mut iface = Interface::new(config, &mut device); in create_ethernet()
[all …]
/smoltcp-0.9.1/src/storage/
Dassembler.rs100 pub const fn new() -> Assembler { in new() method
295 AssemblerIter::new(self, first_offset) in iter_data()
308 fn new(assembler: &'a Assembler, offset: usize) -> AssemblerIter<'a> { in new() method
369 let assr = Assembler::new(); in test_new()
375 let mut assr = Assembler::new(); in test_empty_add_full()
382 let mut assr = Assembler::new(); in test_empty_add_front()
389 let mut assr = Assembler::new(); in test_empty_add_back()
396 let mut assr = Assembler::new(); in test_empty_add_mid()
459 let mut assr = Assembler::new(); in test_rejected_add_keeps_state()
503 let mut assr = Assembler::new(); in test_shrink_next_hole()
[all …]
Dring_buffer.rs37 pub fn new<S>(storage: S) -> RingBuffer<'a, T> in new() method
406 RingBuffer::new(slice) in from()
416 let mut ring = RingBuffer::new(vec![0; 2]); in test_buffer_length_changes()
440 let mut ring = RingBuffer::new(vec![0; 5]); in test_buffer_enqueue_dequeue_one_with()
478 let mut ring = RingBuffer::new(vec![0; 5]); in test_buffer_enqueue_dequeue_one()
502 let mut ring = RingBuffer::new(vec![b'.'; 12]); in test_buffer_enqueue_many_with()
562 let mut ring = RingBuffer::new(vec![b'.'; 12]); in test_buffer_enqueue_many()
575 let mut ring = RingBuffer::new(vec![b'.'; 12]); in test_buffer_enqueue_slice()
594 let mut ring = RingBuffer::new(vec![b'.'; 12]); in test_buffer_dequeue_many_with()
637 let mut ring = RingBuffer::new(vec![b'.'; 12]); in test_buffer_dequeue_many()
[all …]
/smoltcp-0.9.1/src/iface/
Droute.rs28 const IPV4_DEFAULT: IpCidr = IpCidr::Ipv4(Ipv4Cidr::new(Ipv4Address::new(0, 0, 0, 0), 0));
31 IpCidr::Ipv6(Ipv6Cidr::new(Ipv6Address::new(0, 0, 0, 0, 0, 0, 0, 0), 0));
65 pub fn new() -> Self { in new() method
67 storage: Vec::new(), in new()
173 Ipv6Cidr::new( in cidr_1()
184 Ipv6Cidr::new( in cidr_2()
198 Ipv4Cidr::new(Ipv4Address([192, 0, 2, 0]), 24) in cidr_1()
204 Ipv4Cidr::new(Ipv4Address([198, 51, 100, 0]), 24) in cidr_2()
212 let mut routes = Routes::new(); in test_fill()
Dfragmentation.rs43 pub const fn new() -> Self { in new() method
48 buffer: Buffer::new(), in new()
52 assembler: Assembler::new(), in new()
175 const NEW_PA: PacketAssembler<K> = PacketAssembler::new();
178 pub fn new() -> Self { in new() method
231 let mut p_assembler = PacketAssembler::<Key>::new(); in packet_assembler_overlap()
244 let mut p_assembler = PacketAssembler::<Key>::new(); in packet_assembler_assemble()
260 let mut p_assembler = PacketAssembler::<Key>::new(); in packet_assembler_out_of_order_assemble()
278 let mut set = PacketAssemblerSet::new(); in packet_assembler_set()
285 let mut set = PacketAssemblerSet::new(); in packet_assembler_set_full()
[all …]
Dneighbor.rs59 pub fn new() -> Self { in new() method
61 storage: LinearMap::new(), in new()
164 let mut cache = Cache::new(); in test_fill()
196 let mut cache = Cache::new(); in test_expire()
213 let mut cache = Cache::new(); in test_replace()
229 let mut cache = Cache::new(); in test_evict()
254 let mut cache = Cache::new(); in test_hush()
274 let mut cache = Cache::new(); in test_flush()
/smoltcp-0.9.1/fuzz/
Dutils.rs18 let mut opts = Options::new(); in create_options()
20 (opts, Vec::new()) in create_options()
125 pcap_writer = Box::new(File::create(pcap_filename).expect("cannot open file")) in parse_middleware_options()
127 pcap_writer = Box::new(io::sink()) in parse_middleware_options()
135 let device = PcapWriter::new( in parse_middleware_options()
145 let device = Tracer::new(device, |_timestamp, _printer| { in parse_middleware_options()
149 let mut device = FaultInjector::new(device, seed); in parse_middleware_options()

123