Kea  2.3.4-git
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>
12 #include <dhcp/option_data_types.h>
13 #include <util/io_utilities.h>
14 
15 #include <stdint.h>
16 
17 namespace isc {
18 namespace dhcp {
19 
24 
30 class OptionVendor: public Option {
31 public:
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 
101 private:
102 
111  uint8_t dataLen() const;
112 
113  uint32_t vendor_id_;
114 };
115 
117 typedef boost::shared_ptr<OptionVendor> OptionVendorPtr;
118 
119 } // isc::dhcp namespace
120 } // isc namespace
121 
122 #endif // OPTION_VENDOR_H
uint32_t getVendorId() const
Returns enterprise identifier.
Definition: option_vendor.h:85
const int VENDOR_CLASS_STRING_INDEX
Definition: option_vendor.h:23
OptionVendor(Option::Universe u, const uint32_t vendor_id)
Constructor.
boost::shared_ptr< Option > OptionPtr
Definition: option.h:36
Universe
defines option universe DHCPv4 or DHCPv6
Definition: option.h:83
virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end)
Parses received buffer.
OptionPtr clone() const
Copies this option and returns a pointer to the copy.
void check() const
A protected method used for option correctness.
Definition: option.cc:90
virtual std::string toText(int indent=0) const
Returns the option in the textual format.
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
Definition: buffer.h:294
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...
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
Defines the logger used by the top-level component of kea-lfc.
const int VENDOR_CLASS_ENTERPRISE_ID_INDEX
Indexes for fields in vendor-class (17) DHCPv6 option.
Definition: option_vendor.h:21
boost::shared_ptr< OptionVendor > OptionVendorPtr
Pointer to a vendor option.
void setVendorId(const uint32_t vendor_id)
Sets enterprise identifier.
Definition: option_vendor.h:80
This class represents vendor-specific information option.
Definition: option_vendor.h:30
virtual uint16_t len() const
returns complete length of option