relay.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #ifndef _RELAY_H_
  2. #define _RELAY_H_
  3. #include "flow.h"
  4. #include <stdint.h>
  5. struct proxy_thread_data {
  6. flow *f;
  7. uint8_t *initial_data;
  8. uint16_t initial_len;
  9. uint8_t stream_id;
  10. int32_t pipefd;
  11. };
  12. typedef struct stream_st {
  13. uint8_t stream_id;
  14. int32_t pipefd;
  15. struct stream_st *next;
  16. } stream;
  17. typedef struct stream_table_st {
  18. stream *first;
  19. } stream_table;
  20. extern stream_table *streams;
  21. struct socks_req {
  22. uint8_t version;
  23. uint8_t cmd;
  24. uint8_t rsvd;
  25. uint8_t addr_type;
  26. };
  27. struct __attribute__((__packed__)) sl_up_hdr {
  28. uint8_t stream_id;
  29. uint16_t len;
  30. };
  31. int replace_packet(flow *f, struct packet_info *info);
  32. int process_downstream(flow *f, int32_t offset, struct packet_info *info);
  33. int read_header(flow *f, struct packet_info *info);
  34. uint32_t get_response_length(uint8_t *response);
  35. int fill_with_downstream(flow *f, uint8_t *data, int32_t length);
  36. uint16_t tcp_checksum(struct packet_info *info);
  37. void *proxy_covert_site(void *data);
  38. #define BEGIN_HEADER 0x10
  39. #define PARSE_HEADER 0x20
  40. #define MID_CONTENT 0x30
  41. #define BEGIN_CHUNK 0x40
  42. #define MID_CHUNK 0x50
  43. #define END_CHUNK 0x60
  44. #define END_BODY 0x70
  45. #define FORFEIT_REST 0x80
  46. #define USE_REST 0x90
  47. #endif /* _RELAY_H_ */