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