/*++
Copyright (c) 1995 - 1997 Microsoft Corporation
Module Name:
rtm.h
Abstract:
Interface for Routing Table Manager DLL
--*/
#ifndef __ROUTING_RTM_H__
#define __ROUTING_RTM_H__
#ifdef __cplusplus
extern "C" {
#endif
// Currently supported protocol families
#define RTM_PROTOCOL_FAMILY_IPX 0
#define RTM_PROTOCOL_FAMILY_IP 1
// Error messages specific to Routing Table Manager
#define ERROR_MORE_MESSAGES ERROR_MORE_DATA
#define ERROR_CLIENT_ALREADY_EXISTS ERROR_ALREADY_EXISTS
#define ERROR_NO_MESSAGES ERROR_NO_MORE_ITEMS
#define ERROR_NO_MORE_ROUTES ERROR_NO_MORE_ITEMS
#define ERROR_NO_ROUTES ERROR_NO_MORE_ITEMS
#define ERROR_NO_SUCH_ROUTE ERROR_NO_MORE_ITEMS
// Protocol family dependent network number structures
typedef struct _IPX_NETWORK {
DWORD N_NetNumber;
} IPX_NETWORK, *PIPX_NETWORK;
typedef struct _IP_NETWORK {
DWORD N_NetNumber;
DWORD N_NetMask;
} IP_NETWORK, *PIP_NETWORK;
// Protocol family dependent next hop router address structures
typedef struct _IPX_NEXT_HOP_ADDRESS {
BYTE NHA_Mac[6];
} IPX_NEXT_HOP_ADDRESS, *PIPX_NEXT_HOP_ADDRESS;
typedef IP_NETWORK IP_NEXT_HOP_ADDRESS, *PIP_NEXT_HOP_ADDRESS;
// Protocol family dependent specific data structures
typedef struct _IPX_SPECIFIC_DATA {
DWORD FSD_Flags; // should be set to 0 if no flags are defined
USHORT FSD_TickCount; // ticks to destination network
USHORT FSD_HopCount; // hops to destination network
} IPX_SPECIFIC_DATA, *PIPX_SPECIFIC_DATA;
// The following flags are defined for the IPX family dependent Flags field
#define IPX_GLOBAL_CLIENT_WAN_ROUTE 0x00000001
typedef struct _IP_SPECIFIC_DATA
{
DWORD FSD_Type; // One of : other,invalid,local,remote (1-4)
DWORD FSD_Policy; // See RFC 1354
DWORD FSD_NextHopAS; // Autonomous System Number of Next Hop
DWORD FSD_Priority; // For comparing Inter Protocol Metrics
DWORD FSD_Metric; // For comparing Intra Protocol Metrics
DWORD FSD_Metric1; // Protocol specific metrics for MIB II
DWORD FSD_Metric2; // conformance. MIB II agents will not
DWORD FSD_Metric3; // display FSD_Metric, they will only
DWORD FSD_Metric4; // display Metrics1-5, so if you want your
DWORD FSD_Metric5; // metric displayed, put it in one of these
// fields ALSO (It has to be in the
// FSD_Metric field always). It is up to the
// implementor to keep the fields consistent
DWORD FSD_Flags; // Flags defined below
} IP_SPECIFIC_DATA, *PIP_SPECIFIC_DATA;
//
// All routing protocols MUST clear out the FSD_Flags field.
// If RTM notifies a protocol of a route and that route is marked
// invalid, the protocols MUST disregard this route. A protocol
// may mark a route as invalid, if it does not want the route to
// be indicated to other protocols or set to the stack. e.g. RIPv2
// marks summarized routes as INVALID and uses the RTM purely as
// a store for such routes. These routes are not considered when
// comparing metrics etc to decide the "best" route
//
#define IP_VALID_ROUTE 0x00000001
#define ClearRouteFlags(pRoute) \
((pRoute)->RR_FamilySpecificData.FSD_Flags = 0x00000000)
#define IsRouteValid(pRoute) \
((pRoute)->RR_FamilySpecificData.FSD_Flags & IP_VALID_ROUTE)
#define SetRouteValid(pRoute) \
((pRoute)->RR_FamilySpecificData.FSD_Flags |= IP_VALID_ROUTE)
#define ClearRouteValid(pRoute) \
((pRoute)->RR_FamilySpecificData.FSD_Flags &= ~IP_VALID_ROUTE)
#define IsRouteNonUnicast(pRoute) \
(((DWORD)((pRoute)->RR_Network.N_NetNumber & 0x000000FF)) >= ((DWORD)0x000000E0))
#define IsRouteLoopback(pRoute) \
((((pRoute)->RR_Network.N_NetNumber & 0x000000FF) == 0x0000007F) || \
((pRoute)->RR_NextHopAddress.N_NetNumber == 0x0100007F))
// Protocol dependent specific data structure
typedef struct _PROTOCOL_SPECIFIC_DATA {
DWORD PSD_Data[4];
} PROTOCOL_SPECIFIC_DATA, *PPROTOCOL_SPECIFIC_DATA;
#define DWORD_ALIGN(type,field) \
union { \
type field; \
DWORD field##Align; \
}
// Standard header associated with all types of routes
#define ROUTE_HEADER \
DWORD_ALIGN ( \
FILETIME, RR_TimeStamp); \
DWORD RR_RoutingProtocol; \
DWORD RR_InterfaceID; \
DWORD_ALIGN ( \
PROTOCOL_SPECIFIC_DATA, RR_ProtocolSpecificData)
// Ensure dword aligment of all fields
// Protocol family dependent route entries
// (intended for use by protocol handlers to pass paramerters
// to and from RTM routines)
typedef struct _RTM_IPX_ROUTE {
ROUTE_HEADER;
DWORD_ALIGN (
IPX_NETWORK, RR_Network);
DWORD_ALIGN (
IPX_NEXT_HOP_ADDRESS, RR_NextHopAddress);
DWORD_ALIGN (
IPX_SPECIFIC_DATA, RR_FamilySpecificData);
} RTM_IPX_ROUTE, *PRTM_IPX_ROUTE;
typedef struct _RTM_IP_ROUTE {
ROUTE_HEADER;
DWORD_ALIGN (
IP_NETWORK, RR_Network);
DWORD_ALIGN (
IP_NEXT_HOP_ADDRESS, RR_NextHopAddress);
DWORD_ALIGN (
IP_SPECIFIC_DATA, RR_FamilySpecificData);
} RTM_IP_ROUTE, *PRTM_IP_ROUTE;
// RTM route change message flags
// Flags to test the presence of route change information
// in the buffers filled by RTM routines
#define RTM_CURRENT_BEST_ROUTE 0x00000001
#define RTM_PREVIOUS_BEST_ROUTE 0x00000002
// Flags that convey what acutally happened
#define RTM_NO_CHANGE 0
#define RTM_ROUTE_ADDED RTM_CURRENT_BEST_ROUTE
#define RTM_ROUTE_DELETED RTM_PREVIOUS_BEST_ROUTE
#define RTM_ROUTE_CHANGED (RTM_CURRENT_BEST_ROUTE|RTM_PREVIOUS_BEST_ROUTE)
// Enumeration flags limit that enumerations of routes in the table
// to only entries with the specified field(s)
#define RTM_ONLY_THIS_NETWORK 0x00000001
#define RTM_ONLY_THIS_INTERFACE 0x00000002
#define RTM_ONLY_THIS_PROTOCOL 0x00000004
#define RTM_ONLY_BEST_ROUTES 0x00000008
#define RTM_PROTOCOL_SINGLE_ROUTE 0x00000001
/*++
*******************************************************************
R t m R e g i s t e r C l i e n t
Routine Description:
Registers client as a handler of specified protocol.
Establishes route change notification mechanism for the client
Arguments:
ProtocolFamily - protocol family of the routing protocol to register
RoutingProtocol - which routing protocol is handled by the client
ChangeEvent - this event will be signalled when best route to any
network in the table changes
Flags - flags that enable special features applied to routes maintained
by the protocol:
RTM_PROTOCOL_SINGLE_ROUTE - RTM will only keep
one route per destination network for the protocol
Return Value:
Handle to be used to identify the client in calls made to Rtm
NULL - operation failed, call GetLastError() to get reason of
failure:
ERROR_INVALID_PARAMETER - specified protocol family is not supported
ERROR_CLIENT_ALREADY_EXISTS - another client already registered
to handle specified protocol
ERROR_NO_SYSTEM_RESOURCES - not enough resources to perform the opertaion,
try again later
ERROR_NOT_ENOUGH_MEMORY - not enough memory to allocate client
control block
*******************************************************************
--*/
HANDLE WINAPI
RtmRegisterClient (
IN DWORD ProtocolFamily,
IN DWORD RoutingProtocol,
IN HANDLE ChangeEvent OPTIONAL,
IN DWORD Flags
);
/*++
*******************************************************************
R t m D e r e g i s t e r C l i e n t
Routine Description:
Deregister client and frees associated resources (including all
routes added by the client).
Argum
![avatar](https://profile-avatar.csdnimg.cn/default.jpg!1)
大富大贵7
- 粉丝: 400
- 资源: 8869
最新资源
- 陕理工图书馆管理系统系统ssm.zip
- 小学芙童币和芙童印章管理系统ssm.zip
- 学生过程性评价系统ssm.zip
- 郑州经贸学院迎新系统springboot.zip
- 智慧家政在线预约管理系统的设计与实现ssm.zip
- 支教系统springboot.zip
- 智慧农贸信息化管理平台ssm.zip
- 信息技术寒假作业.zip
- 2003-2019年各省对外开放度数据(含原始数据+计算过程+结果)
- 电机控制直流有刷电机电流采样-LM324电流采样
- 局域网IP搜索工具IPScaner V1.1
- deepseek 8b 本地部署 ollama0.5.9
- 四、RAG接入agent 问答文档
- USB驱动程序.rar
- 收银一体秤顶尖等Windows版电子秤设置(内含图解)
- 2025 DeepSeek隐私政策-如何正确使用DeepSeek和保护隐私.pdf
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)