1e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley/* 2e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu> 3e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson 4e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * 5e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * Redistribution and use in source and binary forms, with or without 6e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * modification, are permitted provided that the following conditions 7e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * are met: 8e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * 1. Redistributions of source code must retain the above copyright 9e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * notice, this list of conditions and the following disclaimer. 10e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * 2. Redistributions in binary form must reproduce the above copyright 11e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * notice, this list of conditions and the following disclaimer in the 12e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * documentation and/or other materials provided with the distribution. 13e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * 3. The name of the author may not be used to endorse or promote products 14e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * derived from this software without specific prior written permission. 15e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * 16e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley */ 27fc74cb45eafe51162b10a850016c6d2e1f8fd23cNarayan Kamath#ifndef EVENT2_KEYVALQ_STRUCT_H_INCLUDED_ 28fc74cb45eafe51162b10a850016c6d2e1f8fd23cNarayan Kamath#define EVENT2_KEYVALQ_STRUCT_H_INCLUDED_ 29e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley 30e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley#ifdef __cplusplus 31e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wileyextern "C" { 32e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley#endif 33e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley 34e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley/* Fix so that people don't have to run with <sys/queue.h> */ 35e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley/* XXXX This code is duplicated with event_struct.h */ 36e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley#ifndef TAILQ_ENTRY 37fc74cb45eafe51162b10a850016c6d2e1f8fd23cNarayan Kamath#define EVENT_DEFINED_TQENTRY_ 38e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley#define TAILQ_ENTRY(type) \ 39e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wileystruct { \ 40e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley struct type *tqe_next; /* next element */ \ 41e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley struct type **tqe_prev; /* address of previous next element */ \ 42e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley} 43e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley#endif /* !TAILQ_ENTRY */ 44e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley 45e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley#ifndef TAILQ_HEAD 46fc74cb45eafe51162b10a850016c6d2e1f8fd23cNarayan Kamath#define EVENT_DEFINED_TQHEAD_ 47e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley#define TAILQ_HEAD(name, type) \ 48e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wileystruct name { \ 49e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley struct type *tqh_first; \ 50e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley struct type **tqh_last; \ 51e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley} 52e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley#endif 53e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley 54e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley/* 55e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * Key-Value pairs. Can be used for HTTP headers but also for 56e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * query argument parsing. 57e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley */ 58e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wileystruct evkeyval { 59e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley TAILQ_ENTRY(evkeyval) next; 60e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley 61e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley char *key; 62e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley char *value; 63e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley}; 64e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley 65e867981d427db5e0b860d67485838e1f9e8c37daChristopher WileyTAILQ_HEAD (evkeyvalq, evkeyval); 66e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley 67e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley/* XXXX This code is duplicated with event_struct.h */ 68fc74cb45eafe51162b10a850016c6d2e1f8fd23cNarayan Kamath#ifdef EVENT_DEFINED_TQENTRY_ 69e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley#undef TAILQ_ENTRY 70e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley#endif 71e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley 72fc74cb45eafe51162b10a850016c6d2e1f8fd23cNarayan Kamath#ifdef EVENT_DEFINED_TQHEAD_ 73e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley#undef TAILQ_HEAD 74e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley#endif 75e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley 76e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley#ifdef __cplusplus 77e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley} 78e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley#endif 79e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley 80e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley#endif 81