Lines Matching refs:cx

764         cx: &mut Context,  in connect()
794 None => cx in connect()
812 let seq = Self::random_seq_no(cx); in connect()
824 fn random_seq_no(cx: &mut Context) -> TcpSeqNumber { in random_seq_no()
825 TcpSeqNumber(cx.rand().rand_u32() as i32) in random_seq_no()
1267 cx: &mut Context, in challenge_ack_reply()
1271 if cx.now() < self.challenge_ack_timer { in challenge_ack_reply()
1276 self.challenge_ack_timer = cx.now() + Duration::from_secs(1); in challenge_ack_reply()
1311 cx: &mut Context, in process()
1315 debug_assert!(self.accepts(cx, ip_repr, repr)); in process()
1421 return self.challenge_ack_reply(cx, ip_repr, repr); in process()
1470 self.timer.set_for_close(cx.now()); in process()
1473 return self.challenge_ack_reply(cx, ip_repr, repr); in process()
1504 self.rtte.on_ack(cx.now(), ack_number); in process()
1554 self.local_seq_no = Self::random_seq_no(cx); in process()
1564 self.timer.set_for_idle(cx.now(), self.keep_alive); in process()
1570 self.timer.set_for_idle(cx.now(), self.keep_alive); in process()
1580 self.timer.set_for_idle(cx.now(), self.keep_alive); in process()
1604 self.timer.set_for_idle(cx.now(), self.keep_alive); in process()
1611 self.timer.set_for_idle(cx.now(), self.keep_alive); in process()
1620 self.timer.set_for_idle(cx.now(), self.keep_alive); in process()
1630 self.timer.set_for_idle(cx.now(), self.keep_alive); in process()
1641 self.timer.set_for_close(cx.now()); in process()
1644 self.timer.set_for_idle(cx.now(), self.keep_alive); in process()
1650 self.timer.set_for_idle(cx.now(), self.keep_alive); in process()
1658 self.timer.set_for_close(cx.now()); in process()
1665 self.timer.set_for_close(cx.now()); in process()
1667 self.timer.set_for_idle(cx.now(), self.keep_alive); in process()
1673 self.timer.set_for_idle(cx.now(), self.keep_alive); in process()
1683 self.timer.set_for_idle(cx.now(), self.keep_alive); in process()
1694 self.remote_last_ts = Some(cx.now()); in process()
1831 AckDelayTimer::Waiting(cx.now() + ack_delay) in process()
1869 fn seq_to_transmit(&self, cx: &mut Context) -> bool { in seq_to_transmit()
1878 let local_mss = cx.ip_mtu() - ip_header_len - TCP_HEADER_LEN; in seq_to_transmit()
1960 pub(crate) fn dispatch<F, E>(&mut self, cx: &mut Context, emit: F) -> Result<(), E> in dispatch()
1976 self.remote_last_ts = Some(cx.now()); in dispatch()
1980 if self.timed_out(cx.now()) { in dispatch()
1984 } else if !self.seq_to_transmit(cx) { in dispatch()
1985 if let Some(retransmit_delta) = self.timer.should_retransmit(cx.now()) { in dispatch()
1998 self.timer.set_for_idle(cx.now(), self.keep_alive); in dispatch()
2006 if self.seq_to_transmit(cx) { in dispatch()
2009 } else if self.ack_to_transmit() && self.delayed_ack_expired(cx.now()) { in dispatch()
2012 } else if self.window_to_update() && self.delayed_ack_expired(cx.now()) { in dispatch()
2018 } else if self.timer.should_keep_alive(cx.now()) { in dispatch()
2021 } else if self.timer.should_close(cx.now()) { in dispatch()
2116 .min(cx.ip_mtu() - ip_repr.header_len() - TCP_HEADER_LEN); in dispatch()
2145 if self.timer.should_keep_alive(cx.now()) && repr.is_empty() { in dispatch()
2178 let max_segment_size = cx.ip_mtu() - ip_repr.header_len() - TCP_HEADER_LEN; in dispatch()
2190 emit(cx, (ip_repr, repr))?; in dispatch()
2194 self.timer.rewind_keep_alive(cx.now(), self.keep_alive); in dispatch()
2221 .on_send(cx.now(), repr.seq_number + repr.segment_len()); in dispatch()
2224 if !self.seq_to_transmit(cx) && repr.segment_len() > 0 { in dispatch()
2228 .set_for_retransmit(cx.now(), self.rtte.retransmission_timeout()); in dispatch()
2240 pub(crate) fn poll_at(&self, cx: &mut Context) -> PollAt { in poll_at()
2251 } else if self.seq_to_transmit(cx) { in poll_at()
2402 cx: Context, field
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()
2449 socket.cx.set_now(timestamp); in recv()
2454 .dispatch(&mut socket.cx, |_, (ip_repr, tcp_repr)| { in recv()
2471 socket.cx.set_now(timestamp); in recv_nothing()
2475 .dispatch(&mut socket.cx, |_, (_ip_repr, _tcp_repr)| { in recv_nothing()
2542 let cx = Context::mock(); in socket_with_buffer_sizes() localVariable
2543 TestSocket { socket, cx } in socket_with_buffer_sizes()
2672 assert!(!s.socket.accepts(&mut s.cx, &SEND_IP_TEMPL, &tcp_repr)); in test_closed_reject()
2685 assert!(!s.socket.accepts(&mut s.cx, &SEND_IP_TEMPL, &tcp_repr)); in test_closed_reject_after_listen()
2846 assert!(!s.socket.accepts(&mut s.cx, &SEND_IP_TEMPL, &tcp_repr)); in test_listen_syn_reject_ack()
3126 .connect(&mut s.cx, REMOTE_END, (IpvXAddress::UNSPECIFIED, 0)), in test_connect_validation()
3131 .connect(&mut s.cx, REMOTE_END, (IpvXAddress::UNSPECIFIED, 1024)), in test_connect_validation()
3136 .connect(&mut s.cx, (IpvXAddress::UNSPECIFIED, 0), LOCAL_END), in test_connect_validation()
3140 .connect(&mut s.cx, REMOTE_END, LOCAL_END) in test_connect_validation()
3150 .connect(&mut s.cx, REMOTE_END, LOCAL_END.port) in test_connect()
3182 assert_eq!(s.socket.connect(&mut s.cx, REMOTE_END, 80), Ok(())); in test_connect_unspecified_local()
3189 s.socket.connect(&mut s.cx, REMOTE_END, (REMOTE_ADDR, 80)), in test_connect_specified_local()
3197 assert_eq!(s.socket.connect(&mut s.cx, REMOTE_END, 80), Ok(())); in test_connect_twice()
3199 s.socket.connect(&mut s.cx, REMOTE_END, 80), in test_connect_twice()
3208 s.socket.connect(&mut s.cx, REMOTE_END, LOCAL_END).unwrap(); in test_syn_sent_sanity()
3460 s.socket.connect(&mut s.cx, REMOTE_END, LOCAL_END).unwrap(); in test_syn_sent_win_scale_buffers()
6026 assert_eq!(s.socket.poll_at(&mut s.cx), PollAt::Ingress); in test_listen_timeout()
6034 .connect(&mut s.cx, REMOTE_END, LOCAL_END.port) in test_connect_timeout()
6048 s.socket.poll_at(&mut s.cx), in test_connect_timeout()
6067 s.socket.poll_at(&mut s.cx), in test_established_timeout()
6071 assert_eq!(s.socket.poll_at(&mut s.cx), PollAt::Now); in test_established_timeout()
6079 s.socket.poll_at(&mut s.cx), in test_established_timeout()
6089 s.socket.poll_at(&mut s.cx), in test_established_timeout()
6114 s.socket.poll_at(&mut s.cx), in test_established_keep_alive_timeout()
6123 s.socket.poll_at(&mut s.cx), in test_established_keep_alive_timeout()
6134 s.socket.poll_at(&mut s.cx), in test_established_keep_alive_timeout()
6192 assert_eq!(s.socket.poll_at(&mut s.cx), PollAt::Now); in test_closed_timeout()
6199 assert_eq!(s.socket.poll_at(&mut s.cx), PollAt::Ingress); in test_closed_timeout()
6230 assert_eq!(s.socket.poll_at(&mut s.cx), PollAt::Now); in test_sends_keep_alive()
6239 s.socket.poll_at(&mut s.cx), in test_sends_keep_alive()
6251 s.socket.poll_at(&mut s.cx), in test_sends_keep_alive()
6268 s.socket.poll_at(&mut s.cx), in test_sends_keep_alive()
6290 s.socket.dispatch(&mut s.cx, |_, (ip_repr, _)| { in test_set_hop_limit()
6907 assert!(!s.socket.accepts(&mut s.cx, &SEND_IP_TEMPL, &tcp_repr)); in test_doesnt_accept_wrong_port()
6915 assert!(!s.socket.accepts(&mut s.cx, &SEND_IP_TEMPL, &tcp_repr)); in test_doesnt_accept_wrong_port()
6936 assert!(s.socket.accepts(&mut s.cx, &ip_repr, &tcp_repr)); in test_doesnt_accept_wrong_ip()
6945 assert!(!s.socket.accepts(&mut s.cx, &ip_repr_wrong_src, &tcp_repr)); in test_doesnt_accept_wrong_ip()
6954 assert!(!s.socket.accepts(&mut s.cx, &ip_repr_wrong_dst, &tcp_repr)); in test_doesnt_accept_wrong_ip()