trunnel.h 2.5 KB

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