Greenbone Vulnerability Management Libraries 22.32.0
uuidutils.c File Reference

UUID creation. More...

#include "uuidutils.h"
#include <glib.h>
#include <stdlib.h>
#include <uuid/uuid.h>
Include dependency graph for uuidutils.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define G_LOG_DOMAIN   "libgvm util"
 GLib logging domain.

Functions

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

Detailed Description

UUID creation.

Definition in file uuidutils.c.

Macro Definition Documentation

◆ G_LOG_DOMAIN

#define G_LOG_DOMAIN   "libgvm util"

GLib logging domain.

Definition at line 21 of file uuidutils.c.

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 Ensure(), Ensure(), Ensure(), and mqtt_set_client_id().

Here is the caller graph for this function: