pips_guid_from_str()

Updated: April 19, 2023

Encode a GUID based on its string representation

Synopsis:

#include <pips/pips.h>
int pips_guid_from_str(pips_guid_t *guid,
                       const char *str,
                       const int str_len)

Arguments:

guid
A pointer to a buffer for storing the encoded GUID
str
The input string to convert into a GUID
str_len
The maximum length of the input string

Library:

pips-client

Description:

This function parses the given string representation of a GUID and encodes it as a 128-bit value. The string can be up to 32 characters long (the space required for a hexadecimal representation of a 128-bit value). If the string is shorter, the GUID's most significant bits are padded with zeros.

Returns:

0
The string was successfully parsed and converted into a GUID
-1
An error prevented the string from being converted into a GUID (errno is set)

Errors:

  • EINVAL: The input string reference is invalid.
  • ENOTTY: The GUID storage buffer reference is invalid.
  • EPROTO: The input string does not contain a valid GUID.