nexmon – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 /* $Id$ */
2 /* Copyright Gerhard Rieger 2004-2007 */
3 /* Published under the GNU General Public License V.2, see file COPYING */
4  
5 #ifndef __xio_socks5_h_included
6 #define __xio_socks5_h_included 1
7  
8 #define SOCKS5_VERSION 5
9  
10 #define SOCKS5_METHOD_NOAUTH 0x00
11 #define SOCKS5_METHOD_GSSAPI 0x01
12 #define SOCKS5_METHOD_USERPASS 0x02
13 #define SOCKS5_METHOD_AVENTAIL 0x86 /*!*/
14 #define SOCKS5_METHOD_NONE 0xff
15  
16 #define SOCKS5_COMMAND_CONNECT 0x01
17 #define SOCKS5_COMMAND_BIND 0x02
18 #define SOCKS5_COMMAND_UDPASSOC 0x03
19  
20 #define SOCKS5_ADDRTYPE_IPV4 0x01
21 #define SOCKS5_ADDRTYPE_NAME 0x03
22 #define SOCKS5_ADDRTYPE_IPV6 0x04
23  
24 #define SOCKS5_REPLY_SUCCESS 0x00
25 #define SOCKS5_REPLY_FAILURE 0x01
26 #define SOCKS5_REPLY_DENIED 0x02
27 #define SOCKS5_REPLY_NETUNREACH 0x03
28 #define SOCKS5_REPLY_HOSTUNREACH 0x04
29 #define SOCKS5_REPLY_REFUSED 0x05
30 #define SOCKS5_REPLY_TTLEXPIRED 0x06
31 #define SOCKS5_REPLY_CMDUNSUPP 0x07
32 #define SOCKS5_REPLY_ADDRUNSUPP 0x08
33  
34 #define SOCKS5_USERPASS_VERSION 0x01
35  
36 /* just the first byte of server replies */
37 struct socks5_version {
38 uint8_t version;
39 } ;
40  
41 /* the version/method selection message of the client */
42 struct socks5_method {
43 uint8_t version;
44 uint8_t nmethods;
45 uint8_t methods[1]; /* has variable length, see nmethods */
46 } ;
47  
48 /* the selection message of the server */
49 struct socks5_select {
50 uint8_t version;
51 uint8_t method;
52 } ;
53 #define SOCKS5_SELECT_LENGTH sizeof(struct socks5_select)
54  
55 /* the request message */
56 struct socks5_request {
57 uint8_t version;
58 uint8_t command;
59 uint8_t reserved;
60 uint8_t addrtype;
61 uint8_t destaddr[1]; /* has variable length */
62 /*uint16_t destport;*/ /* position depends on length of destaddr */
63 } ;
64  
65 /* the request message */
66 struct socks5_reply {
67 uint8_t version;
68 uint8_t reply;
69 uint8_t reserved;
70 uint8_t addrtype;
71 uint8_t destaddr[1]; /* has variable length */
72 /*uint16_t destport;*/ /* position depends on length of destaddr */
73 } ;
74 #define SOCKS5_REPLY_LENGTH1 4 /*!*/ /* the fixed size fields */
75  
76 /* the username/password authentication reply */
77 struct socks5_userpass_reply {
78 uint8_t version; /* authentication version, not socks version */
79 uint8_t status;
80 } ;
81  
82 #if 0
83 extern const struct optdesc opt_socksport;
84 extern const struct optdesc opt_socksuser;
85 #endif
86 extern const struct optdesc opt_socks5_username;
87 extern const struct optdesc opt_socks5_password;
88  
89 extern const union xioaddr_desc *xioaddrs_socks5_client[];
90  
91 extern int
92 _xioopen_socks5_connect0(struct single *xfd,
93 const char *targetname, const char *targetservice,
94 int level);
95 extern int _xioopen_socks5_connect(struct single *xfd,
96 const char *targetname,
97 const char *targetservice,
98 struct opt *opts,
99 int level);
100 extern int xio_socks5_dialog(int level, struct single *xfd,
101 unsigned char *sendbuff, size_t sendlen,
102 unsigned char *recvbuff, size_t recvlen,
103 const char *descr);
104 extern int xio_socks5_username_password(int level, struct opt *opts,
105 struct single *xfd);
106  
107 #endif /* !defined(__xio_socks5_h_included) */