00001 /********************************************************************\ 00002 * guid.h -- globally unique ID User API * 00003 * Copyright (C) 2000 Dave Peticolas <peticola@cs.ucdavis.edu> * 00004 * * 00005 * This program is free software; you can redistribute it and/or * 00006 * modify it under the terms of the GNU General Public License as * 00007 * published by the Free Software Foundation; either version 2 of * 00008 * the License, or (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License* 00016 * along with this program; if not, contact: * 00017 * * 00018 * Free Software Foundation Voice: +1-617-542-5942 * 00019 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 * 00020 * Boston, MA 02110-1301, USA gnu@gnu.org * 00021 * * 00022 \********************************************************************/ 00023 00024 #ifndef GUID_H 00025 #define GUID_H 00026 00027 #include <stddef.h> 00028 #include <glib-object.h> 00029 00053 #define GUID_DATA_SIZE 16 00054 typedef union _GUID 00055 { 00056 guchar data[GUID_DATA_SIZE]; 00057 00058 gint __align_me; /* this just ensures that GUIDs are 32-bit 00059 * aligned on systems that need them to be. */ 00060 } GUID; 00061 00062 00063 #define GNC_TYPE_GUID (gnc_guid_get_type()) 00064 #define GNC_VALUE_HOLDS_GUID(value) G_VALUE_HOLDS(value, GNC_TYPE_GUID) 00065 00066 GType gnc_guid_get_type (void); 00067 G_CONST_RETURN GUID* gnc_value_get_guid (const GValue *value); 00068 00071 #define GUID_ENCODING_LENGTH 32 00072 00073 00082 void guid_init(void); 00083 00097 void guid_init_with_salt(const void *salt, size_t salt_len); 00098 00113 void guid_init_only_salt(const void *salt, size_t salt_len); 00114 00118 void guid_shutdown (void); 00119 00134 void guid_new(GUID *guid); 00135 00142 GUID guid_new_return(void); 00143 00146 const GUID * guid_null (void); 00147 00149 GUID * guid_malloc (void); 00150 00151 /* Return a guid set to all zero's */ 00152 void guid_free (GUID *guid); 00153 00154 GUID *guid_copy (const GUID *guid); 00155 00171 const gchar * guid_to_string (const GUID * guid); 00172 00186 gchar * guid_to_string_buff (const GUID * guid, gchar *buff); 00187 00188 00194 gboolean string_to_guid(const gchar * string, GUID * guid); 00195 00196 00199 gboolean guid_equal(const GUID *guid_1, const GUID *guid_2); 00200 gint guid_compare(const GUID *g1, const GUID *g2); 00201 00203 guint guid_hash_to_guint(gconstpointer ptr); 00204 00205 GHashTable *guid_hash_table_new(void); 00206 00207 /* @} */ 00208 /* @} */ 00209 #endif
1.5.2