Kea 2.2.0
option_vendor.h
Go to the documentation of this file.
1// Copyright (C) 2013-2022 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#ifndef OPTION_VENDOR_H
8#define OPTION_VENDOR_H
9
10#include <dhcp/libdhcp++.h>
11#include <dhcp/option.h>
13#include <util/io_utilities.h>
14
15#include <stdint.h>
16
17namespace isc {
18namespace dhcp {
19
24
30class OptionVendor: public Option {
31public:
36 OptionVendor(Option::Universe u, const uint32_t vendor_id);
37
52
54 OptionPtr clone() const;
55
61 virtual void pack(isc::util::OutputBuffer& buf, bool check = true) const;
62
75 virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end);
76
80 void setVendorId(const uint32_t vendor_id) { vendor_id_ = vendor_id; }
81
85 uint32_t getVendorId() const { return (vendor_id_); }
86
92 virtual uint16_t len() const;
93
99 virtual std::string toText(int indent = 0) const;
100
101private:
102
111 uint8_t dataLen() const;
112
113 uint32_t vendor_id_;
114};
115
117typedef boost::shared_ptr<OptionVendor> OptionVendorPtr;
118
119} // isc::dhcp namespace
120} // isc namespace
121
122#endif // OPTION_VENDOR_H
This class represents vendor-specific information option.
Definition: option_vendor.h:30
uint32_t getVendorId() const
Returns enterprise identifier.
Definition: option_vendor.h:85
OptionVendor(Option::Universe u, const uint32_t vendor_id)
Constructor.
virtual uint16_t len() const
returns complete length of option
OptionPtr clone() const
Copies this option and returns a pointer to the copy.
void setVendorId(const uint32_t vendor_id)
Sets enterprise identifier.
Definition: option_vendor.h:80
virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end)
Parses received buffer.
virtual std::string toText(int indent=0) const
Returns the option in the textual format.
virtual void pack(isc::util::OutputBuffer &buf, bool check=true) const
Writes option in wire-format to buf, returns pointer to first unused byte after stored option.
Universe
defines option universe DHCPv4 or DHCPv6
Definition: option.h:83
void check() const
A protected method used for option correctness.
Definition: option.cc:90
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
Definition: buffer.h:294
boost::shared_ptr< OptionVendor > OptionVendorPtr
Pointer to a vendor option.
const int VENDOR_CLASS_DATA_LEN_INDEX
Definition: option_vendor.h:22
OptionBuffer::const_iterator OptionBufferConstIter
const_iterator for walking over OptionBuffer
Definition: option.h:30
const int VENDOR_CLASS_STRING_INDEX
Definition: option_vendor.h:23
const int VENDOR_CLASS_ENTERPRISE_ID_INDEX
Indexes for fields in vendor-class (17) DHCPv6 option.
Definition: option_vendor.h:21
boost::shared_ptr< Option > OptionPtr
Definition: option.h:36
Defines the logger used by the top-level component of kea-lfc.