VirtualBox

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

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

Dhcpd: Went over the DhcpMessage a little as well as revisiting the lease reading code in the database. Logging is LogRel() or similar, no cout, RTPrintf or similar. The debug & release loggers can both output to stderr/out/whatever as needed. bugref:9288

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.4 KB
Line 
1/* $Id: DhcpdInternal.h 79568 2019-07-06 23:42:51Z 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.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#define LOG_GROUP LOG_GROUP_NET_DHCPD
25#include <iprt/stdint.h>
26#include <iprt/string.h>
27#include <VBox/log.h>
28
29#include <map>
30#include <vector>
31
32#if __cplusplus >= 199711
33#include <memory>
34using std::shared_ptr;
35#else
36# include <tr1/memory>
37using std::tr1::shared_ptr;
38#endif
39
40
41/** Byte vector. */
42typedef std::vector<uint8_t> octets_t;
43
44/** Raw DHCP option map (keyed by option number, byte vector value). */
45typedef std::map<uint8_t, octets_t> rawopts_t;
46
47class DhcpOption;
48/** DHCP option map (keyed by option number, DhcpOption value). */
49typedef std::map<uint8_t, std::shared_ptr<DhcpOption> > optmap_t;
50
51
52/** Equal compare operator for mac address. */
53DECLINLINE(bool) operator==(const RTMAC &l, const RTMAC &r)
54{
55 return memcmp(&l, &r, sizeof(RTMAC)) == 0;
56}
57
58/** Less-than 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
65/** @name LogXRel + return NULL helpers
66 * @{ */
67#define DHCP_LOG_RET_NULL(a_MsgArgs) do { LogRel(a_MsgArgs); return NULL; } while (0)
68#define DHCP_LOG2_RET_NULL(a_MsgArgs) do { LogRel2(a_MsgArgs); return NULL; } while (0)
69#define DHCP_LOG3_RET_NULL(a_MsgArgs) do { LogRel3(a_MsgArgs); return NULL; } while (0)
70/** @} */
71
72
73/** @name LogXRel + return a_rcRet helpers
74 * @{ */
75#define DHCP_LOG_RET(a_rcRet, a_MsgArgs) do { LogRel(a_MsgArgs); return (a_rcRet); } while (0)
76#define DHCP_LOG2_RET(a_rcRet, a_MsgArgs) do { LogRel2(a_MsgArgs); return (a_rcRet); } while (0)
77#define DHCP_LOG3_RET(a_rcRet, a_MsgArgs) do { LogRel3(a_MsgArgs); return (a_rcRet); } while (0)
78/** @} */
79
80#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