#include <sys/types.h>#include <sys/time.h>#include <time.h>Include dependency graph for gw_uuid.h:

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

Go to the source code of this file.
Defines | |
| #define | UUID_STR_LEN 36 |
| #define | UUID_VARIANT_NCS 0 |
| #define | UUID_VARIANT_DCE 1 |
| #define | UUID_VARIANT_MICROSOFT 2 |
| #define | UUID_VARIANT_OTHER 3 |
Typedefs | |
| typedef unsigned char | uuid_t [16] |
Functions | |
| void | uuid_init (void) |
| void | uuid_shutdown (void) |
| void | uuid_clear (uuid_t uu) |
| int | uuid_compare (const uuid_t uu1, const uuid_t uu2) |
| void | uuid_copy (uuid_t dst, const uuid_t src) |
| void | uuid_generate (uuid_t out) |
| void | uuid_generate_random (uuid_t out) |
| void | uuid_generate_time (uuid_t out) |
| int | uuid_is_null (const uuid_t uu) |
| int | uuid_parse (const char *in, uuid_t uu) |
| void | uuid_unparse (const uuid_t uu, char *out) |
| time_t | uuid_time (const uuid_t uu, struct timeval *ret_tv) |
| int | uuid_type (const uuid_t uu) |
| int | uuid_variant (const uuid_t uu) |
|
|
Definition at line 19 of file gw_uuid.h. Referenced by add_msg_cb(), append_uuid(), boxc_sent_pop(), boxc_sent_push(), brunet_send_sms(), clickatell_send_sms(), delayed_http_reply(), get_pattern(), kannel_parse_reply(), kannel_send_sms(), main(), main_connection_loop(), msg_dump(), status_cb(), store_file_status(), store_spool_save(), store_to_dict(), store_uuid(), and urltrans_fill_escape_codes(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 32 of file gw_uuid.h. Referenced by main(), and uuid_generate_random(). |
|
|
Definition at line 105 of file gw_uuid.c. Referenced by main(). 00106 {
00107 memset(uu, 0, 16);
00108 }
|
|
||||||||||||
|
Definition at line 126 of file gw_uuid.c. References uuid::clock_seq, uuid::node, uuid::time_hi_and_version, uuid::time_low, uuid::time_mid, UUCMP, and uuid_unpack(). 00127 {
00128 struct uuid uuid1, uuid2;
00129
00130 uuid_unpack(uu1, &uuid1);
00131 uuid_unpack(uu2, &uuid2);
00132
00133 UUCMP(uuid1.time_low, uuid2.time_low);
00134 UUCMP(uuid1.time_mid, uuid2.time_mid);
00135 UUCMP(uuid1.time_hi_and_version, uuid2.time_hi_and_version);
00136 UUCMP(uuid1.clock_seq, uuid2.clock_seq);
00137 return memcmp(uuid1.node, uuid2.node, 6);
00138 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 150 of file gw_uuid.c. Referenced by boxc_receiver(), deliver_sms_to_queue(), obey_request_thread(), store_file_save_ack(), and store_spool_save_ack(). 00151 {
00152 unsigned char *cp1;
00153 const unsigned char *cp2;
00154 int i;
00155
00156 for (i=0, cp1 = dst, cp2 = src; i < 16; i++)
00157 *cp1++ = *cp2++;
00158 }
|
|
|
Definition at line 392 of file gw_uuid.c. References get_random_fd(), uuid_generate_random(), and uuid_generate_time(). Referenced by check_concatenation(), main(), sms_split(), soap_send_loop(), store_spool_save(), and store_to_dict(). 00393 {
00394 if (get_random_fd() >= 0) {
00395 uuid_generate_random(out);
00396 }
00397 else
00398 uuid_generate_time(out);
00399 }
|
Here is the call graph for this function:

|
|
Definition at line 373 of file gw_uuid.c. References uuid::clock_seq, get_random_bytes(), uuid::time_hi_and_version, uuid_pack(), uuid_t, and uuid_unpack(). Referenced by uuid_generate(). 00374 {
00375 uuid_t buf;
00376 struct uuid uu;
00377
00378 get_random_bytes(buf, sizeof(buf));
00379 uuid_unpack(buf, &uu);
00380
00381 uu.clock_seq = (uu.clock_seq & 0x3FFF) | 0x8000;
00382 uu.time_hi_and_version = (uu.time_hi_and_version & 0x0FFF) | 0x4000;
00383 uuid_pack(&uu, out);
00384 }
|
Here is the call graph for this function:

|
|
Definition at line 346 of file gw_uuid.c. References __u32, uuid::clock_seq, get_clock(), get_node_id(), get_random_bytes(), uuid::node, uuid::time_hi_and_version, uuid::time_low, uuid::time_mid, and uuid_pack(). Referenced by uuid_generate(). 00347 {
00348 static unsigned char node_id[6];
00349 static int has_init = 0;
00350 struct uuid uu;
00351 __u32 clock_mid;
00352
00353 if (!has_init) {
00354 if (get_node_id(node_id) <= 0) {
00355 get_random_bytes(node_id, 6);
00356 /*
00357 * Set multicast bit, to prevent conflicts
00358 * with IEEE 802 addresses obtained from
00359 * network cards
00360 */
00361 node_id[0] |= 0x80;
00362 }
00363 has_init = 1;
00364 }
00365 get_clock(&clock_mid, &uu.time_low, &uu.clock_seq);
00366 uu.clock_seq |= 0x8000;
00367 uu.time_mid = (__u16) clock_mid;
00368 uu.time_hi_and_version = (clock_mid >> 16) | 0x1000;
00369 memcpy(uu.node, node_id, 6);
00370 uuid_pack(&uu, out);
00371 }
|
Here is the call graph for this function:

|
|
Definition at line 86 of file gw_uuid.c. References get_random_fd(). Referenced by gwlib_init(). 00087 {
00088 /*
00089 * open random device if any.
00090 * We should do it here because otherwise it's
00091 * possible that we open device twice.
00092 */
00093 get_random_fd();
00094 }
|
Here is the call graph for this function:

|
|
Definition at line 412 of file gw_uuid.c. Referenced by get_pattern(), soap_send_loop(), store_spool_save(), store_to_dict(), and urltrans_fill_escape_codes(). 00413 {
00414 const unsigned char *cp;
00415 int i;
00416
00417 for (i=0, cp = uu; i < 16; i++)
00418 if (*cp++)
00419 return 0;
00420 return 1;
00421 }
|
|
||||||||||||
|
Definition at line 475 of file gw_uuid.c. References uuid::clock_seq, uuid::node, uuid::time_hi_and_version, uuid::time_low, uuid::time_mid, and uuid_pack(). Referenced by parse_uuid(). 00476 {
00477 struct uuid uuid;
00478 int i;
00479 const char *cp;
00480 char buf[3];
00481
00482 if (strlen(in) != 36)
00483 return -1;
00484 for (i=0, cp = in; i <= 36; i++,cp++) {
00485 if ((i == 8) || (i == 13) || (i == 18) ||
00486 (i == 23)) {
00487 if (*cp == '-')
00488 continue;
00489 else
00490 return -1;
00491 }
00492 if (i== 36)
00493 if (*cp == 0)
00494 continue;
00495 if (!isxdigit(*cp))
00496 return -1;
00497 }
00498 uuid.time_low = strtoul(in, NULL, 16);
00499 uuid.time_mid = strtoul(in+9, NULL, 16);
00500 uuid.time_hi_and_version = strtoul(in+14, NULL, 16);
00501 uuid.clock_seq = strtoul(in+19, NULL, 16);
00502 cp = in+24;
00503 buf[2] = 0;
00504 for (i=0; i < 6; i++) {
00505 buf[0] = *cp++;
00506 buf[1] = *cp++;
00507 uuid.node[i] = strtoul(buf, NULL, 16);
00508 }
00509
00510 uuid_pack(&uuid, uu);
00511 return 0;
00512 }
|
Here is the call graph for this function:

|
|
Definition at line 97 of file gw_uuid.c. References get_random_fd(). Referenced by gwlib_shutdown(). 00098 {
00099 int fd = get_random_fd();
00100
00101 if (fd > 0)
00102 close(fd);
00103 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 586 of file gw_uuid.c. References __u32, uuid::time_hi_and_version, uuid::time_low, uuid::time_mid, and uuid_unpack(). 00587 {
00588 struct uuid uuid;
00589 __u32 high;
00590 struct timeval tv;
00591 unsigned long long clock_reg;
00592
00593 uuid_unpack(uu, &uuid);
00594
00595 high = uuid.time_mid | ((uuid.time_hi_and_version & 0xFFF) << 16);
00596 clock_reg = uuid.time_low | ((unsigned long long) high << 32);
00597
00598 clock_reg -= (((unsigned long long) 0x01B21DD2) << 32) + 0x13814000;
00599 tv.tv_sec = clock_reg / 10000000;
00600 tv.tv_usec = (clock_reg % 10000000) / 10;
00601
00602 if (ret_tv)
00603 *ret_tv = tv;
00604
00605 return tv.tv_sec;
00606 }
|
Here is the call graph for this function:

|
|
Definition at line 608 of file gw_uuid.c. References uuid::time_hi_and_version, and uuid_unpack(). 00609 {
00610 struct uuid uuid;
00611
00612 uuid_unpack(uu, &uuid);
00613 return ((uuid.time_hi_and_version >> 12) & 0xF);
00614 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 561 of file gw_uuid.c. References uuid::clock_seq, uuid::node, uuid::time_hi_and_version, uuid::time_low, uuid::time_mid, and uuid_unpack(). Referenced by add_msg_cb(), append_uuid(), boxc_sent_pop(), boxc_sent_push(), brunet_send_sms(), clickatell_send_sms(), delayed_http_reply(), get_pattern(), kannel_parse_reply(), kannel_send_sms(), main(), main_connection_loop(), status_cb(), store_file_status(), store_spool_save(), store_to_dict(), store_uuid(), and urltrans_fill_escape_codes(). 00562 {
00563 struct uuid uuid;
00564
00565 uuid_unpack(uu, &uuid);
00566 sprintf(out,
00567 "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
00568 uuid.time_low, uuid.time_mid, uuid.time_hi_and_version,
00569 uuid.clock_seq >> 8, uuid.clock_seq & 0xFF,
00570 uuid.node[0], uuid.node[1], uuid.node[2],
00571 uuid.node[3], uuid.node[4], uuid.node[5]);
00572 }
|
Here is the call graph for this function:

|
|
Definition at line 616 of file gw_uuid.c. References uuid::clock_seq, and uuid_unpack(). 00617 {
00618 struct uuid uuid;
00619 int var;
00620
00621 uuid_unpack(uu, &uuid);
00622 var = uuid.clock_seq;
00623
00624 if ((var & 0x8000) == 0)
00625 return UUID_VARIANT_NCS;
00626 if ((var & 0x4000) == 0)
00627 return UUID_VARIANT_DCE;
00628 if ((var & 0x2000) == 0)
00629 return UUID_VARIANT_MICROSOFT;
00630 return UUID_VARIANT_OTHER;
00631 }
|
Here is the call graph for this function:
