00001 /* 00002 * This file is part of the Sofia-SIP package 00003 * 00004 * Copyright (C) 2005 Nokia Corporation. 00005 * 00006 * Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden> 00007 * 00008 * This library is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Lesser General Public License 00010 * as published by the Free Software Foundation; either version 2.1 of 00011 * the License, or (at your option) any later version. 00012 * 00013 * This library is distributed in the hope that it will be useful, but 00014 * WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public 00019 * License along with this library; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 00021 * 02110-1301 USA 00022 * 00023 */ 00024 00025 #ifndef SU_UNIQUEID_H 00026 00027 #define SU_UNIQUEID_H 00028 00029 00041 #ifndef SU_TYPES_H 00042 #include <sofia-sip/su_types.h> 00043 #endif 00044 00045 SOFIA_BEGIN_DECLS 00046 00048 typedef union GloballyUniqueIdentifier { 00049 unsigned char id[16]; 00050 struct { 00051 uint32_t time_low; 00052 uint16_t time_mid; 00053 uint16_t time_high_and_version; 00054 uint8_t clock_seq_hi_and_reserved; 00055 uint8_t clock_seq_low; 00056 uint8_t node[6]; 00057 } s; 00058 } su_guid_t; 00059 00061 SOFIAPUBFUN size_t su_node_identifier(void *address, size_t addrlen); 00062 00072 SOFIAPUBFUN void su_guid_generate(su_guid_t *guid); 00073 00090 SOFIAPUBFUN isize_t su_guid_sprintf(char* buf, size_t len, su_guid_t const *guid); 00091 00092 enum { 00094 su_guid_strlen = 8 + 5 + 5 + 5 + 13 00095 }; 00096 00108 SOFIAPUBFUN int su_randint(int lb, int ub); 00109 00117 SOFIAPUBFUN void *su_randmem(void *mem, size_t siz); 00118 00120 SOFIAPUBFUN uint32_t su_random(void); 00121 00122 SOFIA_END_DECLS 00123 00124 #endif