tcp_functions.9 (cf3c688cc9bc0a5e8ccb49be27a8c92c8d88b408) | tcp_functions.9 (587d67c008444a7d35d918763708b7aba40a9509) |
---|---|
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 --- 100 unchanged lines hidden (view full) --- 109 struct socket *, struct tcpcb *, 110 int, int, uint8_t, 111 int); 112 int (*tfb_tcp_ctloutput)(struct socket *so, 113 struct sockopt *sopt, 114 struct inpcb *inp, struct tcpcb *tp); 115 /* Optional memory allocation/free routine */ 116 void (*tfb_tcp_fb_init)(struct tcpcb *); | 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 --- 100 unchanged lines hidden (view full) --- 109 struct socket *, struct tcpcb *, 110 int, int, uint8_t, 111 int); 112 int (*tfb_tcp_ctloutput)(struct socket *so, 113 struct sockopt *sopt, 114 struct inpcb *inp, struct tcpcb *tp); 115 /* Optional memory allocation/free routine */ 116 void (*tfb_tcp_fb_init)(struct tcpcb *); |
117 void (*tfb_tcp_fb_fini)(struct tcpcb *); | 117 void (*tfb_tcp_fb_fini)(struct tcpcb *, int); |
118 /* Optional timers, must define all if you define one */ 119 int (*tfb_tcp_timer_stop_all)(struct tcpcb *); 120 void (*tfb_tcp_timer_activate)(struct tcpcb *, 121 uint32_t, u_int); 122 int (*tfb_tcp_timer_active)(struct tcpcb *, uint32_t); 123 void (*tfb_tcp_timer_stop)(struct tcpcb *, uint32_t); | 118 /* Optional timers, must define all if you define one */ 119 int (*tfb_tcp_timer_stop_all)(struct tcpcb *); 120 void (*tfb_tcp_timer_activate)(struct tcpcb *, 121 uint32_t, u_int); 122 int (*tfb_tcp_timer_active)(struct tcpcb *, uint32_t); 123 void (*tfb_tcp_timer_stop)(struct tcpcb *, uint32_t); |
124 /* Optional functions */ |
|
124 void (*tfb_tcp_rexmit_tmr)(struct tcpcb *); | 125 void (*tfb_tcp_rexmit_tmr)(struct tcpcb *); |
126 void (*tfb_tcp_handoff_ok)(struct tcpcb *); 127 /* System use */ |
|
125 volatile uint32_t tfb_refcnt; 126 uint32_t tfb_flags; 127}; 128.Ed 129.Pp 130The 131.Va tfb_tcp_block_name 132field identifies the unique name of the TCP stack, and should be no longer than --- 19 unchanged lines hidden (view full) --- 152.Va tfb_tcp_fb_init 153field. 154Likewise, if a TCP stack needs to cleanup data when a socket stops using the 155TCP stack (or, when the socket is closed), it should set a non-NULL pointer 156in the 157.Va tfb_tcp_fb_fini 158field. 159.Pp | 128 volatile uint32_t tfb_refcnt; 129 uint32_t tfb_flags; 130}; 131.Ed 132.Pp 133The 134.Va tfb_tcp_block_name 135field identifies the unique name of the TCP stack, and should be no longer than --- 19 unchanged lines hidden (view full) --- 155.Va tfb_tcp_fb_init 156field. 157Likewise, if a TCP stack needs to cleanup data when a socket stops using the 158TCP stack (or, when the socket is closed), it should set a non-NULL pointer 159in the 160.Va tfb_tcp_fb_fini 161field. 162.Pp |
163If the 164.Va tfb_tcp_fb_fini 165argument is non-NULL, the function to which it points is called when the 166kernel is destroying the TCP control block or when the socket is transitioning 167to use a different TCP stack. 168The function is called with arguments of the TCP control block and an integer 169flag. 170The flag will be zero if the socket is transitioning to use another TCP stack 171or one if the TCP control block is being destroyed. 172.Pp |
|
160If the TCP stack implements additional timers, the TCP stack should set a 161non-NULL pointer in the 162.Va tfb_tcp_timer_stop_all , 163.Va tfb_tcp_timer_activate , 164.Va tfb_tcp_timer_active , 165and 166.Va tfb_tcp_timer_stop 167fields. --- 20 unchanged lines hidden (view full) --- 188.Va tfb_tcp_rexmit_tmr 189field. 190This function is called very early in the process of handling a retransmit 191timer. 192However, care must be taken to ensure the retransmit timer leaves the 193TCP control block in a valid state for the remainder of the retransmit 194timer logic. 195.Pp | 173If the TCP stack implements additional timers, the TCP stack should set a 174non-NULL pointer in the 175.Va tfb_tcp_timer_stop_all , 176.Va tfb_tcp_timer_activate , 177.Va tfb_tcp_timer_active , 178and 179.Va tfb_tcp_timer_stop 180fields. --- 20 unchanged lines hidden (view full) --- 201.Va tfb_tcp_rexmit_tmr 202field. 203This function is called very early in the process of handling a retransmit 204timer. 205However, care must be taken to ensure the retransmit timer leaves the 206TCP control block in a valid state for the remainder of the retransmit 207timer logic. 208.Pp |
209A user may select a new TCP stack before calling 210.Xr connect 2 211or 212.Xr listen 2 . 213Optionally, a TCP stack may also allow a user to begin using the TCP stack for 214a connection that is in a later state by setting a non-NULL function pointer in 215the 216.Va tfb_tcp_handoff_ok 217field. 218If this field is non-NULL and a user attempts to select that TCP stack after 219calling 220.Xr connect 2 221or 222.Xr listen 2 223for that socket, the kernel will call the function pointed to by the 224.Va tfb_tcp_handoff_ok 225field. 226The function should return 0 if the user is allowed to switch the socket to use 227the TCP stack. Otherwise, the function should return an error code, which will 228be returned to the user. 229If the 230.Va tfb_tcp_handoff_ok 231field is 232.Dv NULL 233and a user attempts to select the TCP stack after calling 234.Xr connect 2 235or 236.Xr listen 2 237for that socket, the operation will fail and the kernel will return 238.Er EINVAL . 239.Pp |
|
196The 197.Va tfb_refcnt 198and 199.Va tfb_flags 200fields are used by the kernel's TCP code and will be initialized when the 201TCP stack is registered. 202.Ss Requirements for Alternate TCP Stacks 203If the TCP stack needs to store data beyond what is stored in the default --- 60 unchanged lines hidden (view full) --- 264.It Bq Er EBUSY 265The function block is still in use by one or more sockets, or is defined as 266the current default function block. 267.It Bq Er ENOENT 268The 269.Fa blk 270argument references a function block that is not currently registered. 271.Sh SEE ALSO | 240The 241.Va tfb_refcnt 242and 243.Va tfb_flags 244fields are used by the kernel's TCP code and will be initialized when the 245TCP stack is registered. 246.Ss Requirements for Alternate TCP Stacks 247If the TCP stack needs to store data beyond what is stored in the default --- 60 unchanged lines hidden (view full) --- 308.It Bq Er EBUSY 309The function block is still in use by one or more sockets, or is defined as 310the current default function block. 311.It Bq Er ENOENT 312The 313.Fa blk 314argument references a function block that is not currently registered. 315.Sh SEE ALSO |
272.Xr malloc 9 , 273.Xr tcp 4 | 316.Xr connect 2 , 317.Xr listen 2 , 318.Xr tcp 4 , 319.Xr malloc 9 |
274.Sh HISTORY 275This framework first appeared in 276.Fx 11.0 . 277.Sh AUTHORS 278.An -nosplit 279The 280.Nm 281framework was written by 282.An Randall Stewart Aq Mt rrs@FreeBSD.org . 283.Pp 284This manual page was written by 285.An Jonathan Looney Aq Mt jtl@FreeBSD.org . | 320.Sh HISTORY 321This framework first appeared in 322.Fx 11.0 . 323.Sh AUTHORS 324.An -nosplit 325The 326.Nm 327framework was written by 328.An Randall Stewart Aq Mt rrs@FreeBSD.org . 329.Pp 330This manual page was written by 331.An Jonathan Looney Aq Mt jtl@FreeBSD.org . |