Changeset View
Changeset View
Standalone View
Standalone View
lib/libfetch/common.h
Show First 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | |||||
/* Structure used for error message lists */ | /* Structure used for error message lists */ | ||||
struct fetcherr { | struct fetcherr { | ||||
const int num; | const int num; | ||||
const int cat; | const int cat; | ||||
const char *string; | const char *string; | ||||
}; | }; | ||||
/* For SOCKS header size */ | |||||
#define HEAD_SIZE 4 | |||||
#define FQDN_SIZE 256 | |||||
#define PACK_SIZE 1 | |||||
#define PORT_SIZE 2 | |||||
#define BUFF_SIZE HEAD_SIZE + FQDN_SIZE + PACK_SIZE + PORT_SIZE | |||||
/* SOCKS5 Request Header */ | |||||
#define SOCKS_VERSION_5 0x05 | |||||
/* SOCKS5 CMD */ | |||||
#define SOCKS_CONNECTION 0x01 | |||||
#define SOCKS_BIND 0x02 | |||||
#define SOCKS_UDP 0x03 | |||||
#define SOCKS_NOMETHODS 0xFF | |||||
#define SOCKS5_NOTIMPLEMENTED 0x00 | |||||
/* SOCKS5 Reserved */ | |||||
#define SOCKS_RSV 0x00 | |||||
/* SOCKS5 Address Type */ | |||||
#define SOCKS_ATYP_IPV4 0x01 | |||||
#define SOCKS_ATYP_DOMAINNAME 0x03 | |||||
#define SOCKS_ATYP_IPV6 0x04 | |||||
/* SOCKS5 Reply Field */ | |||||
#define SOCKS_SUCCESS 0x00 | |||||
#define SOCKS_GENERAL_FAILURE 0x01 | |||||
#define SOCKS_CONNECTION_NOT_ALLOWED 0x02 | |||||
#define SOCKS_NETWORK_UNREACHABLE 0x03 | |||||
#define SOCKS_HOST_UNREACHABLE 0x04 | |||||
#define SOCKS_CONNECTION_REFUSED 0x05 | |||||
#define SOCKS_TTL_EXPIRED 0x06 | |||||
#define SOCKS_COMMAND_NOT_SUPPORTED 0x07 | |||||
#define SOCKS_ADDRESS_NOT_SUPPORTED 0x08 | |||||
/* for fetch_writev */ | /* for fetch_writev */ | ||||
struct iovec; | struct iovec; | ||||
void fetch_seterr(struct fetcherr *, int); | void fetch_seterr(struct fetcherr *, int); | ||||
void fetch_syserr(void); | void fetch_syserr(void); | ||||
void fetch_info(const char *, ...) __printflike(1, 2); | void fetch_info(const char *, ...) __printflike(1, 2); | ||||
int fetch_socks5_getenv(char **host, int *port); | |||||
int fetch_socks5_init(conn_t *conn, const char *host, | |||||
int port, int verbose); | |||||
int fetch_default_port(const char *); | int fetch_default_port(const char *); | ||||
int fetch_default_proxy_port(const char *); | int fetch_default_proxy_port(const char *); | ||||
struct addrinfo *fetch_resolve(const char *, int, int); | struct addrinfo *fetch_resolve(const char *, int, int); | ||||
int fetch_bind(int, int, const char *); | int fetch_bind(int, int, const char *); | ||||
conn_t *fetch_connect(const char *, int, int, int); | conn_t *fetch_connect(const char *, int, int, int); | ||||
conn_t *fetch_reopen(int); | conn_t *fetch_reopen(int); | ||||
conn_t *fetch_ref(conn_t *); | conn_t *fetch_ref(conn_t *); | ||||
#ifdef WITH_SSL | #ifdef WITH_SSL | ||||
▲ Show 20 Lines • Show All 55 Lines • Show Last 20 Lines |