Google is committed to advancing racial equity for Black communities. See how.

nl::Weave::HostPortList

#include <src/lib/core/HostPortList.h>

For managing and manipulating a Host Port List, a compact, binary-encoded collection of host and port identifier tuples associated with the Weave Service Directory.

Summary

Constructors and Destructors

HostPortList(void)
Class default (void) constructor.
HostPortList(const uint8_t *hostPortList, uint8_t hostPortCount, const uint8_t *suffixList, const uint8_t suffixCount)

Public functions

Clear(void)
void
Reset the list to empty.
Get(uint8_t index, char *hostBuf, uint32_t hostBufSize, uint16_t & port) const
Get the host name and port at the specified index from the list.
IsEmpty(void) const
bool
Pop(char *hostBuf, uint32_t hostBufSize, uint16_t & port)
Get and remove the first host name and port from the list.

Public functions

Clear

void Clear(
  void
)

Reset the list to empty.

Get

WEAVE_ERROR Get(
  uint8_t index,
  char *hostBuf,
  uint32_t hostBufSize,
  uint16_t & port
) const 

Get the host name and port at the specified index from the list.

Details
Parameters
[in] index
The position in the list to return the host name and port.
[in,out] hostBuf
A pointer to storage into which to copy the host name.
[in] hostBufSize
The amount of storage available in hostBuf.
[out] port
The port number.
Return Values
WEAVE_ERROR_INVALID_ARGUMENT
The requested index exceeds the size of the list.
WEAVE_ERROR_UNSUPPORTED_HOST_PORT_ELEMENT
The Host Port element requested was an unsupported type.
WEAVE_ERROR_BUFFER_TOO_SMALL
The Host Port host name length is longer than the provided buffer.
WEAVE_NO_ERROR
On success.

HostPortList

 HostPortList(
  void
)

Class default (void) constructor.

HostPortList

 HostPortList(
  const uint8_t *hostPortList,
  uint8_t hostPortCount,
  const uint8_t *suffixList,
  const uint8_t suffixCount
)

IsEmpty

bool IsEmpty(
  void
) const 

Pop

WEAVE_ERROR Pop(
  char *hostBuf,
  uint32_t hostBufSize,
  uint16_t & port
)

Get and remove the first host name and port from the list.

Details
Parameters
[in,out] hostBuf
A pointer to storage into which to copy the host name.
[in] hostBufSize
The amount of storage available in hostBuf.
[out] port
The port number.
Return Values
WEAVE_ERROR_HOST_PORT_LIST_EMPTY
There are no entries in the list.
WEAVE_ERROR_UNSUPPORTED_HOST_PORT_ELEMENT
The Host Port element encountered was an unsupported type.
WEAVE_ERROR_BUFFER_TOO_SMALL
The Host Port host name length is longer than the provided buffer.
WEAVE_NO_ERROR
On success.