Lines Matching refs:socket
7 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()
680 socket.send_slice(&*packet.into_inner(), REMOTE_IPV4.into()), in test_send_dispatch()
684 socket.send_slice(b"123456", REMOTE_IPV4.into()), in test_send_dispatch()
687 assert!(!socket.can_send()); in test_send_dispatch()
690 socket.dispatch(&mut cx, |_, (ip_repr, icmp_repr)| { in test_send_dispatch()
698 assert!(!socket.can_send()); in test_send_dispatch()
701 socket.dispatch(&mut cx, |_, (ip_repr, icmp_repr)| { in test_send_dispatch()
709 assert!(socket.can_send()); in test_send_dispatch()
714 let mut s = socket(buffer(0), buffer(1)); in test_set_hop_limit_v4()
748 let mut socket = socket(buffer(1), buffer(1)); in test_recv_process() localVariable
750 assert_eq!(socket.bind(Endpoint::Ident(0x1234)), Ok(())); in test_recv_process()
752 assert!(!socket.can_recv()); in test_recv_process()
753 assert_eq!(socket.recv(), Err(RecvError::Exhausted)); in test_recv_process()
762 assert!(socket.accepts(&mut cx, &REMOTE_IPV4_REPR, &ECHOV4_REPR.into())); in test_recv_process()
763 socket.process(&mut cx, &REMOTE_IPV4_REPR, &ECHOV4_REPR.into()); in test_recv_process()
764 assert!(socket.can_recv()); in test_recv_process()
766 assert!(socket.accepts(&mut cx, &REMOTE_IPV4_REPR, &ECHOV4_REPR.into())); in test_recv_process()
767 socket.process(&mut cx, &REMOTE_IPV4_REPR, &ECHOV4_REPR.into()); in test_recv_process()
769 assert_eq!(socket.recv(), Ok((data, REMOTE_IPV4.into()))); in test_recv_process()
770 assert!(!socket.can_recv()); in test_recv_process()
775 let mut socket = socket(buffer(1), buffer(1)); in test_accept_bad_id() localVariable
777 assert_eq!(socket.bind(Endpoint::Ident(0x1234)), Ok(())); in test_accept_bad_id()
791 assert!(!socket.accepts(&mut cx, &REMOTE_IPV4_REPR, &icmp_repr.into())); in test_accept_bad_id()
796 let mut socket = socket(buffer(1), buffer(1)); in test_accepts_udp() localVariable
798 assert_eq!(socket.bind(Endpoint::Udp(LOCAL_END_V4.into())), Ok(())); in test_accepts_udp()
834 assert!(!socket.can_recv()); in test_accepts_udp()
838 assert!(socket.accepts(&mut cx, &ip_repr, &icmp_repr.into())); in test_accepts_udp()
839 socket.process(&mut cx, &ip_repr, &icmp_repr.into()); in test_accepts_udp()
840 assert!(socket.can_recv()); in test_accepts_udp()
846 socket.recv(), in test_accepts_udp()
849 assert!(!socket.can_recv()); in test_accepts_udp()
891 let mut socket = socket(buffer(0), buffer(1)); in test_send_unaddressable() localVariable
893 socket.send_slice(b"abcdef", IpAddress::Ipv6(Ipv6Address::default())), in test_send_unaddressable()
896 assert_eq!(socket.send_slice(b"abcdef", REMOTE_IPV6.into()), Ok(())); in test_send_unaddressable()
901 let mut socket = socket(buffer(0), buffer(1)); in test_send_dispatch() localVariable
906 socket.dispatch(&mut cx, |_, _| unreachable!()), in test_send_dispatch()
912 socket.send_slice(&[0xff; 67], REMOTE_IPV6.into()), in test_send_dispatch()
915 assert!(socket.can_send()); in test_send_dispatch()
927 socket.send_slice(&*packet.into_inner(), REMOTE_IPV6.into()), in test_send_dispatch()
931 socket.send_slice(b"123456", REMOTE_IPV6.into()), in test_send_dispatch()
934 assert!(!socket.can_send()); in test_send_dispatch()
937 socket.dispatch(&mut cx, |_, (ip_repr, icmp_repr)| { in test_send_dispatch()
945 assert!(!socket.can_send()); in test_send_dispatch()
948 socket.dispatch(&mut cx, |_, (ip_repr, icmp_repr)| { in test_send_dispatch()
956 assert!(socket.can_send()); in test_send_dispatch()
961 let mut s = socket(buffer(0), buffer(1)); in test_set_hop_limit()
1000 let mut socket = socket(buffer(1), buffer(1)); in test_recv_process() localVariable
1002 assert_eq!(socket.bind(Endpoint::Ident(0x1234)), Ok(())); in test_recv_process()
1004 assert!(!socket.can_recv()); in test_recv_process()
1005 assert_eq!(socket.recv(), Err(RecvError::Exhausted)); in test_recv_process()
1019 assert!(socket.accepts(&mut cx, &REMOTE_IPV6_REPR, &ECHOV6_REPR.into())); in test_recv_process()
1020 socket.process(&mut cx, &REMOTE_IPV6_REPR, &ECHOV6_REPR.into()); in test_recv_process()
1021 assert!(socket.can_recv()); in test_recv_process()
1023 assert!(socket.accepts(&mut cx, &REMOTE_IPV6_REPR, &ECHOV6_REPR.into())); in test_recv_process()
1024 socket.process(&mut cx, &REMOTE_IPV6_REPR, &ECHOV6_REPR.into()); in test_recv_process()
1026 assert_eq!(socket.recv(), Ok((data, REMOTE_IPV6.into()))); in test_recv_process()
1027 assert!(!socket.can_recv()); in test_recv_process()
1032 let mut socket = socket(buffer(1), buffer(1)); in test_accept_bad_id() localVariable
1034 assert_eq!(socket.bind(Endpoint::Ident(0x1234)), Ok(())); in test_accept_bad_id()
1053 assert!(!socket.accepts(&mut cx, &REMOTE_IPV6_REPR, &icmp_repr.into())); in test_accept_bad_id()
1058 let mut socket = socket(buffer(1), buffer(1)); in test_accepts_udp() localVariable
1060 assert_eq!(socket.bind(Endpoint::Udp(LOCAL_END_V6.into())), Ok(())); in test_accepts_udp()
1096 assert!(!socket.can_recv()); in test_accepts_udp()
1100 assert!(socket.accepts(&mut cx, &ip_repr, &icmp_repr.into())); in test_accepts_udp()
1101 socket.process(&mut cx, &ip_repr, &icmp_repr.into()); in test_accepts_udp()
1102 assert!(socket.can_recv()); in test_accepts_udp()
1113 socket.recv(), in test_accepts_udp()
1116 assert!(!socket.can_recv()); in test_accepts_udp()