1
1
iperf3/src/uuid.c

43 строки
816 B
C
Исходник Обычный вид История

#include "config.h"
2009-07-23 18:22:24 +00:00
#include <stdio.h>
#include <stdlib.h>
#include<string.h>
#if defined(HAVE_UUID_H)
#warning DOING SOMETHING
2009-07-23 18:22:24 +00:00
#include <uuid.h>
#elif defined(HAVE_UUID_UUID_H)
2009-07-23 18:22:24 +00:00
#include <uuid/uuid.h>
#else
#error No uuid header file specified
2009-07-23 18:22:24 +00:00
#endif
2009-10-24 20:43:06 +00:00
/* XXX: this code is not portable: not all versions of linux install libuuidgen
by default
* if not installed, may need to do something like this:
* yum install libuuid-devel
* apt-get install apt-get install
*/
void
get_uuid(char *temp)
2009-07-23 18:22:24 +00:00
{
char *s;
uuid_t uu;
2009-07-23 18:22:24 +00:00
#if defined(HAVE_UUID_CREATE)
2009-07-23 18:22:24 +00:00
uuid_create(&uu, NULL);
uuid_to_string(&uu, &s, 0);
#elif defined(HAVE_UUID_GENERATE)
2009-11-06 01:43:50 +00:00
s = (char *) malloc(37);
2009-07-23 18:22:24 +00:00
uuid_generate(uu);
uuid_unparse(uu, s);
#else
#error No uuid function specified
2009-07-23 18:22:24 +00:00
#endif
memcpy(temp, s, 37);
2009-07-23 18:22:24 +00:00
}