ReactOS  0.4.13-dev-1089-g05f0b08
route_reactos.c File Reference
#include <config.h>
#include "iphlpapi_private.h"
Include dependency graph for route_reactos.c:

Go to the source code of this file.

Macros

#define IP_FORWARD_ADD   3
 
#define IP_FORWARD_DEL   2
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (iphlpapi)
 
DWORD createIpForwardEntry (PMIB_IPFORWARDROW pRoute)
 
DWORD setIpForwardEntry (PMIB_IPFORWARDROW pRoute)
 
DWORD deleteIpForwardEntry (PMIB_IPFORWARDROW pRoute)
 

Macro Definition Documentation

◆ IP_FORWARD_ADD

#define IP_FORWARD_ADD   3

Definition at line 27 of file route_reactos.c.

◆ IP_FORWARD_DEL

#define IP_FORWARD_DEL   2

Definition at line 28 of file route_reactos.c.

Function Documentation

◆ createIpForwardEntry()

DWORD createIpForwardEntry ( PMIB_IPFORWARDROW  pRoute)

Definition at line 32 of file route_reactos.c.

32  {
33  HANDLE tcpFile;
37  IPRouteEntry *rte;
39  DWORD returnSize = 0;
40 
41  TRACE("Called.\n");
42 
43  if( NT_SUCCESS(status) ) {
44  status = getNthIpEntity( tcpFile, pRoute->dwForwardIfIndex, &id );
45 
46  if( NT_SUCCESS(status) ) {
50  req.Req.ID.toi_entity.tei_instance = id.tei_instance;
52  req.Req.BufferSize = sizeof(*rte);
53  rte =
54  (IPRouteEntry *)&req.Req.Buffer[0];
55 
56  // dwForwardPolicy
57  // dwForwardNextHopAS
58  rte->ire_dest = pRoute->dwForwardDest;
59  rte->ire_mask = pRoute->dwForwardMask;
60  rte->ire_gw = pRoute->dwForwardNextHop;
61  rte->ire_index = pRoute->dwForwardIfIndex;
62  rte->ire_type = IP_FORWARD_ADD;
63  rte->ire_proto = pRoute->dwForwardProto;
64  rte->ire_age = pRoute->dwForwardAge;
65  rte->ire_metric1 = pRoute->dwForwardMetric1;
66  rte->ire_metric2 = pRoute->dwForwardMetric2;
67  rte->ire_metric3 = pRoute->dwForwardMetric3;
68  rte->ire_metric4 = pRoute->dwForwardMetric4;
69  rte->ire_metric5 = pRoute->dwForwardMetric5;
70 
71  status = DeviceIoControl( tcpFile,
73  &req,
74  sizeof(req),
75  NULL,
76  0,
77  &returnSize,
78  NULL );
79  }
80 
81  closeTcpFile( tcpFile );
82  }
83 
84  TRACE("Returning: %08x (IOCTL was %08x)\n", status, IOCTL_TCP_SET_INFORMATION_EX);
85 
86  if( NT_SUCCESS(status) )
87  return NO_ERROR;
88  else
89  return status;
90 }
TDIEntityID toi_entity
Definition: tdiinfo.h:74
unsigned long ire_metric2
Definition: tcp_info.c:27
unsigned long ire_dest
Definition: tcp_info.c:24
DWORD dwForwardMetric4
Definition: ipmib.h:91
ULONG toi_class
Definition: tdiinfo.h:75
unsigned char Buffer[1]
Definition: tdiinfo.h:97
unsigned long ire_metric3
Definition: tcp_info.c:28
LONG NTSTATUS
Definition: precomp.h:26
unsigned long ire_mask
Definition: tcp_info.c:34
NTSTATUS getNthIpEntity(HANDLE tcpFile, DWORD index, TDIEntityID *ent)
DWORD dwForwardMask
Definition: ipmib.h:72
DWORD dwForwardMetric5
Definition: ipmib.h:92
#define IP_FORWARD_ADD
Definition: route_reactos.c:27
#define NO_ERROR
Definition: dderror.h:5
#define IP_MIB_ARPTABLE_ENTRY_ID
Definition: tcpioctl.h:51
DWORD dwForwardMetric3
Definition: ipmib.h:90
unsigned long ire_metric5
Definition: tcp_info.c:35
DWORD dwForwardAge
Definition: ipmib.h:86
#define FILE_READ_DATA
Definition: nt_native.h:628
ULONG toi_id
Definition: tdiinfo.h:77
DWORD dwForwardMetric2
Definition: ipmib.h:89
unsigned long ire_proto
Definition: tcp_info.c:32
#define IOCTL_TCP_SET_INFORMATION_EX
Definition: ticonsts.h:45
smooth NULL
Definition: ftsmooth.c:416
#define FILE_WRITE_DATA
Definition: nt_native.h:631
IF_INDEX dwForwardIfIndex
Definition: ipmib.h:75
ULONG tei_entity
Definition: tdiinfo.h:31
#define TRACE(s)
Definition: solgame.cpp:4
DWORD dwForwardNextHop
Definition: ipmib.h:74
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
ULONG tei_instance
Definition: tdiinfo.h:32
DWORD dwForwardDest
Definition: ipmib.h:71
unsigned long DWORD
Definition: ntddk_ex.h:95
#define TCP_REQUEST_SET_INFORMATION_INIT
unsigned long ire_metric4
Definition: tcp_info.c:29
VOID closeTcpFile(HANDLE h)
Definition: handle.c:43
#define CL_NL_ENTITY
Definition: tdiinfo.h:42
TCP_REQUEST_SET_INFORMATION_EX Req
unsigned long ire_age
Definition: tcp_info.c:33
unsigned long ire_metric1
Definition: tcp_info.c:26
unsigned long ire_type
Definition: tcp_info.c:31
BOOL WINAPI DeviceIoControl(IN HANDLE hDevice, IN DWORD dwIoControlCode, IN LPVOID lpInBuffer OPTIONAL, IN DWORD nInBufferSize OPTIONAL, OUT LPVOID lpOutBuffer OPTIONAL, IN DWORD nOutBufferSize OPTIONAL, OUT LPDWORD lpBytesReturned OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: deviceio.c:136
#define INFO_TYPE_PROVIDER
Definition: tdiinfo.h:69
NTSTATUS openTcpFile(PHANDLE tcpFile, ACCESS_MASK DesiredAccess)
Definition: handle.c:12
GLenum GLuint id
Definition: glext.h:5579
DWORD dwForwardProto
Definition: ipmib.h:83
DWORD dwForwardMetric1
Definition: ipmib.h:88
unsigned long ire_index
Definition: tcp_info.c:25
static SERVICE_STATUS status
Definition: service.c:31
ULONG toi_type
Definition: tdiinfo.h:76
#define INFO_CLASS_PROTOCOL
Definition: tdiinfo.h:65
Definition: ps.c:97

◆ deleteIpForwardEntry()

DWORD deleteIpForwardEntry ( PMIB_IPFORWARDROW  pRoute)

Definition at line 97 of file route_reactos.c.

97  {
98  HANDLE tcpFile;
102  IPRouteEntry *rte;
103  TDIEntityID id;
104  DWORD returnSize = 0;
105 
106  TRACE("Called.\n");
107 
108  if( NT_SUCCESS(status) ) {
109  status = getNthIpEntity( tcpFile, pRoute->dwForwardIfIndex, &id );
110 
111  if( NT_SUCCESS(status) ) {
115  req.Req.ID.toi_entity.tei_instance = id.tei_instance;
117  req.Req.BufferSize = sizeof(*rte);
118  rte =
119  (IPRouteEntry *)&req.Req.Buffer[0];
120 
121  // dwForwardPolicy
122  // dwForwardNextHopAS
123  rte->ire_dest = pRoute->dwForwardDest;
124  rte->ire_mask = INADDR_NONE;
125  rte->ire_gw = pRoute->dwForwardNextHop;
126  rte->ire_index = pRoute->dwForwardIfIndex;
127  rte->ire_type = IP_FORWARD_DEL;
128  rte->ire_proto = pRoute->dwForwardProto;
129  rte->ire_age = pRoute->dwForwardAge;
130  rte->ire_metric1 = pRoute->dwForwardMetric1;
131  rte->ire_metric2 = INADDR_NONE;
132  rte->ire_metric3 = INADDR_NONE;
133  rte->ire_metric4 = INADDR_NONE;
134  rte->ire_metric5 = INADDR_NONE;
135 
136  status = DeviceIoControl( tcpFile,
138  &req,
139  sizeof(req),
140  NULL,
141  0,
142  &returnSize,
143  NULL );
144  }
145 
146  closeTcpFile( tcpFile );
147  }
148 
149  TRACE("Returning: %08x (IOCTL was %08x)\n", status, IOCTL_TCP_SET_INFORMATION_EX);
150 
151  if( NT_SUCCESS(status) )
152  return NO_ERROR;
153  else
154  return status;
155 }
TDIEntityID toi_entity
Definition: tdiinfo.h:74
unsigned long ire_metric2
Definition: tcp_info.c:27
unsigned long ire_dest
Definition: tcp_info.c:24
ULONG toi_class
Definition: tdiinfo.h:75
unsigned char Buffer[1]
Definition: tdiinfo.h:97
unsigned long ire_metric3
Definition: tcp_info.c:28
#define INADDR_NONE
Definition: tcp.c:42
LONG NTSTATUS
Definition: precomp.h:26
unsigned long ire_mask
Definition: tcp_info.c:34
NTSTATUS getNthIpEntity(HANDLE tcpFile, DWORD index, TDIEntityID *ent)
#define NO_ERROR
Definition: dderror.h:5
#define IP_MIB_ARPTABLE_ENTRY_ID
Definition: tcpioctl.h:51
unsigned long ire_metric5
Definition: tcp_info.c:35
DWORD dwForwardAge
Definition: ipmib.h:86
#define FILE_READ_DATA
Definition: nt_native.h:628
ULONG toi_id
Definition: tdiinfo.h:77
unsigned long ire_proto
Definition: tcp_info.c:32
#define IOCTL_TCP_SET_INFORMATION_EX
Definition: ticonsts.h:45
smooth NULL
Definition: ftsmooth.c:416
#define FILE_WRITE_DATA
Definition: nt_native.h:631
IF_INDEX dwForwardIfIndex
Definition: ipmib.h:75
ULONG tei_entity
Definition: tdiinfo.h:31
#define TRACE(s)
Definition: solgame.cpp:4
DWORD dwForwardNextHop
Definition: ipmib.h:74
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
ULONG tei_instance
Definition: tdiinfo.h:32
DWORD dwForwardDest
Definition: ipmib.h:71
unsigned long DWORD
Definition: ntddk_ex.h:95
#define TCP_REQUEST_SET_INFORMATION_INIT
unsigned long ire_metric4
Definition: tcp_info.c:29
VOID closeTcpFile(HANDLE h)
Definition: handle.c:43
#define CL_NL_ENTITY
Definition: tdiinfo.h:42
#define IP_FORWARD_DEL
Definition: route_reactos.c:28
TCP_REQUEST_SET_INFORMATION_EX Req
unsigned long ire_age
Definition: tcp_info.c:33
unsigned long ire_metric1
Definition: tcp_info.c:26
unsigned long ire_type
Definition: tcp_info.c:31
BOOL WINAPI DeviceIoControl(IN HANDLE hDevice, IN DWORD dwIoControlCode, IN LPVOID lpInBuffer OPTIONAL, IN DWORD nInBufferSize OPTIONAL, OUT LPVOID lpOutBuffer OPTIONAL, IN DWORD nOutBufferSize OPTIONAL, OUT LPDWORD lpBytesReturned OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: deviceio.c:136
#define INFO_TYPE_PROVIDER
Definition: tdiinfo.h:69
NTSTATUS openTcpFile(PHANDLE tcpFile, ACCESS_MASK DesiredAccess)
Definition: handle.c:12
GLenum GLuint id
Definition: glext.h:5579
DWORD dwForwardProto
Definition: ipmib.h:83
DWORD dwForwardMetric1
Definition: ipmib.h:88
unsigned long ire_index
Definition: tcp_info.c:25
static SERVICE_STATUS status
Definition: service.c:31
ULONG toi_type
Definition: tdiinfo.h:76
#define INFO_CLASS_PROTOCOL
Definition: tdiinfo.h:65
Definition: ps.c:97

◆ setIpForwardEntry()

DWORD setIpForwardEntry ( PMIB_IPFORWARDROW  pRoute)

Definition at line 92 of file route_reactos.c.

92  {
93  FIXME(":stub\n");
94  return (DWORD) 0;
95 }
#define FIXME(fmt,...)
Definition: debug.h:110
unsigned long DWORD
Definition: ntddk_ex.h:95

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( iphlpapi  )