-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIPForwardRow.cs
More file actions
174 lines (87 loc) · 3.04 KB
/
IPForwardRow.cs
File metadata and controls
174 lines (87 loc) · 3.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
namespace RouteForwarder
{
class IPForwardRow
{
/// <summary>
/// destination IP address.
/// </summary>
public IPAddress Dest { get; set; }
/// <summary>
/// Subnet mask
/// </summary>
public IPAddress Mask { get; set; }
/// <summary>
/// conditions for multi-path route. Unused, specify 0.
/// </summary>
public uint Policy { get; set; }
/// <summary>
/// IP address of the next hop. Own address?
/// </summary>
public IPAddress NextHop { get; set; }
/// <summary>
/// index of interface
/// </summary>
public uint IfIndex { get; set; }
/// <summary>
/// route type
/// </summary>
public RouteTableManager.MIB_IPFORWARD_TYPE Type { get; set; }
/// <summary>
/// routing protocol.
/// </summary>
public RouteTableManager.MIB_IPPROTO Proto { get; set; }
/// <summary>
/// age of route.
/// </summary>
public uint Age { get; set; }
/// <summary>
/// autonomous system number. 0 if not relevant
/// </summary>
public uint NextHopAS { get; set; }
/// <summary>
/// -1 if not used (goes for all metrics)
/// </summary>
public int Metric { get; set; }
public IPForwardRow()
{
}
public IPForwardRow(RouteTableManager.MIB_IPFORWARDROW baseStruct)
{
Dest = RouteTableManager.UintToIp(baseStruct.dwForwardDest);
Mask = RouteTableManager.UintToIp(baseStruct.dwForwardMask);
Policy = baseStruct.dwForwardPolicy;
NextHop = RouteTableManager.UintToIp(baseStruct.dwForwardNextHop);
IfIndex = baseStruct.dwForwardIfIndex;
Type = baseStruct.dwForwardType;
Proto = baseStruct.dwForwardProto;
Age = baseStruct.dwForwardAge;
NextHopAS = baseStruct.dwForwardNextHopAS;
Metric = baseStruct.dwForwardMetric1;
}
public RouteTableManager.MIB_IPFORWARDROW GetBaseStruct()
{
return new RouteTableManager.MIB_IPFORWARDROW()
{
dwForwardDest = RouteTableManager.IpToUint(Dest),
dwForwardMask = RouteTableManager.IpToUint(Mask),
dwForwardPolicy = Policy,
dwForwardNextHop = RouteTableManager.IpToUint(NextHop),
dwForwardIfIndex = IfIndex,
dwForwardType = Type,
dwForwardProto = Proto,
dwForwardAge = Age,
dwForwardNextHopAS = NextHopAS,
dwForwardMetric1 = Metric,
dwForwardMetric2 = -1,
dwForwardMetric3 = -1,
dwForwardMetric4 = -1,
dwForwardMetric5 = -1
};
}
}
}