ReactOS  0.4.15-dev-3308-g9455def
rosdhcp.h File Reference
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <winreg.h>
#include <ndk/rtlfuncs.h>
#include <dhcpcsdk.h>
#include <dhcp/rosdhcp_public.h>
#include "debug.h"
#include "dhcpd.h"
Include dependency graph for rosdhcp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _DHCP_ADAPTER
 

Macros

#define WIN32_NO_STATUS
 
#define _INC_WINDOWS
 
#define COM_NO_WINDOWS_H
 
#define NTOS_MODE_USER
 
#define IFNAMSIZ   MAX_INTERFACE_NAME_LEN
 
#define DHCP_DISCOVER_INTERVAL   5
 
#define DHCP_REBOOT_TIMEOUT   10
 
#define DHCP_PANIC_TIMEOUT   20
 
#define DHCP_BACKOFF_MAX   300
 
#define DHCP_DEFAULT_LEASE_TIME   43200 /* 12 hours */
 
#define _PATH_DHCLIENT_PID   "\\systemroot\\system32\\drivers\\etc\\dhclient.pid"
 
#define _SSIZE_T_DEFINED
 
#define TIME   uintTIME
 
#define INLINE   inline
 
#define PROTO(x)   x
 
#define random   rand
 
#define srandom   srand
 

Typedefs

typedef voidVOIDPTR
 
typedef unsigned char u_int8_t
 
typedef unsigned short u_int16_t
 
typedef unsigned int u_int32_t
 
typedef charcaddr_t
 
typedef int ssize_t
 
typedef u_int32_t uintTIME
 
typedef void handler_t PROTO((struct packet *))
 
typedef struct _DHCP_ADAPTER DHCP_ADAPTER
 
typedef struct _DHCP_ADAPTERPDHCP_ADAPTER
 
typedef DWORD(* PipeSendFunc) (HANDLE CommPipe, COMM_DHCP_REPLY *Reply)
 

Functions

int init_client (void)
 
void stop_client (void)
 
void AdapterInit (VOID)
 
HANDLE StartAdapterDiscovery (HANDLE hStopEvent)
 
void AdapterStop (VOID)
 
PDHCP_ADAPTER AdapterGetFirst (VOID)
 
PDHCP_ADAPTER AdapterGetNext (PDHCP_ADAPTER)
 
PDHCP_ADAPTER AdapterFindIndex (unsigned int AdapterIndex)
 
PDHCP_ADAPTER AdapterFindInfo (struct interface_info *info)
 
PDHCP_ADAPTER AdapterFindByHardwareAddress (u_int8_t haddr[16], u_int8_t hlen)
 
HANDLE PipeInit (HANDLE hStopEvent)
 
VOID ApiInit (VOID)
 
VOID ApiFree (VOID)
 
VOID ApiLock (VOID)
 
VOID ApiUnlock (VOID)
 
DWORD DSQueryHWInfo (PipeSendFunc Send, HANDLE CommPipe, COMM_DHCP_REQ *Req)
 
DWORD DSLeaseIpAddress (PipeSendFunc Send, HANDLE CommPipe, COMM_DHCP_REQ *Req)
 
DWORD DSRenewIpAddressLease (PipeSendFunc Send, HANDLE CommPipe, COMM_DHCP_REQ *Req)
 
DWORD DSReleaseIpAddressLease (PipeSendFunc Send, HANDLE CommPipe, COMM_DHCP_REQ *Req)
 
DWORD DSStaticRefreshParams (PipeSendFunc Send, HANDLE CommPipe, COMM_DHCP_REQ *Req)
 
DWORD DSGetAdapterInfo (PipeSendFunc Send, HANDLE CommPipe, COMM_DHCP_REQ *Req)
 
int inet_aton (const char *s, struct in_addr *addr)
 
int warn (char *format,...)
 

Macro Definition Documentation

◆ _INC_WINDOWS

#define _INC_WINDOWS

Definition at line 7 of file rosdhcp.h.

◆ _PATH_DHCLIENT_PID

#define _PATH_DHCLIENT_PID   "\\systemroot\\system32\\drivers\\etc\\dhclient.pid"

Definition at line 31 of file rosdhcp.h.

