2024-08-07 14:25:26 +03:00
|
|
|
#ifndef PACKETS_H
|
|
|
|
#define PACKETS_H
|
|
|
|
|
2023-06-03 22:52:10 +03:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdlib.h>
|
2024-04-08 23:09:51 +03:00
|
|
|
#include <stdbool.h>
|
2024-02-18 23:36:51 +03:00
|
|
|
#include <sys/types.h>
|
2023-06-03 22:52:10 +03:00
|
|
|
|
2024-07-29 12:26:42 +03:00
|
|
|
#define IS_TCP 1
|
|
|
|
#define IS_UDP 2
|
|
|
|
#define IS_HTTP 4
|
|
|
|
#define IS_HTTPS 8
|
2024-11-10 02:39:21 +03:00
|
|
|
#define IS_IPV4 16
|
|
|
|
//#define IS_QUIC 64
|
|
|
|
//#define IS_DNS 128
|
2023-06-03 22:52:10 +03: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 12:26:42 +03:00
|
|
|
extern char udp_data[64];
|
2023-06-03 22:52:10 +03:00
|
|
|
|
2024-03-02 19:13:55 +03:00
|
|
|
int change_tls_sni(const char *host, char *buffer, size_t bsize);
|
2023-06-03 22:52:10 +03:00
|
|
|
|
2024-11-09 18:07:27 +03:00
|
|
|
bool is_tls_chello(const char *buffer, size_t bsize);
|
2024-04-23 08:47:27 +03:00
|
|
|
|
2024-11-09 18:07:27 +03:00
|
|
|
int parse_tls(const char *buffer, size_t bsize, char **hs);
|
2023-06-03 22:52:10 +03:00
|
|
|
|
2024-11-09 18:07:27 +03:00
|
|
|
bool is_http(const char *buffer, size_t bsize);
|
2024-04-23 08:47:27 +03:00
|
|
|
|
2024-11-09 18:07:27 +03:00
|
|
|
int parse_http(const char *buffer, size_t bsize, char **hs, uint16_t *port);
|
2023-06-03 22:52:10 +03:00
|
|
|
|
2023-10-10 21:24:46 +03:00
|
|
|
int mod_http(char *buffer, size_t bsize, int m);
|
2024-02-18 17:19:11 +03:00
|
|
|
|
2024-11-09 18:07:27 +03:00
|
|
|
bool is_http_redirect(const char *req, size_t qn, const char *resp, size_t sn);
|
2024-04-03 22:51:02 +03:00
|
|
|
|
2024-11-09 18:07:27 +03:00
|
|
|
bool neq_tls_sid(const char *req, size_t qn, const char *resp, size_t sn);
|
2024-04-03 22:51:02 +03:00
|
|
|
|
2024-11-09 18:07:27 +03:00
|
|
|
bool is_tls_shello(const char *buffer, size_t bsize);
|
2024-04-03 22:51:02 +03:00
|
|
|
|
2024-04-08 23:09:51 +03:00
|
|
|
int part_tls(char *buffer, size_t bsize, ssize_t n, long pos);
|
2024-04-23 08:47:27 +03:00
|
|
|
|
2024-04-26 01:15:02 +03:00
|
|
|
//bool is_dns_req(char *buffer, size_t n);
|
2024-04-23 08:47:27 +03:00
|
|
|
|
2024-08-04 19:24:32 +03:00
|
|
|
//bool is_quic_initial(char *buffer, size_t bsize);
|
2024-08-07 14:25:26 +03:00
|
|
|
|
|
|
|
|
|
|
|
#endif
|