williamr@2
|
1 |
// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
2 |
// All rights reserved.
|
williamr@2
|
3 |
// This component and the accompanying materials are made available
|
williamr@4
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@4
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@2
|
7 |
//
|
williamr@2
|
8 |
// Initial Contributors:
|
williamr@2
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@2
|
10 |
//
|
williamr@2
|
11 |
// Contributors:
|
williamr@2
|
12 |
//
|
williamr@2
|
13 |
// Description:
|
williamr@2
|
14 |
// in6_if.h - control API between the stack and IPv6 interfaces
|
williamr@2
|
15 |
// Specifies the IPv6 extensions for CNifIfBase::Control() API
|
williamr@2
|
16 |
// defined in the standard EPOC header file in_iface.h.
|
williamr@2
|
17 |
//
|
williamr@2
|
18 |
|
williamr@2
|
19 |
|
williamr@2
|
20 |
|
williamr@2
|
21 |
/**
|
williamr@2
|
22 |
@file in6_if.h
|
williamr@2
|
23 |
@publishedAll
|
williamr@2
|
24 |
@released
|
williamr@2
|
25 |
*/
|
williamr@2
|
26 |
|
williamr@2
|
27 |
#ifndef __IN6_IF_H__
|
williamr@2
|
28 |
#define __IN6_IF_H__
|
williamr@2
|
29 |
|
williamr@2
|
30 |
#include <e32std.h>
|
williamr@4
|
31 |
#include <in_sock.h>
|
williamr@2
|
32 |
|
williamr@2
|
33 |
// CNifIfBase::Control(aLevel, aName, aOption, ..)
|
williamr@2
|
34 |
// aLevel is KSOLInterface defined in in_iface.h in standard EPOC
|
williamr@2
|
35 |
|
williamr@2
|
36 |
// IPv6 specific aName constants and aOption structures
|
williamr@2
|
37 |
|
williamr@2
|
38 |
/**
|
williamr@2
|
39 |
* Option to get the current network interface driver operation parameters to
|
williamr@2
|
40 |
* the passed TSoIfInfo6 structure.
|
williamr@2
|
41 |
* @since v7.0
|
williamr@2
|
42 |
* @publishedAll
|
williamr@2
|
43 |
* @released
|
williamr@2
|
44 |
*/
|
williamr@2
|
45 |
const TUint KSoIfInfo6 = 0x202;
|
williamr@2
|
46 |
|
williamr@2
|
47 |
|
williamr@2
|
48 |
/**
|
williamr@2
|
49 |
* Incoming RMBufPktInfo iFlag value for a loopback packet.
|
williamr@2
|
50 |
*
|
williamr@2
|
51 |
* The stack sets this flag for a packet, which is looped
|
williamr@2
|
52 |
* back by a call to IP layer Process function. A NIF should
|
williamr@2
|
53 |
* never set this flag.
|
williamr@2
|
54 |
*
|
williamr@2
|
55 |
* This flag is effective only when capabilities are enabled.
|
williamr@2
|
56 |
* A packet with this flag set can be delivered to sockets
|
williamr@2
|
57 |
* that do not posses NetworkServices cabability.
|
williamr@2
|
58 |
*/
|
williamr@2
|
59 |
const TUint KIpLoopbackPacket = 0x1;
|
williamr@2
|
60 |
/**
|
williamr@2
|
61 |
* Incoming and outgoing RMBufPktInfo iFlag value for broadcast packet.
|
williamr@2
|
62 |
*
|
williamr@2
|
63 |
* The packet uses link layer broadcast. The stack sets this bit for
|
williamr@2
|
64 |
* outgoing packets that are not unicast (e.g. multicast and broadcast
|
williamr@2
|
65 |
* destinations). A NIF can set this flag for incoming packet, if it
|
williamr@2
|
66 |
* was sent to a link layer broadcast address. The presence of this
|
williamr@2
|
67 |
* flag suppresses some error replies from the stack.
|
williamr@2
|
68 |
*/
|
williamr@2
|
69 |
const TUint KIpBroadcastOnLink = 0x2;
|
williamr@2
|
70 |
|
williamr@2
|
71 |
|
williamr@2
|
72 |
/**
|
williamr@2
|
73 |
* A TSoIfInfo::iFeatures flag to indicate that the interface requires Neighbour
|
williamr@2
|
74 |
* Discovery.
|
williamr@2
|
75 |
*
|
williamr@2
|
76 |
* @note
|
williamr@2
|
77 |
* For IPv4 this enables ARP for the interface. The NIF must
|
williamr@2
|
78 |
* pass received ARP packets to the stack, and accept ARP
|
williamr@2
|
79 |
* packets for sending from the stack.
|
williamr@2
|
80 |
* @since v7.0
|
williamr@2
|
81 |
* @publishedAll
|
williamr@2
|
82 |
* @released
|
williamr@2
|
83 |
*/
|
williamr@2
|
84 |
const TUint KIfNeedsND = 0x00000100;
|
williamr@2
|
85 |
|
williamr@4
|
86 |
const TUint KMaxInterfaceName=32;
|
williamr@4
|
87 |
|
williamr@4
|
88 |
/**
|
williamr@4
|
89 |
* Holds the name of a network interface.
|
williamr@4
|
90 |
*
|
williamr@4
|
91 |
* This is used in TSoIfInfo.
|
williamr@4
|
92 |
*
|
williamr@4
|
93 |
*/
|
williamr@4
|
94 |
typedef TBuf<KMaxInterfaceName> TInterfaceName;
|
williamr@4
|
95 |
|
williamr@4
|
96 |
class TSoIfInfo
|
williamr@4
|
97 |
// Socket option structure for KSoIfInfo
|
williamr@4
|
98 |
/**
|
williamr@4
|
99 |
* Current network interface operation parameters.
|
williamr@4
|
100 |
*
|
williamr@4
|
101 |
* It is returned by RSocket::GetOpt(), when that function is called with anOptionLevel
|
williamr@4
|
102 |
* set to KSOLInterface and anOptionName set to KSoIfInfo.
|
williamr@4
|
103 |
*
|
williamr@4
|
104 |
*/
|
williamr@4
|
105 |
{
|
williamr@4
|
106 |
public:
|
williamr@4
|
107 |
/** Feature flags. Possible values are defined in in_iface.h. */
|
williamr@4
|
108 |
TUint iFeatures; // Feature flags
|
williamr@4
|
109 |
/** Maximum transmission unit. */
|
williamr@4
|
110 |
TInt iMtu; // Max frame size
|
williamr@4
|
111 |
/** An approximation of the interface speed in Kbps. */
|
williamr@4
|
112 |
TInt iSpeedMetric; // Indication of performance, approx to Kbps
|
williamr@4
|
113 |
/** Interface protocol name, ipcp::\<port\>. */
|
williamr@4
|
114 |
TInterfaceName iName;
|
williamr@4
|
115 |
};
|
williamr@4
|
116 |
|
williamr@4
|
117 |
|
williamr@2
|
118 |
class TSoIfInfo6 : public TSoIfInfo // aOption when aName == KSoIfInfo
|
williamr@2
|
119 |
/**
|
williamr@2
|
120 |
* Extends the TSoIfInfo for the receive MTU.
|
williamr@2
|
121 |
*
|
williamr@2
|
122 |
* The IPv6 capable interfaces must support this control option. The usage
|
williamr@2
|
123 |
* template in the stack is:
|
williamr@2
|
124 |
@code
|
williamr@2
|
125 |
CNifIfBase *iNif;
|
williamr@2
|
126 |
...
|
williamr@2
|
127 |
TPckgBuf<TSoIfInfo6> ifProp;
|
williamr@2
|
128 |
TInt err = iNif->Control(KSOLInterface, KSoIfInfo6, ifProp);
|
williamr@2
|
129 |
@endcode
|
williamr@2
|
130 |
* For the IPv4 interfaces, only the plain TSoIfInfo is used.
|
williamr@2
|
131 |
@code
|
williamr@2
|
132 |
CNifIfBase *iNif;
|
williamr@2
|
133 |
...
|
williamr@2
|
134 |
TPckgBuf<TSoIfInfo> ifProp;
|
williamr@2
|
135 |
TInt err = iNif->Control(KSOLInterface, KSoIfInfo, ifProp);
|
williamr@2
|
136 |
@endcode
|
williamr@2
|
137 |
* @since v7.0
|
williamr@2
|
138 |
* @publishedAll
|
williamr@2
|
139 |
* @released
|
williamr@2
|
140 |
*/
|
williamr@2
|
141 |
{
|
williamr@2
|
142 |
public:
|
williamr@2
|
143 |
/** Maximum transmission unit for receiving. */
|
williamr@2
|
144 |
TInt iRMtu;
|
williamr@2
|
145 |
};
|
williamr@2
|
146 |
|
williamr@4
|
147 |
class TSoIfConfigBase
|
williamr@4
|
148 |
/**
|
williamr@4
|
149 |
* Base class for TSoInetIfConfig, which simply identifies the protocol family
|
williamr@4
|
150 |
* using the interface.
|
williamr@4
|
151 |
*
|
williamr@4
|
152 |
* @internalComponent
|
williamr@4
|
153 |
*/
|
williamr@4
|
154 |
{
|
williamr@4
|
155 |
public:
|
williamr@4
|
156 |
/** The protocol family, e.g. KAfInet. */
|
williamr@4
|
157 |
TUint iFamily;
|
williamr@4
|
158 |
};
|
williamr@4
|
159 |
|
williamr@2
|
160 |
class TSoInet6IfConfig : public TSoIfConfigBase
|
williamr@2
|
161 |
/**
|
williamr@2
|
162 |
* IPv6 interface configuration.
|
williamr@2
|
163 |
*
|
williamr@2
|
164 |
* This is the option when stack queries the interface configuration
|
williamr@2
|
165 |
* information using
|
williamr@2
|
166 |
@code
|
williamr@2
|
167 |
TPckgBuf<TSoInet6IfConfig> cfg;
|
williamr@2
|
168 |
cfg().iFamily = KAfInet6; // Query about IPv6 capability
|
williamr@2
|
169 |
TInt res = iNif->Control(KSOLInterface, KSoIfConfig, cfg);
|
williamr@2
|
170 |
@endcode
|
williamr@2
|
171 |
* The KErrNone return signifies that this NIF supports IPv6 on the
|
williamr@2
|
172 |
* link layer. Note, similarly, the IPv4 support is detected by the
|
williamr@2
|
173 |
* stack using:
|
williamr@2
|
174 |
@code
|
williamr@2
|
175 |
TPckgBuf<TSoInetIfConfig> cfg;
|
williamr@2
|
176 |
cfg().iFamily = KAfInet; // Query about IPv4 capability.
|
williamr@2
|
177 |
TInt res = iNif->Control(KSOLInterface, KSoIfConfig, cfg);
|
williamr@2
|
178 |
@endcode
|
williamr@2
|
179 |
* The same NIF can support both IPv4 and IPv6.
|
williamr@2
|
180 |
*
|
williamr@2
|
181 |
* @since v7.0
|
williamr@2
|
182 |
* @publishedAll
|
williamr@2
|
183 |
* @released
|
williamr@2
|
184 |
*/
|
williamr@2
|
185 |
{
|
williamr@2
|
186 |
public:
|
williamr@2
|
187 |
/**
|
williamr@2
|
188 |
* The local interface id.
|
williamr@2
|
189 |
*
|
williamr@2
|
190 |
* If the address family is not KAFUnspec, then this defines the id portion of
|
williamr@2
|
191 |
* the IPv6 addresses for this host. The id portion is used in constructing the
|
williamr@2
|
192 |
* link-local address (fe80::id) and combined with any other prefixes, which
|
williamr@2
|
193 |
* are configured for this interface (prefix::id). Prefixes are configured via
|
williamr@2
|
194 |
* Router Advertisement prefix option (TInet6OptionICMP_Prefix) with the A flag
|
williamr@2
|
195 |
* set, or using interface control socket options (see TSoInet6InterfaceInfo).
|
williamr@2
|
196 |
*
|
williamr@2
|
197 |
* The length of the id is determined by the TSockAddr::GetUserLen. The normal
|
williamr@2
|
198 |
* value is 8 (e.g. the standard id is always 64 bits). Other id lengths are
|
williamr@2
|
199 |
* possibly activated by future RFC's for some special address formats.
|
williamr@2
|
200 |
*
|
williamr@2
|
201 |
* If the address family is KAFUnspec, then id is not configured (and for the
|
williamr@2
|
202 |
* IPv6 interface to be functional, address(es), including the link-local address,
|
williamr@2
|
203 |
* must be configured by some other means).
|
williamr@2
|
204 |
*/
|
williamr@2
|
205 |
TSockAddr iLocalId;
|
williamr@2
|
206 |
/**
|
williamr@2
|
207 |
* The remote interface id (or KAFUnspec, if not applicaple).
|
williamr@2
|
208 |
*
|
williamr@2
|
209 |
* If the address family is not KAFUnspec, then this defines the id portion of
|
williamr@2
|
210 |
* another host on the link. The stack constructs a link-local address
|
williamr@2
|
211 |
* (fe80::remote-id) and installs a host route for it.
|
williamr@2
|
212 |
*
|
williamr@2
|
213 |
* This might be useful for PPP links, if other end is not acting as a router.
|
williamr@2
|
214 |
* If the other end is a router, it's address will become automaticly known,
|
williamr@2
|
215 |
* when it sends the Router Advertisement.
|
williamr@2
|
216 |
*/
|
williamr@2
|
217 |
TSockAddr iRemoteId;
|
williamr@2
|
218 |
/**
|
williamr@2
|
219 |
* Unused highest significant bits in interface id (usually 0).
|
williamr@2
|
220 |
*
|
williamr@2
|
221 |
* This is reserved for future use, in case there is a need for id length
|
williamr@2
|
222 |
* that is not multiple of 8.
|
williamr@2
|
223 |
*/
|
williamr@2
|
224 |
TUint idPaddingBits;
|
williamr@2
|
225 |
/** 1st DNS address (or Unspecified address, if none) */
|
williamr@2
|
226 |
TInetAddr iNameSer1;
|
williamr@2
|
227 |
/** 2nd DNS address (or Unspecified address, if none) */
|
williamr@2
|
228 |
TInetAddr iNameSer2;
|
williamr@2
|
229 |
};
|
williamr@2
|
230 |
|
williamr@2
|
231 |
/**
|
williamr@2
|
232 |
|
williamr@2
|
233 |
@page nif_interface The interface between a NIF and the TCP/IP stack.
|
williamr@2
|
234 |
|
williamr@2
|
235 |
The network interfaces (NIF's) are registered with the stack using the
|
williamr@2
|
236 |
MNifIfUser::IfUserNewInterfaceL function. Stack has an internal object that
|
williamr@2
|
237 |
represents the interface and the given CNifIfBase object is attached to this.
|
williamr@2
|
238 |
|
williamr@2
|
239 |
The stack communicates with the NIF using the public API defined by the CNifIfBase.
|
williamr@2
|
240 |
The NIF sees the stack as an instance of CProtocolBase and can use a subset of
|
williamr@2
|
241 |
public functions to communcite with the stack.
|
williamr@2
|
242 |
|
williamr@2
|
243 |
The following CNifBase functions are used by the stack:
|
williamr@2
|
244 |
|
williamr@2
|
245 |
- CNifIfBase::Open, (binding stack and NIF)
|
williamr@2
|
246 |
- CNifIfBase::Close, (binding stack and NIF)
|
williamr@2
|
247 |
- CNifIfBase::BindL, (binding stack and NIF)
|
williamr@2
|
248 |
- CNifIfBase::Control, (for the configuration information)
|
williamr@2
|
249 |
- CNifIfBase::Info, (retrieve the interface name)
|
williamr@2
|
250 |
- CNifIfBase::Send, (send outbound packets to NIF)
|
williamr@2
|
251 |
- CNifIfBase::Notify, (NIFMAN about packet activity)
|
williamr@2
|
252 |
|
williamr@2
|
253 |
The following CProtocolBase functions are available for NIFs:
|
williamr@2
|
254 |
|
williamr@2
|
255 |
- CProtocolBase::StartSending, (notify stack that NIF is ready)
|
williamr@2
|
256 |
- CProtocolBase::Error, (notify stack about NIF error)
|
williamr@2
|
257 |
- CProtocolBase::Process, (feed inbound packets to stack)
|
williamr@2
|
258 |
|
williamr@2
|
259 |
The network interface is removed from the stack either by directly deleting it, or
|
williamr@2
|
260 |
by NIFMAN using MNifIfUser::IfUserInterfaceDown.
|
williamr@2
|
261 |
|
williamr@2
|
262 |
A pointer to the MNifIfUser object can be obtained from the network
|
williamr@2
|
263 |
layer protocol.
|
williamr@2
|
264 |
@code
|
williamr@2
|
265 |
MNetworkService *iNetwork;
|
williamr@2
|
266 |
TPckgBuf<MNifIfUser*> ifUser;
|
williamr@2
|
267 |
TInt err = iNetwork->Protocol()->GetOption(KNifOptLevel, KNifOptGetNifIfUser, ifUser);
|
williamr@2
|
268 |
@endcode
|
williamr@2
|
269 |
|
williamr@2
|
270 |
|
williamr@2
|
271 |
@section nif_binding Binding the NIF and TCP/IP together
|
williamr@2
|
272 |
|
williamr@2
|
273 |
MNifIfUser::IfUserNewInterfaceL introduces a new network interface (NIF) to the stack.
|
williamr@2
|
274 |
The introduction consists of the following steps:
|
williamr@2
|
275 |
|
williamr@2
|
276 |
-# retrieve interface info into TNifIfInfo by CNifIfBase::Info function. Stack uses
|
williamr@2
|
277 |
only the interface name (iName) from this. The name cannot be an empty string.
|
williamr@2
|
278 |
-# using the name, the stack searches for a matching internal interface object. If
|
williamr@2
|
279 |
it does not exist, it is created. If there was an existing interface with the same
|
williamr@2
|
280 |
name, the stack will disconnect that first.
|
williamr@2
|
281 |
-# the stack gives itself to the new NIF by calling CNifIfBase::BindL.
|
williamr@2
|
282 |
-# stack does not send any packets to the interface until the NIF has called
|
williamr@2
|
283 |
CProtocolBase::StartSending at least once.
|
williamr@2
|
284 |
-# stack executes the interface configuration when the first CProtocolBase::StartSending arrives
|
williamr@2
|
285 |
after MNifIfUser::IfUserNewInterfaceL. The configuration uses the CNifIfBase::Control function
|
williamr@2
|
286 |
with different options to retrieve additional information from the NIF.
|
williamr@2
|
287 |
|
williamr@2
|
288 |
MNifIfUser::IfUserInterfaceDown disconnects the NIF from the stack. There is one
|
williamr@2
|
289 |
exception: if the MNifIfUser::IfUserInterfaceDown aResult parameter has a special
|
williamr@2
|
290 |
value #KErrLinkConfigChanged, then the internal interface state is only reset to the
|
williamr@2
|
291 |
exact same state as if interface was just introduced by the
|
williamr@2
|
292 |
MNifIfUser::IfUserNewInterfaceL, and a reconfiguration occurs when the NIF calls
|
williamr@2
|
293 |
StartSending.
|
williamr@2
|
294 |
|
williamr@2
|
295 |
@section nif_control_api The Control API
|
williamr@2
|
296 |
|
williamr@2
|
297 |
The stack requires the NIF to implement a minimal set of #KSOLInterface level
|
williamr@2
|
298 |
options via it's CNifIfBase::Control API.
|
williamr@2
|
299 |
|
williamr@2
|
300 |
- at least one of the information options
|
williamr@2
|
301 |
- TSoIfInfo6 with #KSoIfInfo6 (for IPv6)
|
williamr@2
|
302 |
- TSoIfInfo with #KSoIfInfo (for IPv4)
|
williamr@2
|
303 |
.
|
williamr@2
|
304 |
- at least one of the configuration options
|
williamr@2
|
305 |
- TSoInet6IfConfig (iFamily=#KAfInet6) with #KSoIfConfig
|
williamr@2
|
306 |
- TSoInetIfConfig (iFamily=#KAfInet) with #KSoIfConfig
|
williamr@2
|
307 |
.
|
williamr@2
|
308 |
- TSoIfHardwareAddr with #KSoIfHardwareAddr if the link
|
williamr@2
|
309 |
uses hardware addresses (only used #KIfNeedsND is also set.). The returned
|
williamr@2
|
310 |
address is used in the neighbor discovery (ICMPv6 ND or ARP for IPv4), and
|
williamr@2
|
311 |
in sending packets to NIF, the address family is used to indicate that the
|
williamr@2
|
312 |
stack has chosen the destination link layer address (based on the neighbor
|
williamr@2
|
313 |
cache).
|
williamr@2
|
314 |
- TSoIfConnectionInfo with #KSoIfGetConnectionInfo (for IAP and NET numbers).
|
williamr@2
|
315 |
If this is not supported, the stack will assign unique numbers for the
|
williamr@2
|
316 |
IAP and NET. The scope vector (zone identifiers) is contructed as follows:
|
williamr@2
|
317 |
-# [0] The unique interface index (node local scope id)
|
williamr@2
|
318 |
-# [1] IAP number (link scope id)
|
williamr@2
|
319 |
-# [2] IAP number (subnet scope id)
|
williamr@2
|
320 |
-# [3] NET number
|
williamr@2
|
321 |
-# [4] NET number (site local scope id)
|
williamr@2
|
322 |
-# [5] NET number
|
williamr@2
|
323 |
-# [6] NET number
|
williamr@2
|
324 |
-# [7] NET number (organization scope id)
|
williamr@2
|
325 |
-# [8] NET number
|
williamr@2
|
326 |
-# [9] NET number
|
williamr@2
|
327 |
-# [10] NET number
|
williamr@2
|
328 |
-# [11] NET number
|
williamr@2
|
329 |
-# [12] NET number
|
williamr@2
|
330 |
-# [13] NET number (IPv6 global scope)
|
williamr@2
|
331 |
-# [14] NET number
|
williamr@2
|
332 |
-# [15] NET number (highest, NET id, IPv4 global)
|
williamr@2
|
333 |
|
williamr@2
|
334 |
@note
|
williamr@2
|
335 |
To build complete ARP packets in the stack, stack needs to know the hardware
|
williamr@2
|
336 |
type value to be used in the packet (see TInet6HeaderArp). This 16 bit value
|
williamr@2
|
337 |
is assumed to be in the Port() field of the returned hardware address
|
williamr@2
|
338 |
(#KSoIfHardwareAddr). An IPv4 NIF that leaves the ARP to the stack,
|
williamr@2
|
339 |
must provide this value (or sniff and fix the outgoing ARP packets).
|
williamr@2
|
340 |
|
williamr@2
|
341 |
@section nif_inbound_packets Inbound packets from the NIF to stack.
|
williamr@2
|
342 |
|
williamr@2
|
343 |
The NIF feeds the inbound packets to the stack through the CProtocolBase::Process
|
williamr@2
|
344 |
function (see also MNetworkService::Process). The information block associated
|
williamr@2
|
345 |
with the packet is RMBufPktInfo and the fields must have been set as follows:
|
williamr@2
|
346 |
|
williamr@2
|
347 |
- RMBufPktInfo::iSrcAddr, the link layer source address (using the same
|
williamr@2
|
348 |
address family as returned with the hardware address control option). If
|
williamr@2
|
349 |
the link does not use addresses, then #KAFUnspec should be used.
|
williamr@2
|
350 |
- RMBufPktInfo::iDstAddr, the link layer destination address (using the same
|
williamr@2
|
351 |
address family as returned with the hardware address control option). If
|
williamr@2
|
352 |
the link does not use addresses, then #KAFUnspec should be used.
|
williamr@2
|
353 |
- RMBufPktInfo::iProtocol, the type of the packet:
|
williamr@2
|
354 |
- #KProtocolInetIp, IPv4 packet
|
williamr@2
|
355 |
- #KProtocolInet6Ip, IPv6 packet
|
williamr@2
|
356 |
- #KProtocolArp, ARP packet
|
williamr@2
|
357 |
.
|
williamr@2
|
358 |
- RMBufPktInfo::iLength, the length of the packet in octets
|
williamr@2
|
359 |
- RMBufPktInfo::iFlags, should be set to zero (reserved for future use).
|
williamr@2
|
360 |
|
williamr@2
|
361 |
@note
|
williamr@2
|
362 |
The stack is relaxed about the checking of iProtocol field, and anything
|
williamr@2
|
363 |
else except #KProtocolArp is assumed to be an IP packet. This is potentially
|
williamr@2
|
364 |
to changed in future, and NIFs should set the protocol field correctly.
|
williamr@2
|
365 |
@note
|
williamr@2
|
366 |
The link layer addresses in iSrcAddr and iDstAddr are informative. The
|
williamr@2
|
367 |
values do not affect the processing of the packet within stack. They are
|
williamr@2
|
368 |
made available for the inbound post hooks (CProtocolPosthook).
|
williamr@2
|
369 |
|
williamr@2
|
370 |
@section nif_outbound_packets Outbound packets from the stack to NIF
|
williamr@2
|
371 |
|
williamr@2
|
372 |
The stack feeds the outbound packets to the NIF through the CNifIfBase::Send
|
williamr@2
|
373 |
function. The information block associated with the packet follows RMBufPktInfo
|
williamr@2
|
374 |
and the fields need to be interpreted as follows:
|
williamr@2
|
375 |
|
williamr@2
|
376 |
- RMBufPktInfo::iSrcAddr, undefined (must be ignored by the NIF).
|
williamr@2
|
377 |
The NIF must choose the link layer source address.
|
williamr@2
|
378 |
- RMBufPktInfo::iDstAddr, three variants, if link layer addresses are used
|
williamr@2
|
379 |
- hardware address, using the same address family as NIF returned
|
williamr@2
|
380 |
in harware address control option (TSoIfHardwareAddr ).
|
williamr@2
|
381 |
The packet must be sent to this link layer destination.
|
williamr@2
|
382 |
- #KAfInet, the address is IPv4 multicast address. and the NIF must
|
williamr@2
|
383 |
select a suitable link layer broadcast address as a destination.
|
williamr@2
|
384 |
- #KAfInet6, the address is IPv6 multicast address, and the NIF msut
|
williamr@2
|
385 |
select a suitable link layer broadcast address as a destination.
|
williamr@2
|
386 |
.
|
williamr@2
|
387 |
If the NIF does not use link layer addresses, then iDstAddr is also
|
williamr@2
|
388 |
undefined (must be ingnored byt the NIF). The link is a point-to-point
|
williamr@2
|
389 |
interface.
|
williamr@2
|
390 |
- RMBufPktInfo::iProtocol, defines the type of packet
|
williamr@2
|
391 |
- #KProtocolInetIp, IPv4 packet
|
williamr@2
|
392 |
- #KProtocolInet6Ip, IPv6 packet
|
williamr@2
|
393 |
- #KProtocolArp, ARP packet
|
williamr@2
|
394 |
.
|
williamr@2
|
395 |
- RMBufPktInfo::iLength, the length of the packet in octets.
|
williamr@2
|
396 |
- RMBufPktInfo::iFlags, undefined (must be igrnored by the NIF).
|
williamr@2
|
397 |
|
williamr@2
|
398 |
The stack interprets the return value from the CNifIfBase::Send as follows:
|
williamr@2
|
399 |
|
williamr@2
|
400 |
- return 1; the NIF is ready to receive more packets.
|
williamr@2
|
401 |
- return 0; the NIF is blocked and cannot receive any more packets. The stack
|
williamr@2
|
402 |
<b>does not send anything</b> to the NIF until it calls CProtocolBase::StartSending.
|
williamr@2
|
403 |
- return < 0; unspecified, but currently, the error is passed on to
|
williamr@2
|
404 |
all flows attached to this interface. The stack will continue sending
|
williamr@2
|
405 |
packets to the interface (no StartSending is required).
|
williamr@2
|
406 |
- return > 1; unspecified, but currently treated same as return 1.
|
williamr@2
|
407 |
|
williamr@2
|
408 |
*/
|
williamr@2
|
409 |
|
williamr@2
|
410 |
#endif
|