Ignore:
Timestamp:
11/12/09 15:44:48 (3 years ago)
Author:
eagle
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/i2prep/src/ocat.h

    r514 r518  
    112112#define TOR_PREFIX4_MASK 0xff000000 
    113113#endif 
     114//! hidden service TLD 
     115#define ONION_TLD "onion" 
    114116//! Length of an .onion-URL (without ".onion" and '\0') 
    115117#define ONION_URL_LEN 16 
     
    118120//! Total length of .onion-URL (equal to ONION_NAME_SIZE) 
    119121#define ONION_NAME_LEN ONION_NAME_SIZE 
     122//! hidden service TLD 
     123#define I2P_TLD "oc.b32.i2p" 
     124//! Length of an .onion-URL (without ".onion" and '\0') 
     125#define I2P_URL_LEN 16 
     126//! Total length of .onion-URL 
     127#define I2P_NAME_SIZE (I2P_URL_LEN + 11) 
     128 
    120129 
    121130#define MAXPEERS 1024 
     
    128137//! SOCKS port of TOR proxy 
    129138#define TOR_SOCKS_PORT 9050 
     139#define I2P_SOCKS_PORT 9051 
    130140#ifdef __OpenBSD__ 
    131141#define OCAT_UNAME "_tor" 
     
    235245#define VERSION_STRING_LEN 256 
    236246 
    237 typedef enum PeerType {PT_TOR, PT_I2P} PeerType_t; 
     247typedef enum peer{PT_TOR, PT_I2P} peer_t; 
     248#define PT_TOR_B (1 << (PT_TOR - 1)) 
     249#define PT_I2P_B (1 << (PT_I2P - 1)) 
     250 
     251typedef struct NetConn 
     252{ 
     253   peer_t type; 
     254   int socksfd[2]; 
     255   //! destination socket address of Tor's SOCKS port 
     256   union 
     257   { 
     258      struct sockaddr_in *socks_dst; 
     259      struct sockaddr_in6 *socks_dst6; 
     260   }; 
     261   //! local listening socket address for incoming connections 
     262   struct sockaddr **listen; 
     263   int *listen_fd; 
     264   int listen_cnt; 
     265   //! virtual port of OnionCat hidden service 
     266   uint16_t dest_port; 
     267   //! file descriptors of TUN device (usually tunfd[0] == tunfd[1]) 
     268   int tunfd[2]; 
     269   char host_id[ONION_NAME_SIZE]; 
     270   struct in6_addr addr; 
     271   //! name of tunnel charcter device 
     272   char *tun_dev; 
     273   //! tunnel interface name 
     274   char tunname[SIZE_256]; 
     275   //! local OnionCat MAC address 
     276   uint8_t hwaddr[ETHER_ADDR_LEN]; 
     277} NetConn_t; 
    238278 
    239279struct OcatSetup 
     
    243283   uint32_t fhd_key[2]; 
    244284   int fhd_key_len; 
    245    //! TCP port of SOCKS port of local Tor proxy 
    246    //uint16_t tor_socks_port; 
    247    //! reload port of OnionCat listening for connections 
    248    //uint16_t ocat_listen_port; 
    249    //! virtual port of OnionCat hidden service 
    250    uint16_t ocat_dest_port; 
    251285   //! local port of controller interface 
    252286   uint16_t ocat_ctrl_port; 
    253    //! file descriptors of TUN device (usually tunfd[0] == tunfd[1]) 
    254    int tunfd[2]; 
    255287   int debug_level; 
    256288   //! user name to change uid to 
    257289   char *usrname; 
    258    char onion_url[ONION_NAME_SIZE]; 
    259    struct in6_addr ocat_addr; 
    260290   //! flag to create connection log 
    261291   int create_clog; 
     
    264294   int controller; 
    265295   char *ocat_dir; 
    266    //! name of tunnel charcter device 
    267    char *tun_dev; 
    268    //! tunnel interface name 
    269    char tunname[SIZE_256]; 
    270296   int ipv4_enable; 
    271297   struct in_addr ocat_addr4; 
     
    274300   int config_read; 
    275301   int use_tap; 
    276    //! local OnionCat MAC address 
    277    uint8_t ocat_hwaddr[ETHER_ADDR_LEN]; 
    278302   char *pid_file; 
    279303   int create_pid_file; 
     
    287311   time_t uptime; 
    288312   char *frandn; 
    289    //! destination socket address of Tor's SOCKS port 
    290    union 
    291    { 
    292       struct sockaddr_in *socks_dst; 
    293       struct sockaddr_in6 *socks_dst6; 
    294    }; 
    295    //! local listening socket address for incoming connections 
    296    struct sockaddr **oc_listen; 
    297    int *oc_listen_fd; 
    298    int oc_listen_cnt; 
    299313   int rand_addr; 
    300314   char version[VERSION_STRING_LEN]; 
     
    306320   int *ctrl_listen_fd; 
    307321   int ctrl_listen_cnt; 
    308    //! communication pipe for socks "selected" connector 
    309    int socksfd[2]; 
     322   int conn_enabled; 
     323   NetConn_t conn[2]; 
    310324}; 
    311325 
     
    359373   unsigned inm; 
    360374   unsigned outm; 
    361    PeerType_t type; 
     375   peer_t type; 
    362376} OcatPeer_t; 
    363377 
Note: See TracChangeset for help on using the changeset viewer.