Implemented UUID generation (RFC4122)

This patch adds new API:
  * xmpp_uuid_gen()
This commit is contained in:
Dmitry Podgorny
2015-10-12 15:17:22 +03:00
parent 5e64c850bd
commit 8627fbb13f
5 changed files with 103 additions and 2 deletions

23
examples/uuid.c Normal file
View File

@@ -0,0 +1,23 @@
#include <stdio.h>
#include <strophe.h>
int main(int argc, char **argv)
{
xmpp_ctx_t *ctx;
char *uuid;
int rc = 0;
ctx = xmpp_ctx_new(NULL, NULL);
uuid = xmpp_uuid_gen(ctx);
if (uuid != NULL) {
printf("%s\n", uuid);
xmpp_free(ctx, uuid);
} else {
fprintf(stderr, "Couldn't allocate memory.\n");
rc = 1;
}
xmpp_ctx_free(ctx);
return rc;
}