Tor 0.4.9.0-alpha-dev
trunnel.h
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. */
30typedef TRUNNEL_DYNARRAY_HEAD(trunnel_string_st, char) trunnel_string_t;
31
32#endif
33
34/*
35Copyright 2014 The Tor Project, Inc.
36
37Redistribution and use in source and binary forms, with or without
38modification, are permitted provided that the following conditions are
39met:
40
41 * Redistributions of source code must retain the above copyright
42notice, this list of conditions and the following disclaimer.
43
44 * Redistributions in binary form must reproduce the above
45copyright notice, this list of conditions and the following disclaimer
46in the documentation and/or other materials provided with the
47distribution.
48
49 * Neither the names of the copyright owners nor the names of its
50contributors may be used to endorse or promote products derived from
51this software without specific prior written permission.
52
53THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
54"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
55LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
56A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
57OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
58SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
59LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
60DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
61THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
62(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
63OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
64*/