keyvalq_struct.h revision 280849
160107Sobrien/*
22786Ssos * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
32786Ssos * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
42786Ssos *
52786Ssos * Redistribution and use in source and binary forms, with or without
62786Ssos * modification, are permitted provided that the following conditions
732822Syokota * are met:
82786Ssos * 1. Redistributions of source code must retain the above copyright
92786Ssos *    notice, this list of conditions and the following disclaimer.
102786Ssos * 2. Redistributions in binary form must reproduce the above copyright
112786Ssos *    notice, this list of conditions and the following disclaimer in the
122786Ssos *    documentation and/or other materials provided with the distribution.
132786Ssos * 3. The name of the author may not be used to endorse or promote products
142786Ssos *    derived from this software without specific prior written permission.
152786Ssos *
162786Ssos * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
172786Ssos * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1838140Syokota * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
192786Ssos * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
207420Ssos * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
212786Ssos * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
222786Ssos * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
232786Ssos * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2461118Sroberto * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
252786Ssos * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
262786Ssos */
272786Ssos#ifndef EVENT2_KEYVALQ_STRUCT_H_INCLUDED_
282786Ssos#define EVENT2_KEYVALQ_STRUCT_H_INCLUDED_
292786Ssos
302786Ssos#ifdef __cplusplus
312786Ssosextern "C" {
322786Ssos#endif
332786Ssos
342786Ssos/* Fix so that people don't have to run with <sys/queue.h> */
352786Ssos/* XXXX This code is duplicated with event_struct.h */
362786Ssos#ifndef TAILQ_ENTRY
372786Ssos#define EVENT_DEFINED_TQENTRY_
382786Ssos#define TAILQ_ENTRY(type)						\
392786Ssosstruct {								\
402786Ssos	struct type *tqe_next;	/* next element */			\
412786Ssos	struct type **tqe_prev;	/* address of previous next element */	\
422786Ssos}
432786Ssos#endif /* !TAILQ_ENTRY */
442786Ssos
452786Ssos#ifndef TAILQ_HEAD
462786Ssos#define EVENT_DEFINED_TQHEAD_
4744160Syokota#define TAILQ_HEAD(name, type)			\
482786Ssosstruct name {					\
492786Ssos	struct type *tqh_first;			\
502786Ssos	struct type **tqh_last;			\
512786Ssos}
522786Ssos#endif
532786Ssos
542786Ssos/*
552786Ssos * Key-Value pairs.  Can be used for HTTP headers but also for
562786Ssos * query argument parsing.
572786Ssos */
582786Ssosstruct evkeyval {
592786Ssos	TAILQ_ENTRY(evkeyval) next;
602786Ssos
6143334Syokota	char *key;
622786Ssos	char *value;
6332822Syokota};
6462420Sjoe
652786SsosTAILQ_HEAD (evkeyvalq, evkeyval);
662786Ssos
672786Ssos/* XXXX This code is duplicated with event_struct.h */
682786Ssos#ifdef EVENT_DEFINED_TQENTRY_
692786Ssos#undef TAILQ_ENTRY
702786Ssos#endif
712786Ssos
722786Ssos#ifdef EVENT_DEFINED_TQHEAD_
732786Ssos#undef TAILQ_HEAD
742786Ssos#endif
7543334Syokota
7643334Syokota#ifdef __cplusplus
772786Ssos}
782786Ssos#endif
792786Ssos
8043334Syokota#endif
812786Ssos