◆ _SSIZE_T_DEFINED

#define _SSIZE_T_DEFINED

Definition at line 39 of file rosdhcp.h.

◆ COM_NO_WINDOWS_H

#define COM_NO_WINDOWS_H

Definition at line 8 of file rosdhcp.h.

◆ DHCP_BACKOFF_MAX

#define DHCP_BACKOFF_MAX   300

Definition at line 29 of file rosdhcp.h.

◆ DHCP_DEFAULT_LEASE_TIME

#define DHCP_DEFAULT_LEASE_TIME   43200 /* 12 hours */

Definition at line 30 of file rosdhcp.h.

◆ DHCP_DISCOVER_INTERVAL

#define DHCP_DISCOVER_INTERVAL   5

Definition at line 26 of file rosdhcp.h.

◆ DHCP_PANIC_TIMEOUT

#define DHCP_PANIC_TIMEOUT   20

Definition at line 28 of file rosdhcp.h.

◆ DHCP_REBOOT_TIMEOUT

#define DHCP_REBOOT_TIMEOUT   10

Definition at line 27 of file rosdhcp.h.

◆ IFNAMSIZ

Definition at line 20 of file rosdhcp.h.

◆ INLINE

#define INLINE   inline

Definition at line 56 of file rosdhcp.h.

◆ NTOS_MODE_USER

#define NTOS_MODE_USER

Definition at line 13 of file rosdhcp.h.

◆ PROTO

#define PROTO (   x)    x

Definition at line 57 of file rosdhcp.h.

◆ random

#define random   rand

Definition at line 81 of file rosdhcp.h.

◆ srandom

#define srandom   srand

Definition at line 82 of file rosdhcp.h.

◆ TIME

Definition at line 53 of file rosdhcp.h.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 6 of file rosdhcp.h.

Typedef Documentation

◆ caddr_t

typedef char* caddr_t

Definition at line 36 of file rosdhcp.h.

◆ DHCP_ADAPTER

◆ PDHCP_ADAPTER

◆ PipeSendFunc

typedef DWORD(* PipeSendFunc) (HANDLE CommPipe, COMM_DHCP_REPLY *Reply)

Definition at line 79 of file rosdhcp.h.

◆ PROTO

typedef void handler_t PROTO((struct packet *))

Definition at line 59 of file rosdhcp.h.

◆ ssize_t

typedef int ssize_t

Definition at line 48 of file rosdhcp.h.

◆ u_int16_t

Definition at line 34 of file rosdhcp.h.

◆ u_int32_t

Definition at line 35 of file rosdhcp.h.

◆ u_int8_t

Definition at line 33 of file rosdhcp.h.

◆ uintTIME

Definition at line 52 of file rosdhcp.h.

◆ VOIDPTR

typedef void* VOIDPTR

Definition at line 32 of file rosdhcp.h.

Function Documentation

◆ AdapterFindByHardwareAddress()

PDHCP_ADAPTER AdapterFindByHardwareAddress ( u_int8_t  haddr[16],
u_int8_t  hlen 
)

Definition at line 540 of file adapter.c.

540  {
541  PDHCP_ADAPTER Adapter;
542  PLIST_ENTRY ListEntry;
543 
544  for(ListEntry = AdapterList.Flink;
545  ListEntry != &AdapterList;
546  ListEntry = ListEntry->Flink) {
547  Adapter = CONTAINING_RECORD( ListEntry, DHCP_ADAPTER, ListEntry );
548  if (Adapter->DhclientInfo.hw_address.hlen == hlen &&
549  !memcmp(Adapter->DhclientInfo.hw_address.haddr,
550  haddr,
551  hlen)) return Adapter;
552  }
553 
554  return NULL;
555 }
static LIST_ENTRY AdapterList
Definition: adapter.c:9
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
struct interface_info DhclientInfo
Definition: rosdhcp.h:71
Definition: typedefs.h:119
#define NULL
Definition: types.h:112

Referenced by AdapterDiscoveryThread(), and got_one().

◆ AdapterFindIndex()

PDHCP_ADAPTER AdapterFindIndex ( unsigned int  AdapterIndex)

Definition at line 498 of file adapter.c.

