openvpn-msg.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /*
  2. * OpenVPN -- An application to securely tunnel IP networks
  3. * over a single TCP/UDP port, with support for SSL/TLS-based
  4. * session authentication and key exchange,
  5. * packet encryption, packet authentication, and
  6. * packet compression.
  7. *
  8. * Copyright (C) 2013-2018 Heiko Hund <heiko.hund@sophos.com>
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2
  12. * as published by the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License along
  20. * with this program; if not, write to the Free Software Foundation, Inc.,
  21. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  22. */
  23. #ifndef OPENVPN_MSG_H_
  24. #define OPENVPN_MSG_H_
  25. typedef enum {
  26. msg_acknowledgement,
  27. msg_add_address,
  28. msg_del_address,
  29. msg_add_route,
  30. msg_del_route,
  31. msg_add_dns_cfg,
  32. msg_del_dns_cfg,
  33. msg_add_nbt_cfg,
  34. msg_del_nbt_cfg,
  35. msg_flush_neighbors,
  36. msg_add_block_dns,
  37. msg_del_block_dns,
  38. msg_register_dns,
  39. msg_enable_dhcp,
  40. } message_type_t;
  41. typedef struct {
  42. message_type_t type;
  43. size_t size;
  44. int message_id;
  45. } message_header_t;
  46. typedef union {
  47. struct in_addr ipv4;
  48. struct in6_addr ipv6;
  49. } inet_address_t;
  50. typedef struct {
  51. int index;
  52. char name[256];
  53. } interface_t;
  54. typedef struct {
  55. message_header_t header;
  56. short family;
  57. inet_address_t address;
  58. int prefix_len;
  59. interface_t iface;
  60. } address_message_t;
  61. typedef struct {
  62. message_header_t header;
  63. short family;
  64. inet_address_t prefix;
  65. int prefix_len;
  66. inet_address_t gateway;
  67. interface_t iface;
  68. int metric;
  69. } route_message_t;
  70. typedef struct {
  71. message_header_t header;
  72. interface_t iface;
  73. char domains[512];
  74. short family;
  75. int addr_len;
  76. inet_address_t addr[4]; /* support up to 4 dns addresses */
  77. } dns_cfg_message_t;
  78. typedef struct {
  79. message_header_t header;
  80. interface_t iface;
  81. int disable_nbt;
  82. int nbt_type;
  83. char scope_id[256];
  84. struct in_addr primary_nbns;
  85. struct in_addr secondary_nbns;
  86. } nbt_cfg_message_t;
  87. /* TODO: NTP */
  88. typedef struct {
  89. message_header_t header;
  90. short family;
  91. interface_t iface;
  92. } flush_neighbors_message_t;
  93. typedef struct {
  94. message_header_t header;
  95. int error_number;
  96. } ack_message_t;
  97. typedef struct {
  98. message_header_t header;
  99. interface_t iface;
  100. } block_dns_message_t;
  101. typedef struct {
  102. message_header_t header;
  103. interface_t iface;
  104. } enable_dhcp_message_t;
  105. #endif /* ifndef OPENVPN_MSG_H_ */