~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/include/net/route.h

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  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 router.
  7  *
  8  * Version:     @(#)route.h     1.0.4   05/27/93
  9  *
 10  * Authors:     Ross Biro, <bir7@leland.Stanford.Edu>
 11  *              Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
 12  * Fixes:
 13  *              Alan Cox        :       Reformatted. Added ip_rt_local()
 14  *              Alan Cox        :       Support for TCP parameters.
 15  *              Alexey Kuznetsov:       Major changes for new routing code.
 16  *              Mike McLagan    :       Routing by source
 17  *
 18  *              This program is free software; you can redistribute it and/or
 19  *              modify it under the terms of the GNU General Public License
 20  *              as published by the Free Software Foundation; either version
 21  *              2 of the License, or (at your option) any later version.
 22  */
 23 #ifndef _ROUTE_H
 24 #define _ROUTE_H
 25 
 26 #include <linux/config.h>
 27 #include <net/dst.h>
 28 #include <net/inetpeer.h>
 29 #include <linux/in_route.h>
 30 #include <linux/rtnetlink.h>
 31 #include <linux/route.h>
 32 
 33 #ifndef __KERNEL__
 34 #warning This file is not supposed to be used outside of kernel.
 35 #endif
 36 
 37 #define RTO_ONLINK      0x01
 38 #define RTO_TPROXY      0x80000000
 39 
 40 #define RTO_CONN        0
 41 
 42 struct rt_key
 43 {
 44         __u32                   dst;
 45         __u32                   src;
 46         int                     iif;
 47         int                     oif;
 48 #ifdef CONFIG_IP_ROUTE_FWMARK
 49         __u32                   fwmark;
 50 #endif
 51         __u8                    tos;
 52         __u8                    scope;
 53 };
 54 
 55 struct inet_peer;
 56 struct rtable
 57 {
 58         union
 59         {
 60                 struct dst_entry        dst;
 61                 struct rtable           *rt_next;
 62         } u;
 63 
 64         unsigned                rt_flags;
 65         unsigned                rt_type;
 66 
 67         __u32                   rt_dst; /* Path destination     */
 68         __u32                   rt_src; /* Path source          */
 69         int                     rt_iif;
 70 
 71         /* Info on neighbour */
 72         __u32                   rt_gateway;
 73 
 74         /* Cache lookup keys */
 75         struct rt_key           key;
 76 
 77         /* Miscellaneous cached information */
 78         __u32                   rt_spec_dst; /* RFC1122 specific destination */
 79         struct inet_peer        *peer; /* long-living peer info */
 80 
 81 #ifdef CONFIG_IP_ROUTE_NAT
 82         __u32                   rt_src_map;
 83         __u32                   rt_dst_map;
 84 #endif
 85 };
 86 
 87 struct ip_rt_acct
 88 {
 89         __u32   o_bytes;
 90         __u32   o_packets;
 91         __u32   i_bytes;
 92         __u32   i_packets;
 93 };
 94 
 95 extern struct ip_rt_acct *ip_rt_acct;
 96 
 97 struct in_device;
 98 extern void             ip_rt_init(void);
 99 extern void             ip_rt_redirect(u32 old_gw, u32 dst, u32 new_gw,
100                                        u32 src, u8 tos, struct net_device *dev);
101 extern void             ip_rt_advice(struct rtable **rp, int advice);
102 extern void             rt_cache_flush(int how);
103 extern int              ip_route_output_key(struct rtable **, const struct rt_key *key);
104 extern int              ip_route_input(struct sk_buff*, u32 dst, u32 src, u8 tos, struct net_device *devin);
105 extern unsigned short   ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu);
106 extern void             ip_rt_update_pmtu(struct dst_entry *dst, unsigned mtu);
107 extern void             ip_rt_send_redirect(struct sk_buff *skb);
108 
109 extern unsigned         inet_addr_type(u32 addr);
110 extern void             ip_rt_multicast_event(struct in_device *);
111 extern int              ip_rt_ioctl(unsigned int cmd, void *arg);
112 extern void             ip_rt_get_source(u8 *src, struct rtable *rt);
113 extern int              ip_rt_dump(struct sk_buff *skb,  struct netlink_callback *cb);
114 
115 /* Deprecated: use ip_route_output_key directly */
116 static inline int ip_route_output(struct rtable **rp,
117                                       u32 daddr, u32 saddr, u32 tos, int oif)
118 {
119         struct rt_key key = { dst:daddr, src:saddr, oif:oif, tos:tos };
120 
121         return ip_route_output_key(rp, &key);
122 }
123 
124 
125 static inline void ip_rt_put(struct rtable * rt)
126 {
127         if (rt)
128                 dst_release(&rt->u.dst);
129 }
130 
131 #ifdef CONFIG_INET_ECN
132 #define IPTOS_RT_MASK   (IPTOS_TOS_MASK & ~3)
133 #else
134 #define IPTOS_RT_MASK   IPTOS_TOS_MASK
135 #endif
136 
137 
138 extern __u8 ip_tos2prio[16];
139 
140 static inline char rt_tos2priority(u8 tos)
141 {
142         return ip_tos2prio[IPTOS_TOS(tos)>>1];
143 }
144 
145 static inline int ip_route_connect(struct rtable **rp, u32 dst, u32 src, u32 tos, int oif)
146 {
147         int err;
148         err = ip_route_output(rp, dst, src, tos, oif);
149         if (err || (dst && src))
150                 return err;
151         dst = (*rp)->rt_dst;
152         src = (*rp)->rt_src;
153         ip_rt_put(*rp);
154         *rp = NULL;
155         return ip_route_output(rp, dst, src, tos, oif);
156 }
157 
158 extern void rt_bind_peer(struct rtable *rt, int create);
159 
160 static inline struct inet_peer *rt_get_peer(struct rtable *rt)
161 {
162         if (rt->peer)
163                 return rt->peer;
164 
165         rt_bind_peer(rt, 0);
166         return rt->peer;
167 }
168 
169 #endif  /* _ROUTE_H */
170 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.