498  {
499  PDHCP_ADAPTER Adapter;
500  PLIST_ENTRY ListEntry;
501 
502  for( ListEntry = AdapterList.Flink;
503  ListEntry != &AdapterList;
504  ListEntry = ListEntry->Flink ) {
505  Adapter = CONTAINING_RECORD( ListEntry, DHCP_ADAPTER, ListEntry );
506  if( Adapter->IfMib.dwIndex == indx ) return Adapter;
507  }
508 
509  return NULL;
510 }
static LIST_ENTRY AdapterList
Definition: adapter.c:9
MIB_IFROW IfMib
Definition: rosdhcp.h:66
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
Definition: typedefs.h:119
#define NULL
Definition: types.h:112
DWORD dwIndex
Definition: ifmib.h:38

Referenced by DSGetAdapterInfo(), DSLeaseIpAddress(), DSQueryHWInfo(), DSReleaseIpAddressLease(), DSRenewIpAddressLease(), and DSStaticRefreshParams().

◆ AdapterFindInfo()

PDHCP_ADAPTER AdapterFindInfo ( struct interface_info info)

Definition at line 526 of file adapter.c.

526  {
527  PDHCP_ADAPTER Adapter;
528  PLIST_ENTRY ListEntry;
529 
530  for( ListEntry = AdapterList.Flink;
531  ListEntry != &AdapterList;
532  ListEntry = ListEntry->Flink ) {
533  Adapter = CONTAINING_RECORD( ListEntry, DHCP_ADAPTER, ListEntry );
534  if( ip == &Adapter->DhclientInfo ) return Adapter;
535  }
536 
537  return NULL;
538 }
static LIST_ENTRY AdapterList
Definition: adapter.c:9
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
Definition: dhcpd.h:61
struct interface_info DhclientInfo
Definition: rosdhcp.h:71
Definition: typedefs.h:119
#define NULL
Definition: types.h:112

Referenced by bind_lease(), got_one(), send_request(), and state_panic().

◆ AdapterGetFirst()

PDHCP_ADAPTER AdapterGetFirst ( VOID  )

◆ AdapterGetNext()

PDHCP_ADAPTER AdapterGetNext ( PDHCP_ADAPTER  )

Definition at line 564 of file adapter.c.

565 {
566  if( This->ListEntry.Flink == &AdapterList ) return NULL;
567  return CONTAINING_RECORD
568  ( This->ListEntry.Flink, DHCP_ADAPTER, ListEntry );
569 }
static LIST_ENTRY AdapterList
Definition: adapter.c:9
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define NULL
Definition: types.h:112

◆ AdapterInit()

void AdapterInit ( VOID  )

◆ AdapterStop()

void AdapterStop ( VOID  )

◆ ApiFree()

VOID ApiFree ( VOID  )

◆ ApiInit()

VOID ApiInit ( VOID  )

◆ ApiLock()

VOID ApiLock ( VOID  )

◆ ApiUnlock()

VOID ApiUnlock ( VOID  )

◆ DSGetAdapterInfo()

DWORD DSGetAdapterInfo ( PipeSendFunc  Send,
HANDLE  CommPipe,
COMM_DHCP_REQ Req 
)

Definition at line 209 of file api.c.

