- Stop trying to find more adapters if it failed to avoid spamming the debug log
[reactos.git] / reactos / base / services / dhcp / include / rosdhcp.h
1 #ifndef ROSDHCP_H
2 #define ROSDHCP_H
3
4 #define WIN32_NO_STATUS
5 #include <winsock2.h>
6 #define NTOS_MODE_USER
7 #include <ndk/ntndk.h>
8 #include <iprtrmib.h>
9 #include <iphlpapi.h>
10 #include <dhcpcsdk.h>
11 #include <stdio.h>
12 #include <io.h>
13 #include <setjmp.h>
14 #include "stdint.h"
15 #include "predec.h"
16 #include <dhcp/rosdhcp_public.h>
17 #include "debug.h"
18 #define IFNAMSIZ MAX_INTERFACE_NAME_LEN
19 #undef interface /* wine/objbase.h -- Grrr */
20
21 #undef IGNORE
22 #undef ACCEPT
23 #undef PREFER
24 #define DHCP_DISCOVER_INTERVAL 15
25 #define DHCP_REBOOT_TIMEOUT 300
26 #define DHCP_PANIC_TIMEOUT DHCP_REBOOT_TIMEOUT * 3
27 #define DHCP_BACKOFF_MAX 300
28 #define DHCP_DEFAULT_LEASE_TIME 43200 /* 12 hours */
29 #define _PATH_DHCLIENT_PID "\\systemroot\\system32\\drivers\\etc\\dhclient.pid"
30 typedef void *VOIDPTR;
31
32 #ifndef _SSIZE_T_DEFINED
33 #define _SSIZE_T_DEFINED
34 #undef ssize_t
35 #ifdef _WIN64
36 #if defined(__GNUC__) && defined(__STRICT_ANSI__)
37 typedef int ssize_t __attribute__ ((mode (DI)));
38 #else
39 typedef __int64 ssize_t;
40 #endif
41 #else
42 typedef int ssize_t;
43 #endif
44 #endif
45
46 typedef u_int32_t uintTIME;
47 #define TIME uintTIME
48 #include "dhcpd.h"
49
50 #define INLINE inline
51 #define PROTO(x) x
52
53 typedef void (*handler_t) PROTO ((struct packet *));
54
55 typedef struct _DHCP_ADAPTER {
56 LIST_ENTRY ListEntry;
57 MIB_IFROW IfMib;
58 MIB_IPFORWARDROW RouterMib;
59 MIB_IPADDRROW IfAddr;
60 SOCKADDR Address;
61 ULONG NteContext,NteInstance;
62 struct interface_info DhclientInfo;
63 struct client_state DhclientState;
64 struct client_config DhclientConfig;
65 struct sockaddr_in ListenAddr;
66 unsigned int BindStatus;
67 unsigned char recv_buf[1];
68 } DHCP_ADAPTER, *PDHCP_ADAPTER;
69
70 typedef DWORD (*PipeSendFunc)( COMM_DHCP_REPLY *Reply );
71
72 #define random rand
73 #define srandom srand
74
75 void AdapterInit(VOID);
76 BOOLEAN AdapterDiscover(VOID);
77 void AdapterStop(VOID);
78 HANDLE PipeInit(VOID);
79 extern PDHCP_ADAPTER AdapterGetFirst();
80 extern PDHCP_ADAPTER AdapterGetNext(PDHCP_ADAPTER);
81 extern PDHCP_ADAPTER AdapterFindIndex( unsigned int AdapterIndex );
82 extern PDHCP_ADAPTER AdapterFindInfo( struct interface_info *info );
83 extern PDHCP_ADAPTER AdapterFindByHardwareAddress( u_int8_t haddr[16], u_int8_t hlen );
84 extern VOID ApiInit();
85 extern VOID ApiLock();
86 extern VOID ApiUnlock();
87 extern DWORD DSQueryHWInfo( PipeSendFunc Send, COMM_DHCP_REQ *Req );
88 extern DWORD DSLeaseIpAddress( PipeSendFunc Send, COMM_DHCP_REQ *Req );
89 extern DWORD DSRenewIpAddressLease( PipeSendFunc Send, COMM_DHCP_REQ *Req );
90 extern DWORD DSReleaseIpAddressLease( PipeSendFunc Send, COMM_DHCP_REQ *Req );
91 extern DWORD DSStaticRefreshParams( PipeSendFunc Send, COMM_DHCP_REQ *Req );
92 extern DWORD DSGetAdapterInfo( PipeSendFunc Send, COMM_DHCP_REQ *Req );
93 extern int inet_aton(const char *s, struct in_addr *addr);
94 int warn( char *format, ... );
95 #endif/*ROSDHCP_H*/