require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_NET_IF_TUN_H_)) {
    eval 'sub _NET_IF_TUN_H_ () {1;}' unless defined(&_NET_IF_TUN_H_);
    require 'sys/ioccom.ph';
    if(defined(&_KERNEL)) {
	require 'sys/types.ph';
	require 'sys/condvar.ph';
	require 'sys/mutex.ph';
	require 'sys/queue.ph';
	require 'sys/select.ph';
	require 'net/if.ph';
	eval 'sub TUN_OPEN () {0x1;}' unless defined(&TUN_OPEN);
	eval 'sub TUN_INITED () {0x2;}' unless defined(&TUN_INITED);
	eval 'sub TUN_RCOLL () {0x4;}' unless defined(&TUN_RCOLL);
	eval 'sub TUN_IASET () {0x8;}' unless defined(&TUN_IASET);
	eval 'sub TUN_DSTADDR () {0x10;}' unless defined(&TUN_DSTADDR);
	eval 'sub TUN_UNUSED0 () {0x40;}' unless defined(&TUN_UNUSED0);
	eval 'sub TUN_ASYNC () {0x80;}' unless defined(&TUN_ASYNC);
	eval 'sub TUN_NBIO () {0x100;}' unless defined(&TUN_NBIO);
	eval 'sub TUN_PREPADDR () {0x200;}' unless defined(&TUN_PREPADDR);
	eval 'sub TUN_IFHEAD () {0x400;}' unless defined(&TUN_IFHEAD);
	eval 'sub TUN_READY () {( &TUN_OPEN |  &TUN_INITED |  &TUN_IASET);}' unless defined(&TUN_READY);
    }
    eval 'sub TUNMTU () {1500;}' unless defined(&TUNMTU);
    eval 'sub TUNSDEBUG () { &_IOW(ord(\'t\'), 90, \'int\');}' unless defined(&TUNSDEBUG);
    eval 'sub TUNGDEBUG () { &_IOR(ord(\'t\'), 89, \'int\');}' unless defined(&TUNGDEBUG);
    eval 'sub TUNSIFMODE () { &_IOW(ord(\'t\'), 88, \'int\');}' unless defined(&TUNSIFMODE);
    eval 'sub TUNSLMODE () { &_IOW(ord(\'t\'), 87, \'int\');}' unless defined(&TUNSLMODE);
    eval 'sub TUNSIFHEAD () { &_IOW(ord(\'t\'), 66, \'int\');}' unless defined(&TUNSIFHEAD);
    eval 'sub TUNGIFHEAD () { &_IOR(ord(\'t\'), 65, \'int\');}' unless defined(&TUNGIFHEAD);
}
1;
