Greenbone Vulnerability Management Libraries  22.8.0
uuidutils.h File Reference

UUID creation. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

char * gvm_uuid_make (void)
 Make a new universal identifier. More...
 

Detailed Description

UUID creation.

Definition in file uuidutils.h.

Function Documentation

◆ gvm_uuid_make()

char* gvm_uuid_make ( void  )

Make a new universal identifier.

Returns
A newly allocated string holding the identifier, which the caller must free, or NULL on failure.

Definition at line 30 of file uuidutils.c.

31 {
32  char *id;
33  uuid_t uuid;
34 
35  /* Generate an UUID. */
36  uuid_generate (uuid);
37  if (uuid_is_null (uuid) == 1)
38  {
39  g_warning ("%s: failed to generate UUID", __func__);
40  return NULL;
41  }
42 
43  /* Allocate mem for string to hold UUID. */
44  id = g_malloc0 (sizeof (char) * 37);
45  if (id == NULL)
46  {
47  g_warning ("%s: Cannot export UUID to text: out of memory", __func__);
48  return NULL;
49  }
50 
51  /* Export the UUID to text. */
52  uuid_unparse (uuid, id);
53 
54  return id;
55 }

Referenced by mqtt_set_client_id().

Here is the caller graph for this function: