Records

Functions

  • otError ParseAsUint8 (const char * aString, uint8_t & aUint8)

    Parses a string as a `uint8_t` value.

    The number in string is parsed as decimal or hex format (if contains `0x` or `0X` prefix).

    Parameters

    aString [in] The string to parse.
    aUint8 [out] A reference to an `uint8_t` variable to output the parsed value.
  • otError ParseAsUint16 (const char * aString, uint16_t & aUint16)

    Parses a string as a `uint16_t` value.

    The number in string is parsed as decimal or hex format (if contains `0x` or `0X` prefix).

    Parameters

    aString [in] The string to parse.
    aUint16 [out] A reference to an `uint16_t` variable to output the parsed value.
  • otError ParseAsUint32 (const char * aString, uint32_t & aUint32)

    Parses a string as a `uint32_t` value.

    The number in string is parsed as decimal or hex format (if contains `0x` or `0X` prefix).

    Parameters

    aString [in] The string to parse.
    aUint32 [out] A reference to an `uint32_t` variable to output the parsed value.
  • otError ParseAsUint64 (const char * aString, uint64_t & aUint64)

    Parses a string as a `uint64_t` value.

    The number in string is parsed as decimal or hex format (if contains `0x` or `0X` prefix).

    Parameters

    aString [in] The string to parse.
    aUint64 [out] A reference to an `uint64_t` variable to output the parsed value.
  • otError ParseAsInt8 (const char * aString, int8_t & aInt8)

    Parses a string as a `int8_t` value.

    The number in string is parsed as decimal or hex format (if contains `0x` or `0X` prefix). The string can start with

    `+`/`-` sign.

    Parameters

    aString [in] The string to parse.
    aInt8 [out] A reference to an `int8_t` variable to output the parsed value.
  • otError ParseAsInt16 (const char * aString, int16_t & aInt16)

    Parses a string as a `int16_t` value.

    The number in string is parsed as decimal or hex format (if contains `0x` or `0X` prefix). The string can start with

    `+`/`-` sign.

    Parameters

    aString [in] The string to parse.
    aInt16 [out] A reference to an `int16_t` variable to output the parsed value.
  • otError ParseAsInt32 (const char * aString, int32_t & aInt32)

    Parses a string as a `int32_t` value.

    The number in string is parsed as decimal or hex format (if contains `0x` or `0X` prefix). The string can start with

    `+`/`-` sign.

    Parameters

    aString [in] The string to parse.
    aInt32 [out] A reference to an `int32_t` variable to output the parsed value.
  • otError ParseAsBool (const char * aString, bool & aBool)

    Parses a string as a `bool` value.

    Zero value is treated as `false`, non-zero value as `true`.

    Parameters

    aString [in] The string to parse.
    aBool [out] A reference to a `bool` variable to output the parsed value.
  • otError ParseAsIp6Address (const char * aString, otIp6Address & aAddress)

    Parses a string as an IPv6 address.

    Parameters

    aString [in] The string to parse.
    aAddress [out] A reference to an `otIp6Address` to output the parsed IPv6 address.
  • otError ParseAsIp4Address (const char * aString, otIp4Address & aAddress)

    Parses a string as an IPv4 address.

    Parameters

    aString [in] The string to parse.
    aAddress [out] A reference to an `otIp6Address` to output the parsed IPv6 address.
  • otError ParseAsIp6Prefix (const char * aString, otIp6Prefix & aPrefix)

    Parses a string as an IPv6 prefix.

    The string is parsed as `{IPv6Address}/{PrefixLength}`.

    Parameters

    aString [in] The string to parse.
    aPrefix [out] A reference to an `otIp6Prefix` to output the parsed IPv6 prefix.
  • otError ParseAsHexString (const char * aString, uint8_t * aBuffer, uint16_t aSize)

    Parses a hex string into a byte array of fixed expected size.

    Returns `kErrorNone` only when the hex string contains exactly

    bytes (after parsing). If

    there are fewer or more bytes in hex string that

    the parsed bytes (up to

    are copied into the

    `aBuffer` and `kErrorInvalidArgs` is returned.

    Correctly handles hex strings with even or odd length. For example, "AABBCCDD" (with even length) is

    parsed as {0xaa, 0xbb, 0xcc, 0xdd} and "123" (with odd length) is parsed as {0x01, 0x23}.

    Parameters

    aString [in] The string to parse.
    aBuffer [out] A pointer to a buffer to output the parsed byte sequence.
    aSize [in] The expected size of byte sequence (number of bytes after parsing).
  • otError ParseAsHexString (const char * aString, uint16_t & aSize, uint8_t * aBuffer)

    Parses a hex string into a byte array.

    Verifies that the parsed hex string bytes fit in

    with its given

    Correctly handles hex strings with even or odd length. For example, "AABBCCDD" (with even length) is

    parsed as {0xaa, 0xbb, 0xcc, 0xdd} and "123" (with odd length) is parsed as {0x01, 0x23}.

    Parameters

    aString [in] The string to parse.
    aSize [in,out] On entry indicates the number of bytes in (max size of On exit provides number of bytes parsed and copied into
    aBuffer [out] A pointer to a buffer to output the parsed byte sequence.
  • otError ParseAsHexStringSegment (const char *& aString, uint16_t & aSize, uint8_t * aBuffer)

    Parses a segment of a hex string up to a given size.

    Allows a longer hex string to be parsed and read in smaller segments into a given buffer. If the

    entire hex string bytes can fit in the given

    with its

    they are copied into

    and

    function returns `kErrorNone`. Otherwise,

    bytes are read and copied and function returns `kErrorPending`

    to indicate that there are more bytes to parse. The

    is also updated to skip over the parsed segment.

    Correctly handles hex strings with even or odd length. For example, "AABBCCDD" (with even length) is

    parsed as {0xaa, 0xbb, 0xcc, 0xdd} and "123" (with odd length) is parsed as {0x01, 0x23}.

    Parameters

    aString [in,out] A reference to string to parse. On successful parse, updated to skip parsed digits.
    aSize [in,out] On entry indicates the segment size (number of bytes in On exit provides number of bytes parsed and copied into
    aBuffer [out] A pointer to a buffer to output the parsed byte sequence.
  • otError ParseCmd (char * aCommandString, Arg[] aArgs, uint8_t aArgsMaxLength)

    Parses a given command line string and breaks it into an argument list.

    May change the input

    it will put a '

    \

    0' by the end of each argument, and

    will point to the arguments in the input

    Backslash ('

    \

    ') can be used to escape separators

    (' ', '

    ', '

    ', '

    ') and the backslash itself.

    As the arguments are parsed, the

    array entries are populated. Any remaining

    entries in the array

    will be cleared and marked as empty. So the number of arguments can be determined by going through

    array

    entries till we get to an empty `Arg` (i.e., `Arg::IsEmpty()` returns `true).

    Ensures that the last entry in

    array is always used to indicate the end (always marked as

    empty), so the

    array should have one more entry than the desired max number of arguments.

    Parameters

    aCommandString [in] A null-terminated input string.
    aArgs [out] The argument array.
    aArgsMaxLength [in] The max length of array.
  • template <uint8_t kLength>
    otError ParseCmd (char * aCommandStringArg (&)[kLength] aArgs)

    Defined at line 610 of file ../../third_party/openthread/src/core/utils/parse_cmdline.hpp