require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_NET_IF_STATS_H_)) {
    eval 'sub _NET_IF_STATS_H_ () {1;}' unless defined(&_NET_IF_STATS_H_);
    require 'net/net_stats.ph';
    eval("sub if_ipackets () { 0; }") unless defined(&if_ipackets);
    eval("sub if_ierrors () { 1; }") unless defined(&if_ierrors);
    eval("sub if_opackets () { 2; }") unless defined(&if_opackets);
    eval("sub if_oerrors () { 3; }") unless defined(&if_oerrors);
    eval("sub if_collisions () { 4; }") unless defined(&if_collisions);
    eval("sub if_ibytes () { 5; }") unless defined(&if_ibytes);
    eval("sub if_obytes () { 6; }") unless defined(&if_obytes);
    eval("sub if_imcasts () { 7; }") unless defined(&if_imcasts);
    eval("sub if_omcasts () { 8; }") unless defined(&if_omcasts);
    eval("sub if_iqdrops () { 9; }") unless defined(&if_iqdrops);
    eval("sub if_noproto () { 10; }") unless defined(&if_noproto);
    eval("sub IF_NSTATS () { 11; }") unless defined(&IF_NSTATS);
    if(defined(&_KERNEL)) {
	eval 'sub IF_STAT_GETREF {
	    my($ifp) = @_;
    	    eval q( &_NET_STAT_GETREF(($ifp)-> &if_stats));
	}' unless defined(&IF_STAT_GETREF);
	eval 'sub IF_STAT_PUTREF {
	    my($ifp) = @_;
    	    eval q( &_NET_STAT_PUTREF(($ifp)-> &if_stats));
	}' unless defined(&IF_STAT_PUTREF);
	eval 'sub if_statinc {
	    my($ifp,$x) = @_;
    	    eval q({  &_NET_STATINC(($ifp)-> &if_stats, $x); });
	}' unless defined(&if_statinc);
	eval 'sub if_statinc_ref {
	    my($nsr,$x) = @_;
    	    eval q({  &_NET_STATINC_REF($nsr, $x); });
	}' unless defined(&if_statinc_ref);
	eval 'sub if_statdec {
	    my($ifp,$x) = @_;
    	    eval q({  &_NET_STATDEC(($ifp)-> &if_stats, $x); });
	}' unless defined(&if_statdec);
	eval 'sub if_statdec_ref {
	    my($nsr,$x) = @_;
    	    eval q({  &_NET_STATDEC_REF($nsr, $x); });
	}' unless defined(&if_statdec_ref);
	eval 'sub if_statadd {
	    my($ifp,$x,$v) = @_;
    	    eval q({  &_NET_STATADD(($ifp)-> &if_stats, $x, $v); });
	}' unless defined(&if_statadd);
	eval 'sub if_statadd_ref {
	    my($nsr,$x,$v) = @_;
    	    eval q({  &_NET_STATADD_REF($nsr, $x, $v); });
	}' unless defined(&if_statadd_ref);
	eval 'sub if_statadd2 {
	    my($ifp,$x1,$v1,$x2,$v2) = @_;
    	    eval q({  &net_stat_ref_t  &_nsr_ =  &IF_STAT_GETREF($ifp);  &_NET_STATADD_REF( &_nsr_, $x1, $v1);  &_NET_STATADD_REF( &_nsr_, $x2, $v2);  &IF_STAT_PUTREF($ifp); });
	}' unless defined(&if_statadd2);
	eval 'sub if_statsub {
	    my($ifp,$x,$v) = @_;
    	    eval q({  &_NET_STATSUB(($ifp)-> &if_stats, $x, $v); });
	}' unless defined(&if_statsub);
	eval 'sub if_statsub_ref {
	    my($nsr,$x,$v) = @_;
    	    eval q({  &_NET_STATSUB_REF($nsr, $x, $v); });
	}' unless defined(&if_statsub_ref);
    }
}
1;
