tcp_functions.9 (fa9896e082a1046ff4fbc75fcba4d18d1f2efc19) tcp_functions.9 (86c9325d341fc3f39543bcfaf7c3bb3ceeacbe5d)
1.\"
2.\" Copyright (c) 2016 Jonathan Looney <jtl@FreeBSD.org>
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
1.\"
2.\" Copyright (c) 2016 Jonathan Looney <jtl@FreeBSD.org>
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
26.Dd March 10, 2017
26.Dd June 6, 2024
27.Dt TCP_FUNCTIONS 9
28.Os
29.Sh NAME
30.Nm tcp_functions
31.Nd Alternate TCP Stack Framework
32.Sh SYNOPSIS
33.In netinet/tcp.h
34.In netinet/tcp_var.h

--- 136 unchanged lines hidden (view full) ---

171 void (*tfb_tcp_fb_init)(struct tcpcb *);
172 void (*tfb_tcp_fb_fini)(struct tcpcb *, int);
173 /* Optional timers, must define all if you define one */
174 int (*tfb_tcp_timer_stop_all)(struct tcpcb *);
175 void (*tfb_tcp_timer_activate)(struct tcpcb *,
176 uint32_t, u_int);
177 int (*tfb_tcp_timer_active)(struct tcpcb *, uint32_t);
178 void (*tfb_tcp_timer_stop)(struct tcpcb *, uint32_t);
27.Dt TCP_FUNCTIONS 9
28.Os
29.Sh NAME
30.Nm tcp_functions
31.Nd Alternate TCP Stack Framework
32.Sh SYNOPSIS
33.In netinet/tcp.h
34.In netinet/tcp_var.h

--- 136 unchanged lines hidden (view full) ---

171 void (*tfb_tcp_fb_init)(struct tcpcb *);
172 void (*tfb_tcp_fb_fini)(struct tcpcb *, int);
173 /* Optional timers, must define all if you define one */
174 int (*tfb_tcp_timer_stop_all)(struct tcpcb *);
175 void (*tfb_tcp_timer_activate)(struct tcpcb *,
176 uint32_t, u_int);
177 int (*tfb_tcp_timer_active)(struct tcpcb *, uint32_t);
178 void (*tfb_tcp_timer_stop)(struct tcpcb *, uint32_t);
179 /* Optional functions */
179 /* Optional function */
180 void (*tfb_tcp_rexmit_tmr)(struct tcpcb *);
180 void (*tfb_tcp_rexmit_tmr)(struct tcpcb *);
181 void (*tfb_tcp_handoff_ok)(struct tcpcb *);
181 /* Mandatory function */
182 int (*tfb_tcp_handoff_ok)(struct tcpcb *);
182 /* System use */
183 volatile uint32_t tfb_refcnt;
184 uint32_t tfb_flags;
185};
186.Ed
187.Pp
188The
189.Va tfb_tcp_block_name

--- 66 unchanged lines hidden (view full) ---

256.Va tfb_tcp_rexmit_tmr
257field.
258This function is called very early in the process of handling a retransmit
259timer.
260However, care must be taken to ensure the retransmit timer leaves the
261TCP control block in a valid state for the remainder of the retransmit
262timer logic.
263.Pp
183 /* System use */
184 volatile uint32_t tfb_refcnt;
185 uint32_t tfb_flags;
186};
187.Ed
188.Pp
189The
190.Va tfb_tcp_block_name

--- 66 unchanged lines hidden (view full) ---

257.Va tfb_tcp_rexmit_tmr
258field.
259This function is called very early in the process of handling a retransmit
260timer.
261However, care must be taken to ensure the retransmit timer leaves the
262TCP control block in a valid state for the remainder of the retransmit
263timer logic.
264.Pp
264A user may select a new TCP stack before calling
265.Xr connect 2
266or
267.Xr listen 2 .
268Optionally, a TCP stack may also allow a user to begin using the TCP stack for
269a connection that is in a later state by setting a non-NULL function pointer in
270the
265A user may select a new TCP stack before calling at any time.
266Therefore, the function pointer
271.Va tfb_tcp_handoff_ok
267.Va tfb_tcp_handoff_ok
272field.
273If this field is non-NULL and a user attempts to select that TCP stack after
274calling
275.Xr connect 2
276or
277.Xr listen 2
278for that socket, the kernel will call the function pointed to by the
268field must be non-NULL.
269If a user attempts to select that TCP stack, the kernel will call the function
270pointed to by the
279.Va tfb_tcp_handoff_ok
280field.
281The function should return 0 if the user is allowed to switch the socket to use
271.Va tfb_tcp_handoff_ok
272field.
273The function should return 0 if the user is allowed to switch the socket to use
282the TCP stack.
283Otherwise, the function should return an error code, which will be returned to
284the user.
285If the
286.Va tfb_tcp_handoff_ok
287field is
288.Dv NULL
289and a user attempts to select the TCP stack after calling
290.Xr connect 2
291or
292.Xr listen 2
293for that socket, the operation will fail and the kernel will return
294.Er EINVAL .
274the TCP stack. In this case, the kernel will call the function pointed to by
275.Va tfb_tcp_fb_init
276if this function pointer is non-NULL and finally perform the stack switch.
277If the user is not allowed to switch the socket, the function should undo any
278changes it made to the connection state configuration and return an error code,
279which will be returned to the user.
295.Pp
296The
297.Va tfb_refcnt
298and
299.Va tfb_flags
300fields are used by the kernel's TCP code and will be initialized when the
301TCP stack is registered.
302.Ss Requirements for Alternate TCP Stacks

--- 88 unchanged lines hidden ---
280.Pp
281The
282.Va tfb_refcnt
283and
284.Va tfb_flags
285fields are used by the kernel's TCP code and will be initialized when the
286TCP stack is registered.
287.Ss Requirements for Alternate TCP Stacks

--- 88 unchanged lines hidden ---