VirtualBox

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

Last change on this file was 106061, checked in by vboxsync, 3 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.0 KB
Line 
1/* $Id: DhcpdInternal.h 106061 2024-09-16 14:03:52Z vboxsync $ */
2/** @file
3 * DHCP server - Internal header.
4 */
5
6/*
7 * Copyright (C) 2017-2024 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28#ifndef VBOX_INCLUDED_SRC_Dhcpd_DhcpdInternal_h
29#define VBOX_INCLUDED_SRC_Dhcpd_DhcpdInternal_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34#ifndef IN_VBOXSVC
35# define LOG_GROUP LOG_GROUP_NET_DHCPD
36#elif !defined(LOG_GROUP)
37# define LOG_GROUP LOG_GROUP_MAIN_DHCPCONFIG
38#endif
39#include <iprt/stdint.h>
40#include <iprt/string.h>
41#include <VBox/log.h>
42
43#include <map>
44#include <vector>
45
46#ifndef IN_VBOXSVC
47
48# if __cplusplus >= 199711
49#include <memory>
50using std::shared_ptr;
51# else
52# include <tr1/memory>
53using std::tr1::shared_ptr;
54# endif
55
56class DhcpOption;
57/** DHCP option map (keyed by option number, DhcpOption value). */
58typedef std::map<uint8_t, std::shared_ptr<DhcpOption> > optmap_t;
59
60#endif /* !IN_VBOXSVC */
61
62/** Byte vector. */
63typedef std::vector<uint8_t> octets_t;
64
65/** Raw DHCP option map (keyed by option number, byte vector value). */
66typedef std::map<uint8_t, octets_t> rawopts_t;
67
68
69/** Equal compare operator for mac address. */
70DECLINLINE(bool) operator==(const RTMAC &l, const RTMAC &r)
71{
72 return memcmp(&l, &r, sizeof(RTMAC)) == 0;
73}
74
75/** Less-than compare operator for mac address. */
76DECLINLINE(bool) operator<(const RTMAC &l, const RTMAC &r)
77{
78 return memcmp(&l, &r, sizeof(RTMAC)) < 0;
79}
80
81
82/** @name LogXRel + return NULL helpers
83 * @{ */
84#define DHCP_LOG_RET_NULL(a_MsgArgs) do { LogRel(a_MsgArgs); return NULL; } while (0)
85#define DHCP_LOG2_RET_NULL(a_MsgArgs) do { LogRel2(a_MsgArgs); return NULL; } while (0)
86#define DHCP_LOG3_RET_NULL(a_MsgArgs) do { LogRel3(a_MsgArgs); return NULL; } while (0)
87/** @} */
88
89
90/** @name LogXRel + return a_rcRet helpers
91 * @{ */
92#define DHCP_LOG_RET(a_rcRet, a_MsgArgs) do { LogRel(a_MsgArgs); return (a_rcRet); } while (0)
93#define DHCP_LOG2_RET(a_rcRet, a_MsgArgs) do { LogRel2(a_MsgArgs); return (a_rcRet); } while (0)
94#define DHCP_LOG3_RET(a_rcRet, a_MsgArgs) do { LogRel3(a_MsgArgs); return (a_rcRet); } while (0)
95/** @} */
96
97/** LogRel + RTMsgError helper. */
98#define DHCP_LOG_MSG_ERROR(a_MsgArgs) do { LogRel(a_MsgArgs); RTMsgError a_MsgArgs; } while (0)
99
100#endif /* !VBOX_INCLUDED_SRC_Dhcpd_DhcpdInternal_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