VirtualBox

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

Last change on this file since 95259 was 93115, checked in by vboxsync, 3 years ago

scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.7 KB
Line 
1/* $Id: DhcpdInternal.h 93115 2022-01-01 11:31:46Z vboxsync $ */
2/** @file
3 * DHCP server - Internal header.
4 */
5
6/*
7 * Copyright (C) 2017-2022 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 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#ifndef IN_VBOXSVC
37
38# if __cplusplus >= 199711
39#include <memory>
40using std::shared_ptr;
41# else
42# include <tr1/memory>
43using std::tr1::shared_ptr;
44# endif
45
46class DhcpOption;
47/** DHCP option map (keyed by option number, DhcpOption value). */
48typedef std::map<uint8_t, std::shared_ptr<DhcpOption> > optmap_t;
49
50#endif /* !IN_VBOXSVC */
51
52/** Byte vector. */
53typedef std::vector<uint8_t> octets_t;
54
55/** Raw DHCP option map (keyed by option number, byte vector value). */
56typedef std::map<uint8_t, octets_t> rawopts_t;
57
58
59/** Equal compare operator for mac address. */
60DECLINLINE(bool) operator==(const RTMAC &l, const RTMAC &r)
61{
62 return memcmp(&l, &r, sizeof(RTMAC)) == 0;
63}
64
65/** Less-than compare operator for mac address. */
66DECLINLINE(bool) operator<(const RTMAC &l, const RTMAC &r)
67{
68 return memcmp(&l, &r, sizeof(RTMAC)) < 0;
69}
70
71
72/** @name LogXRel + return NULL helpers
73 * @{ */
74#define DHCP_LOG_RET_NULL(a_MsgArgs) do { LogRel(a_MsgArgs); return NULL; } while (0)
75#define DHCP_LOG2_RET_NULL(a_MsgArgs) do { LogRel2(a_MsgArgs); return NULL; } while (0)
76#define DHCP_LOG3_RET_NULL(a_MsgArgs) do { LogRel3(a_MsgArgs); return NULL; } while (0)
77/** @} */
78
79
80/** @name LogXRel + return a_rcRet helpers
81 * @{ */
82#define DHCP_LOG_RET(a_rcRet, a_MsgArgs) do { LogRel(a_MsgArgs); return (a_rcRet); } while (0)
83#define DHCP_LOG2_RET(a_rcRet, a_MsgArgs) do { LogRel2(a_MsgArgs); return (a_rcRet); } while (0)
84#define DHCP_LOG3_RET(a_rcRet, a_MsgArgs) do { LogRel3(a_MsgArgs); return (a_rcRet); } while (0)
85/** @} */
86
87/** LogRel + RTMsgError helper. */
88#define DHCP_LOG_MSG_ERROR(a_MsgArgs) do { LogRel(a_MsgArgs); RTMsgError a_MsgArgs; } while (0)
89
90#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