2017-09-15 03:34:29 -05:00
|
|
|
/*
|
|
|
|
* packet.h
|
|
|
|
*
|
|
|
|
* Created on: Sep 15, 2017
|
|
|
|
* Author: root
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PACKET_H_
|
|
|
|
#define PACKET_H_
|
|
|
|
|
|
|
|
#include "common.h"
|
2017-09-25 10:38:39 -05:00
|
|
|
#include "fd_manager.h"
|
2017-09-15 03:34:29 -05:00
|
|
|
|
|
|
|
extern int iv_min;
|
2023-02-07 05:34:06 -05:00
|
|
|
extern int iv_max; //< 256;
|
2017-09-15 03:34:29 -05:00
|
|
|
|
|
|
|
extern u64_t packet_send_count;
|
|
|
|
extern u64_t dup_packet_send_count;
|
|
|
|
extern u64_t packet_recv_count;
|
|
|
|
extern u64_t dup_packet_recv_count;
|
|
|
|
extern char key_string[1000];
|
|
|
|
extern int disable_replay_filter;
|
2017-09-15 22:45:13 -05:00
|
|
|
extern int random_drop;
|
2017-10-17 05:20:30 -05:00
|
|
|
extern int disable_obscure;
|
|
|
|
extern int disable_xor;
|
2017-09-15 03:34:29 -05:00
|
|
|
|
2023-02-07 05:34:06 -05:00
|
|
|
int my_send(const dest_t &dest, char *data, int len);
|
|
|
|
|
|
|
|
void encrypt_0(char *input, int &len, char *key);
|
|
|
|
void decrypt_0(char *input, int &len, char *key);
|
|
|
|
int add_seq(char *data, int &data_len);
|
|
|
|
int remove_seq(char *data, int &data_len);
|
|
|
|
int do_obscure(const char *input, int in_len, char *output, int &out_len);
|
|
|
|
int de_obscure(const char *input, int in_len, char *output, int &out_len);
|
|
|
|
|
|
|
|
// int sendto_fd_u64 (int fd,u64_t u64,char * buf, int len,int flags);
|
|
|
|
int sendto_ip_port(u32_t ip, int port, char *buf, int len, int flags);
|
|
|
|
int send_fd(int fd, char *buf, int len, int flags);
|
|
|
|
|
|
|
|
int put_conv(u32_t conv, const char *input, int len_in, char *&output, int &len_out);
|
|
|
|
int get_conv(u32_t &conv, const char *input, int len_in, char *&output, int &len_out);
|
|
|
|
int put_crc32(char *s, int &len);
|
|
|
|
int rm_crc32(char *s, int &len);
|
|
|
|
int do_cook(char *data, int &len);
|
|
|
|
int de_cook(char *s, int &len);
|
2017-09-15 03:34:29 -05:00
|
|
|
#endif /* PACKET_H_ */
|