• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

I_Socks.h

Go to the documentation of this file.
00001 /** @file
00002 
00003   A brief file description
00004 
00005   @section license License
00006 
00007   Licensed to the Apache Software Foundation (ASF) under one
00008   or more contributor license agreements.  See the NOTICE file
00009   distributed with this work for additional information
00010   regarding copyright ownership.  The ASF licenses this file
00011   to you under the Apache License, Version 2.0 (the
00012   "License"); you may not use this file except in compliance
00013   with the License.  You may obtain a copy of the License at
00014 
00015       http://www.apache.org/licenses/LICENSE-2.0
00016 
00017   Unless required by applicable law or agreed to in writing, software
00018   distributed under the License is distributed on an "AS IS" BASIS,
00019   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00020   See the License for the specific language governing permissions and
00021   limitations under the License.
00022  */
00023 
00024 #ifndef __I_SOCKS_H__
00025 #define __I_SOCKS_H__
00026 
00027 /*When this is being compiled with TS, we enable more features the use
00028   non modularized stuff. namely:
00029   ip_ranges and multiple socks server support.
00030 */
00031 #define SOCKS_WITH_TS
00032 
00033 
00034 #define SOCKS_DEFAULT_VERSION 0 //defined the configuration variable
00035 #define SOCKS4_VERSION  4
00036 #define SOCKS5_VERSION 5
00037 #define SOCKS_CONNECT  1
00038 #define SOCKS4_REQ_LEN  9
00039 #define SOCKS4_REP_LEN  8
00040 #define SOCKS5_REP_LEN 262      //maximum possible
00041 #define SOCKS4_REQ_GRANTED 90
00042 #define SOCKS4_CONN_FAILED 91
00043 #define SOCKS5_REQ_GRANTED 0
00044 #define SOCKS5_CONN_FAILED 1
00045 
00046 enum
00047 {
00048   //For these two, we need to pick two values which are not used for any of the
00049   //"commands" (eg: CONNECT, BIND) in SOCKS protocols.
00050   NORMAL_SOCKS = 0,
00051   NO_SOCKS = 48
00052 };
00053 
00054 enum
00055 {
00056   SOCKS_ATYPE_NONE = 0,
00057   SOCKS_ATYPE_IPV4 = 1,
00058   SOCKS_ATYPE_FQHN = 3,
00059   SOCKS_ATYPE_IPV6 = 4
00060 };
00061 
00062 struct SocksAddrType
00063 {
00064   unsigned char type;
00065   union
00066   {
00067     //mostly it is ipv4. in other cases we will xalloc().
00068     unsigned char ipv4[4];
00069     unsigned char *buf;
00070   } addr;
00071 
00072   void reset();
00073     SocksAddrType():type(SOCKS_ATYPE_NONE)
00074   {
00075     addr.buf = 0;
00076   }
00077    ~SocksAddrType()
00078   {
00079     reset();
00080   }
00081 };
00082 
00083 #endif

Generated by  doxygen 1.7.1