5 * Copyright (c) 1998-1999 Jeremie Miller <jer@jabber.org>
6 * Copyright (C) 2013 Ole Reinhardt <ole.reinhardt@embedded-it.de>
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. Neither the name of the copyright holders nor the names of
20 * contributors may be used to endorse or promote products derived
21 * from this software without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
30 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
31 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
33 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * For additional information see http://www.ethernut.de/
40 /* This code is based on
41 * Based on BSD licensed mdnsd implementation by Jer <jer@jabber.org>
42 * http://dotlocal.org/mdnsd/
44 * Unfortunately this site is now longer alive. You can still find it at:
45 * http://web.archive.org/web/20080705131510/http://dotlocal.org/mdnsd/
47 * mdnsd - embeddable Multicast DNS Daemon
48 * =======================================
50 * "mdnsd" is a very lightweight, simple, portable, and easy to integrate
51 * open source implementation of Multicast DNS (part of Zeroconf, also called
52 * Rendezvous by Apple) for developers. It supports both acting as a Query and
53 * a Responder, allowing any software to participate fully on the .localnetwork
54 * just by including a few files and calling a few functions. All of the
55 * complexity of handling the Multicast DNS retransmit timing, duplicate
56 * suppression, probing, conflict detection, and other facets of the DNS
57 * protocol is hidden behind a very simple and very easy to use interface,
58 * described in the header file. The single small c source file has almost no
59 * dependencies, and is portable to almost any embedded platform.
60 * Multiple example applications and usages are included in the download,
61 * including a simple persistent query browser and a tool to advertise .local
64 * The code is licensed under both the GPL and BSD licenses, for use in any
65 * free software or commercial application. If there is a licensing need not
66 * covered by either of those, alternative licensing is available upon request.
71 * \file include/gorp/shash.h
72 * \brief Simple hastable implementation of a string ==> void* hashtable
73 * Minimal and efficient
89 /* Simple hastable implementation of a string ==> void* hashtable */
90 typedef struct string_hash_table_struct *SHASH;
92 /* Hash creation and cleanup functions */
93 SHASH SHashInit(int prime);
94 void SHashFree(SHASH hash);
96 /* Hash manipulation and query functions */
97 void SHashSet(SHASH hash, char *key, void *val);
98 void SHashStore(SHASH hash, const char *key, int key_len, void *val, int value_len);
99 void *SHashGet(SHASH hash, const char *key);
101 /* Routine to iterate over the hash and call a callback for each entry */
102 typedef void (*SHASH_CB)(SHASH hash, const char *key, void *val, void *arg);
103 void SHashForEach(SHASH hash, SHASH_CB cb, void *arg);