trunnel.h (2581B)
1 /* trunnel.h -- copied from Trunnel v1.5.3 2 * https://gitweb.torproject.org/trunnel.git 3 * You probably shouldn't edit this file. 4 */ 5 /* trunnel.h -- Public declarations for trunnel, to be included 6 * in trunnel header files. 7 8 * Copyright 2014-2019, The Tor Project, Inc. 9 * See license at the end of this file for copying information. 10 */ 11 12 #ifndef TRUNNEL_H_INCLUDED_ 13 #define TRUNNEL_H_INCLUDED_ 14 15 #include <sys/types.h> 16 17 /** Macro to declare a variable-length dynamically allocated array. Trunnel 18 * uses these to store all variable-length arrays. */ 19 #define TRUNNEL_DYNARRAY_HEAD(name, elttype) \ 20 struct name { \ 21 size_t n_; \ 22 size_t allocated_; \ 23 elttype *elts_; \ 24 } 25 26 /** Initializer for a dynamic array of a given element type. */ 27 #define TRUNNEL_DYNARRAY_INIT(elttype) { 0, 0, (elttype*)NULL } 28 29 /** Typedef used for storing variable-length arrays of char. */ 30 typedef TRUNNEL_DYNARRAY_HEAD(trunnel_string_st, char) trunnel_string_t; 31 32 #endif 33 34 /* 35 Copyright 2014 The Tor Project, Inc. 36 37 Redistribution and use in source and binary forms, with or without 38 modification, are permitted provided that the following conditions are 39 met: 40 41 * Redistributions of source code must retain the above copyright 42 notice, this list of conditions and the following disclaimer. 43 44 * Redistributions in binary form must reproduce the above 45 copyright notice, this list of conditions and the following disclaimer 46 in the documentation and/or other materials provided with the 47 distribution. 48 49 * Neither the names of the copyright owners nor the names of its 50 contributors may be used to endorse or promote products derived from 51 this software without specific prior written permission. 52 53 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 54 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 55 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 56 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 57 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 58 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 59 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 60 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 61 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 62 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 63 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 64 */