📄 route.h
字号:
/***************************************************************************
*
* Copyright (c) 1993 READY SYSTEMS CORPORATION.
*
* All rights reserved. READY SYSTEMS' source code is an unpublished
* work and the use of a copyright notice does not imply otherwise.
* This source code contains confidential, trade secret material of
* READY SYSTEMS. Any attempt or participation in deciphering, decoding,
* reverse engineering or in any way altering the source code is
* strictly prohibited, unless the prior written consent of
* READY SYSTEMS is obtained.
*
*
* Module Name: route.h
*
* Identification: @(#) 1.3 route.h
*
* Date: 1/6/94 16:33:23
*
****************************************************************************
*/
/*
RCS header identifier - route.h,v 1.2 1995/01/05 16:32:03 sriram Exp
*/
/*
* Copyrighted as an unpublished work.
* (c) Copyright 1987-1993 Lachman Technology, Incorporated
* All rights reserved.
*
* RESTRICTED RIGHTS
*
* These programs are supplied under a license. They may be used,
* disclosed, and/or copied only as permitted under such license
* agreement. Any copy must contain the above copyright notice and
* this restricted rights notice. Use, copying, and/or disclosure
* of the programs is strictly prohibited unless otherwise provided
* in the license agreement.
*/
/*
* Copyright (c) 1985 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
/* **********************************************************************
*
* CHANGE HISTORY:
*
* ----------------------------------------------------------------------
* DATE CHANGES
* ----------------------------------------------------------------------
*
* 12/14/94 Included the Version 5 TCP compatible code for SNMP_V2.
* Check for #ifdef VER5_COMPAT.
*
* ********************************************************************* */
#ifndef route_h
#define route_h
#ifdef SNX
#ifndef VER5_COMPAT
#define VER5_COMPAT
#endif
#ifndef route_5h
#include "net/route5.h"
#endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* route.h 6.1 83/07/29 */
/*
* Kernel resident routing tables.
*
* The routing tables are initialized when interface addresses are set 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 {
mblk_t *ro_rt; /* Contains an rtentry */
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 ip_provider *rt_prov; /* the answer: provider to use */
int rt_metric; /* metric for route provider */
int rt_proto; /* protocol route was learned */
long rt_age; /* time of last update */
};
#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 /* modified dynamically by redirect */
#define RTF_REMOTE 0x40 /* route used for forwarded packets */
#define RTF_USERMASK (RTF_GATEWAY|RTF_HOST)
/*
* Protocols for learning routes. These values are from RFC 1158.
*/
#define RTP_OTHER 1
#define RTP_LOCAL 2
#define RTP_NETMGMT 3
#define RTP_ICMP 4
#define RTP_EGP 5
#define RTP_GGP 6
#define RTP_HELLO 7
#define RTP_RIP 8
#define RTP_IS_IS 9
#define RTP_ES_IS 10
#define RTP_CISCOIGRP 11
#define RTP_BBNSPFIGP 12
#define RTP_OSPF 13
#define RTP_BGP 14
/*
* 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 VER5_COMPAT
u_long rts_pmtumade; /* routes created via PMTU discovery */
u_long rts_pmtumod; /* routes modified by PMTU discovery */
u_long rts_discard; /* routes discarded by PMTU discovery */
#endif
};
#ifdef KERNEL
#define RT(x) ((struct rtentry *) (x)->b_rptr)
#define RTFREE(rt) \
if (RT(rt)->rt_refcnt == 1) \
rt_free(rt); \
else \
RT(rt)->rt_refcnt--;
#define RTHASHSIZ 64
#if (RTHASHSIZ & (RTHASHSIZ - 1)) == 0
#define RTHASHMOD(h) ((h) & (RTHASHSIZ - 1))
#else
#define RTHASHMOD(h) ((h) % RTHASHSIZ)
#endif
extern mblk_t *rt_host[];
extern mblk_t *rt_net[];
extern struct rtstat rt_stat;
#endif
#ifdef __cplusplus
}
#endif
#endif /* route_h */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -