require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_ALTQ_ALTQ_CLASSQ_H_)) {
    eval 'sub _ALTQ_ALTQ_CLASSQ_H_ () {1;}' unless defined(&_ALTQ_ALTQ_CLASSQ_H_);
    if(defined(&__cplusplus)) {
    }
    eval 'sub Q_DROPHEAD () {0x;}' unless defined(&Q_DROPHEAD);
    eval 'sub Q_RED () {0x1;}' unless defined(&Q_RED);
    eval 'sub Q_RIO () {0x2;}' unless defined(&Q_RIO);
    eval 'sub Q_DROPTAIL () {0x3;}' unless defined(&Q_DROPTAIL);
    if(defined(&_KERNEL)) {
	eval 'sub qtype {
	    my($q) = @_;
    	    eval q(($q)-> &qtype_);
	}' unless defined(&qtype);
	eval 'sub qlimit {
	    my($q) = @_;
    	    eval q(($q)-> &qlim_);
	}' unless defined(&qlimit);
	eval 'sub qlen {
	    my($q) = @_;
    	    eval q(($q)-> &qlen_);
	}' unless defined(&qlen);
	eval 'sub qtail {
	    my($q) = @_;
    	    eval q(($q)-> &tail_);
	}' unless defined(&qtail);
	eval 'sub qhead {
	    my($q) = @_;
    	    eval q((($q)-> &tail_ ? ($q)-> ($tail_->{m_nextpkt}) :  &NULL));
	}' unless defined(&qhead);
	eval 'sub qempty {
	    my($q) = @_;
    	    eval q((($q)-> &qlen_ == 0));
	}' unless defined(&qempty);
	eval 'sub q_is_red {
	    my($q) = @_;
    	    eval q((($q)-> &qtype_ ==  &Q_RED));
	}' unless defined(&q_is_red);
	eval 'sub q_is_rio {
	    my($q) = @_;
    	    eval q((($q)-> &qtype_ ==  &Q_RIO));
	}' unless defined(&q_is_rio);
	eval 'sub q_is_red_or_rio {
	    my($q) = @_;
    	    eval q((($q)-> &qtype_ ==  &Q_RED || ($q)-> &qtype_ ==  &Q_RIO));
	}' unless defined(&q_is_red_or_rio);
	if(!defined( &__GNUC__) || defined( &ALTQ_DEBUG)) {
	} else {
	    eval 'sub _getq {
	        my($q) = @_;
    		eval q({ \'struct mbuf\' * &m, * &m0;  &if (( &m =  &qtail($q)) ==  &NULL) ( &NULL);  &if (( &m0 =  ($m->{m_nextpkt})) !=  &m)  ($m->{m_nextpkt}) =  ($m0->{m_nextpkt});  &else  &qtail($q) =  &NULL;  &qlen($q)--;  ($m0->{m_nextpkt}) =  &NULL; ( &m0); });
	    }' unless defined(&_getq);
	    eval 'sub _removeq {
	        my($q,$m) = @_;
    		eval q({ \'struct mbuf\' * &m0, * &prev;  &m0 =  &qtail($q);  &do {  &prev =  &m0;  &m0 =  ($m0->{m_nextpkt}); }  &while ( &m0 != $m);  ($prev->{m_nextpkt}) =  ($m->{m_nextpkt});  &if ( &prev == $m)  &qtail($q) =  &NULL;  &else  &if ( &qtail($q) == $m)  &qtail($q) =  &prev;  &qlen($q)--; });
	    }' unless defined(&_removeq);
	    eval 'sub _flushq {
	        my($q) = @_;
    		eval q({ \'struct mbuf\' * &m;  &while (( &m =  &_getq($q)) !=  &NULL)  &m_freem( &m); });
	    }' unless defined(&_flushq);
	}
    }
    if(defined(&__cplusplus)) {
    }
}
1;
