Kannel: Open Source WAP and SMS gateway  $Revision: 5037 $
test_uuid.c File Reference
#include <string.h>
#include <unistd.h>
#include <signal.h>
#include "gwlib/gwlib.h"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 69 of file test_uuid.c.

References debug(), gwlib_init(), gwlib_shutdown(), octstr_create, octstr_destroy(), octstr_get_cstr, octstr_imm(), octstr_replace(), uuid_clear(), uuid_generate(), UUID_STR_LEN, and uuid_unparse().

70 {
71  Octstr *os;
72  char id[UUID_STR_LEN + 1];
73  uuid_t uid;
74 
75  gwlib_init();
76 
77  debug("uuid",0,"Creating UUID");
78  uuid_generate(uid);
79  debug("uuid",0,"Parse into char");
80  uuid_unparse(uid, id);
81  debug("uuid",0,"Create Octstr");
82  os = octstr_create(id);
83  debug("uuid",0,"UUID is: %s", octstr_get_cstr(os));
84  debug("uuid",0,"Removing dashes");
85  octstr_replace(os, octstr_imm("-"), octstr_imm(""));
86  debug("uuid",0,"UUID is: %s", octstr_get_cstr(os));
87 
88  octstr_destroy(os);
89  uuid_clear(uid);
90 
92  return 0;
93 }
void octstr_replace(Octstr *haystack, Octstr *needle, Octstr *repl)
Definition: octstr.c:2647
void uuid_unparse(const uuid_t uu, char *out)
Definition: gw_uuid.c:561
void uuid_generate(uuid_t out)
Definition: gw_uuid.c:392
#define octstr_get_cstr(ostr)
Definition: octstr.h:233
Octstr * octstr_imm(const char *cstr)
Definition: octstr.c:281
void octstr_destroy(Octstr *ostr)
Definition: octstr.c:322
#define octstr_create(cstr)
Definition: octstr.h:125
#define UUID_STR_LEN
Definition: gw_uuid.h:19
Definition: octstr.c:118
void debug(const char *place, int err, const char *fmt,...)
Definition: log.c:690
void gwlib_shutdown(void)
Definition: gwlib.c:94
unsigned char uuid_t[16]
Definition: gw_uuid.h:32
void gwlib_init(void)
Definition: gwlib.c:78
void uuid_clear(uuid_t uu)
Definition: gw_uuid.c:105
See file LICENSE for details about the license agreement for using, modifying, copying or deriving work from this software.