6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * MobileIPv6 support added by Tomislav Borosa <tomislav.borosa@siemens.hr>
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 #include "guid-utils.h"
38 guid_equal (gconstpointer k1, gconstpointer k2)
40 const guid_key *key1 = (const guid_key *)k1;
41 const guid_key *key2 = (const guid_key *)k2;
42 return ((memcmp (&key1->guid, &key2->guid, sizeof (e_guid_t)) == 0));
46 guid_hash (gconstpointer k)
48 const guid_key *key = (const guid_key *)k;
49 /* This isn't perfect, but the Data1 part of these is almost always
51 return key->guid.data1;
55 GHashTable *guids_new(void)
57 return g_hash_table_new (guid_hash, guid_equal);
60 void guids_add_guid(GHashTable *guids, e_guid_t *guid, gchar *name, void *private_data)
62 guid_key *key = g_malloc (sizeof (*key));
63 guid_value *value = g_malloc (sizeof (*value));
69 g_hash_table_insert (guids, key, value);
73 /* try to get registered name for this guid */
74 const gchar *guids_get_guid_name(GHashTable *guids, e_guid_t *guid)
80 /* try to get registered guid "name" of if_id */
83 if ((value = g_hash_table_lookup (guids, &key)) != NULL) {