flow.h 952 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef __RELAY_H__
  2. #define __RELAY_H__
  3. #include <netinet/in.h>
  4. #include "ptwist.h"
  5. #define MAX_FLOWS 10
  6. #define TLS_CLNT_HELLO 0x01
  7. #define TLS_SERV_HELLO 0x02
  8. #define TLS_KEY_EXCHG 0x04
  9. #define TLS_NEW_SESS 0x08
  10. #define TLS_FINISHED 0x10
  11. typedef struct tcp_state_st {
  12. int sequence_number;
  13. } TCP_state;
  14. typedef struct flow_st {
  15. struct in_addr src_ip, dst_ip; /* Source and Destination addresses */
  16. u_short src_port, dst_port; /* Source and Destination ports */
  17. u_int seq_num; /* sequence number */
  18. byte key[16]; /* negotiated key */
  19. int tls_state; /* TLS handshake state */
  20. int encrypted; /* indicates whether flow is encrypted */
  21. } flow;
  22. typedef struct flow_table_st {
  23. flow *table;
  24. int len;
  25. int max_len;
  26. } flow_table;
  27. int init_flow_table (void);
  28. int add_flow(flow newFlow);
  29. int update_flow(int index, int code);
  30. int remove_flow(int index);
  31. int check_flow(flow observed);
  32. flow *get_flow(int index);
  33. #endif /* __RELAY_H__ */