Cleanup in elf.c with .bss section clean; adm command mounts cdrom instead of floppy...
[ZeXOS.git] / kernel / include / net / tcp.h
blob3a4fe0b84f49cbcb60556b5329fbf7878340d647
1 /*
2 * ZeX/OS
3 * Copyright (C) 2008 Tomas 'ZeXx86' Jedrzejek (zexx86@zexos.org)
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef _TCP_H
20 #define _TCP_H
22 #include <net/ip.h>
24 #define PROTO_TCP_CONN_STATE_ESTABILISH 0x1
25 #define PROTO_TCP_CONN_STATE_ESTABILISHED 0x2
26 #define PROTO_TCP_CONN_STATE_DISCONNECTED 0x4
27 #define PROTO_TCP_CONN_STATE_WAIT 0x8
28 #define PROTO_TCP_CONN_STATE_READY 0x10
29 #define PROTO_TCP_CONN_STATE_CLOSE 0x20
30 #define PROTO_TCP_CONN_STATE_ESTABILISHERROR 0x40
32 /* TCP connection structure */
33 typedef struct proto_tcp_conn_context {
34 struct proto_tcp_conn_context *next, *prev;
36 net_ipv4 ip_source;
37 net_ipv4 ip_dest;
39 net_port port_source;
40 net_port port_dest;
42 unsigned seq;
43 unsigned ack;
45 unsigned short flags;
47 unsigned char state;
49 unsigned char bind;
51 unsigned short fd;
53 unsigned char cross;
55 netif_t *netif;
57 unsigned short offset;
58 unsigned short len;
59 char *data;
60 } proto_tcp_conn_t;
62 /* TCPv6 connection structure */
63 typedef struct proto_tcp6_conn_context {
64 struct proto_tcp6_conn_context *next, *prev;
66 net_ipv6 ip_source;
67 net_ipv6 ip_dest;
69 net_port port_source;
70 net_port port_dest;
72 unsigned seq;
73 unsigned ack;
75 unsigned short flags;
77 unsigned char state;
79 unsigned char bind;
81 unsigned short fd;
83 unsigned char cross;
85 netif_t *netif;
87 unsigned short offset;
88 unsigned short len;
89 char *data;
90 } proto_tcp6_conn_t;
92 /* TCP server backlog structure */
93 typedef struct proto_tcp_backlog_context {
94 struct proto_tcp_backlog_context *next, *prev;
96 net_ipv4 ip;
98 net_port port;
100 unsigned seq;
102 proto_tcp_conn_t *conn;
103 } proto_tcp_backlog_t;
105 /* TCPv6 server backlog structure */
106 typedef struct proto_tcp6_backlog_context {
107 struct proto_tcp6_backlog_context *next, *prev;
109 net_ipv6 ip;
111 net_port port;
113 unsigned seq;
115 proto_tcp6_conn_t *conn;
116 } proto_tcp6_backlog_t;
118 /* TCP layer structure */
119 typedef struct proto_tcp_t {
120 net_port port_source; // 2
121 net_port port_dest; // 4
123 unsigned seq; // 8
124 unsigned ack; // 12
126 unsigned char res:4; // 13
127 unsigned char data_offset:4;
129 unsigned char flags; // 14
131 unsigned short window; // 16
133 unsigned short checksum; // 18
135 // unsigned char *options;
136 } proto_tcp_t;
139 extern unsigned init_net_proto_tcp ();
140 extern unsigned init_net_proto_tcp6 ();
142 #endif