Changeset 547 for trunk/src/ocat.h


Ignore:
Timestamp:
04/26/10 13:29:15 (2 years ago)
Author:
eagle
Message:
  • configure.ac refined
  • OC now compiles and runs on Solaris 10 using the Universal TUN/TAP driver version 1.1 (http://vtun.sourceforge.net/tun/index.html)
  • ocathosts.[ch] added. It reads IPv6 addresses from /etc/hosts
  • /etc/hosts reverse lookup for I2P .b32 names added
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/ocat.h

    r546 r547  
    1919#define OCAT_H 
    2020 
     21#ifdef HAVE_CONFIG_H 
    2122#include "config.h" 
     23#endif 
    2224 
    2325#include <stdio.h> 
     
    5658#include <sys/wait.h> 
    5759#endif 
     60#ifdef HAVE_SYS_ETHERNET_H 
     61#include <sys/ethernet.h> 
     62#endif 
    5863#ifdef HAVE_NETINET_IN_H 
    5964#include <netinet/in.h> 
     
    102107#ifndef ETHERTYPE_IPV6 
    103108#define ETHERTYPE_IPV6 0x86dd 
     109#endif 
     110 
     111#ifndef ETHER_ADDR_LEN 
     112#ifdef ETHERADDRL 
     113#define ETHER_ADDR_LEN ETHERADDRL 
     114#endif 
     115#endif 
     116 
     117// At least on Solaris the Ethernet addresses are defined as struct containing 
     118// an array of bytes.  This is different from most other OSes which define the 
     119// addresses directly as array. 
     120#ifdef HAVE_ETHER_ADDR_OCTET 
     121#define ether_dst ether_dhost.ether_addr_octet 
     122#define ether_src ether_shost.ether_addr_octet 
     123#else 
     124#define ether_dst ether_dhost 
     125#define ether_src ether_shost 
    104126#endif 
    105127 
     
    226248#define SYSCONFDIR "/etc" 
    227249#endif 
     250 
     251// this macro returns a constains string if a buffer points to NULL. 
     252#define SSTR(x) (x != NULL ? x : "(nil)") 
     253 
     254// Solaris and the Windows OpenVPN tunnel driver do not send a 4 byte tunnel 
     255// header thus we adjust reads and writes. 
     256#if defined(__sun__) || defined(__CYGWIN__) 
     257#define BUF_OFF 4 
     258#else 
     259#define BUF_OFF 0 
     260#endif 
     261 
    228262 
    229263struct OcatSetup 
     
    306340   int pid_fd[2]; 
    307341   int sig_usr1, clear_stats; 
     342   int hosts_lookup; 
    308343}; 
    309344 
     
    468503 
    469504#ifndef WITHOUT_TUN 
    470 #ifdef __FreeBSD__ 
     505#ifdef __sun__ 
     506#define TUN_DEV "/dev/tun" 
     507#elif __linux__ 
     508#define TUN_DEV "/dev/net/tun" 
     509#else 
    471510#define TUN_DEV "/dev/tun0" 
    472 #elif __OpenBSD__ 
    473 #define TUN_DEV "/dev/tun0" 
     511#endif 
     512extern char *tun_dev_; 
    474513#else 
    475 #define TUN_DEV "/dev/net/tun" 
    476 #endif 
    477 extern char *tun_dev_; 
     514#define TUN_DEV "STDIO" 
    478515#endif 
    479516 
     
    614651int win_read_tun(char *, int); 
    615652int win_write_tun(const char *, int); 
    616 #endif 
    617  
    618 #endif 
    619  
     653#define tun_read(x,y,z) win_read_tun(y,z) 
     654#define tun_write(x,y,z) win_write_tun(y,z) 
     655#else 
     656#define tun_read(x,y,z) read(x,y,z) 
     657#define tun_write(x,y,z) write(x,y,z) 
     658#endif 
     659 
     660 
     661#endif 
     662 
Note: See TracChangeset for help on using the changeset viewer.