forked from shadowsocks/simple-obfs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathobfs.h
58 lines (50 loc) · 1.62 KB
/
obfs.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
* obfs.h - Interfaces of obfuscating function
*
* Copyright (C) 2013 - 2016, Max Lv <[email protected]>
*
* This file is part of the simple-obfs.
*
* simple-obfs is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* simple-obfs is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with simple-obfs; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*/
#ifndef OBFS_H
#define OBFS_H
#include <stdbool.h>
#include "encrypt.h"
#define OBFS_OK 0
#define OBFS_NEED_MORE -1
#define OBFS_ERROR -2
typedef struct obfs {
int obfs_stage;
int deobfs_stage;
buffer_t *buf;
void *extra;
} obfs_t;
typedef struct obfs_para {
const char *name;
const char *host;
const char *uri;
const char *method;
uint16_t port;
bool send_empty_response_upon_connection;
int(*const obfs_request)(buffer_t *, size_t, obfs_t *);
int(*const obfs_response)(buffer_t *, size_t, obfs_t *);
int(*const deobfs_request)(buffer_t *, size_t, obfs_t *);
int(*const deobfs_response)(buffer_t *, size_t, obfs_t *);
int(*const check_obfs)(buffer_t *);
void(*const disable)(obfs_t *);
int(*const is_enable)(obfs_t *);
} obfs_para_t;
#endif