135592Sbostic /* 2*61474Sbostic * Copyright (c) 1983, 1993 3*61474Sbostic * The Regents of the University of California. All rights reserved. 435592Sbostic * 542698Sbostic * %sccs.include.redist.c% 635592Sbostic * 735592Sbostic * @(#)table.h 5.1 (Berkeley) 6/4/85 (routed/table.h) 835592Sbostic * 9*61474Sbostic * @(#)table.h 8.1 (Berkeley) 06/05/93 1035592Sbostic */ 1135592Sbostic 1235592Sbostic /* 1335592Sbostic * Routing table management daemon. 1435592Sbostic */ 1535592Sbostic 1635592Sbostic /* 1735592Sbostic * Routing table structure; differs a bit from kernel tables. 1835592Sbostic * 1935592Sbostic * Note: the union below must agree in the first 4 members 2035592Sbostic * so the ioctl's will work. 2135592Sbostic */ 2235592Sbostic struct rthash { 2335592Sbostic struct rt_entry *rt_forw; 2435592Sbostic struct rt_entry *rt_back; 2535592Sbostic }; 2635592Sbostic 2738688Skarels #ifdef RTM_ADD 2838688Skarels #define rtentry ortentry 2938688Skarels #endif 3038688Skarels 3135592Sbostic struct rt_entry { 3235592Sbostic struct rt_entry *rt_forw; 3335592Sbostic struct rt_entry *rt_back; 3435592Sbostic union { 3535592Sbostic struct rtentry rtu_rt; 3635592Sbostic struct { 3735592Sbostic u_long rtu_hash; 3835592Sbostic struct sockaddr rtu_dst; 3935592Sbostic struct sockaddr rtu_router; 4035592Sbostic short rtu_flags; 4135592Sbostic short rtu_state; 4235592Sbostic int rtu_timer; 4335592Sbostic int rtu_metric; 4435592Sbostic struct interface *rtu_ifp; 4535592Sbostic } rtu_entry; 4635592Sbostic } rt_rtu; 4735592Sbostic }; 4835592Sbostic 4935592Sbostic #define rt_rt rt_rtu.rtu_rt /* pass to ioctl */ 5035592Sbostic #define rt_hash rt_rtu.rtu_entry.rtu_hash /* for net or host */ 5135592Sbostic #define rt_dst rt_rtu.rtu_entry.rtu_dst /* match value */ 5235592Sbostic #define rt_router rt_rtu.rtu_entry.rtu_router /* who to forward to */ 5335592Sbostic #define rt_flags rt_rtu.rtu_entry.rtu_flags /* kernel flags */ 5435592Sbostic #define rt_timer rt_rtu.rtu_entry.rtu_timer /* for invalidation */ 5535592Sbostic #define rt_state rt_rtu.rtu_entry.rtu_state /* see below */ 5635592Sbostic #define rt_metric rt_rtu.rtu_entry.rtu_metric /* cost of route */ 5735592Sbostic #define rt_ifp rt_rtu.rtu_entry.rtu_ifp /* interface to take */ 5835592Sbostic 5935592Sbostic #define ROUTEHASHSIZ 32 /* must be a power of 2 */ 6035592Sbostic #define ROUTEHASHMASK (ROUTEHASHSIZ - 1) 6135592Sbostic 6235592Sbostic /* 6335592Sbostic * "State" of routing table entry. 6435592Sbostic */ 6535592Sbostic #define RTS_CHANGED 0x1 /* route has been altered recently */ 6635592Sbostic #define RTS_PASSIVE IFF_PASSIVE /* don't time out route */ 6735592Sbostic #define RTS_INTERFACE IFF_INTERFACE /* route is for network interface */ 6835592Sbostic #define RTS_REMOTE IFF_REMOTE /* route is for ``remote'' entity */ 6935592Sbostic 7035592Sbostic struct rthash nethash[ROUTEHASHSIZ]; 7135592Sbostic struct rthash hosthash[ROUTEHASHSIZ]; 7235592Sbostic struct rt_entry *rtlookup(); 7335592Sbostic struct rt_entry *rtfind(); 74