Home
last modified time | relevance | path

Searched refs:socket (Results 1 – 25 of 33) sorted by relevance

12

/smoltcp-0.9.1/src/socket/
Draw.rs6 use crate::socket::PollAt;
8 use crate::socket::WakerRegistration;
429 pub fn socket( in socket() function
460 pub fn socket( in socket() function
498 ($module:ident, $socket:path, $hdr:path, $packet:path, $payload:path) => {
504 let mut socket = $socket(buffer(0), buffer(1)); localVariable
505 assert_eq!(socket.send_slice(&[0; 56][..]), Err(SendError::BufferFull));
510 let mut socket = $socket(buffer(0), buffer(1)); localVariable
513 assert!(socket.can_send());
515 socket.dispatch(&mut cx, |_, _| unreachable!()),
[all …]
Dudp.rs6 use crate::socket::PollAt;
8 use crate::socket::WakerRegistration;
496 fn socket( in socket() function
579 let mut socket = socket(buffer(0), buffer(0)); in test_bind_unaddressable() localVariable
580 assert_eq!(socket.bind(0), Err(BindError::Unaddressable)); in test_bind_unaddressable()
585 let mut socket = socket(buffer(0), buffer(0)); in test_bind_twice() localVariable
586 assert_eq!(socket.bind(1), Ok(())); in test_bind_twice()
587 assert_eq!(socket.bind(2), Err(BindError::InvalidState)); in test_bind_twice()
593 let mut s = socket(buffer(0), buffer(1)); in test_set_hop_limit_zero()
599 let mut socket = socket(buffer(0), buffer(1)); in test_send_unaddressable() localVariable
[all …]
Dicmp.rs7 use crate::socket::WakerRegistration;
8 use crate::socket::{Context, PollAt};
596 pub fn socket( in socket() function
649 let mut socket = socket(buffer(0), buffer(1)); in test_send_unaddressable() localVariable
651 socket.send_slice(b"abcdef", IpAddress::Ipv4(Ipv4Address::default())), in test_send_unaddressable()
654 assert_eq!(socket.send_slice(b"abcdef", REMOTE_IPV4.into()), Ok(())); in test_send_unaddressable()
659 let mut socket = socket(buffer(0), buffer(1)); in test_send_dispatch() localVariable
664 socket.dispatch(&mut cx, |_, _| unreachable!()), in test_send_dispatch()
670 socket.send_slice(&[0xff; 67], REMOTE_IPV4.into()), in test_send_dispatch()
673 assert!(socket.can_send()); in test_send_dispatch()
[all …]
Dmod.rs96 fn downcast<'c>(socket: &'c Socket<'a>) -> Option<&'c Self> in downcast()
99 fn downcast_mut<'c>(socket: &'c mut Socket<'a>) -> Option<&'c mut Self> in downcast_mut()
105 ($socket:ty, $variant:ident) => {
106 impl<'a> AnySocket<'a> for $socket {
111 fn downcast<'c>(socket: &'c Socket<'a>) -> Option<&'c Self> {
113 match socket {
114 Socket::$variant(socket) => Some(socket),
119 fn downcast_mut<'c>(socket: &'c mut Socket<'a>) -> Option<&'c mut Self> {
121 match socket {
122 Socket::$variant(socket) => Some(socket),
Dtcp.rs11 use crate::socket::WakerRegistration;
12 use crate::socket::{Context, PollAt};
2401 socket: Socket<'static>, field
2408 &self.socket in deref()
2414 &mut self.socket in deref_mut()
2419 socket: &mut TestSocket, in send()
2423 socket.cx.set_now(timestamp); in send()
2434 assert!(socket.socket.accepts(&mut socket.cx, &ip_repr, repr)); in send()
2436 match socket.socket.process(&mut socket.cx, &ip_repr, repr) { in send()
2445 fn recv<F>(socket: &mut TestSocket, timestamp: Instant, mut f: F) in recv()
[all …]
Ddhcpv4.rs724 socket: Socket<'static>, field
731 &self.socket in deref()
737 &mut self.socket in deref_mut()
757 s.socket.process(&mut s.cx, &ip_repr, &udp_repr, &payload) in send()
765 while s.socket.poll_at(&mut s.cx) <= PollAt::Time(timestamp) { in recv()
767 .socket in recv()
796 ($socket:ident, $repr:expr) =>
797 (send!($socket, time 0, $repr));
798 ($socket:ident, time $time:expr, $repr:expr) =>
799 (send(&mut $socket, Instant::from_millis($time), $repr));
[all …]
/smoltcp-0.9.1/.github/workflows/
Dtest.yml35 - std medium-ethernet phy-raw_socket proto-ipv6 socket-udp socket-dns
36 - std medium-ethernet phy-tuntap_interface proto-ipv6 socket-udp
37 - std medium-ethernet proto-ipv4 proto-ipv4-fragmentation socket-raw socket-dns
38 - std medium-ethernet proto-ipv4 proto-igmp socket-raw socket-dns
39 - std medium-ethernet proto-ipv4 socket-udp socket-tcp socket-dns
40 - std medium-ethernet proto-ipv4 proto-dhcpv4 socket-udp
41 - std medium-ethernet medium-ip medium-ieee802154 proto-ipv6 socket-udp socket-dns
42 - std medium-ethernet proto-ipv6 socket-tcp
43 - std medium-ethernet medium-ip proto-ipv4 socket-icmp socket-tcp
44 - std medium-ip proto-ipv6 socket-icmp socket-tcp
[all …]
/smoltcp-0.9.1/examples/
Dserver.rs9 use smoltcp::socket::{tcp, udp};
94 let socket = sockets.get_mut::<udp::Socket>(udp_handle); in main() localVariable
95 if !socket.is_open() { in main()
96 socket.bind(6969).unwrap() in main()
99 let client = match socket.recv() { in main()
110 socket.send_slice(&data, endpoint).unwrap(); in main()
114 let socket = sockets.get_mut::<tcp::Socket>(tcp1_handle); in main() localVariable
115 if !socket.is_open() { in main()
116 socket.listen(6969).unwrap(); in main()
119 if socket.can_send() { in main()
[all …]
Dsixlowpan.rs51 use smoltcp::socket::tcp;
52 use smoltcp::socket::udp;
99 let socket = sockets.get_mut::<tcp::Socket>(tcp_handle); in main() localVariable
100 socket.listen(50000).unwrap(); in main()
109 let socket = sockets.get_mut::<udp::Socket>(udp_handle); in main() localVariable
110 if !socket.is_open() { in main()
111 socket.bind(6969).unwrap() in main()
115 let client = match socket.recv() { in main()
132 socket.send_slice(&buffer[..len], endpoint).unwrap(); in main()
135 let socket = sockets.get_mut::<tcp::Socket>(tcp_handle); in main() localVariable
[all …]
Dclient.rs9 use smoltcp::socket::tcp;
66 let socket = sockets.get_mut::<tcp::Socket>(tcp_handle); in main() localVariable
67 socket in main()
76 let socket = sockets.get_mut::<tcp::Socket>(tcp_handle); in main() localVariable
77 if socket.is_active() && !tcp_active { in main()
79 } else if !socket.is_active() && tcp_active { in main()
83 tcp_active = socket.is_active(); in main()
85 if socket.may_recv() { in main()
86 let data = socket in main()
101 if socket.can_send() && !data.is_empty() { in main()
[all …]
Dloopback.rs14 use smoltcp::socket::tcp;
128 let mut socket = sockets.get_mut::<tcp::Socket>(server_handle); in main() localVariable
129 if !socket.is_active() && !socket.is_listening() { in main()
132 socket.listen(1234).unwrap(); in main()
137 if socket.can_recv() { in main()
140 socket.recv(|buffer| { (buffer.len(), str::from_utf8(buffer).unwrap()) }) in main()
142 socket.close(); in main()
146 let mut socket = sockets.get_mut::<tcp::Socket>(client_handle); in main() localVariable
148 if !socket.is_open() { in main()
151 socket in main()
[all …]
Dhttpclient.rs10 use smoltcp::socket::tcp;
78 let socket = sockets.get_mut::<tcp::Socket>(tcp_handle); in main() localVariable
82 State::Connect if !socket.is_active() => { in main()
85 socket in main()
90 State::Request if socket.may_send() => { in main()
93 socket.send_slice(http_get.as_ref()).expect("cannot send"); in main()
95 socket.send_slice(http_host.as_ref()).expect("cannot send"); in main()
96 socket in main()
99 socket.send_slice(b"\r\n").expect("cannot send"); in main()
102 State::Response if socket.can_recv() => { in main()
[all …]
Dbenchmark.rs14 use smoltcp::socket::tcp;
116 let socket = sockets.get_mut::<tcp::Socket>(tcp1_handle); in main() localVariable
117 if !socket.is_open() { in main()
118 socket.listen(1234).unwrap(); in main()
121 if socket.can_send() { in main()
123 let length = socket in main()
134 let socket = sockets.get_mut::<tcp::Socket>(tcp2_handle); in main() localVariable
135 if !socket.is_open() { in main()
136 socket.listen(1235).unwrap(); in main()
139 if socket.can_recv() { in main()
[all …]
Dsixlowpan_benchmark.rs51 use smoltcp::socket::tcp;
188 let socket = sockets.get_mut::<tcp::Socket>(tcp1_handle); in main() localVariable
189 if !socket.is_open() { in main()
190 socket.listen(1234).unwrap(); in main()
193 if socket.can_send() && processed < AMOUNT { in main()
194 let length = socket in main()
204 let socket = sockets.get_mut::<tcp::Socket>(tcp2_handle); in main() localVariable
205 if !socket.is_open() { in main()
206 socket.listen(1235).unwrap(); in main()
209 if socket.can_recv() && processed < AMOUNT { in main()
[all …]
Dmulticast.rs7 use smoltcp::socket::{raw, udp};
93 let socket = sockets.get_mut::<raw::Socket>(raw_handle); in main() localVariable
95 if socket.can_recv() { in main()
98 match socket.recv() { in main()
110 let socket = sockets.get_mut::<udp::Socket>(udp_handle); in main() localVariable
111 if !socket.is_open() { in main()
112 socket.bind(MDNS_PORT).unwrap() in main()
115 if socket.can_recv() { in main()
116 socket in main()
Dping.rs13 use smoltcp::socket::icmp;
25 $echo_payload:expr, $socket:expr, $remote_addr:expr ) => {{
32 let icmp_payload = $socket.send(icmp_repr.buffer_len(), $remote_addr).unwrap();
154 let socket = sockets.get_mut::<icmp::Socket>(icmp_handle); in main() localVariable
155 if !socket.is_open() { in main()
156 socket.bind(icmp::Endpoint::Ident(ident)).unwrap(); in main()
160 if socket.can_send() && seq_no < count as u16 && send_at <= timestamp { in main()
171 socket, in main()
183 socket, in main()
200 if socket.can_recv() { in main()
[all …]
Dtcpdump.rs10 let mut socket = RawSocket::new(ifname.as_ref(), smoltcp::phy::Medium::Ethernet).unwrap(); in main() localVariable
12 phy_wait(socket.as_raw_fd(), None).unwrap(); in main()
13 let (rx_token, _) = socket.receive(Instant::now()).unwrap(); in main()
Ddns.rs13 use smoltcp::socket::dns::{self, GetQueryResultError};
71 let socket = sockets.get_mut::<dns::Socket>(dns_handle); in main() localVariable
72 let query = socket in main()
/smoltcp-0.9.1/
DCargo.toml40 "medium-ethernet" = ["socket"]
41 "medium-ip" = ["socket"]
42 "medium-ieee802154" = ["socket", "proto-sixlowpan"]
56 "socket" = []
57 "socket-raw" = ["socket"]
58 "socket-udp" = ["socket"]
59 "socket-tcp" = ["socket"]
60 "socket-icmp" = ["socket"]
61 "socket-dhcpv4" = ["socket", "medium-ethernet", "proto-dhcpv4"]
62 "socket-dns" = ["socket", "proto-dns"]
[all …]
DCHANGELOG.md37 - socket: Add send_with to udp, raw, and icmp sockets. These methods enable reserving a packet buff…
38 - socket: Make `trait AnySocket` object-safe (#718)
39 - socket/dhcpv4: add waker support (#623)
40 - socket/dhcpv4: indicate new config if there's a packet buffer provided (#685)
41 - socket/dhcpv4: Use renewal time from DHCP server ACK, if given (#683)
42 - socket/dhcpv4: allow for extra configuration
48 - socket/raw: Add `peek` and `peek_slice` methods (#734)
49 - socket/raw: When sending packets, send the source IP address unmodified (it was previously replac…
50 - socket/tcp: Do not reset socket-level settings, such as keepalive, on reset (#603)
51 - socket/tcp: ensure we always accept the segment at offset=0 even if the assembler is full. (#735,…
[all …]
DREADME.md49 * IPv4 time-to-live value is configurable per socket, set to 64 by default.
57 * IPv6 hop-limit value is configurable per socket, set to 64 by default.
107 * In response to a packet arriving at a port without a listening socket,
189 as 1 octet from a socket is likely to overwhelm the application logic unless a `BufReader`
200 ### Features `socket-raw`, `socket-udp`, `socket-tcp`, `socket-icmp`, `socket-dhcpv4`, `socket-dns`
202 Enable the corresponding socket type.
272 Maximum amount of DNS servers that can be configured in one DNS socket. Default: 1.
423 The TCP socket buffers are limited to 1024 bytes to make packet traces more interesting.
474 Except for the socket on port 6971. the buffers are only 64 bytes long, for convenience
523 …example still requires the `alloc` feature to run, as well as `log`, `proto-ipv4` and `socket-tcp`.
[all …]
/smoltcp-0.9.1/src/iface/
Dsocket_set.rs5 use crate::socket::{AnySocket, Socket};
24 pub(crate) socket: Socket<'a>, field
60 pub fn add<T: AnySocket<'a>>(&mut self, socket: T) -> SocketHandle { in add()
61 fn put<'a>(index: usize, slot: &mut SocketStorage<'a>, socket: Socket<'a>) -> SocketHandle { in add()
67 inner: Some(Item { meta, socket }), in add()
72 let socket = socket.upcast(); in add() localVariable
76 return put(index, slot, socket); in add()
86 put(index, &mut sockets[index], socket) in add()
99 T::downcast(&item.socket).expect("handle refers to a socket of a wrong type") in get()
112 Some(item) => T::downcast_mut(&mut item.socket) in get_mut()
[all …]
/smoltcp-0.9.1/fuzz/fuzz_targets/
Dtcp_headers.rs5 use smoltcp::socket::tcp;
173 let mut socket = socket_set.get::<tcp::Socket>(server_handle); localVariable
174 if !socket.is_active() && !socket.is_listening() {
176 socket.listen(1234).unwrap();
181 if socket.can_recv() {
182 socket.close();
188 let mut socket = socket_set.get::<tcp::Socket>(client_handle); localVariable
189 if !socket.is_open() {
191 socket
201 if socket.can_send() {
[all …]
/smoltcp-0.9.1/src/iface/interface/
Dtests.rs467 let socket = sockets.get_mut::<udp::Socket>(socket_handle); in test_handle_udp_broadcast() localVariable
468 assert_eq!(socket.bind(68), Ok(())); in test_handle_udp_broadcast()
469 assert!(!socket.can_recv()); in test_handle_udp_broadcast()
470 assert!(socket.can_send()); in test_handle_udp_broadcast()
496 let socket = sockets.get_mut::<udp::Socket>(socket_handle); in test_handle_udp_broadcast() localVariable
497 assert!(socket.can_recv()); in test_handle_udp_broadcast()
499 socket.recv(), in test_handle_udp_broadcast()
956 let socket = sockets.get_mut::<icmp::Socket>(socket_handle); in test_icmpv4_socket() localVariable
958 assert_eq!(socket.bind(icmp::Endpoint::Ident(ident)), Ok(())); in test_icmpv4_socket()
1000 let socket = sockets.get_mut::<icmp::Socket>(socket_handle); in test_icmpv4_socket() localVariable
[all …]
Dmod.rs41 use crate::socket::dns;
42 use crate::socket::*;
803 let socket_poll_at = item.socket.poll_at(inner); in poll_at()
926 let result = match &mut item.socket { in socket_egress()
928 Socket::Raw(socket) => socket.dispatch(&mut self.inner, |inner, response| { in socket_egress()
932 Socket::Icmp(socket) => { in socket_egress()
933 socket.dispatch(&mut self.inner, |inner, response| match response { in socket_egress()
947 Socket::Udp(socket) => socket.dispatch(&mut self.inner, |inner, response| { in socket_egress()
951 Socket::Tcp(socket) => socket.dispatch(&mut self.inner, |inner, response| { in socket_egress()
955 Socket::Dhcpv4(socket) => socket.dispatch(&mut self.inner, |inner, response| { in socket_egress()
[all …]

12