]>
Commit | Line | Data |
---|---|---|
b1ab9ed8 | 1 | /* |
d8f41ccd | 2 | * Copyright (c) 2000-2001,2004,2011,2014 Apple Inc. All Rights Reserved. |
b1ab9ed8 A |
3 | * |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
6 | * This file contains Original Code and/or Modifications of Original Code | |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. Please obtain a copy of the License at | |
10 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
11 | * file. | |
12 | * | |
13 | * The Original Code and all software distributed under the License are | |
14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
18 | * Please see the License for the specific language governing rights and | |
19 | * limitations under the License. | |
20 | * | |
21 | * @APPLE_LICENSE_HEADER_END@ | |
22 | */ | |
23 | ||
24 | ||
25 | // | |
26 | // socks++int - internal header for Socks implementation | |
27 | // | |
28 | #ifndef _H_SOCKSPLUSPLUSINT | |
29 | #define _H_SOCKSPLUSPLUSINT | |
30 | ||
31 | #include "socks++.h" | |
32 | ||
33 | ||
34 | namespace Security { | |
35 | namespace IPPlusPlus { | |
36 | namespace Socks4 { | |
37 | ||
38 | ||
39 | typedef unsigned char Byte; | |
40 | ||
41 | ||
42 | enum Command { | |
43 | socksConnect = 1, | |
44 | socksBind = 2 | |
45 | }; | |
46 | ||
47 | enum Reply { | |
48 | requestAccepted = 90, | |
49 | requestFailed = 91, | |
50 | requestIdentFailed = 92, | |
51 | requestIdentRejected = 93 | |
52 | }; | |
53 | ||
54 | ||
55 | class Server : public SocksServer { | |
56 | public: | |
57 | Server(const IPSockAddress &s) : SocksServer(4, s) { } | |
58 | ||
59 | virtual void connect(SocksClientSocket &me, const IPSockAddress &peer); | |
60 | virtual void connect(SocksClientSocket &me, const Host &host, IPPort port); | |
61 | virtual void bind(SocksServerSocket &me, const IPAddress &peer, IPPort port); | |
62 | virtual void receive(SocksServerSocket &me, SocksClientSocket &receiver); | |
63 | }; | |
64 | ||
65 | ||
66 | struct Message { | |
67 | Byte version; | |
68 | Byte message; | |
69 | IPPort port; | |
70 | IPAddress addr; | |
71 | ||
72 | Message(Command cmd, const IPSockAddress &addr); | |
73 | void send(Socket &s, const char *userid); | |
74 | ||
75 | Message(Socket &s); | |
76 | ||
77 | IPSockAddress address() const { return IPSockAddress(addr, port); } | |
78 | }; | |
79 | ||
80 | ||
81 | ||
82 | } // end namespace Socks | |
83 | } // end namespace IPPlusPlus | |
84 | } // end namespace Security | |
85 | ||
86 | #endif //_H_SOCKSPLUSPLUSINT |