VirtualBox

source: vbox/trunk/src/VBox/NetworkServices/Dhcpd/DHCPD.h@ 76525

Last change on this file since 76525 was 76525, checked in by vboxsync, 6 years ago

NetworkServices: scm --fix-header-guards. bugref:9344

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.6 KB
Line 
1/* $Id: DHCPD.h 76525 2018-12-30 05:51:31Z vboxsync $ */
2/** @file
3 * DHCP server - protocol logic
4 */
5
6/*
7 * Copyright (C) 2017-2018 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef _DHCPD_DHCPD_H_
19#define _DHCPD_DHCPD_H_
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24#include "Defs.h"
25#include "Config.h"
26#include "DhcpMessage.h"
27#include "Db.h"
28
29
30class DHCPD
31{
32 const Config *m_pConfig;
33 std::string m_strLeasesFileName;
34 Db m_db;
35
36public:
37 DHCPD();
38
39 int init(const Config *);
40
41 DhcpServerMessage *process(const std::unique_ptr<DhcpClientMessage> &req)
42 {
43 if (req.get() == NULL)
44 return NULL;
45
46 return process(*req.get());
47 }
48
49 DhcpServerMessage *process(DhcpClientMessage &req);
50
51private:
52 DhcpServerMessage *doDiscover(DhcpClientMessage &req);
53 DhcpServerMessage *doRequest(DhcpClientMessage &req);
54 DhcpServerMessage *doInform(DhcpClientMessage &req);
55
56 DhcpServerMessage *doDecline(DhcpClientMessage &req);
57 DhcpServerMessage *doRelease(DhcpClientMessage &req);
58
59 DhcpServerMessage *createMessage(int type, DhcpClientMessage &req);
60
61 void loadLeases();
62 void saveLeases();
63};
64
65#endif /* _DHCPD_DHCPD_H_ */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette