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