2024-08-07 11:25:26 +00:00
|
|
|
#ifndef PACKETS_H
|
|
|
|
#define PACKETS_H
|
|
|
|
|
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
|
|
|
|
2024-07-29 09:26:42 +00:00
|
|
|
#define IS_TCP 1
|
|
|
|
#define IS_UDP 2
|
|
|
|
#define IS_HTTP 4
|
|
|
|
#define IS_HTTPS 8
|
2024-11-09 23:39:21 +00:00
|
|
|
#define IS_IPV4 16
|
|
|
|
//#define IS_QUIC 64
|
|
|
|
//#define IS_DNS 128
|
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-07-29 09:26:42 +00:00
|
|
|
extern char udp_data[64];
|
2023-06-03 19:52:10 +00:00
|
|
|
|
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-11-09 15:07:27 +00:00
|
|
|
bool is_tls_chello(const char *buffer, size_t bsize);
|
2024-04-23 05:47:27 +00:00
|
|
|
|
2024-11-09 15:07:27 +00:00
|
|
|
int parse_tls(const char *buffer, size_t bsize, char **hs);
|
2023-06-03 19:52:10 +00:00
|
|
|
|
2024-11-09 15:07:27 +00:00
|
|
|
bool is_http(const char *buffer, size_t bsize);
|
2024-04-23 05:47:27 +00:00
|
|
|
|
2024-11-09 15:07:27 +00:00
|
|
|
int parse_http(const char *buffer, size_t bsize, char **hs, uint16_t *port);
|
2023-06-03 19:52:10 +00:00
|
|
|
|
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-11-09 15:07:27 +00:00
|
|
|
bool is_http_redirect(const char *req, size_t qn, const char *resp, size_t sn);
|
2024-04-03 19:51:02 +00:00
|
|
|
|
2024-11-09 15:07:27 +00:00
|
|
|
bool neq_tls_sid(const char *req, size_t qn, const char *resp, size_t sn);
|
2024-04-03 19:51:02 +00:00
|
|
|
|
2024-11-09 15:07:27 +00:00
|
|
|
bool is_tls_shello(const char *buffer, size_t bsize);
|
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
|
|
|
|
2024-04-25 22:15:02 +00:00
|
|
|
//bool is_dns_req(char *buffer, size_t n);
|
2024-04-23 05:47:27 +00:00
|
|
|
|
2024-08-04 16:24:32 +00:00
|
|
|
//bool is_quic_initial(char *buffer, size_t bsize);
|
2024-08-07 11:25:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
#endif
|