root/include/net/ip.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   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 
  51 /* Describe an IP fragment. */
  52 struct ipfrag 
  53 {
  54         int             offset;         /* offset of fragment in IP datagram    */
  55         int             end;            /* last byte of data in datagram        */
  56         int             len;            /* length of this fragment              */
  57         struct sk_buff  *skb;           /* complete received fragment           */
  58         unsigned char   *ptr;           /* pointer into real fragment data      */
  59         struct ipfrag   *next;          /* linked list pointers                 */
  60         struct ipfrag   *prev;
  61 };
  62 
  63 /*
  64  *      Describe an entry in the "incomplete datagrams" queue. 
  65  */
  66  
  67 struct ipq       
  68 {
  69         unsigned char   *mac;           /* pointer to MAC header                */
  70         struct iphdr    *iph;           /* pointer to IP header                 */
  71         int             len;            /* total length of original datagram    */
  72         short           ihlen;          /* length of the IP header              */      
  73         short           maclen;         /* length of the MAC header             */
  74         struct timer_list timer;        /* when will this queue expire?         */
  75         struct ipfrag   *fragments;     /* linked list of received fragments    */
  76         struct ipq      *next;          /* linked list pointers                 */
  77         struct ipq      *prev;
  78         struct device   *dev;           /* Device - for icmp replies */
  79 };
  80 
  81 /*
  82  *      Functions provided by ip.c
  83  */
  84 
  85 extern void             ip_print(const struct iphdr *ip);
  86 extern int              ip_ioctl(struct sock *sk, int cmd, unsigned long arg);
  87 extern void             ip_route_check(__u32 daddr); 
  88 extern int              ip_send(struct rtable *rt, struct sk_buff *skb, __u32 daddr, int len, struct device *dev, __u32 saddr);
  89 extern int              ip_build_header(struct sk_buff *skb,
  90                                         __u32 saddr,
  91                                         __u32 daddr,
  92                                         struct device **dev, int type,
  93                                         struct options *opt, int len,
  94                                         int tos,int ttl,struct rtable **rp);
  95 extern int              ip_rcv(struct sk_buff *skb, struct device *dev,
  96                                struct packet_type *pt);
  97 extern int              ip_options_echo(struct options * dopt, struct options * sopt,
  98                                         __u32 daddr, __u32 saddr,
  99                                         struct sk_buff * skb);
 100 extern int              ip_options_compile(struct options * opt, struct sk_buff * skb);
 101 extern void             ip_send_check(struct iphdr *ip);
 102 extern int              ip_id_count;                      
 103 extern void             ip_queue_xmit(struct sock *sk,
 104                                       struct device *dev, struct sk_buff *skb,
 105                                       int free);
 106 extern void             ip_init(void);
 107 extern int              ip_build_xmit(struct sock *sk,
 108                                       void getfrag (const void *,
 109                                                     __u32,
 110                                                     char *,
 111                                                     unsigned int,
 112                                                     unsigned int),
 113                                       const void *frag,
 114                                       unsigned short int length,
 115                                       __u32 daddr,
 116                                       __u32 saddr,
 117                                       struct options * opt,
 118                                       int flags,
 119                                       int type,
 120                                       int noblock);
 121 
 122 extern struct ip_mib    ip_statistics;
 123 
 124 /*
 125  *      Functions provided by ip_fragment.o
 126  */
 127  
 128 struct sk_buff *ip_defrag(struct iphdr *iph, struct sk_buff *skb, struct device *dev);
 129 void ip_fragment(struct sock *sk, struct sk_buff *skb, struct device *dev, int is_frag);
 130 
 131 /*
 132  *      Functions provided by ip_forward.c
 133  */
 134  
 135 extern int ip_forward(struct sk_buff *skb, struct device *dev, int is_frag, __u32 target_addr);
 136  
 137 /*
 138  *      Functions provided by ip_options.c
 139  */
 140  
 141 extern void ip_options_build(struct sk_buff *skb, struct options *opt, __u32 daddr, __u32 saddr, int is_frag);
 142 extern int ip_options_echo(struct options *dopt, struct options *sopt, __u32 daddr, __u32 saddr, struct sk_buff *skb);
 143 extern void ip_options_fragment(struct sk_buff *skb);
 144 extern int ip_options_compile(struct options *opt, struct sk_buff *skb);
 145 
 146 /*
 147  *      Functions provided by ip_sockglue.c
 148  */
 149 
 150 extern int              ip_setsockopt(struct sock *sk, int level, int optname, char *optval, int optlen);
 151 extern int              ip_getsockopt(struct sock *sk, int level, int optname, char *optval, int *optlen);
 152   
 153 #endif  /* _IP_H */

/* [previous][next][first][last][top][bottom][index][help] */