Cleanup in elf.c with .bss section clean; adm command mounts cdrom instead of floppy...
[ZeXOS.git] / kernel / include / net / ip.h
blobb19e2da1237883682f898d714c5da47b13098add
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 _IP_H
20 #define _IP_H
22 #include <net/if.h>
24 typedef unsigned net_ipv4;
25 typedef unsigned short net_ipv6[8];
27 #define NET_IPV4_TO_ADDR(a, b, c, d) \
28 (((net_ipv4)(d) << 24) | (((net_ipv4)(c) & 0xff) << 16) | (((net_ipv4)(b) & 0xff) << 8) | ((net_ipv4)(a) & 0xff))
31 #define NET_PROTO_IP_TYPE_ICMP 0x1
32 #define NET_PROTO_IP_TYPE_ICMP6 0x3a
33 #define NET_PROTO_IP_TYPE_TCP 0x6
34 #define NET_PROTO_IP_TYPE_TCP6 0x6
35 #define NET_PROTO_IP_TYPE_UDP 0x11
36 #define NET_PROTO_IP_TYPE_UDP6 0x11
37 #define NET_PROTO_IP_TYPE_TUN6 0x29
39 #define NET_PROTO_IP_FLAG_TUNNEL 0x80
42 typedef struct proto_ip_t {
43 unsigned char head_len:4;
44 unsigned char ver:4;
46 unsigned char res0;
48 unsigned short total_len;
50 unsigned short ident;
52 unsigned char flags;
54 unsigned char frag;
56 unsigned char ttl;
58 unsigned char proto;
60 unsigned short checksum;
62 net_ipv4 ip_source;
63 net_ipv4 ip_dest;
64 } proto_ip_t;
66 typedef struct proto_ipv6_t {
67 unsigned char ver;
68 unsigned char tclass;
69 unsigned short flabel;
71 unsigned short pl_len;
73 unsigned char nhead;
75 unsigned char hop;
77 net_ipv6 ip_source;
78 net_ipv6 ip_dest;
79 } proto_ipv6_t;
81 extern void NET_IPV6_TO_ADDR (net_ipv6 ip, unsigned short a, unsigned short b, unsigned short c, unsigned short d,
82 unsigned short e, unsigned short f, unsigned short g, unsigned short h);
83 extern unsigned net_proto_ipv6_cmp (net_ipv6 ip, net_ipv6 ip2);
84 extern void net_proto_ip_print (net_ipv4 ip);
85 extern net_ipv4 net_proto_ip_convert (char *ip);
86 extern unsigned net_proto_ip_network (net_ipv4 ip);
87 extern unsigned net_proto_ip_convert2 (net_ipv4 ip, char *ip_addr);
88 //extern unsigned net_proto_ip_esend (netif_t *netif, packet_t *packet, proto_ip_t *ip, char *buf, unsigned len);
89 //extern unsigned net_proto_ip_send (netif_t *netif, net_ipv4 ip_addr, char *buf, unsigned len);
90 extern unsigned init_net_packet ();
92 #endif