3 * License: LGPL 2.1+ with static linking exception
11 #include <netinet/in.h>
12 #include <sys/socket.h>
14 #define MAX_PROXIES 16
34 RS_E_EXCEED_PROXY_LIMIT
= 2,
38 RS_E_OUT_OF_BUFFER
= 6,
40 RS_E_SOCKS4_NOAUTH
= 8,
41 RS_E_SOCKS5_AUTH_EXCEEDSIZE
= 9,
42 RS_E_SOCKS4_NO_IP6
= 10,
43 RS_E_PROXY_UNEXPECTED_RESPONSE
= 11,
44 RS_E_TARGETPROXY_CONNECT_FAILED
= 12,
45 RS_E_PROXY_AUTH_FAILED
= 13,
46 RS_E_HIT_READTIMEOUT
= 14,
47 RS_E_HIT_WRITETIMEOUT
= 15,
48 RS_E_HIT_CONNECTTIMEOUT
= 16,
49 RS_E_PROXY_GENERAL_FAILURE
= 17,
50 RS_E_TARGETPROXY_NET_UNREACHABLE
= 18,
51 RS_E_TARGETPROXY_HOST_UNREACHABLE
= 19,
52 RS_E_TARGETPROXY_CONN_REFUSED
= 20,
53 RS_E_TARGETPROXY_TTL_EXPIRED
= 21,
54 RS_E_PROXY_COMMAND_NOT_SUPPORTED
= 22,
55 RS_E_PROXY_ADDRESSTYPE_NOT_SUPPORTED
= 23,
61 rs_errorType errortype
;
74 rs_proxyType proxytype
;
83 unsigned long timeout
;
84 rs_proxy proxies
[MAX_PROXIES
];
87 rs_errorInfo lasterror
;
97 void rocksock_init_ssl(void);
98 void rocksock_free_ssl(void);
100 int rocksock_init(rocksock
* sock
);
101 int rocksock_set_timeout(rocksock
* sock
, unsigned long timeout_millisec
);
102 int rocksock_add_proxy(rocksock
* sock
, rs_proxyType proxytype
, char* host
, unsigned short port
, char* username
, char* password
);
103 int rocksock_connect(rocksock
* sock
, char* host
, unsigned short port
, int useSSL
);
104 int rocksock_send(rocksock
* sock
, char* buffer
, size_t bufsize
, size_t chunksize
, size_t* byteswritten
);
105 int rocksock_recv(rocksock
* sock
, char* buffer
, size_t bufsize
, size_t chunksize
, size_t* bytesread
);
106 int rocksock_readline(rocksock
* sock
, char* buffer
, size_t bufsize
, size_t* bytesread
);
107 int rocksock_disconnect(rocksock
* sock
);
108 /* clears/free's/resets all internally used buffers. etc but doesn't free the rocksock itself, since it could be stack-alloced */
109 int rocksock_clear(rocksock
* sock
);
110 /* check if data is available for read. result will contain 1 if available, 0 if not available.
111 return value 0 indicates success, everything else error. result may not be NULL */
112 int rocksock_peek(rocksock
* sock
, int *result
);
114 #ifdef ROCKSOCK_DYNAMIC
115 /* returns a new heap alloced rocksock object which must be passed to rocksock_init later on */
116 rocksock
* rocksock_new(void);
117 /* free *only* the rocksock object. typically you would call rocksock_clear first */
118 void rocksock_free(rocksock
* s
);
127 //RcB: DEP "rocksock.c"
128 //RcB: DEP "rocksock_add_proxy.c"
129 //RcB: DEP "rocksock_variables.c"
130 //RcB: DEP "rocksock_dynamic.c"
131 //RcB: DEP "rocksock_readline.c"
132 //RcB: DEP "rocksock_peek.c"