Kea 3.2.0-git
option6_iaaddr.h
Go to the documentation of this file.
1// Copyright (C) 2011-2026 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 OPTION6_IAADDR_H
8#define OPTION6_IAADDR_H
9
10#include <asiolink/io_address.h>
11#include <dhcp/option.h>
12#include <boost/shared_ptr.hpp>
13
14namespace isc {
15namespace dhcp {
16
17class Option6IAAddr;
18
20typedef boost::shared_ptr<Option6IAAddr> Option6IAAddrPtr;
21
22class Option6IAAddr: public Option {
23
24public:
26 static const size_t OPTION6_IAADDR_LEN = 24;
27
36 Option6IAAddr(uint16_t type, const isc::asiolink::IOAddress& addr,
37 uint32_t preferred, uint32_t valid);
38
47 Option6IAAddr(uint32_t type, OptionBuffer::const_iterator begin,
48 OptionBuffer::const_iterator end, size_t rec_level = 0);
49
51 virtual OptionPtr clone() const;
52
60 void pack(isc::util::OutputBuffer& buf, bool check = true) const;
61
66 virtual void unpack(OptionBufferConstIter begin,
68
76 size_t rec_level);
77
83 virtual std::string
84 toText(int indent = 0) const;
85
86
90 void setAddress(const isc::asiolink::IOAddress& addr) { addr_ = addr; }
91
96 void setPreferred(unsigned int pref) { preferred_=pref; }
97
102 void setValid(unsigned int valid) { valid_=valid; }
103
108 getAddress() const { return addr_; }
109
113 unsigned int
114 getPreferred() const { return preferred_; }
115
119 unsigned int
120 getValid() const { return valid_; }
121
123 virtual uint16_t len() const;
124
125protected:
128
130 unsigned int preferred_;
131
133 unsigned int valid_;
134};
135
136} // isc::dhcp namespace
137} // isc namespace
138
139#endif // OPTION_IA_H
void setValid(unsigned int valid)
Sets valid lifetime (in seconds).
isc::asiolink::IOAddress getAddress() const
Returns address contained within this option.
void setPreferred(unsigned int pref)
Sets preferred lifetime (in seconds).
void pack(isc::util::OutputBuffer &buf, bool check=true) const
Writes option in wire-format.
virtual OptionPtr clone() const
Copies this option and returns a pointer to the copy.
virtual std::string toText(int indent=0) const
Returns string representation of the option.
static const size_t OPTION6_IAADDR_LEN
length of the fixed part of the IAADDR option
virtual uint16_t len() const
returns data length (data length + DHCPv4/DHCPv6 option header)
virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end)
Parses received buffer.
unsigned int getPreferred() const
Returns preferred lifetime of an address.
unsigned int valid_
contains valid-lifetime timer (in seconds)
Option6IAAddr(uint16_t type, const isc::asiolink::IOAddress &addr, uint32_t preferred, uint32_t valid)
Constructor, used for options constructed (during transmission).
isc::asiolink::IOAddress addr_
contains an IPv6 address
void setAddress(const isc::asiolink::IOAddress &addr)
sets address in this option.
unsigned int getValid() const
Returns valid lifetime of an address.
unsigned int preferred_
contains preferred-lifetime timer (in seconds)
virtual bool valid() const
returns if option is valid (e.g.
Definition option.cc:191
Option(Universe u, uint16_t type)
ctor, used for options constructed, usually during transmission
Definition option.cc:39
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:346
OptionBuffer::const_iterator OptionBufferConstIter
const_iterator for walking over OptionBuffer
Definition option.h:30
boost::shared_ptr< Option6IAAddr > Option6IAAddrPtr
A pointer to the isc::dhcp::Option6IAAddr object.
boost::shared_ptr< Option > OptionPtr
Definition option.h:37
Defines the logger used by the top-level component of kea-lfc.