require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_NET_ROUTE_H_)) {
    eval 'sub _NET_ROUTE_H_ () {1;}' unless defined(&_NET_ROUTE_H_);
    require 'sys/queue.ph';
    eval 'sub rmx_refcnt () { &rmx_rttvar;}' unless defined(&rmx_refcnt);
    eval 'sub rmx_rt_tableid () { &rmx_rtt;}' unless defined(&rmx_rt_tableid);
    eval 'sub RTM_RTTUNIT () {1000000;}' unless defined(&RTM_RTTUNIT);
    eval 'sub RTTTOPRHZ {
        my($r) = @_;
	    eval q((($r) / ( &RTM_RTTUNIT /  &PR_SLOWHZ)));
    }' unless defined(&RTTTOPRHZ);
    unless(defined(&RNF_NORMAL)) {
	require 'net/radix.ph';
	require 'net/radix_mpath.ph';
    }
    eval 'sub rt_key {
        my($r) = @_;
	    eval q(((($r)-> ($rt_nodes->{rn_key}))));
    }' unless defined(&rt_key);
    eval 'sub rt_mask {
        my($r) = @_;
	    eval q(((($r)-> ($rt_nodes->{rn_mask}))));
    }' unless defined(&rt_mask);
    eval 'sub rt_use () { ($rt_rmx->{rmx_pksent});}' unless defined(&rt_use);
    eval 'sub RTF_UP () {0x1;}' unless defined(&RTF_UP);
    eval 'sub RTF_GATEWAY () {0x2;}' unless defined(&RTF_GATEWAY);
    eval 'sub RTF_HOST () {0x4;}' unless defined(&RTF_HOST);
    eval 'sub RTF_REJECT () {0x8;}' unless defined(&RTF_REJECT);
    eval 'sub RTF_DYNAMIC () {0x10;}' unless defined(&RTF_DYNAMIC);
    eval 'sub RTF_MODIFIED () {0x20;}' unless defined(&RTF_MODIFIED);
    eval 'sub RTF_DONE () {0x40;}' unless defined(&RTF_DONE);
    eval 'sub RTF_MASK () {0x80;}' unless defined(&RTF_MASK);
    eval 'sub RTF_CLONING () {0x100;}' unless defined(&RTF_CLONING);
    eval 'sub RTF_XRESOLVE () {0x200;}' unless defined(&RTF_XRESOLVE);
    eval 'sub RTF_LLINFO () {0x400;}' unless defined(&RTF_LLINFO);
    eval 'sub RTF_STATIC () {0x800;}' unless defined(&RTF_STATIC);
    eval 'sub RTF_BLACKHOLE () {0x1000;}' unless defined(&RTF_BLACKHOLE);
    eval 'sub RTF_PROTO3 () {0x2000;}' unless defined(&RTF_PROTO3);
    eval 'sub RTF_PROTO2 () {0x4000;}' unless defined(&RTF_PROTO2);
    eval 'sub RTF_PROTO1 () {0x8000;}' unless defined(&RTF_PROTO1);
    eval 'sub RTF_CLONED () {0x10000;}' unless defined(&RTF_CLONED);
    eval 'sub RTF_SOURCE () {0x20000;}' unless defined(&RTF_SOURCE);
    eval 'sub RTF_MPATH () {0x40000;}' unless defined(&RTF_MPATH);
    eval 'sub RTF_JUMBO () {0x80000;}' unless defined(&RTF_JUMBO);
    eval 'sub RTF_FMASK () {( &RTF_JUMBO |  &RTF_PROTO1 |  &RTF_PROTO2 |  &RTF_PROTO3 |  &RTF_BLACKHOLE |  &RTF_REJECT |  &RTF_STATIC);}' unless defined(&RTF_FMASK);
    unless(defined(&_KERNEL)) {
	eval 'sub RTF_TUNNEL () {0x100000;}' unless defined(&RTF_TUNNEL);
    }
    eval 'sub rtm_fmask () { &rtm_use;}' unless defined(&rtm_fmask);
    eval 'sub rtm_tableid () { ($rtm_rmx->{rmx_rt_tableid});}' unless defined(&rtm_tableid);
    eval 'sub RTM_VERSION () {3;}' unless defined(&RTM_VERSION);
    eval 'sub RTM_ADD () {0x1;}' unless defined(&RTM_ADD);
    eval 'sub RTM_DELETE () {0x2;}' unless defined(&RTM_DELETE);
    eval 'sub RTM_CHANGE () {0x3;}' unless defined(&RTM_CHANGE);
    eval 'sub RTM_GET () {0x4;}' unless defined(&RTM_GET);
    eval 'sub RTM_LOSING () {0x5;}' unless defined(&RTM_LOSING);
    eval 'sub RTM_REDIRECT () {0x6;}' unless defined(&RTM_REDIRECT);
    eval 'sub RTM_MISS () {0x7;}' unless defined(&RTM_MISS);
    eval 'sub RTM_LOCK () {0x8;}' unless defined(&RTM_LOCK);
    eval 'sub RTM_RESOLVE () {0xb;}' unless defined(&RTM_RESOLVE);
    eval 'sub RTM_NEWADDR () {0xc;}' unless defined(&RTM_NEWADDR);
    eval 'sub RTM_DELADDR () {0xd;}' unless defined(&RTM_DELADDR);
    eval 'sub RTM_IFINFO () {0xe;}' unless defined(&RTM_IFINFO);
    eval 'sub RTM_IFANNOUNCE () {0xf;}' unless defined(&RTM_IFANNOUNCE);
    eval 'sub RTV_MTU () {0x1;}' unless defined(&RTV_MTU);
    eval 'sub RTV_HOPCOUNT () {0x2;}' unless defined(&RTV_HOPCOUNT);
    eval 'sub RTV_EXPIRE () {0x4;}' unless defined(&RTV_EXPIRE);
    eval 'sub RTV_RPIPE () {0x8;}' unless defined(&RTV_RPIPE);
    eval 'sub RTV_SPIPE () {0x10;}' unless defined(&RTV_SPIPE);
    eval 'sub RTV_SSTHRESH () {0x20;}' unless defined(&RTV_SSTHRESH);
    eval 'sub RTV_RTT () {0x40;}' unless defined(&RTV_RTT);
    eval 'sub RTV_RTTVAR () {0x80;}' unless defined(&RTV_RTTVAR);
    eval 'sub RTA_DST () {0x1;}' unless defined(&RTA_DST);
    eval 'sub RTA_GATEWAY () {0x2;}' unless defined(&RTA_GATEWAY);
    eval 'sub RTA_NETMASK () {0x4;}' unless defined(&RTA_NETMASK);
    eval 'sub RTA_GENMASK () {0x8;}' unless defined(&RTA_GENMASK);
    eval 'sub RTA_IFP () {0x10;}' unless defined(&RTA_IFP);
    eval 'sub RTA_IFA () {0x20;}' unless defined(&RTA_IFA);
    eval 'sub RTA_AUTHOR () {0x40;}' unless defined(&RTA_AUTHOR);
    eval 'sub RTA_BRD () {0x80;}' unless defined(&RTA_BRD);
    eval 'sub RTA_SRC () {0x100;}' unless defined(&RTA_SRC);
    eval 'sub RTA_SRCMASK () {0x200;}' unless defined(&RTA_SRCMASK);
    eval 'sub RTA_LABEL () {0x400;}' unless defined(&RTA_LABEL);
    eval 'sub RTAX_DST () {0;}' unless defined(&RTAX_DST);
    eval 'sub RTAX_GATEWAY () {1;}' unless defined(&RTAX_GATEWAY);
    eval 'sub RTAX_NETMASK () {2;}' unless defined(&RTAX_NETMASK);
    eval 'sub RTAX_GENMASK () {3;}' unless defined(&RTAX_GENMASK);
    eval 'sub RTAX_IFP () {4;}' unless defined(&RTAX_IFP);
    eval 'sub RTAX_IFA () {5;}' unless defined(&RTAX_IFA);
    eval 'sub RTAX_AUTHOR () {6;}' unless defined(&RTAX_AUTHOR);
    eval 'sub RTAX_BRD () {7;}' unless defined(&RTAX_BRD);
    eval 'sub RTAX_SRC () {8;}' unless defined(&RTAX_SRC);
    eval 'sub RTAX_SRCMASK () {9;}' unless defined(&RTAX_SRCMASK);
    eval 'sub RTAX_LABEL () {10;}' unless defined(&RTAX_LABEL);
    eval 'sub RTAX_MAX () {11;}' unless defined(&RTAX_MAX);
    eval 'sub RTLABEL_LEN () {32;}' unless defined(&RTLABEL_LEN);
    eval 'sub RT_TABLEID_MAX () {255;}' unless defined(&RT_TABLEID_MAX);
    if(defined(&_KERNEL)) {
	eval 'sub RTFREE {
	    my($rt) = @_;
    	    eval q( &do {  &if (($rt)-> &rt_refcnt <= 1)  &rtfree($rt);  &else ($rt)-> &rt_refcnt--; }  &while (0));
	}' unless defined(&RTFREE);
	eval 'sub ALL_CLONING () {0;}' unless defined(&ALL_CLONING);
	eval 'sub ONNET_CLONING () {1;}' unless defined(&ONNET_CLONING);
	eval 'sub NO_CLONING () {2;}' unless defined(&NO_CLONING);
	if(defined(&SMALL_KERNEL)) {
	    eval 'sub rtalloc_mpath {
	        my($r, $s, $t) = @_;
    		eval q( &rtalloc($r));
	    }' unless defined(&rtalloc_mpath);
	}
    }
}
1;
