require '_h2ph_pre.ph';

require 'linux/version.ph';
unless(defined(&KERNEL_VERSION)) {
    eval 'sub KERNEL_VERSION {
        local($a,$b,$c) = @_;
	    eval q(((($a) << 16) + (($b) << 8) + ($c)));
    }' unless defined(&KERNEL_VERSION);
}
if((defined(&LINUX_VERSION_CODE) ? &LINUX_VERSION_CODE : 0) >=  &KERNEL_VERSION(2,3,0)) {
    eval 'sub LINUX_2_4 () {1;}' unless defined(&LINUX_2_4);
    eval 'sub netdevice_t () {\'struct net_device\';}' unless defined(&netdevice_t);
    require 'linux/spinlock.ph';
}
 elsif((defined(&LINUX_VERSION_CODE) ? &LINUX_VERSION_CODE : 0) >=  &KERNEL_VERSION(2,1,0)) {
    eval 'sub LINUX_2_1 () {1;}' unless defined(&LINUX_2_1);
    eval 'sub netdevice_t () {\'struct device\';}' unless defined(&netdevice_t);
    require 'asm/spinlock.ph';
} else {
    eval 'sub LINUX_2_0 () {1;}' unless defined(&LINUX_2_0);
    eval 'sub netdevice_t () {\'struct device\';}' unless defined(&netdevice_t);
    eval 'sub spinlock_t () {\'int\';}' unless defined(&spinlock_t);
}
unless(defined(&_ROUTER_H)) {
    eval 'sub _ROUTER_H () {1;}' unless defined(&_ROUTER_H);
    eval 'sub ROUTER_NAME () {"wanrouter";}' unless defined(&ROUTER_NAME);
    eval 'sub ROUTER_VERSION () {1;}' unless defined(&ROUTER_VERSION);
    eval 'sub ROUTER_RELEASE () {1;}' unless defined(&ROUTER_RELEASE);
    eval 'sub ROUTER_IOCTL () {ord(\'W\');}' unless defined(&ROUTER_IOCTL);
    eval 'sub ROUTER_MAGIC () {0x524d4157;}' unless defined(&ROUTER_MAGIC);
    eval("sub ROUTER_SETUP () { ROUTER_IOCTL<<8; }") unless defined(&ROUTER_SETUP);
    eval("sub ROUTER_DOWN () { 1; }") unless defined(&ROUTER_DOWN);
    eval("sub ROUTER_STAT () { 2; }") unless defined(&ROUTER_STAT);
    eval("sub ROUTER_IFNEW () { 3; }") unless defined(&ROUTER_IFNEW);
    eval("sub ROUTER_IFDEL () { 4; }") unless defined(&ROUTER_IFDEL);
    eval("sub ROUTER_IFSTAT () { 5; }") unless defined(&ROUTER_IFSTAT);
    eval("sub ROUTER_USER () { (ROUTER_IOCTL<<8)+16; }") unless defined(&ROUTER_USER);
    eval("sub ROUTER_USER_MAX () { (ROUTER_IOCTL<<8)+31; }") unless defined(&ROUTER_USER_MAX);
    eval 'sub PROC_DATA_PORT_0 () {0x8000;}' unless defined(&PROC_DATA_PORT_0);
    eval 'sub PROC_DATA_PORT_1 () {0x8001;}' unless defined(&PROC_DATA_PORT_1);
    eval 'sub NLPID_IP () {0xcc;}' unless defined(&NLPID_IP);
    eval 'sub NLPID_SNAP () {0x80;}' unless defined(&NLPID_SNAP);
    eval 'sub NLPID_CLNP () {0x81;}' unless defined(&NLPID_CLNP);
    eval 'sub NLPID_ESIS () {0x82;}' unless defined(&NLPID_ESIS);
    eval 'sub NLPID_ISIS () {0x83;}' unless defined(&NLPID_ISIS);
    eval 'sub NLPID_Q933 () {0x8;}' unless defined(&NLPID_Q933);
    eval 'sub WAN_IFNAME_SZ () {15;}' unless defined(&WAN_IFNAME_SZ);
    eval 'sub WAN_DRVNAME_SZ () {15;}' unless defined(&WAN_DRVNAME_SZ);
    eval 'sub WAN_ADDRESS_SZ () {31;}' unless defined(&WAN_ADDRESS_SZ);
    eval 'sub USED_BY_FIELD () {8;}' unless defined(&USED_BY_FIELD);
    eval 'sub UDP_PTPIPE_TYPE () {0x1;}' unless defined(&UDP_PTPIPE_TYPE);
    eval 'sub UDP_FPIPE_TYPE () {0x2;}' unless defined(&UDP_FPIPE_TYPE);
    eval 'sub UDP_CPIPE_TYPE () {0x3;}' unless defined(&UDP_CPIPE_TYPE);
    eval 'sub UDP_DRVSTATS_TYPE () {0x4;}' unless defined(&UDP_DRVSTATS_TYPE);
    eval 'sub UDP_INVALID_TYPE () {0x5;}' unless defined(&UDP_INVALID_TYPE);
    eval 'sub CMD_OK () {0;}' unless defined(&CMD_OK);
    eval 'sub CMD_TIMEOUT () {0xff;}' unless defined(&CMD_TIMEOUT);
    eval 'sub UDP_PKT_FRM_STACK () {0x;}' unless defined(&UDP_PKT_FRM_STACK);
    eval 'sub UDP_PKT_FRM_NETWORK () {0x1;}' unless defined(&UDP_PKT_FRM_NETWORK);
    eval 'sub MAX_INTR_TEST_COUNTER () {100;}' unless defined(&MAX_INTR_TEST_COUNTER);
    eval 'sub CRITICAL_IN_ISR () {0xa1;}' unless defined(&CRITICAL_IN_ISR);
    eval 'sub CRITICAL_INTR_HANDLED () {0xb1;}' unless defined(&CRITICAL_INTR_HANDLED);
    eval 'sub WANCONFIG_X25 () {101;}' unless defined(&WANCONFIG_X25);
    eval 'sub WANCONFIG_FR () {102;}' unless defined(&WANCONFIG_FR);
    eval 'sub WANCONFIG_PPP () {103;}' unless defined(&WANCONFIG_PPP);
    eval 'sub WANCONFIG_CHDLC () {104;}' unless defined(&WANCONFIG_CHDLC);
    eval 'sub WANCONFIG_BSC () {105;}' unless defined(&WANCONFIG_BSC);
    eval 'sub WANCONFIG_HDLC () {106;}' unless defined(&WANCONFIG_HDLC);
    eval 'sub WANCONFIG_MPPP () {107;}' unless defined(&WANCONFIG_MPPP);
    eval 'sub WANOPT_OFF () {0;}' unless defined(&WANOPT_OFF);
    eval 'sub WANOPT_ON () {1;}' unless defined(&WANOPT_ON);
    eval 'sub WANOPT_NO () {0;}' unless defined(&WANOPT_NO);
    eval 'sub WANOPT_YES () {1;}' unless defined(&WANOPT_YES);
    eval 'sub WANOPT_RS232 () {0;}' unless defined(&WANOPT_RS232);
    eval 'sub WANOPT_V35 () {1;}' unless defined(&WANOPT_V35);
    eval 'sub WANOPT_NRZ () {0;}' unless defined(&WANOPT_NRZ);
    eval 'sub WANOPT_NRZI () {1;}' unless defined(&WANOPT_NRZI);
    eval 'sub WANOPT_FM0 () {2;}' unless defined(&WANOPT_FM0);
    eval 'sub WANOPT_FM1 () {3;}' unless defined(&WANOPT_FM1);
    eval 'sub WANOPT_POINTTOPOINT () {0;}' unless defined(&WANOPT_POINTTOPOINT);
    eval 'sub WANOPT_MULTIDROP () {1;}' unless defined(&WANOPT_MULTIDROP);
    eval 'sub WANOPT_EXTERNAL () {0;}' unless defined(&WANOPT_EXTERNAL);
    eval 'sub WANOPT_INTERNAL () {1;}' unless defined(&WANOPT_INTERNAL);
    eval 'sub WANOPT_DTE () {0;}' unless defined(&WANOPT_DTE);
    eval 'sub WANOPT_DCE () {1;}' unless defined(&WANOPT_DCE);
    eval 'sub WANOPT_CPE () {0;}' unless defined(&WANOPT_CPE);
    eval 'sub WANOPT_NODE () {1;}' unless defined(&WANOPT_NODE);
    eval 'sub WANOPT_SECONDARY () {0;}' unless defined(&WANOPT_SECONDARY);
    eval 'sub WANOPT_PRIMARY () {1;}' unless defined(&WANOPT_PRIMARY);
    eval 'sub WANOPT_PERMANENT () {0;}' unless defined(&WANOPT_PERMANENT);
    eval 'sub WANOPT_SWITCHED () {1;}' unless defined(&WANOPT_SWITCHED);
    eval 'sub WANOPT_ONDEMAND () {2;}' unless defined(&WANOPT_ONDEMAND);
    eval 'sub WANOPT_FR_ANSI () {1;}' unless defined(&WANOPT_FR_ANSI);
    eval 'sub WANOPT_FR_Q933 () {2;}' unless defined(&WANOPT_FR_Q933);
    eval 'sub WANOPT_FR_LMI () {3;}' unless defined(&WANOPT_FR_LMI);
    eval 'sub WANOPT_PPP_STATIC () {0;}' unless defined(&WANOPT_PPP_STATIC);
    eval 'sub WANOPT_PPP_HOST () {1;}' unless defined(&WANOPT_PPP_HOST);
    eval 'sub WANOPT_PPP_PEER () {2;}' unless defined(&WANOPT_PPP_PEER);
    eval 'sub WANOPT_ONE () {1;}' unless defined(&WANOPT_ONE);
    eval 'sub WANOPT_TWO () {2;}' unless defined(&WANOPT_TWO);
    eval 'sub WANOPT_ONE_AND_HALF () {3;}' unless defined(&WANOPT_ONE_AND_HALF);
    eval 'sub WANOPT_NONE () {0;}' unless defined(&WANOPT_NONE);
    eval 'sub WANOPT_ODD () {1;}' unless defined(&WANOPT_ODD);
    eval 'sub WANOPT_EVEN () {2;}' unless defined(&WANOPT_EVEN);
    eval 'sub WANOPT_PRI () {0;}' unless defined(&WANOPT_PRI);
    eval 'sub WANOPT_SEC () {1;}' unless defined(&WANOPT_SEC);
    eval 'sub WANOPT_INTR () {0;}' unless defined(&WANOPT_INTR);
    eval 'sub WANOPT_POLL () {1;}' unless defined(&WANOPT_POLL);
    eval 'sub WANOPT_TTY_SYNC () {0;}' unless defined(&WANOPT_TTY_SYNC);
    eval 'sub WANOPT_TTY_ASYNC () {1;}' unless defined(&WANOPT_TTY_ASYNC);
    eval("sub WAN_UNCONFIGURED () { 0; }") unless defined(&WAN_UNCONFIGURED);
    eval("sub WAN_DISCONNECTED () { 1; }") unless defined(&WAN_DISCONNECTED);
    eval("sub WAN_CONNECTING () { 2; }") unless defined(&WAN_CONNECTING);
    eval("sub WAN_CONNECTED () { 3; }") unless defined(&WAN_CONNECTED);
    eval("sub WAN_LIMIT () { 4; }") unless defined(&WAN_LIMIT);
    eval("sub WAN_DUALPORT () { 5; }") unless defined(&WAN_DUALPORT);
    eval("sub WAN_DISCONNECTING () { 6; }") unless defined(&WAN_DISCONNECTING);
    eval("sub WAN_FT1_READY () { 7; }") unless defined(&WAN_FT1_READY);
    eval("sub WAN_LOCAL_IP () { 0; }") unless defined(&WAN_LOCAL_IP);
    eval("sub WAN_POINTOPOINT_IP () { 1; }") unless defined(&WAN_POINTOPOINT_IP);
    eval("sub WAN_NETMASK_IP () { 2; }") unless defined(&WAN_NETMASK_IP);
    eval("sub WAN_BROADCAST_IP () { 3; }") unless defined(&WAN_BROADCAST_IP);
    eval 'sub WAN_MODEM_CTS () {0x1;}' unless defined(&WAN_MODEM_CTS);
    eval 'sub WAN_MODEM_DCD () {0x2;}' unless defined(&WAN_MODEM_DCD);
    eval 'sub WAN_MODEM_DTR () {0x10;}' unless defined(&WAN_MODEM_DTR);
    eval 'sub WAN_MODEM_RTS () {0x20;}' unless defined(&WAN_MODEM_RTS);
}
1;
