| 1 |
199 |
simons |
/*
|
| 2 |
|
|
* INET An implementation of the TCP/IP protocol suite for the LINUX
|
| 3 |
|
|
* operating system. INET is implemented using the BSD Socket
|
| 4 |
|
|
* interface as the means of communication with the user level.
|
| 5 |
|
|
*
|
| 6 |
|
|
* Definitions for the IP module.
|
| 7 |
|
|
*
|
| 8 |
|
|
* Version: @(#)ip.h 1.0.2 05/07/93
|
| 9 |
|
|
*
|
| 10 |
|
|
* Authors: Ross Biro, <bir7@leland.Stanford.Edu>
|
| 11 |
|
|
* Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
|
| 12 |
|
|
* Alan Cox, <gw4pts@gw4pts.ampr.org>
|
| 13 |
|
|
*
|
| 14 |
|
|
* This program is free software; you can redistribute it and/or
|
| 15 |
|
|
* modify it under the terms of the GNU General Public License
|
| 16 |
|
|
* as published by the Free Software Foundation; either version
|
| 17 |
|
|
* 2 of the License, or (at your option) any later version.
|
| 18 |
|
|
*/
|
| 19 |
|
|
#ifndef _IP_H
|
| 20 |
|
|
#define _IP_H
|
| 21 |
|
|
|
| 22 |
|
|
|
| 23 |
|
|
#include <linux/config.h>
|
| 24 |
|
|
#include <linux/types.h>
|
| 25 |
|
|
#include <linux/socket.h>
|
| 26 |
|
|
#include <linux/ip.h>
|
| 27 |
|
|
#include <linux/netdevice.h>
|
| 28 |
|
|
#include <net/route.h>
|
| 29 |
|
|
|
| 30 |
|
|
#ifndef _SNMP_H
|
| 31 |
|
|
#include <net/snmp.h>
|
| 32 |
|
|
#endif
|
| 33 |
|
|
|
| 34 |
|
|
#include <net/sock.h> /* struct sock */
|
| 35 |
|
|
|
| 36 |
|
|
/* IP flags. */
|
| 37 |
|
|
#define IP_CE 0x8000 /* Flag: "Congestion" */
|
| 38 |
|
|
#define IP_DF 0x4000 /* Flag: "Don't Fragment" */
|
| 39 |
|
|
#define IP_MF 0x2000 /* Flag: "More Fragments" */
|
| 40 |
|
|
#define IP_OFFSET 0x1FFF /* "Fragment Offset" part */
|
| 41 |
|
|
|
| 42 |
|
|
#define IP_FRAG_TIME (30 * HZ) /* fragment lifetime */
|
| 43 |
|
|
|
| 44 |
|
|
#ifdef CONFIG_IP_MULTICAST
|
| 45 |
|
|
extern void ip_mc_dropsocket(struct sock *);
|
| 46 |
|
|
extern void ip_mc_dropdevice(struct device *dev);
|
| 47 |
|
|
extern int ip_mc_procinfo(char *, char **, off_t, int, int);
|
| 48 |
|
|
#endif
|
| 49 |
|
|
|
| 50 |
|
|
#include <net/ip_forward.h>
|
| 51 |
|
|
|
| 52 |
|
|
/* Describe an IP fragment. */
|
| 53 |
|
|
struct ipfrag
|
| 54 |
|
|
{
|
| 55 |
|
|
int offset; /* offset of fragment in IP datagram */
|
| 56 |
|
|
int end; /* last byte of data in datagram */
|
| 57 |
|
|
int len; /* length of this fragment */
|
| 58 |
|
|
struct sk_buff *skb; /* complete received fragment */
|
| 59 |
|
|
unsigned char *ptr; /* pointer into real fragment data */
|
| 60 |
|
|
struct ipfrag *next; /* linked list pointers */
|
| 61 |
|
|
struct ipfrag *prev;
|
| 62 |
|
|
};
|
| 63 |
|
|
|
| 64 |
|
|
/*
|
| 65 |
|
|
* Describe an entry in the "incomplete datagrams" queue.
|
| 66 |
|
|
*/
|
| 67 |
|
|
|
| 68 |
|
|
struct ipq
|
| 69 |
|
|
{
|
| 70 |
|
|
unsigned char *mac; /* pointer to MAC header */
|
| 71 |
|
|
struct iphdr *iph; /* pointer to IP header */
|
| 72 |
|
|
int len; /* total length of original datagram */
|
| 73 |
|
|
short ihlen; /* length of the IP header */
|
| 74 |
|
|
short maclen; /* length of the MAC header */
|
| 75 |
|
|
struct timer_list timer; /* when will this queue expire? */
|
| 76 |
|
|
struct ipfrag *fragments; /* linked list of received fragments */
|
| 77 |
|
|
struct ipq *next; /* linked list pointers */
|
| 78 |
|
|
struct ipq *prev;
|
| 79 |
|
|
struct device *dev; /* Device - for icmp replies */
|
| 80 |
|
|
};
|
| 81 |
|
|
|
| 82 |
|
|
/*
|
| 83 |
|
|
* Functions provided by ip.c
|
| 84 |
|
|
*/
|
| 85 |
|
|
|
| 86 |
|
|
extern void ip_print(const struct iphdr *ip);
|
| 87 |
|
|
extern int ip_ioctl(struct sock *sk, int cmd, unsigned long arg);
|
| 88 |
|
|
extern void ip_route_check(__u32 daddr);
|
| 89 |
|
|
extern int ip_send(struct rtable *rt, struct sk_buff *skb, __u32 daddr, int len, struct device *dev, __u32 saddr);
|
| 90 |
|
|
extern int ip_build_header(struct sk_buff *skb,
|
| 91 |
|
|
__u32 saddr,
|
| 92 |
|
|
__u32 daddr,
|
| 93 |
|
|
struct device **dev, int type,
|
| 94 |
|
|
struct options *opt, int len,
|
| 95 |
|
|
int tos,int ttl,struct rtable **rp);
|
| 96 |
|
|
extern int ip_rcv(struct sk_buff *skb, struct device *dev,
|
| 97 |
|
|
struct packet_type *pt);
|
| 98 |
|
|
extern int ip_options_echo(struct options * dopt, struct options * sopt,
|
| 99 |
|
|
__u32 daddr, __u32 saddr,
|
| 100 |
|
|
struct sk_buff * skb);
|
| 101 |
|
|
extern int ip_options_compile(struct options * opt, struct sk_buff * skb);
|
| 102 |
|
|
extern void ip_send_check(struct iphdr *ip);
|
| 103 |
|
|
extern int ip_id_count;
|
| 104 |
|
|
extern void ip_queue_xmit(struct sock *sk,
|
| 105 |
|
|
struct device *dev, struct sk_buff *skb,
|
| 106 |
|
|
int free);
|
| 107 |
|
|
extern void ip_init(void);
|
| 108 |
|
|
extern int ip_build_xmit(struct sock *sk,
|
| 109 |
|
|
void getfrag (const void *,
|
| 110 |
|
|
__u32,
|
| 111 |
|
|
char *,
|
| 112 |
|
|
unsigned int,
|
| 113 |
|
|
unsigned int),
|
| 114 |
|
|
const void *frag,
|
| 115 |
|
|
unsigned short int length,
|
| 116 |
|
|
__u32 daddr,
|
| 117 |
|
|
__u32 saddr,
|
| 118 |
|
|
struct options * opt,
|
| 119 |
|
|
int flags,
|
| 120 |
|
|
int type,
|
| 121 |
|
|
int noblock);
|
| 122 |
|
|
|
| 123 |
|
|
extern struct ip_mib ip_statistics;
|
| 124 |
|
|
|
| 125 |
|
|
extern int sysctl_ip_dynaddr;
|
| 126 |
|
|
int ip_rewrite_addrs(struct sock *sk, struct sk_buff *skb, struct device *dev);
|
| 127 |
|
|
|
| 128 |
|
|
/*
|
| 129 |
|
|
* Functions provided by ip_fragment.o
|
| 130 |
|
|
*/
|
| 131 |
|
|
|
| 132 |
|
|
struct sk_buff *ip_defrag(struct iphdr *iph, struct sk_buff *skb, struct device *dev);
|
| 133 |
|
|
void ip_fragment(struct sock *sk, struct sk_buff *skb, struct device *dev, int is_frag);
|
| 134 |
|
|
|
| 135 |
|
|
/*
|
| 136 |
|
|
* Functions provided by ip_forward.c
|
| 137 |
|
|
*/
|
| 138 |
|
|
|
| 139 |
|
|
extern int ip_forward(struct sk_buff *skb, struct device *dev, int is_frag, __u32 target_addr);
|
| 140 |
|
|
extern int sysctl_ip_forward;
|
| 141 |
|
|
|
| 142 |
|
|
|
| 143 |
|
|
/*
|
| 144 |
|
|
* Functions provided by ip_options.c
|
| 145 |
|
|
*/
|
| 146 |
|
|
|
| 147 |
|
|
extern void ip_options_build(struct sk_buff *skb, struct options *opt, __u32 daddr, __u32 saddr, int is_frag);
|
| 148 |
|
|
extern int ip_options_echo(struct options *dopt, struct options *sopt, __u32 daddr, __u32 saddr, struct sk_buff *skb);
|
| 149 |
|
|
extern void ip_options_fragment(struct sk_buff *skb);
|
| 150 |
|
|
extern int ip_options_compile(struct options *opt, struct sk_buff *skb);
|
| 151 |
|
|
|
| 152 |
|
|
/*
|
| 153 |
|
|
* Functions provided by ip_sockglue.c
|
| 154 |
|
|
*/
|
| 155 |
|
|
|
| 156 |
|
|
extern int ip_setsockopt(struct sock *sk, int level, int optname, char *optval, int optlen);
|
| 157 |
|
|
extern int ip_getsockopt(struct sock *sk, int level, int optname, char *optval, int *optlen);
|
| 158 |
|
|
|
| 159 |
|
|
#endif /* _IP_H */
|