const std::string& option_space,
isc::dhcp::OptionCollection& options,
std::list<uint16_t>& deferred,
- bool flexible_pad_end) {
+ bool check) {
size_t offset = 0;
size_t last_offset = 0;
const OptionDefContainerTypeIndex& runtime_idx = runtime_option_defs->get<1>();
// Flexible PAD and END parsing.
- bool flex_pad = (flexible_pad_end && (runtime_idx.count(DHO_PAD) == 0));
- bool flex_end = (flexible_pad_end && (runtime_idx.count(DHO_END) == 0));
+ bool flex_pad = (check && (runtime_idx.count(DHO_PAD) == 0));
+ bool flex_end = (check && (runtime_idx.count(DHO_END) == 0));
// The buffer being read comprises a set of options, each starting with
// a one-byte type code and a one-byte length field.
uint8_t opt_type = buf[offset++];
// DHO_END is a special, one octet long option
- // Valid in dhcp4 space or when flexible_pad_end is true and
+ // Valid in dhcp4 space or when check is true and
// there is a sub-option configured for this code.
if ((opt_type == DHO_END) && (space_is_dhcp4 || flex_end)) {
// just return. Don't need to add DHO_END option
// DHO_PAD is just a padding after DHO_END. Let's continue parsing
// in case we receive a message without DHO_END.
- // Valid in dhcp4 space or when flexible_pad_end is true and
+ // Valid in dhcp4 space or when check is true and
// there is a sub-option configured for this code.
if ((opt_type == DHO_PAD) && (space_is_dhcp4 || flex_pad)) {
continue;
/// @param top indicates if this is the first call to pack the options.
/// When true logic to emit the message type first is executed. It
/// defaults to false.
+ /// @param check indicates if the code should be more flexible with
+ /// PAD and END options. If true, PAD and END options will not be parsed.
+ /// This is useful for partial parsing and slightly broken packets.
static void packOptions4(isc::util::OutputBuffer& buf,
const isc::dhcp::OptionCollection& options,
bool top = false, bool check = true);
///
/// @param options The option container which needs to be updated with split
/// options.
+ /// @param scopedOptions temporary storage for options that are going to be
+ /// split. See @ref ScopedPktOptionsCopy for explanation.
/// @param used The size of the buffer that has already been used by the
/// parent option effectively shrinking the maximum supported length for
/// each options in the container.
/// directly by other classes.
///
/// @param [out] buf output buffer.
+ /// @param check if set to false, allows options larger than 255 for v4
void packHeader(isc::util::OutputBuffer& buf, bool check = true) const;
/// @brief Store sub options in a buffer.
/// derived classes that override pack.
///
/// @param [out] buf output buffer.
+ /// @param check if set to false, allows options larger than 255 for v4
///
/// @todo The set of exceptions thrown by this function depend on
/// exceptions thrown by pack methods invoked on objects
/// Method will throw if option storing fails for some reason.
///
/// @param buf output buffer (option will be stored there)
+ /// @param check if set to false, allows options larger than 255 for v4
virtual void pack(isc::util::OutputBuffer& buf, bool check = true) const;
/// Returns string representation of the option.
/// or full.
DomainNameType getDomainNameType() const;
- /// @brief Writes option in the wire format into a buffer.
+ /// @brief Writes option in the wire format into a buffer.
///
/// @param [out] buf output buffer where option data will be stored.
+ /// @param check if set to false, allows options larger than 255 for v4
virtual void pack(isc::util::OutputBuffer& buf, bool check = true) const;
/// @brief Parses option from the received buffer.
/// @brief Assembles on-wire form of this option
///
/// @param buf pointer to packet buffer
+ /// @param check if set to false, allows options larger than 255 for v4
void pack(isc::util::OutputBuffer& buf, bool check = true) const;
/// @brief Parses received data
/// byte after stored option.
///
/// @param buf buffer (option will be stored here)
+ /// @param check if set to false, allows options larger than 255 for v4
void pack(isc::util::OutputBuffer& buf, bool check = true) const;
/// Writes option in wire-format to buf, for computing hash
} // isc::dhcp namespace
} // isc namespace
-
/// or full.
DomainNameType getDomainNameType() const;
- /// @brief Writes option in the wire format into a buffer.
+ /// @brief Writes option in the wire format into a buffer.
///
/// @param [out] buf output buffer where option data will be stored.
+ /// @param check if set to false, allows options larger than 255 for v4
virtual void pack(isc::util::OutputBuffer& buf, bool check = true) const;
/// @brief Parses option from the received buffer.
/// byte after stored option.
///
/// @param buf buffer (option will be stored here)
+ /// @param check if set to false, allows options larger than 255 for v4
void pack(isc::util::OutputBuffer& buf, bool check = true) const;
/// @brief Parses received buffer
/// byte after stored option.
///
/// @param buf pointer to a buffer
+ /// @param check if set to false, allows options larger than 255 for v4
void pack(isc::util::OutputBuffer& buf, bool check = true) const;
/// @brief Parses received buffer.
/// @throw BadValue if the address is not IPv6
///
/// @param buf pointer to a buffer
+ /// @param check if set to false, allows options larger than 255 for v4
void pack(isc::util::OutputBuffer& buf, bool check = true) const;
/// @brief Parses received buffer.
/// section 4.2 of RFC 6603.
///
/// @param [out] buf Pointer to a buffer.
+ /// @param check if set to false, allows options larger than 255 for v4
virtual void pack(isc::util::OutputBuffer& buf, bool check = true) const;
/// @brief Parses received buffer.
/// byte after stored option.
///
/// @param [out] buf Pointer to the output buffer.
+ /// @param check if set to false, allows options larger than 255 for v4
virtual void pack(isc::util::OutputBuffer& buf, bool check = true) const;
/// @brief Parses received buffer.
/// @brief Returns numeric status code.
uint16_t getStatusCode() const {
- return (status_code_);
+ return (status_code_);
}
/// @brief Returns the name of the status code.
/// byte after stored option.
///
/// @param [out] buf Pointer to the output buffer.
+ /// @param check if set to false, allows options larger than 255 for v4
virtual void pack(isc::util::OutputBuffer& buf, bool check = true) const;
/// @brief Parses received buffer.
/// @brief Returns mandatory flag
bool getMandatoryFlag() const {
- return (mandatory_flag_);
+ return (mandatory_flag_);
}
/// @brief Sets new mandatory flag.
/// @brief Writes DHCP option in a wire format to a buffer.
///
/// @param buf output buffer (option will be stored there).
+ /// @param check if set to false, allows options larger than 255 for v4
virtual void pack(isc::util::OutputBuffer& buf, bool check = true) const;
/// @brief Parses received buffer.
/// byte after stored option.
///
/// @param [out] buf buffer (option will be stored here)
+ /// @param check if set to false, allows options larger than 255 for v4
///
/// @throw isc::dhcp::InvalidDataType if size of a data field type is not
/// equal to 1, 2 or 4 bytes. The data type is not checked in this function
/// byte after stored option.
///
/// @param [out] buf buffer (option will be stored here)
+ /// @param check if set to false, allows options larger than 255 for v4
///
/// @throw isc::dhcp::InvalidDataType if size of a data fields type is not
/// equal to 1, 2 or 4 bytes. The data type is not checked in this function
/// @brief Renders option into the buffer in the wire format.
///
/// @param [out] buf Buffer to which the option is rendered.
+ /// @param check if set to false, allows options larger than 255 for v4
virtual void pack(isc::util::OutputBuffer& buf, bool check = true) const;
/// @brief Parses buffer holding an option.
/// is moved to the end of stored data.
///
/// @param [out] buf output buffer where the option will be stored.
+ /// @param check if set to false, allows options larger than 255 for v4
virtual void pack(isc::util::OutputBuffer& buf, bool check = true) const;
/// @brief Decodes option data from the provided buffer.
/// unused byte after stored option.
///
/// @param [out] buf buffer (option will be stored here)
+ /// @param check if set to false, allows options larger than 255 for v4
virtual void pack(isc::util::OutputBuffer& buf, bool check = true) const;
/// @brief Parses received buffer
/// @brief Renders option into the buffer in the wire format.
///
/// @param [out] buf Buffer to which the option is rendered.
+ /// @param check if set to false, allows options larger than 255 for v4
virtual void pack(isc::util::OutputBuffer& buf, bool check = true) const;
/// @brief Parses buffer holding an option.