📄 route.h
字号:
/* static char *sccsid = "@(#)route.h 4.1 (ULTRIX) 7/2/90"; *//************************************************************************ * * * Copyright (c) 1984,1988 by * * Digital Equipment Corporation, Maynard, MA * * All rights reserved. * * * * This software is furnished under a license and may be used and * * copied only in accordance with the terms of such license and * * with the inclusion of the above copyright notice. This * * software or any other copies thereof may not be provided or * * otherwise made available to any other person. No title to and * * ownership of the software is hereby transferred. * * * * This software is derived from software received from the * * University of California, Berkeley, and from Bell * * Laboratories. Use, duplication, or disclosure is subject to * * restrictions under license agreements with University of * * California and with AT&T. * * * * The information in this software is subject to change without * * notice and should not be construed as a commitment by Digital * * Equipment Corporation. * * * * Digital assumes no responsibility for the use or reliability * * of its software on equipment which is not supplied by Digital. * * * ************************************************************************//* * Copyright (c) 1980 Regents of the University of California. * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * * route.h 7.1 (Berkeley) 6/4/86 *//* * 27-MAR-89 U. Sinkewicz * Added lp routing changes from 3/16/89. * * 15-Jan-88 lp * Merge of final 43BSD changes. Use new memory allocation * scheme for mbufs. * */ /* * Kernel resident routing tables. * * The routing tables are initialized at boot time by * making entries for all directly connected interfaces. *//* * A route consists of a destination address and a reference * to a routing entry. These are often held by protocols * in their control blocks, e.g. inpcb. */struct route { struct rtentry *ro_rt; struct sockaddr ro_dst;};/* * We distinguish between routes to hosts and routes to networks, * preferring the former if available. For each route we infer * the interface to use from the gateway address supplied when * the route was entered. Routes that forward packets through * gateways are marked so that the output routines know to address the * gateway rather than the ultimate destination. */struct rtentry { u_long rt_hash; /* to speed lookups */ struct sockaddr rt_dst; /* key */ struct sockaddr rt_gateway; /* value */ short rt_flags; /* up/down?, host/net */ short rt_refcnt; /* # held references */ u_long rt_use; /* raw # packets forwarded */ struct ifnet *rt_ifp; /* the answer: interface to use */ struct rtentry *rt_next; /* next in list */};#define RTF_UP 0x1 /* route useable */#define RTF_GATEWAY 0x2 /* destination is a gateway */#define RTF_HOST 0x4 /* host entry (net otherwise) */#define RTF_DYNAMIC 0x10 /* created dynamically (by redirect) */#define RTF_MODIFIED 0x20 /* changed by redirect *//* * Routing statistics. */struct rtstat { short rts_badredirect; /* bogus redirect calls */ short rts_dynamic; /* routes created by redirects */ short rts_newgateway; /* routes modified by redirects */ short rts_unreach; /* lookups which failed */ short rts_wildcard; /* lookups satisfied by a wildcard */};#ifdef KERNEL#define RTLOCK() smp_lock(&lk_rtentry, LK_RETRY)#define RTUNLOCK() smp_unlock(&lk_rtentry)#ifdef old#define RTFREE(rt) \ if ((rt)->rt_refcnt == 1) \ rtfree(rt); \ else \ (rt)->rt_refcnt--;#endif /* old */#ifdef GATEWAY#define RTHASHSIZ 64#else#define RTHASHSIZ 8#endif#if (RTHASHSIZ & (RTHASHSIZ - 1)) == 0#define RTHASHMOD(h) ((h) & (RTHASHSIZ - 1))#else#define RTHASHMOD(h) ((h) % RTHASHSIZ)#endifstruct rtentry *rthost[RTHASHSIZ];struct rtentry *rtnet[RTHASHSIZ];struct rtstat rtstat;#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -