nat-auto.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. This file is part of GNUnet.
  3. Copyright (C) 2011, 2016, 2017 GNUnet e.V.
  4. GNUnet is free software: you can redistribute it and/or modify it
  5. under the terms of the GNU Affero General Public License as published
  6. by the Free Software Foundation, either version 3 of the License,
  7. or (at your option) any later version.
  8. GNUnet is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Affero General Public License for more details.
  12. You should have received a copy of the GNU Affero General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. SPDX-License-Identifier: AGPL3.0-or-later
  15. */
  16. /**
  17. * @file src/nat-auto/nat-auto.h
  18. * @brief Messages for interaction with gnunet-nat-auto-service
  19. * @author Christian Grothoff
  20. *
  21. */
  22. #ifndef NAT_AUTO_H
  23. #define NAT_AUTO_H
  24. #include "gnunet_util_lib.h"
  25. GNUNET_NETWORK_STRUCT_BEGIN
  26. /**
  27. * Request to test NAT traversal, sent to the gnunet-nat-server
  28. * (not the service!).
  29. */
  30. struct GNUNET_NAT_AUTO_TestMessage
  31. {
  32. /**
  33. * Header with type #GNUNET_MESSAGE_TYPE_NAT_TEST
  34. */
  35. struct GNUNET_MessageHeader header;
  36. /**
  37. * IPv4 target IP address
  38. */
  39. uint32_t dst_ipv4;
  40. /**
  41. * Port to use, 0 to send dummy ICMP response.
  42. */
  43. uint16_t dport;
  44. /**
  45. * Data to send OR advertised-port (in NBO) to use for dummy ICMP.
  46. */
  47. uint16_t data;
  48. /**
  49. * #GNUNET_YES for TCP, #GNUNET_NO for UDP.
  50. */
  51. int32_t is_tcp;
  52. };
  53. /**
  54. * Client requesting automatic configuration.
  55. */
  56. struct GNUNET_NAT_AUTO_AutoconfigRequestMessage
  57. {
  58. /**
  59. * Header with type #GNUNET_MESSAGE_TYPE_NAT_REQUEST_AUTO_CFG
  60. */
  61. struct GNUNET_MessageHeader header;
  62. /* Followed by configuration (diff, serialized, compressed) */
  63. };
  64. /**
  65. * Service responding with proposed configuration.
  66. */
  67. struct GNUNET_NAT_AUTO_AutoconfigResultMessage
  68. {
  69. /**
  70. * Header with type #GNUNET_MESSAGE_TYPE_NAT_AUTO_CFG_RESULT
  71. */
  72. struct GNUNET_MessageHeader header;
  73. /**
  74. * An `enum GNUNET_NAT_StatusCode` in NBO.
  75. */
  76. int32_t status_code GNUNET_PACKED;
  77. /**
  78. * An `enum GNUNET_NAT_Type` in NBO.
  79. */
  80. int32_t type GNUNET_PACKED;
  81. /* Followed by configuration (diff, serialized, compressed) */
  82. };
  83. GNUNET_NETWORK_STRUCT_END
  84. #endif