socks5proxy.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * Slitheen - a decoy routing system for censorship resistance
  3. * Copyright (C) 2017 Cecylia Bocovich (cbocovic@uwaterloo.ca)
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, version 3.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. *
  17. * Additional permission under GNU GPL version 3 section 7
  18. *
  19. * If you modify this Program, or any covered work, by linking or combining
  20. * it with the OpenSSL library (or a modified version of that library),
  21. * containing parts covered by the terms of [name of library's license],
  22. * the licensors of this Program grant you additional permission to convey
  23. * the resulting work. {Corresponding Source for a non-source form of such
  24. * a combination shall include the source code for the parts of the OpenSSL
  25. * library used as well as that of the covered work.}
  26. */
  27. #ifndef _SOCKS5PROXY_H_
  28. #define _SOCKS5PROXY_H_
  29. #include <stdint.h>
  30. #define SLITHEEN_ID_LEN 28
  31. #define SLITHEEN_SUPER_SECRET_SIZE 16
  32. #define SLITHEEN_SUPER_CONST "SLITHEEN_SUPER_ENCRYPT"
  33. #define SLITHEEN_SUPER_CONST_SIZE 22
  34. void *demultiplex_data();
  35. void *multiplex_data();
  36. void *ous_IO();
  37. int remove_connection(uint16_t stream_id);
  38. struct __attribute__ ((__packed__)) slitheen_hdr {
  39. uint64_t counter;
  40. uint16_t stream_id;
  41. uint16_t len;
  42. uint16_t garbage;
  43. uint16_t zeros;
  44. };
  45. #define SLITHEEN_HEADER_LEN 16
  46. struct __attribute__ ((__packed__)) slitheen_up_hdr{
  47. uint16_t stream_id;
  48. uint16_t len;
  49. };
  50. #define NEW_STREAM 0
  51. #define NEGOTIATED 1
  52. #define CONNECTED 2
  53. typedef struct connection_st{
  54. uint16_t stream_id;
  55. int32_t socket;
  56. uint8_t state;
  57. struct connection_st *next;
  58. } connection;
  59. typedef struct connection_table_st{
  60. connection *first;
  61. } connection_table;
  62. typedef struct data_block_st {
  63. uint64_t count;
  64. uint8_t *data;
  65. uint16_t len;
  66. int32_t socket;
  67. struct data_block_st *next;
  68. } data_block;
  69. struct socks_method_req {
  70. uint8_t version;
  71. uint8_t num_methods;
  72. };
  73. struct socks_req {
  74. uint8_t version;
  75. uint8_t cmd;
  76. uint8_t rsvd;
  77. uint8_t addr_type;
  78. };
  79. #endif /* _SOCKS5PROXY_H_ */