3 * Copyright (C) 2008 Tomas 'ZeXx86' Jedrzejek (zexx86@gmail.com)
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/>.
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;
48 unsigned short total_len
;
60 unsigned short checksum
;
66 typedef struct proto_ipv6_t
{
69 unsigned short flabel
;
71 unsigned short pl_len
;
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 ();