Class used to test the DHCP API.
More...
|
| void | onDiscover (const DhcpPacket &request) override |
| | answer a discover with an offer.
|
| |
| void | onRequest (const DhcpPacket &request) override |
| | answer a request with an acknowledgement, or refuse it.
|
| |
| void | onRelease (const DhcpPacket &request) override |
| | note that a release was received.
|
| |
| void | onDecline (const DhcpPacket &request) override |
| | note that a decline was received.
|
| |
| void | onInform (const DhcpPacket &request) override |
| | answer an inform with the parameters, without a lease.
|
| |
| void | received (uint8_t type) |
| | record the type of the last message the server received.
|
| |
| bool | awaits (uint8_t type) |
| | wait for the server to receive a message of the given type.
|
| |
|
| static DhcpOption | settings () |
| | get the options the server advertises.
|
| |
| static void | checkSettings (const DhcpPacket &packet) |
| | check that a message carries the settings the server advertises.
|
| |
| static DhcpPacket | requestOf (uint8_t type) |
| | build a message the way a client sends one.
|
| |
| static std::string | frameOf (const DhcpPacket &packet) |
| | frame a message the way the wire carries it.
|
| |
| static void | inject (const std::string &wire) |
| | put raw bytes on the wire, bypassing the library.
|
| |
|
| static const std::string | _device = "dhcp0" |
| | interface both peers are bound to.
|
| |
| static const std::string | _bare = "dhcp1" |
| | interface that owns no address.
|
| |
| static const std::string | _mac = "4e:ed:ed:ee:59:db" |
| | hardware address of that interface.
|
| |
| static const std::string | _server = "192.168.24.100" |
| | address of the server.
|
| |
| static const std::string | _lease = "192.168.24.110" |
| | address the server hands out.
|
| |
Class used to test the DHCP API.
◆ Behaviour
how the server answers.
| Enumerator |
|---|
| Normal | answer the way a server should.
|
| Refuse | refuse every request.
|
| Silent | refuse every request without giving a reason.
|
| WrongType | answer a discover with a type the client does not expect.
|
| NoType | answer a discover without a message type at all.
|
◆ DhcpTest()
◆ awaits()
| bool DhcpTest::awaits |
( |
uint8_t | type | ) |
|
|
inlineprotected |
wait for the server to receive a message of the given type.
- Parameters
-
- Returns
- true if it was received, false if it timed out.
◆ checkSettings()
| static void DhcpTest::checkSettings |
( |
const DhcpPacket & | packet | ) |
|
|
inlinestaticprotected |
check that a message carries the settings the server advertises.
- Parameters
-
◆ frameOf()
| static std::string DhcpTest::frameOf |
( |
const DhcpPacket & | packet | ) |
|
|
inlinestaticprotected |
frame a message the way the wire carries it.
- Parameters
-
- Returns
- the frame.
◆ inject()
| static void DhcpTest::inject |
( |
const std::string & | wire | ) |
|
|
inlinestaticprotected |
put raw bytes on the wire, bypassing the library.
- Parameters
-
◆ onDecline()
| void DhcpTest::onDecline |
( |
const DhcpPacket & | request | ) |
|
|
inlineoverrideprotected |
note that a decline was received.
- Parameters
-
◆ onDiscover()
| void DhcpTest::onDiscover |
( |
const DhcpPacket & | request | ) |
|
|
inlineoverrideprotected |
answer a discover with an offer.
- Parameters
-
◆ onInform()
| void DhcpTest::onInform |
( |
const DhcpPacket & | request | ) |
|
|
inlineoverrideprotected |
answer an inform with the parameters, without a lease.
- Parameters
-
◆ onRelease()
| void DhcpTest::onRelease |
( |
const DhcpPacket & | request | ) |
|
|
inlineoverrideprotected |
note that a release was received.
- Parameters
-
◆ onRequest()
| void DhcpTest::onRequest |
( |
const DhcpPacket & | request | ) |
|
|
inlineoverrideprotected |
answer a request with an acknowledgement, or refuse it.
- Parameters
-
◆ received()
| void DhcpTest::received |
( |
uint8_t | type | ) |
|
|
inlineprotected |
record the type of the last message the server received.
- Parameters
-
◆ requestOf()
| static DhcpPacket DhcpTest::requestOf |
( |
uint8_t | type | ) |
|
|
inlinestaticprotected |
build a message the way a client sends one.
- Parameters
-
- Returns
- the message.
◆ settings()
get the options the server advertises.
- Returns
- the options.
◆ SetUpTestCase()
| static void DhcpTest::SetUpTestCase |
( |
| ) |
|
|
inlinestatic |
◆ TearDownTestCase()
| static void DhcpTest::TearDownTestCase |
( |
| ) |
|
|
inlinestatic |
◆ _bare
| const std::string DhcpTest::_bare = "dhcp1" |
|
staticprotected |
interface that owns no address.
◆ _behaviour
◆ _cond
last message notification.
◆ _device
| const std::string DhcpTest::_device = "dhcp0" |
|
staticprotected |
interface both peers are bound to.
◆ _last
| uint8_t DhcpTest::_last = 0 |
|
protected |
type of the last message received.
◆ _lease
| const std::string DhcpTest::_lease = "192.168.24.110" |
|
staticprotected |
address the server hands out.
◆ _mac
| const std::string DhcpTest::_mac = "4e:ed:ed:ee:59:db" |
|
staticprotected |
hardware address of that interface.
◆ _mutex
last message protection mutex.
◆ _secs
| uint16_t DhcpTest::_secs = 0 |
|
protected |
elapsed time the last discover reported.
◆ _server
| const std::string DhcpTest::_server = "192.168.24.100" |
|
staticprotected |
The documentation for this class was generated from the following file: