/* system dependent call to get IEEE node ID. This sample implementation generates a random node ID. */ void get_ieee_node_identifier(uuid_node_t *node) { static inited = 0; static uuid_node_t saved_node; char seed[16]; FILE *fp; if (!inited) { fp = fopen("nodeid", "rb"); if (fp) { fread(&saved_node, sizeof(saved_node), 1, fp); fclose(fp); } else { get_random_info(seed); seed[0] |= 0x01; memcpy(&saved_node, seed, sizeof(saved_node)); fp = fopen("nodeid", "wb"); if (fp) { fwrite(&saved_node, sizeof(saved_node), 1, fp); fclose(fp); } } inited = 1; } *node = saved_node; }
/* system dependent call to get IEEE node ID. This sample implementation generates a random node ID */ void get_ieee_node_identifier(uuid_node_t *node) { char seed[16]; FILE * fd; static inited = 0; static uuid_node_t saved_node; if (!inited) { fd = fopen("nodeid", "rb"); if (fd) { fread(&saved_node, sizeof(uuid_node_t), 1, fd); fclose(fd); } else { get_random_info(seed); seed[0] |= 0x80; memcpy(&saved_node, seed, sizeof(uuid_node_t)); fd = fopen("nodeid", "wb"); if (fd) { fwrite(&saved_node, sizeof(uuid_node_t), 1, fd); fclose(fd); }; }; inited = 1; }; *node = saved_node; };
/* This sample implementation generates a random node ID * * in lieu of a system dependent call to get IEEE node ID. */ static void get_pseudo_node_identifier(uuid_node_t *node) { unsigned char seed[16]; get_random_info(seed); seed[0] |= 0x80; memcpy(node, seed, sizeof(uuid_node_t)); }
boost::uint64_t true_random() { boost::uint64_t result; adobe::md5_t::digest_t seed(get_random_info()); std::memcpy(&result, &seed[0], sizeof(result)); return result; }
/*! * \brief System dependent call to get IEEE node ID. * * This sample implementation generates a random node ID. */ void get_ieee_node_identifier(uuid_node_t *node) { unsigned char seed[16]; static int inited = 0; static uuid_node_t saved_node; if (!inited) { get_random_info(seed); seed[0] |= 0x80; memcpy(&saved_node, seed, sizeof(uuid_node_t)); inited = 1; }; *node = saved_node; };