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