1 | /* socks.h,v 1.3 2004/09/14 22:27:35 bird Exp */
|
---|
2 | /** @file
|
---|
3 | * BSD
|
---|
4 | */
|
---|
5 | /*-----------------------------------------------------------------
|
---|
6 | Copyright (c) 1989 Regents of the University of California.
|
---|
7 | All rights reserved.
|
---|
8 |
|
---|
9 | Redistribution and use in source and binary forms, with or without
|
---|
10 | modification, are permitted provided that the following conditions
|
---|
11 | are met:
|
---|
12 | 1. Redistributions of source code must retain the above copyright
|
---|
13 | notice, this list of conditions and the following disclaimer.
|
---|
14 | 2. Redistributions in binary form must reproduce the above copyright
|
---|
15 | notice, this list of conditions and the following disclaimer in the
|
---|
16 | documentation and/or other materials provided with the distribution.
|
---|
17 | 3. All advertising materials mentioning features or use of this software
|
---|
18 | must display the following acknowledgement:
|
---|
19 | This product includes software developed by the University of
|
---|
20 | California, Berkeley and its contributors.
|
---|
21 | 4. Neither the name of the University nor the names of its contributors
|
---|
22 | may be used to endorse or promote products derived from this software
|
---|
23 | without specific prior written permission.
|
---|
24 |
|
---|
25 | THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
---|
26 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
---|
27 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
---|
28 | ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
---|
29 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
---|
30 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
---|
31 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
---|
32 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
---|
33 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
---|
34 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
---|
35 | SUCH DAMAGE.
|
---|
36 |
|
---|
37 | -----------------------------------------------------------------
|
---|
38 | Portions Copyright (c) 1993, 1994 by NEC Systems Laboratory.
|
---|
39 |
|
---|
40 | Permission to use, copy, modify, and distribute this software for
|
---|
41 | any purpose with or without fee is hereby granted, provided that
|
---|
42 | the above copyright notice and this permission notice appear in all
|
---|
43 | copies, and that the name of NEC Systems Laboratory not be used in
|
---|
44 | advertising or publicity pertaining to distribution of the document
|
---|
45 | or software without specific, written prior permission.
|
---|
46 |
|
---|
47 | THE SOFTWARE IS PROVIDED ``AS IS'' AND NEC SYSTEMS LABORATORY DISCLAIMS
|
---|
48 | ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
|
---|
49 | WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NEC
|
---|
50 | SYSTEMS LABORATORY BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
|
---|
51 | CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
---|
52 | OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
---|
53 | OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
|
---|
54 | OR PERFORMANCE OF THIS SOFTWARE.
|
---|
55 |
|
---|
56 | -----------------------------------------------------------------*/
|
---|
57 | #ifndef _SOCKS_H_
|
---|
58 | #define _SOCKS_H_
|
---|
59 | #include <netinet\in.h>
|
---|
60 |
|
---|
61 | /*
|
---|
62 | * Default port number for SOCKS services.
|
---|
63 | */
|
---|
64 | #define SOCKS_DEF_PORT 1080
|
---|
65 |
|
---|
66 | /* Current SOCKS protocol version */
|
---|
67 | #define SOCKS_VERSION 4
|
---|
68 |
|
---|
69 | /*
|
---|
70 | ** Response commands/codes
|
---|
71 | */
|
---|
72 | #define SOCKS_CONNECT 1
|
---|
73 | #define SOCKS_BIND 2
|
---|
74 | #define SOCKS_RESULT 90
|
---|
75 | #define SOCKS_FAIL 91
|
---|
76 | #define SOCKS_NO_IDENTD 92 /* Failed to connect to Identd on client machine */
|
---|
77 | #define SOCKS_BAD_ID 93 /* Client's Identd reported a different user-id */
|
---|
78 |
|
---|
79 | typedef unsigned long u_int32;
|
---|
80 |
|
---|
81 | typedef struct {
|
---|
82 | u_int32 host; /* in network byte order */
|
---|
83 | unsigned short port; /* in network byte oreder */
|
---|
84 | unsigned char version;
|
---|
85 | unsigned char cmd;
|
---|
86 | } Socks_t;
|
---|
87 |
|
---|
88 |
|
---|
89 | typedef struct socksdata {
|
---|
90 | /* the following feilds are for socks */
|
---|
91 | char * socks_server;
|
---|
92 | char * socks_serverlist;
|
---|
93 | int direct;
|
---|
94 | struct sockaddr_in cursin;
|
---|
95 | int socks_conn_sock;
|
---|
96 | unsigned short socks_port;
|
---|
97 | unsigned short socks_conn_port;
|
---|
98 | unsigned short socks_last_conn_port;
|
---|
99 | unsigned long socks_conn_host;
|
---|
100 | unsigned long socks_last_conn_host;
|
---|
101 | struct sockaddr_in socks_nsin;
|
---|
102 | struct sockaddr_in me;
|
---|
103 | } SD;
|
---|
104 | #endif
|
---|