Fixed buffer overflow in mserver; fixed type of checkinfo () 2nd parameter; memory
[ZeXOS.git] / kernel / include / net / udp.h
blobc0d1042558dfb70ec2f5476383579544acb01742
1 /*
2 * ZeX/OS
3 * Copyright (C) 2008 Tomas 'ZeXx86' Jedrzejek (zexx86@zexos.org)
4 * Copyright (C) 2009 Tomas 'ZeXx86' Jedrzejek (zexx86@zexos.org)
5 * Copyright (C) 2010 Tomas 'ZeXx86' Jedrzejek (zexx86@zexos.org)
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #ifndef _UDP_H
22 #define _UDP_H
24 #include <net/ip.h>
26 #define PROTO_UDP_CONN_STATE_NEW 0x1
28 /* UDP connection structure */
29 typedef struct proto_udp_conn_context {
30 struct proto_udp_conn_context *next, *prev;
32 net_ipv4 ip_source;
33 net_ipv4 ip_dest;
35 net_port port_source;
36 net_port port_dest;
38 unsigned short flags;
40 unsigned char bind;
42 unsigned char state;
44 unsigned short fd;
46 netif_t *netif;
48 unsigned len;
49 char *data;
50 } proto_udp_conn_t;
52 /* UDP connection structure */
53 typedef struct proto_udp6_conn_context {
54 struct proto_udp6_conn_context *next, *prev;
56 net_ipv6 ip_source;
57 net_ipv6 ip_dest;
59 net_port port_source;
60 net_port port_dest;
62 unsigned short flags;
64 unsigned char bind;
66 unsigned short fd;
68 netif_t *netif;
70 unsigned len;
71 char *data;
72 } proto_udp6_conn_t;
74 /* UDP layer structure */
75 typedef struct proto_udp_t {
76 net_port port_source; // 2
77 net_port port_dest; // 4
79 unsigned short len; // 6
81 unsigned short checksum; // 8
82 } proto_udp_t;
85 /* externs */
86 extern int net_proto_udp_anycast (int fd);
87 extern int net_proto_udp_port (int fd, net_port port);
88 extern unsigned init_net_proto_udp ();
89 extern unsigned init_net_proto_udp6 ();
91 #endif