byedpi/packets.h

44 lines
1004 B
C
Raw Permalink Normal View History

2023-06-03 19:52:10 +00:00
#include <stdint.h>
#include <stdlib.h>
2024-04-08 20:09:51 +00:00
#include <stdbool.h>
2024-02-18 20:36:51 +00:00
#include <sys/types.h>
2023-06-03 19:52:10 +00:00
#define IS_UNKNOWN 0
#define IS_HTTP 1
#define IS_HTTPS 2
//#define IS_QUIC 4
//#define IS_DNS 8
2023-06-03 19:52:10 +00:00
#define MH_HMIX 1
#define MH_SPACE 2
#define MH_DMIX 4
extern char tls_data[517];
extern char http_data[43];
2024-03-02 16:13:55 +00:00
int change_tls_sni(const char *host, char *buffer, size_t bsize);
2023-06-03 19:52:10 +00:00
2024-04-23 05:47:27 +00:00
bool is_tls_chello(char *buffer, size_t bsize);
2023-06-03 19:52:10 +00:00
int parse_tls(char *buffer, size_t bsize, char **hs);
2024-04-23 05:47:27 +00:00
bool is_http(char *buffer, size_t bsize);
2023-06-03 19:52:10 +00:00
int parse_http(char *buffer, size_t bsize, char **hs, uint16_t *port);
2023-10-10 18:24:46 +00:00
int mod_http(char *buffer, size_t bsize, int m);
2024-02-18 14:19:11 +00:00
2024-04-08 20:09:51 +00:00
int get_http_code(char *b, size_t n);
2024-04-03 19:51:02 +00:00
2024-04-08 20:09:51 +00:00
bool is_http_redirect(char *req, size_t qn, char *resp, size_t sn);
2024-04-03 19:51:02 +00:00
2024-04-08 20:09:51 +00:00
bool neq_tls_sid(char *req, size_t qn, char *resp, size_t sn);
2024-04-03 19:51:02 +00:00
2024-04-08 20:09:51 +00:00
bool is_tls_alert(char *resp, size_t sn);
2024-04-03 19:51:02 +00:00
2024-04-08 20:09:51 +00:00
int part_tls(char *buffer, size_t bsize, ssize_t n, long pos);
2024-04-23 05:47:27 +00:00
//bool is_dns_req(char *buffer, size_t n);
2024-04-23 05:47:27 +00:00
//bool is_quic_inital(char *buffer, size_t bsize);