nl::Weave::Profiles::SoftwareUpdate::IntegritySpec

#include <src/lib/profiles/software-update/SoftwareUpdateProfile.h>

An auxiliary class holding the integrity type and the actual hash of the software update image.

Summary

The object holds the IntegrityTypes field specifying the type of the hash, and the actual hash of the software update image. The length of the hash is fixed based on the type of the hash. The object is sized to hold the largest of the supported hashes.

Constructors and Destructors

IntegritySpec()
The default constructor for IntegritySpec.

Public attributes

type
uint8_t
Type of the hash, value to be drawn from IntegrityTypes.
value[64]
uint8_t
A variable length sequence of bytes containing the integrity value for the software image identified by the URI field.

Public functions

init(uint8_t, uint8_t *)
Explicitly initialize the IntegritySpec object with provided values.
operator==(const IntegritySpec &) const
bool
An equality operator.
pack(MessageIterator &)
Serialize the IntegritySpec into provided MessageIterator.

Public static functions

parse(MessageIterator &, IntegritySpec &)
Deserialize the object from the provided MessageIterator into provided IntegritySpec.

Public attributes

type

uint8_t type

Type of the hash, value to be drawn from IntegrityTypes.

value

uint8_t value[64]

A variable length sequence of bytes containing the integrity value for the software image identified by the URI field.

The integrity value is computed by applying the integrity function specified by the integrity type to the contents of the software update image accessed at the URI specified above.  The integrity specification allows the client to confirm that the image downloaded matches the image specified in this response.

Public functions

IntegritySpec

 IntegritySpec()

The default constructor for IntegritySpec.

The object must be initialized either via the init() method or via deserializing it from a message.

init

WEAVE_ERROR init(
  uint8_t,
  uint8_t *
)

Explicitly initialize the IntegritySpec object with provided values.

Details
Parameters
[in] aType
An integrity type value drawn from IntegrityTypes
[in] aValue
A hash value of the appropriate length represented as a packed string of bytes
Returns
WEAVE_NO_ERROR On success
Returns
WEAVE_ERROR_INVALID_INTEGRITY_TYPE If the provided integrity type is not one of the values specified in IntegrityTypes

operator==

bool operator==(
  const IntegritySpec &
) const 

An equality operator.

Details
Parameters
another
An IntegritySpec to check against this IntegritySpec
Returns
true if all the fields in both objects are equal, false otherwise

pack

WEAVE_ERROR pack(
  MessageIterator &
)

Serialize the IntegritySpec into provided MessageIterator.

Details
Parameters
[in] i
An iterator over the message being packed
Return Values
WEAVE_NO_ERROR
On success.
WEAVE_ERROR_BUFFER_TOO_SMALL
If the IntegritySpec is too large to fit in the message.

Public static functions

parse

WEAVE_ERROR parse(
  MessageIterator &,
  IntegritySpec &
)

Deserialize the object from the provided MessageIterator into provided IntegritySpec.

Details
Parameters
[in] i
An iterator over the message being parsed.
[in] aSpec
A reference to an object to contain the result
Return Values
WEAVE_NO_ERROR
On success.
Return Values
WEAVE_ERROR_BUFFER_TOO_SMALL
If the message did not contain enough bytes for the integrity type and the associated hash
Returns
WEAVE_ERROR_INVALID_INTEGRITY_TYPE If the provided integrity type is not one of the values specified in IntegrityTypes