2 * Copyright 2006-2010, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
6 * Axel Dörfler, axeld@pinc-software.de
12 #include "AutoconfigClient.h"
14 #include <netinet/in.h>
16 #include <NetworkAddress.h>
36 class DHCPClient
: public AutoconfigClient
{
38 DHCPClient(BMessenger target
,
40 virtual ~DHCPClient();
42 virtual status_t
Initialize();
44 virtual void MessageReceived(BMessage
* message
);
47 status_t
_Negotiate(dhcp_state state
);
48 status_t
_GotMessage(dhcp_state
& state
,
49 dhcp_message
* message
);
50 status_t
_StateTransition(int socket
, dhcp_state
& state
);
51 void _ParseOptions(dhcp_message
& message
,
53 BMessage
& resolverConfiguration
);
54 void _PrepareMessage(dhcp_message
& message
,
56 status_t
_SendMessage(int socket
, dhcp_message
& message
,
57 const BNetworkAddress
& address
) const;
58 dhcp_state
_CurrentState() const;
59 bool _TimeoutShift(int socket
, dhcp_state
& state
,
60 socket_timeout
& timeout
);
61 void _RestartLease(bigtime_t lease
);
63 static BString
_AddressToString(const uint8
* data
);
64 static BString
_AddressToString(in_addr_t address
);
67 BMessage fConfiguration
;
68 BMessage fResolverConfiguration
;
69 BMessageRunner
* fRunner
;
72 uint32 fTransactionID
;
73 in_addr_t fAssignedAddress
;
74 BNetworkAddress fServer
;
76 bigtime_t fRequestTime
;
77 bigtime_t fRenewalTime
;
78 bigtime_t fRebindingTime
;
83 #endif // DHCP_CLIENT_H