#include "precomp.h"
Go to the source code of this file.
|
NTSTATUS | AddGenericHeaderIPv4 (PADDRESS_FILE AddrFile, PIP_ADDRESS RemoteAddress, USHORT RemotePort, PIP_ADDRESS LocalAddress, USHORT LocalPort, PIP_PACKET IPPacket, UINT DataLength, UINT Protocol, UINT ExtraLength, PVOID *NextHeader) |
|
NTSTATUS | BuildRawIpPacket (PADDRESS_FILE AddrFile, PIP_PACKET Packet, PIP_ADDRESS RemoteAddress, USHORT RemotePort, PIP_ADDRESS LocalAddress, USHORT LocalPort, PCHAR DataBuffer, UINT DataLen) |
|
NTSTATUS | RawIPSendDatagram (PADDRESS_FILE AddrFile, PTDI_CONNECTION_INFORMATION ConnInfo, PCHAR BufferData, ULONG DataSize, PULONG DataUsed) |
|
VOID | RawIpReceive (PIP_INTERFACE Interface, PIP_PACKET IPPacket) |
|
NTSTATUS | RawIPStartup (VOID) |
|
NTSTATUS | RawIPShutdown (VOID) |
|
◆ AddGenericHeaderIPv4()
Definition at line 13 of file rawip.c.
34{
37
40
42
44 0,
48
50
54
55
57
59
61
63
65
67
69
71
73
75
77
78
80 IPPacket->
Data = ((
PCHAR)*NextHeader) + ExtraLength;
81
83}
#define TI_DbgPrint(_t_, _x_)
struct IPv4_HEADER * PIPv4_HEADER
void GetDataPtr(PNDIS_PACKET Packet, UINT Offset, PCHAR *DataOut, PUINT Size)
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
_Must_inspect_result_ _In_ ULONG _In_ PSOCKADDR LocalAddress
_Must_inspect_result_ _In_ ULONG _In_ PSOCKADDR _In_ PSOCKADDR RemoteAddress
Referenced by AddUDPHeaderIPv4(), and BuildRawIpPacket().
◆ BuildRawIpPacket()
Definition at line 86 of file rawip.c.
105{
108
110
111
113
115
116
120
122
126
133 0, (
PVOID *)&Payload );
134 break;
136
139 break;
140
141 default:
144 break;
145 }
146
152 }
153
157
159
161
163
165
167
169}
#define NT_SUCCESS(StatCode)
#define IP_PACKET_FLAG_RAW
PIP_PACKET IPInitializePacket(PIP_PACKET IPPacket, ULONG Type)
PCHAR A2S(PIP_ADDRESS Address)
#define AllocatePacketWithBuffer(x, y, z)
_In_ NDIS_HANDLE _In_ PNDIS_PACKET Packet
NTSTATUS AddGenericHeaderIPv4(PADDRESS_FILE AddrFile, PIP_ADDRESS RemoteAddress, USHORT RemotePort, PIP_ADDRESS LocalAddress, USHORT LocalPort, PIP_PACKET IPPacket, UINT DataLength, UINT Protocol, UINT ExtraLength, PVOID *NextHeader)
#define DISPLAY_IP_PACKET(x)
#define RtlCopyMemory(Destination, Source, Length)
#define STATUS_UNSUCCESSFUL
Referenced by ICMPReply(), and RawIPSendDatagram().
◆ RawIpReceive()
Definition at line 266 of file rawip.c.
276{
282
284
285 switch (IPPacket->
Type) {
286
289 DstAddress = &IPPacket->
DstAddr;
290 SrcAddress = &IPPacket->
SrcAddr;
292 break;
293
294
297
298
299 return;
300
301 default:
302 return;
303 }
304
305
306
307
308
309
311 0,
313 &SearchContext);
314 if (AddrFile) {
315 do {
317 SrcAddress,
318 DstAddress,
319 0,
320 0,
321 IPPacket,
325 } else {
326
327
330
331
332 }
334}
PADDRESS_FILE AddrSearchFirst(PIP_ADDRESS Address, USHORT Port, USHORT Protocol, PAF_SEARCH SearchContext)
PADDRESS_FILE AddrSearchNext(PAF_SEARCH SearchContext)
VOID DGDeliverData(PADDRESS_FILE AddrFile, PIP_ADDRESS SrcAddress, PIP_ADDRESS DstAddress, USHORT SrcPort, USHORT DstPort, PIP_PACKET IPPacket, UINT DataSize)
struct _tagIPv4Header IPv4Header
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
union IP_ADDRESS::@1014 Address
IPv4_RAW_ADDRESS IPv4Address
#define DereferenceObject(Object)
Referenced by ICMPReceive(), and RawIPStartup().
◆ RawIPSendDatagram()
Definition at line 171 of file rawip.c.
187{
194
196
198 AddrFile, ConnInfo, BufferData,
DataSize));
200
201 switch( RemoteAddressTa->
Address[0].AddressType ) {
205 RemoteAddressTa->
Address[0].Address[0].in_addr;
206 RemotePort = RemoteAddressTa->
Address[0].Address[0].sin_port;
207 break;
208
209 default:
212 }
213
215
218 {
219
220
221
222
226 }
227
229 }
230 else
231 {
235 }
236 }
237
241 RemotePort,
244 BufferData,
246
248
251
253
257
259
261
263}
BOOLEAN AddrIsUnspecified(PIP_ADDRESS Address)
PNEIGHBOR_CACHE_ENTRY RouteGetRouteToDestination(PIP_ADDRESS Destination)
PNEIGHBOR_CACHE_ENTRY NBLocateNeighbor(PIP_ADDRESS Address, PIP_INTERFACE Interface)
#define STATUS_NETWORK_UNREACHABLE
NTSTATUS BuildRawIpPacket(PADDRESS_FILE AddrFile, PIP_PACKET Packet, PIP_ADDRESS RemoteAddress, USHORT RemotePort, PIP_ADDRESS LocalAddress, USHORT LocalPort, PCHAR DataBuffer, UINT DataLen)
struct _TA_ADDRESS_IP::_AddrIp Address[1]
struct _TA_ADDRESS_IP * PTA_IP_ADDRESS
#define TDI_ADDRESS_TYPE_IP
#define UnlockObject(Object)
#define LockObject(Object)
NTSTATUS IPSendDatagram(PIP_PACKET IPPacket, PNEIGHBOR_CACHE_ENTRY NCE)
#define STATUS_INVALID_PARAMETER
Referenced by FileOpenAddress(), and ICMPSendDatagram().
◆ RawIPShutdown()
Definition at line 353 of file rawip.c.
359{
360
362
364}
VOID IPRegisterProtocol(UINT ProtocolNumber, IP_PROTOCOL_HANDLER Handler)
Referenced by TiUnload().
◆ RawIPStartup()
Definition at line 337 of file rawip.c.
343{
345
346
348
350}
VOID RawIpReceive(PIP_INTERFACE Interface, PIP_PACKET IPPacket)
#define RtlZeroMemory(Destination, Length)
Referenced by DriverEntry().