nl::Weave::Profiles::SoftwareUpdate::ImageQuery

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

A class to support creation and decoding of image query messages.

Summary

The image query frame has the following form over the wire

Length Field Name
1 byte frame control
6 bytes product specification
variable version specification
2..4 bytes integrity type list
2..5 bytes update scheme list
variable locale specification (optional)
8 bytes target node ID
variable vendor specific data (optional)
where the frame control field has bit-fields as follows:

Bit Meaning
0 1 - vendor-specific data present, 0 - not present
1 1 - locale specification present, 0 - not present
2 1 - target node id present, 0 - not present
3..7 Reserved
The ImageQuery, as a structure reads slightly differently from the in-flight representation. In particular, the version and locale are null-terminated c-strings (as opposed to (length, characters) tuples) and both of the optional items are represented as nullable pointers so there isn't a separate boolean to check.

Constructors and Destructors

ImageQuery()
Default constructor for ImageQuery.

Public attributes

integrityTypes
Integrity types supported by the device.
localeSpec
A variable length UTF-8 string containing the POSIX locale in effect on the device for which the image query is being made.
packageSpec
A variable length UTF-8 string containing a vendor-specific package specification string.
productSpec
Product specification describing the device that is making the image query.
targetNodeId
uint64_t
An optional node id of the device for which the query is being made.
theMetaData
The vendor-specific data field is variable in length and occupies the remainder of the Weave message payload, beyond the fields described above.
updateSchemes
Update schemes (download protocols) supported by the device.
version
A variable length UTF-8 string containing the vendor-specified software version of the device for which the query is being made.

Public functions

init(ProductSpec & aProductSpec, ReferencedString & aVersion, IntegrityTypeList & aTypeList, UpdateSchemeList & aSchemeList, ReferencedString *aPackage, ReferencedString *aLocale, uint64_t aTargetNodeId, ReferencedTLVData *aMetaData)
Explicitly initialize the ImageQuery object with the provided values.
operator==(const ImageQuery &) const
bool
An equality operator.
pack(PacketBuffer *)
Serialize the underlying ImageQuery into the provided PacketBuffer.
print(void)
void

Public static functions

parse(PacketBuffer *, ImageQuery &)
Deserialize the image query message provided in a PacketBuffer into a provided ImageQuery.

Public attributes

integrityTypes

IntegrityTypeList integrityTypes

Integrity types supported by the device.

localeSpec

ReferencedString localeSpec

A variable length UTF-8 string containing the POSIX locale in effect on the device for which the image query is being made.

The contents of the string must conform to the POSIX locale identifier format, as specified in ISO/IEC 15897, e.g. en_AU.UTF-8 for Australian English.

packageSpec

ReferencedString packageSpec

A variable length UTF-8 string containing a vendor-specific package specification string.

The contents of the field describe the desired container type for the software image, such as ‘rpm’, ‘deb’, ‘tgz’, ‘elf’, etc. (NOTE: This field is unused in Nest implementations of the protocol)

productSpec

ProductSpec productSpec

Product specification describing the device that is making the image query.

targetNodeId

uint64_t targetNodeId

An optional node id of the device for which the query is being made.

The target node id field is optional. If absent, the target node id for the query is implicitly the node that was the source of the image query message.

The target node id field is typically used in instances where the node that is the source of the IMAGE QUERY message is serving as a software update proxy for another node.

theMetaData

ReferencedTLVData theMetaData

The vendor-specific data field is variable in length and occupies the remainder of the Weave message payload, beyond the fields described above.

The field encodes vendor-specific information about the device for which the query is being made. The vendor-specific data field is optional. If present, the field has a form of anonymous TLV-encoded structure. The tags presented within this structure shall be fully-qualified profile-specific tags.

updateSchemes

UpdateSchemeList updateSchemes

Update schemes (download protocols) supported by the device.

version

ReferencedString version

A variable length UTF-8 string containing the vendor-specified software version of the device for which the query is being made.

Must be of length 32 or smaller.

Public functions

ImageQuery

 ImageQuery()

Default constructor for ImageQuery.

The ImageQuery may be populated by calling init() or by deserializing the object from a message.

init

WEAVE_ERROR init(
  ProductSpec & aProductSpec,
  ReferencedString & aVersion,
  IntegrityTypeList & aTypeList,
  UpdateSchemeList & aSchemeList,
  ReferencedString *aPackage,
  ReferencedString *aLocale,
  uint64_t aTargetNodeId,
  ReferencedTLVData *aMetaData
)

Explicitly initialize the ImageQuery object with the provided values.

Details
Parameters
[in] aProductSpec
Product specification.
[in] aVersion
Currently installed version of software.
[in] aTypeList
The integrity types supported by the client.
[in] aSchemeList
The update schemes supported by the client.
[in] aPackage
An optional package spec supported by the client.
[in] aLocale
An optional locale spec requested by the client.
[in] aTargetNodeId
An optional target node ID.
[in] aMetaData
An optional TLV-encoded vendor data blob.
Returns
WEAVE_NO_ERROR Unconditionally.

operator==

bool operator==(
  const ImageQuery &
) const 

An equality operator.

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

pack

WEAVE_ERROR pack(
  PacketBuffer *
)

Serialize the underlying ImageQuery into the provided PacketBuffer.

Details
Parameters
[in] aBuffer
A packet buffer into which to pack the query
Return Values
WEAVE_NO_ERROR
On success
WEAVE_ERROR_BUFFER_TOO_SMALL
If the ImageQuery is too large to fit in the provided buffer.

print

void print(
  void
)

Public static functions

parse

WEAVE_ERROR parse(
  PacketBuffer *,
  ImageQuery &
)

Deserialize the image query message provided in a PacketBuffer into a provided ImageQuery.

Details
Parameters
[in] aBuffer
A pointer to a packet from which to parse the image query
[in] aQuery
An object in which to put the result
Returns
WEAVE_NO_ERROR On success
Returns
WEAVE_ERROR_BUFFER_TOO_SMALL If the message was too small to contain all the fields of the ImageQuery
Returns
WEAVE_ERROR_INVALID_LIST_LENGTH If the message contained an IntegrityTypeList or the UpdateSchemeList that was too long