]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - include/net/inet_connection_sock.h
[NET]: Introduce inet_connection_sock
[mirror_ubuntu-bionic-kernel.git] / include / net / inet_connection_sock.h
CommitLineData
463c84b9
ACM
1/*
2 * NET Generic infrastructure for INET connection oriented protocols.
3 *
4 * Definitions for inet_connection_sock
5 *
6 * Authors: Many people, see the TCP sources
7 *
8 * From code originally in TCP
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version.
14 */
15#ifndef _INET_CONNECTION_SOCK_H
16#define _INET_CONNECTION_SOCK_H
17
18#include <linux/ip.h>
19#include <linux/timer.h>
20#include <net/request_sock.h>
21
22struct inet_bind_bucket;
23struct inet_hashinfo;
24
25/** inet_connection_sock - INET connection oriented sock
26 *
27 * @icsk_accept_queue: FIFO of established children
28 * @icsk_bind_hash: Bind node
29 * @icsk_timeout: Timeout
30 * @icsk_retransmit_timer: Resend (no ack)
31 * @icsk_rto: Retransmit timeout
32 * @icsk_retransmits: Number of unrecovered [RTO] timeouts
33 * @icsk_pending: Scheduled timer event
34 * @icsk_backoff: Backoff
35 * @icsk_syn_retries: Number of allowed SYN (or equivalent) retries
36 * @icsk_ack: Delayed ACK control data
37 */
38struct inet_connection_sock {
39 /* inet_sock has to be the first member! */
40 struct inet_sock icsk_inet;
41 struct request_sock_queue icsk_accept_queue;
42 struct inet_bind_bucket *icsk_bind_hash;
43 unsigned long icsk_timeout;
44 struct timer_list icsk_retransmit_timer;
45 struct timer_list icsk_delack_timer;
46 __u32 icsk_rto;
47 __u8 icsk_retransmits;
48 __u8 icsk_pending;
49 __u8 icsk_backoff;
50 __u8 icsk_syn_retries;
51 struct {
52 __u8 pending; /* ACK is pending */
53 __u8 quick; /* Scheduled number of quick acks */
54 __u8 pingpong; /* The session is interactive */
55 __u8 blocked; /* Delayed ACK was blocked by socket lock */
56 __u32 ato; /* Predicted tick of soft clock */
57 unsigned long timeout; /* Currently scheduled timeout */
58 __u32 lrcvtime; /* timestamp of last received data packet */
59 __u16 last_seg_size; /* Size of last incoming segment */
60 __u16 rcv_mss; /* MSS used for delayed ACK decisions */
61 } icsk_ack;
62};
63
64static inline struct inet_connection_sock *inet_csk(const struct sock *sk)
65{
66 return (struct inet_connection_sock *)sk;
67}
68
69extern void inet_csk_init_xmit_timers(struct sock *sk,
70 void (*retransmit_handler)(unsigned long),
71 void (*delack_handler)(unsigned long),
72 void (*keepalive_handler)(unsigned long));
73extern void inet_csk_clear_xmit_timers(struct sock *sk);
74
75extern struct request_sock *inet_csk_search_req(const struct sock *sk,
76 struct request_sock ***prevp,
77 const __u16 rport,
78 const __u32 raddr,
79 const __u32 laddr);
80extern int inet_csk_get_port(struct inet_hashinfo *hashinfo,
81 struct sock *sk, unsigned short snum);
82
83extern struct dst_entry* inet_csk_route_req(struct sock *sk,
84 const struct request_sock *req);
85
86#endif /* _INET_CONNECTION_SOCK_H */