209  {
210  COMM_DHCP_REPLY Reply;
211  PDHCP_ADAPTER Adapter;
212 
213  ApiLock();
214 
215  Adapter = AdapterFindIndex( Req->AdapterIndex );
216 
217  Reply.Reply = Adapter ? 1 : 0;
218 
219  if( Adapter ) {
220  Reply.GetAdapterInfo.DhcpEnabled = (S_STATIC != Adapter->DhclientState.state);
221  if (S_BOUND == Adapter->DhclientState.state) {
222  if (sizeof(Reply.GetAdapterInfo.DhcpServer) ==
223  Adapter->DhclientState.active->serveraddress.len) {
224  memcpy(&Reply.GetAdapterInfo.DhcpServer,
225  Adapter->DhclientState.active->serveraddress.iabuf,
226  Adapter->DhclientState.active->serveraddress.len);
227  } else {
228  DPRINT1("Unexpected server address len %d\n",
229  Adapter->DhclientState.active->serveraddress.len);
230  Reply.GetAdapterInfo.DhcpServer = htonl(INADDR_NONE);
231  }
232  Reply.GetAdapterInfo.LeaseObtained = Adapter->DhclientState.active->obtained;
233  Reply.GetAdapterInfo.LeaseExpires = Adapter->DhclientState.active->expiry;
234  } else {
235  Reply.GetAdapterInfo.DhcpServer = htonl(INADDR_NONE);
236  Reply.GetAdapterInfo.LeaseObtained = 0;
237  Reply.GetAdapterInfo.LeaseExpires = 0;
238  }
239  }
240 
241  ApiUnlock();
242 
243  return Send(CommPipe, &Reply );
244 }
Definition: dhcpd.h:175
#define INADDR_NONE
Definition: tcp.c:42
#define htonl(x)
Definition: module.h:212
PDHCP_ADAPTER AdapterFindIndex(unsigned int indx)
Definition: adapter.c:498
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
struct client_state DhclientState
Definition: rosdhcp.h:72
#define DPRINT1
Definition: precomp.h:8
VOID ApiUnlock()
Definition: api.c:26
struct _COMM_DHCP_REPLY::@3368 GetAdapterInfo
VOID ApiLock()
Definition: api.c:22

Referenced by PipeThreadProc().

◆ DSLeaseIpAddress()

DWORD DSLeaseIpAddress ( PipeSendFunc  Send,
HANDLE  CommPipe,
COMM_DHCP_REQ Req 
)

Definition at line 36 of file api.c.

36  {
37  COMM_DHCP_REPLY Reply;
38  PDHCP_ADAPTER Adapter;
39  struct protocol* proto;
40 
41  ApiLock();
42 
43  Adapter = AdapterFindIndex( Req->AdapterIndex );
44 
45  Reply.Reply = Adapter ? 1 : 0;
46 
47  if( Adapter ) {
49  if (proto)
51 
52  add_protocol( Adapter->DhclientInfo.name,
53  Adapter->DhclientInfo.rfdesc, got_one,
54  &Adapter->DhclientInfo );
55 
56  Adapter->DhclientInfo.client->state = S_INIT;
57  state_reboot(&Adapter->DhclientInfo);
58 
61  }
62 
63  ApiUnlock();
64 
65  return Send(CommPipe, &Reply );
66 }
void state_reboot(void *ipp)
Definition: dhclient.c:172
Definition: dhcpd.h:172
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
void got_one(struct protocol *l)
Definition: dispatch.c:194
void remove_protocol(struct protocol *proto)
Definition: dispatch.c:359
HANDLE hAdapterStateChangedEvent
Definition: dhcpcsvc.c:20
struct protocol * find_protocol_by_adapter(struct interface_info *info)
Definition: dispatch.c:412
void add_protocol(char *name, int fd, void(*handler)(struct protocol *), void *local)
Definition: dispatch.c:342
PDHCP_ADAPTER AdapterFindIndex(unsigned int indx)
Definition: adapter.c:498
struct interface_info DhclientInfo
Definition: rosdhcp.h:71
#define NULL
Definition: types.h:112
VOID ApiUnlock()
Definition: api.c:26
VOID ApiLock()
Definition: api.c:22

Referenced by PipeThreadProc().

◆ DSQueryHWInfo()

DWORD DSQueryHWInfo ( PipeSendFunc  Send,
HANDLE  CommPipe,
COMM_DHCP_REQ Req 
)

Definition at line 68 of file api.c.

68  {
69  COMM_DHCP_REPLY Reply;
70  PDHCP_ADAPTER Adapter;
71 
72  ApiLock();
73 
74  Adapter = AdapterFindIndex( Req->AdapterIndex );
75 
76  Reply.Reply = Adapter ? 1 : 0;
77 
78  if (Adapter) {
79  Reply.QueryHWInfo.AdapterIndex = Req->AdapterIndex;
80  Reply.QueryHWInfo.MediaType = Adapter->IfMib.dwType;
81  Reply.QueryHWInfo.Mtu = Adapter->IfMib.dwMtu;
82  Reply.QueryHWInfo.Speed = Adapter->IfMib.dwSpeed;
83  }
84 
85  ApiUnlock();
86 
87  return Send(CommPipe, &Reply );
88 }
MIB_IFROW IfMib
Definition: rosdhcp.h:66
struct _COMM_DHCP_REPLY::@3367 QueryHWInfo
DWORD dwType
Definition: ifmib.h:39
DWORD dwSpeed
Definition: ifmib.h:41
PDHCP_ADAPTER AdapterFindIndex(unsigned int indx)
Definition: adapter.c:498
VOID ApiUnlock()
Definition: api.c:26
DWORD dwMtu
Definition: ifmib.h:40
VOID ApiLock()
Definition: api.c:22

