VirtualBox

source: vbox/trunk/src/VBox/NetworkServices/Dhcpd/DhcpdInternal.h@ 79763

最後變更 在這個檔案從79763是 79763,由 vboxsync 提交於 6 年 前

Main/DHCPServer,Dhcpd,VBoxManage: Added --log option to the DHCP server so we can start logging early. Added log rotation and limits. Put the config file next to the log and leases file. Validate DHCP options by reusing the parser code from the server, adding a bunch more DHCP options to the parser. Removed legacy and hardcoded configuration options from the dhcp server, it's all config file now. Fixed a bug in the option parsing of the VBoxManage dhcpserver add/modify commands. [build fix] bugref:9288

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 2.7 KB
 
1/* $Id: DhcpdInternal.h 79763 2019-07-14 03:59:56Z vboxsync $ */
2/** @file
3 * DHCP server - Internal header.
4 */
5
6/*
7 * Copyright (C) 2017-2019 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.alldomusa.eu.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 VBOX_INCLUDED_SRC_Dhcpd_DhcpdInternal_h
19#define VBOX_INCLUDED_SRC_Dhcpd_DhcpdInternal_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24#ifndef IN_VBOXSVC
25# define LOG_GROUP LOG_GROUP_NET_DHCPD
26#elif !defined(LOG_GROUP)
27# define LOG_GROUP LOG_GROUP_MAIN_DHCPCONFIG
28#endif
29#include <iprt/stdint.h>
30#include <iprt/string.h>
31#include <VBox/log.h>
32
33#include <map>
34#include <vector>
35
36#if __cplusplus >= 199711
37#include <memory>
38using std::shared_ptr;
39#else
40# include <tr1/memory>
41using std::tr1::shared_ptr;
42#endif
43
44
45/** Byte vector. */
46typedef std::vector<uint8_t> octets_t;
47
48/** Raw DHCP option map (keyed by option number, byte vector value). */
49typedef std::map<uint8_t, octets_t> rawopts_t;
50
51#ifndef IN_VBOXSVC
52class DhcpOption;
53/** DHCP option map (keyed by option number, DhcpOption value). */
54typedef std::map<uint8_t, std::shared_ptr<DhcpOption> > optmap_t;
55#endif
56
57
58/** Equal compare operator for mac address. */
59DECLINLINE(bool) operator==(const RTMAC &l, const RTMAC &r)
60{
61 return memcmp(&l, &r, sizeof(RTMAC)) == 0;
62}
63
64/** Less-than compare operator for mac address. */
65DECLINLINE(bool) operator<(const RTMAC &l, const RTMAC &r)
66{
67 return memcmp(&l, &r, sizeof(RTMAC)) < 0;
68}
69
70
71/** @name LogXRel + return NULL helpers
72 * @{ */
73#define DHCP_LOG_RET_NULL(a_MsgArgs) do { LogRel(a_MsgArgs); return NULL; } while (0)
74#define DHCP_LOG2_RET_NULL(a_MsgArgs) do { LogRel2(a_MsgArgs); return NULL; } while (0)
75#define DHCP_LOG3_RET_NULL(a_MsgArgs) do { LogRel3(a_MsgArgs); return NULL; } while (0)
76/** @} */
77
78
79/** @name LogXRel + return a_rcRet helpers
80 * @{ */
81#define DHCP_LOG_RET(a_rcRet, a_MsgArgs) do { LogRel(a_MsgArgs); return (a_rcRet); } while (0)
82#define DHCP_LOG2_RET(a_rcRet, a_MsgArgs) do { LogRel2(a_MsgArgs); return (a_rcRet); } while (0)
83#define DHCP_LOG3_RET(a_rcRet, a_MsgArgs) do { LogRel3(a_MsgArgs); return (a_rcRet); } while (0)
84/** @} */
85
86/** LogRel + RTMsgError helper. */
87#define DHCP_LOG_MSG_ERROR(a_MsgArgs) do { LogRel(a_MsgArgs); RTMsgError a_MsgArgs; } while (0)
88
89#endif /* !VBOX_INCLUDED_SRC_Dhcpd_DhcpdInternal_h */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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