route.h,v

来自「TCP-IP红宝书源代码」· H,V 代码 · 共 86 行

H,V
86
字号
head	1.2;
access;
symbols;
locks
	dls:1.2; strict;
comment	@ * @;


1.2
date	97.09.21.19.26.19;	author dls;	state Dist;
branches;
next	1.1;

1.1
date	94.05.10.20.48.46;	author dls;	state Old;
branches;
next	;


desc
@@


1.2
log
@pre-3e code
@
text
@/* route.h - RTFREE */

/* Routing Table Entries: */
struct route {
	IPaddr	rt_net;		/* network address for this route	*/
	IPaddr	rt_mask;	/* mask for this route			*/
	IPaddr	rt_gw;		/* next IP hop				*/
	short	rt_metric;	/* distance metric			*/
	short	rt_ifnum;	/* interface number			*/
	short	rt_key;		/* sort key				*/
	short	rt_ttl;		/* time to live	(seconds)		*/
	struct	route *rt_next;	/* next entry for this hash value	*/
/* stats */
	int	rt_refcnt;	/* current reference count		*/
	int	rt_usecnt;	/* total use count so far		*/
};

/* Routing Table Global Data: */
struct rtinfo {
	struct	route	*ri_default;
	int		ri_bpool;
	Bool		ri_valid;
	int		ri_mutex;
};

#define	RT_DEFAULT ip_anyaddr	/* the default net			*/
#define	RT_LOOPBACK ip_loopback	/* the loopback net			*/
#define	RT_TSIZE	512	/* these are pointers; it's cheap	*/
#define	RT_INF		999	/* no timeout for this route		*/

#define	RTM_INF		16	/* an infinite metric			*/

/* rtget()'s second argument... */

#define	RTF_REMOTE	0	/* traffic is from a remote host	*/
#define	RTF_LOCAL	1	/* traffic is locally generated		*/

#define	RT_BPSIZE	100	/* max number of routes			*/

/* RTFREE - remove a route reference (assumes ri_mutex HELD)		*/

#define	RTFREE(prt)					\
	if (--prt->rt_refcnt <= 0) {			\
		freebuf(prt);				\
	}

extern	struct	rtinfo	Route;
extern	struct	route	*rttable[];
@


1.1
log
@Initial revision
@
text
@@

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?