Referenced by PipeThreadProc().

◆ DSReleaseIpAddressLease()

DWORD DSReleaseIpAddressLease ( PipeSendFunc  Send,
HANDLE  CommPipe,
COMM_DHCP_REQ Req 
)

Definition at line 90 of file api.c.

90  {
91  COMM_DHCP_REPLY Reply;
92  PDHCP_ADAPTER Adapter;
93  struct protocol* proto;
94 
95  ApiLock();
96 
97  Adapter = AdapterFindIndex( Req->AdapterIndex );
98 
99  Reply.Reply = Adapter ? 1 : 0;
100 
101  if( Adapter ) {
102  if (Adapter->NteContext)
103  {
104  DeleteIPAddress( Adapter->NteContext );
105  Adapter->NteContext = 0;
106  }
107  if (Adapter->RouterMib.dwForwardNextHop)
108  {
109  DeleteIpForwardEntry( &Adapter->RouterMib );
110  Adapter->RouterMib.dwForwardNextHop = 0;
111  }
112 
114  if (proto)
116 
117  Adapter->DhclientInfo.client->active = NULL;
118  Adapter->DhclientInfo.client->state = S_INIT;
119 
122  }
123 
124  ApiUnlock();
125 
126  return Send(CommPipe, &Reply );
127 }
DWORD WINAPI DeleteIpForwardEntry(PMIB_IPFORWARDROW pRoute)
ULONG NteContext
Definition: rosdhcp.h:70
Definition: dhcpd.h:172
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
void remove_protocol(struct protocol *proto)
Definition: dispatch.c:359
HANDLE hAdapterStateChangedEvent
Definition: dhcpcsvc.c:20
MIB_IPFORWARDROW RouterMib
Definition: rosdhcp.h:67
struct protocol * find_protocol_by_adapter(struct interface_info *info)
Definition: dispatch.c:412
DWORD dwForwardNextHop
Definition: ipmib.h:74
PDHCP_ADAPTER AdapterFindIndex(unsigned int indx)
Definition: adapter.c:498
struct interface_info DhclientInfo
Definition: rosdhcp.h:71
DWORD WINAPI DeleteIPAddress(ULONG NTEContext)
#define NULL
Definition: types.h:112
VOID ApiUnlock()
Definition: api.c:26
VOID ApiLock()
Definition: api.c:22

Referenced by PipeThreadProc().

◆ DSRenewIpAddressLease()

DWORD DSRenewIpAddressLease ( PipeSendFunc  Send,
HANDLE  CommPipe,
COMM_DHCP_REQ Req 
)

Definition at line 129 of file api.c.

129  {
130  COMM_DHCP_REPLY Reply;
131  PDHCP_ADAPTER Adapter;
132  struct protocol* proto;
133 
134  ApiLock();
135 
136  Adapter = AdapterFindIndex( Req->AdapterIndex );
137 
138  if( !Adapter || Adapter->DhclientState.state == S_STATIC ) {
139  Reply.Reply = 0;
140  ApiUnlock();
141  return Send(CommPipe, &Reply );
142  }
143 
144  Reply.Reply = 1;
145 
147  if (proto)
149 
150  add_protocol( Adapter->DhclientInfo.name,
151  Adapter->DhclientInfo.rfdesc, got_one,
152  &Adapter->DhclientInfo );
153 
154  Adapter->DhclientInfo.client->state = S_INIT;
155  state_reboot(&Adapter->DhclientInfo);
156 
159 
160  ApiUnlock();
161 
162  return Send(CommPipe, &Reply );
163 }
void state_reboot(void *ipp)
Definition: dhclient.c:172
Definition: dhcpd.h:172
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
void got_one(struct protocol *l)
Definition: dispatch.c:194
void remove_protocol(struct protocol *proto)
Definition: dispatch.c:359
HANDLE hAdapterStateChangedEvent
Definition: dhcpcsvc.c:20
struct protocol * find_protocol_by_adapter(struct interface_info *info)
Definition: dispatch.c:412
void add_protocol(char *name, int fd, void(*handler)(struct protocol *), void *local)
Definition: dispatch.c:342
PDHCP_ADAPTER AdapterFindIndex(unsigned int indx)
Definition: adapter.c:498
struct interface_info DhclientInfo
Definition: rosdhcp.h:71
struct client_state DhclientState
Definition: rosdhcp.h:72
#define NULL
Definition: types.h:112
VOID ApiUnlock()
Definition: api.c:26
VOID ApiLock()
Definition: api.c:22

