socks5proxy.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. int proxy_data(int sockfd, uint16_t stream_id, int32_t pipefd, int32_t ous_in);
  35. void *demultiplex_data();
  36. struct __attribute__ ((__packed__)) slitheen_hdr {
  37. uint64_t counter;
  38. uint16_t stream_id;
  39. uint16_t len;
  40. uint16_t garbage;
  41. uint16_t zeros;
  42. };
  43. #define SLITHEEN_HEADER_LEN 16
  44. struct __attribute__ ((__packed__)) slitheen_up_hdr{
  45. uint16_t stream_id;
  46. uint16_t len;
  47. };
  48. typedef struct connection_st{
  49. int32_t pipe_fd;
  50. uint16_t stream_id;
  51. struct connection_st *next;
  52. } connection;
  53. typedef struct connection_table_st{
  54. connection *first;
  55. } connection_table;
  56. typedef struct data_block_st {
  57. uint64_t count;
  58. uint8_t *data;
  59. uint16_t len;
  60. int32_t pipe_fd;
  61. struct data_block_st *next;
  62. } data_block;
  63. struct socks_method_req {
  64. uint8_t version;
  65. uint8_t num_methods;
  66. };
  67. struct socks_req {
  68. uint8_t version;
  69. uint8_t cmd;
  70. uint8_t rsvd;
  71. uint8_t addr_type;
  72. };
  73. #endif /* _SOCKS5PROXY_H_ */