Referenced by PipeThreadProc().

◆ DSStaticRefreshParams()

DWORD DSStaticRefreshParams ( PipeSendFunc  Send,
HANDLE  CommPipe,
COMM_DHCP_REQ Req 
)

Definition at line 165 of file api.c.

165  {
167  COMM_DHCP_REPLY Reply;
168  PDHCP_ADAPTER Adapter;
169  struct protocol* proto;
170 
171  ApiLock();
172 
173  Adapter = AdapterFindIndex( Req->AdapterIndex );
174 
175  Reply.Reply = Adapter ? 1 : 0;
176 
177  if( Adapter ) {
178  if (Adapter->NteContext)
179  {
180  DeleteIPAddress( Adapter->NteContext );
181  Adapter->NteContext = 0;
182  }
183  if (Adapter->RouterMib.dwForwardNextHop)
184  {
185  DeleteIpForwardEntry( &Adapter->RouterMib );
186  Adapter->RouterMib.dwForwardNextHop = 0;
187  }
188 
189  Adapter->DhclientState.state = S_STATIC;
191  if (proto)
193  Status = AddIPAddress( Req->Body.StaticRefreshParams.IPAddress,
194  Req->Body.StaticRefreshParams.Netmask,
195  Req->AdapterIndex,
196  &Adapter->NteContext,
197  &Adapter->NteInstance );
198  Reply.Reply = NT_SUCCESS(Status);
199 
202  }
203 
204  ApiUnlock();
205 
206  return Send(CommPipe, &Reply );
207 }
ULONG NteInstance
Definition: rosdhcp.h:70
DWORD WINAPI DeleteIpForwardEntry(PMIB_IPFORWARDROW pRoute)
ULONG NteContext
Definition: rosdhcp.h:70
LONG NTSTATUS
Definition: precomp.h:26
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
void remove_protocol(struct protocol *proto)
Definition: dispatch.c:359
HANDLE hAdapterStateChangedEvent
Definition: dhcpcsvc.c:20
MIB_IPFORWARDROW RouterMib
Definition: rosdhcp.h:67
Status
Definition: gdiplustypes.h:24
struct protocol * find_protocol_by_adapter(struct interface_info *info)
Definition: dispatch.c:412
DWORD WINAPI AddIPAddress(IPAddr Address, IPMask Netmask, DWORD IfIndex, PULONG NteContext, PULONG NteInstance)
Definition: iphlpapi_main.c:71
DWORD dwForwardNextHop
Definition: ipmib.h:74
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
PDHCP_ADAPTER AdapterFindIndex(unsigned int indx)
Definition: adapter.c:498
struct interface_info DhclientInfo
Definition: rosdhcp.h:71
struct client_state DhclientState
Definition: rosdhcp.h:72
DWORD WINAPI DeleteIPAddress(ULONG NTEContext)
struct _COMM_DHCP_REQ::@3362::@3366 StaticRefreshParams
#define NULL
Definition: types.h:112
VOID ApiUnlock()
Definition: api.c:26
union _COMM_DHCP_REQ::@3362 Body
VOID ApiLock()
Definition: api.c:22

Referenced by PipeThreadProc().

◆ inet_aton()

int inet_aton ( const char s,
struct in_addr addr 
)

Definition at line 32 of file compat.c.

34 {
35  ULONG Octets[4] = {0,0,0,0};
36  ULONG i = 0;
37 
38  if(!cp)
39  return 0;
40 
41  while(*cp)
42  {
43  CHAR c = *cp;
44  cp++;
45 
46  if(c == '.')
47  {
48  i++;
49  continue;
50  }
51 
52  if(c < '0' || c > '9')
53  return 0;
54 
55  Octets[i] *= 10;
56  Octets[i] += (c - '0');
57 
58  if(Octets[i] > 255)
59  return 0;
60  }
61 
62  inp->S_un.S_addr = (Octets[3] << 24) + (Octets[2] << 16) + (Octets[1] << 8) + Octets[0];
63  return 1;
64 }
char CHAR
Definition: xmlstorage.h:175
const GLubyte * c
Definition: glext.h:8905
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
POINT cp
Definition: magnifier.c:59
unsigned int ULONG
Definition: retypes.h:1

◆ init_client()

int init_client ( void  )

Definition at line 111 of file dhclient.c.

112 {
113  ApiInit();
114  AdapterInit();
115 
116  tzset();
117 
119  sockaddr_broadcast.sin_family = AF_INET;
121  sockaddr_broadcast.sin_addr.s_addr = INADDR_BROADCAST;
122  inaddr_any.s_addr = INADDR_ANY;
124 
125  return 1; // TRUE
126 }
_CRTIMP void __cdecl tzset(void)
#define INADDR_BROADCAST
Definition: winsock.h:313
#define REMOTE_PORT
Definition: dhcpd.h:113
void AdapterInit()
Definition: adapter.c:192
#define INADDR_ANY
Definition: StrAddr.c:4
VOID ApiInit()
Definition: api.c:18
void do_packet(struct interface_info *interface, struct dhcp_packet *packet, int len, unsigned int from_port, struct iaddr from, struct hardware *hfrom)
Definition: options.c:635
void(* bootp_packet_handler)(struct interface_info *, struct dhcp_packet *, int, unsigned int, struct iaddr, struct hardware *)
Definition: dispatch.c:59
#define htons(x)
Definition: module.h:213
struct sockaddr_in sockaddr_broadcast
Definition: dhclient.c:82
struct in_addr inaddr_any
Definition: dhclient.c:81
#define AF_INET
Definition: tcpip.h:117
#define memset(x, y, z)
Definition: compat.h:39

Referenced by ServiceMain().

◆ PipeInit()

HANDLE PipeInit ( HANDLE  hStopEvent)

Definition at line 171 of file pipe.c.

172 {
174 }
DWORD WINAPI PipeThreadProc(LPVOID Parameter)
Definition: pipe.c:39
HANDLE hStopEvent
Definition: dhcpcsvc.c:19
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:136
#define NULL
Definition: types.h:112

Referenced by ServiceMain().

◆ StartAdapterDiscovery()

HANDLE StartAdapterDiscovery ( HANDLE  hStopEvent)

Definition at line 481 of file adapter.c.

481  {
483 }
HANDLE hStopEvent
Definition: dhcpcsvc.c:19
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:136
#define NULL
Definition: types.h:112
DWORD WINAPI AdapterDiscoveryThread(LPVOID Context)
Definition: adapter.c:291

Referenced by ServiceMain().

◆ stop_client()

void stop_client ( void  )

Definition at line 129 of file dhclient.c.

130 {
131  // AdapterStop();
132  // ApiFree();
133  /* FIXME: Close pipe and kill pipe thread */
134 }

Referenced by ServiceMain().

◆ warn()

int warn ( char format,
  ... 
)

Definition at line 42 of file util.c.

42  {
43  char buf[0x100];
44  int ret;
45  va_list arg_begin;
46  va_start( arg_begin, format );
47 
48  ret = _vsnprintf( buf, sizeof(buf), format, arg_begin );
49 
50  va_end( arg_begin );
51 
52  DPRINT("WARN: %s\n", buf);
53 
54  return ret;
55 }
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
va_start(ap, x)
int ret
#define _vsnprintf
Definition: xmlstorage.h:202
#define DPRINT
Definition: sndvol32.h:71

Referenced by read_client_conf().