require '_h2ph_pre.ph';

unless(defined(&_NETISO_TP_PARAM_H_)) {
    eval 'sub _NETISO_TP_PARAM_H_ () {1;}' unless defined(&_NETISO_TP_PARAM_H_);
    eval 'sub TP_CLASSES_IMPLEMENTED () {0x11;}' unless defined(&TP_CLASSES_IMPLEMENTED);
    eval 'sub TP_DECBIT_CLEAR_COUNT () {3;}' unless defined(&TP_DECBIT_CLEAR_COUNT);
    if(defined(&_KERNEL)) {
    }
    eval 'sub TP_SOCKBUFSIZE () {(4096);}' unless defined(&TP_SOCKBUFSIZE);
    eval 'sub TP0_SOCKBUFSIZE () {(512);}' unless defined(&TP0_SOCKBUFSIZE);
    eval 'sub MAX_TSAP_SEL_LEN () {64;}' unless defined(&MAX_TSAP_SEL_LEN);
    eval 'sub TP_TPDUSIZE () {0xc;}' unless defined(&TP_TPDUSIZE);
    eval 'sub TP0_TPDUSIZE () {0xb;}' unless defined(&TP0_TPDUSIZE);
    eval 'sub TP_DFL_TPDUSIZE () {0x7;}' unless defined(&TP_DFL_TPDUSIZE);
    eval 'sub TP_NRETRANS () {12;}' unless defined(&TP_NRETRANS);
    eval 'sub TP_MAXRXTSHIFT () {6;}' unless defined(&TP_MAXRXTSHIFT);
    eval 'sub TP_MAXPORT () {0xefff;}' unless defined(&TP_MAXPORT);
    eval 'sub TP_RTT_ALPHA () {3;}' unless defined(&TP_RTT_ALPHA);
    eval 'sub TP_RTV_ALPHA () {2;}' unless defined(&TP_RTV_ALPHA);
    eval 'sub TP_REXMTVAL {
        local($tpcb) = @_;
	    eval q(((( &tp_rttadd + ($tpcb)-> &tp_rtt + (($tpcb)-> &tp_rtv)) << 2) /  &tp_rttdiv));
    }' unless defined(&TP_REXMTVAL);
    eval 'sub TP_RANGESET {
        local($tv, $value, $min, $max) = @_;
	    eval q((($tv = $value) > ($max) ? ($tv = $max) : ($tv < $min ? $tv = $min : $tv)));
    }' unless defined(&TP_RANGESET);
    eval 'sub T_CONN_DATA () {0x1;}' unless defined(&T_CONN_DATA);
    eval 'sub T_DISCONNECT () {0x2;}' unless defined(&T_DISCONNECT);
    eval 'sub T_DISC_DATA () {0x4;}' unless defined(&T_DISC_DATA);
    eval 'sub T_XDATA () {0x8;}' unless defined(&T_XDATA);
    eval 'sub ISO_CLNS () {0;}' unless defined(&ISO_CLNS);
    eval 'sub IN_CLNS () {1;}' unless defined(&IN_CLNS);
    eval 'sub ISO_CONS () {2;}' unless defined(&ISO_CONS);
    eval 'sub ISO_COSNS () {3;}' unless defined(&ISO_COSNS);
    eval 'sub TP_MAX_NETSERVICES () {3;}' unless defined(&TP_MAX_NETSERVICES);
    eval 'sub _ACK_DONT_ () {0;}' unless defined(&_ACK_DONT_);
    eval 'sub _ACK_STRAT_EACH_ () {0x1;}' unless defined(&_ACK_STRAT_EACH_);
    eval 'sub _ACK_STRAT_FULLWIN_ () {0x2;}' unless defined(&_ACK_STRAT_FULLWIN_);
    eval 'sub _ACK_DUP_ () {0x3;}' unless defined(&_ACK_DUP_);
    eval 'sub _ACK_EOT_ () {0x4;}' unless defined(&_ACK_EOT_);
    eval 'sub _ACK_REORDER_ () {0x5;}' unless defined(&_ACK_REORDER_);
    eval 'sub _ACK_USRRCV_ () {0x6;}' unless defined(&_ACK_USRRCV_);
    eval 'sub _ACK_FCC_ () {0x7;}' unless defined(&_ACK_FCC_);
    eval 'sub _ACK_NUM_REASONS_ () {0x8;}' unless defined(&_ACK_NUM_REASONS_);
    eval 'sub ACK_DONT () {0;}' unless defined(&ACK_DONT);
    eval 'sub ACK_STRAT_EACH () {(1<<  &_ACK_STRAT_EACH_);}' unless defined(&ACK_STRAT_EACH);
    eval 'sub ACK_STRAT_FULLWIN () {(1<<  &_ACK_STRAT_FULLWIN_);}' unless defined(&ACK_STRAT_FULLWIN);
    eval 'sub ACK_DUP () {(1<<  &_ACK_DUP_);}' unless defined(&ACK_DUP);
    eval 'sub ACK_EOT () {(1<<  &_ACK_EOT_);}' unless defined(&ACK_EOT);
    eval 'sub ACK_REORDER () {(1<<  &_ACK_REORDER_);}' unless defined(&ACK_REORDER);
    eval 'sub TP_VERSION () {0x1;}' unless defined(&TP_VERSION);
    eval 'sub TP_MAX_HEADER_LEN () {256;}' unless defined(&TP_MAX_HEADER_LEN);
    eval 'sub TP_MIN_TPDUSIZE () {0x7;}' unless defined(&TP_MIN_TPDUSIZE);
    eval 'sub TP_MAX_TPDUSIZE () {0xd;}' unless defined(&TP_MAX_TPDUSIZE);
    eval 'sub TP_MAX_XPD_DATA () {0x10;}' unless defined(&TP_MAX_XPD_DATA);
    eval 'sub TP_MAX_CC_DATA () {0x20;}' unless defined(&TP_MAX_CC_DATA);
    eval 'sub TP_MAX_CR_DATA () { &TP_MAX_CC_DATA;}' unless defined(&TP_MAX_CR_DATA);
    eval 'sub TP_MAX_DR_DATA () {0x40;}' unless defined(&TP_MAX_DR_DATA);
    eval 'sub TP_XTD_FMT_BIT () {0x80000000;}' unless defined(&TP_XTD_FMT_BIT);
    eval 'sub TP_XTD_FMT_MASK () {0x7fffffff;}' unless defined(&TP_XTD_FMT_MASK);
    eval 'sub TP_NML_FMT_BIT () {0x80;}' unless defined(&TP_NML_FMT_BIT);
    eval 'sub TP_NML_FMT_MASK () {0x7f;}' unless defined(&TP_NML_FMT_MASK);
    eval 'sub TP_MIN_TPDUTYPE () {0x1;}' unless defined(&TP_MIN_TPDUTYPE);
    eval 'sub XPD_TPDU_type () {0x1;}' unless defined(&XPD_TPDU_type);
    eval 'sub XAK_TPDU_type () {0x2;}' unless defined(&XAK_TPDU_type);
    eval 'sub GR_TPDU_type () {0x3;}' unless defined(&GR_TPDU_type);
    eval 'sub AK_TPDU_type () {0x6;}' unless defined(&AK_TPDU_type);
    eval 'sub ER_TPDU_type () {0x7;}' unless defined(&ER_TPDU_type);
    eval 'sub DR_TPDU_type () {0x8;}' unless defined(&DR_TPDU_type);
    eval 'sub DC_TPDU_type () {0xc;}' unless defined(&DC_TPDU_type);
    eval 'sub CC_TPDU_type () {0xd;}' unless defined(&CC_TPDU_type);
    eval 'sub CR_TPDU_type () {0xe;}' unless defined(&CR_TPDU_type);
    eval 'sub DT_TPDU_type () {0xf;}' unless defined(&DT_TPDU_type);
    eval 'sub TP_MAX_TPDUTYPE () {0xf;}' unless defined(&TP_MAX_TPDUTYPE);
    eval 'sub TPP_acktime () {0x85;}' unless defined(&TPP_acktime);
    eval 'sub TPP_residER () {0x86;}' unless defined(&TPP_residER);
    eval 'sub TPP_priority () {0x87;}' unless defined(&TPP_priority);
    eval 'sub TPP_transdelay () {0x88;}' unless defined(&TPP_transdelay);
    eval 'sub TPP_throughput () {0x89;}' unless defined(&TPP_throughput);
    eval 'sub TPP_subseq () {0x8a;}' unless defined(&TPP_subseq);
    eval 'sub TPP_flow_cntl_conf () {0x8c;}' unless defined(&TPP_flow_cntl_conf);
    eval 'sub TPP_addl_info () {0xe0;}' unless defined(&TPP_addl_info);
    eval 'sub TPP_tpdu_size () {0xc0;}' unless defined(&TPP_tpdu_size);
    eval 'sub TPP_calling_sufx () {0xc1;}' unless defined(&TPP_calling_sufx);
    eval 'sub TPP_invalid_tpdu () {0xc1;}' unless defined(&TPP_invalid_tpdu);
    eval 'sub TPP_called_sufx () {0xc2;}' unless defined(&TPP_called_sufx);
    eval 'sub TPP_checksum () {0xc3;}' unless defined(&TPP_checksum);
    eval 'sub TPP_vers () {0xc4;}' unless defined(&TPP_vers);
    eval 'sub TPP_security () {0xc5;}' unless defined(&TPP_security);
    eval 'sub TPP_addl_opt () {0xc6;}' unless defined(&TPP_addl_opt);
    eval 'sub TPP_alt_class () {0xc7;}' unless defined(&TPP_alt_class);
    eval 'sub TPP_perf_meas () {0xc8;}' unless defined(&TPP_perf_meas);
    eval 'sub TPP_ptpdu_size () {0xf0;}' unless defined(&TPP_ptpdu_size);
    eval 'sub TPP_inact_time () {0xf2;}' unless defined(&TPP_inact_time);
    unless(defined(&TRUE)) {
	eval 'sub TRUE () {1;}' unless defined(&TRUE);
    }
    unless(defined(&FALSE)) {
	eval 'sub FALSE () {0;}' unless defined(&FALSE);
    }
    eval 'sub TP_LOCAL () {22;}' unless defined(&TP_LOCAL);
    eval 'sub TP_FOREIGN () {33;}' unless defined(&TP_FOREIGN);
    unless(defined(&EOK)) {
	eval 'sub EOK () {0;}' unless defined(&EOK);
    }
    eval 'sub TP_CLASS_0 () {(1<<0);}' unless defined(&TP_CLASS_0);
    eval 'sub TP_CLASS_1 () {(1<<1);}' unless defined(&TP_CLASS_1);
    eval 'sub TP_CLASS_2 () {(1<<2);}' unless defined(&TP_CLASS_2);
    eval 'sub TP_CLASS_3 () {(1<<3);}' unless defined(&TP_CLASS_3);
    eval 'sub TP_CLASS_4 () {(1<<4);}' unless defined(&TP_CLASS_4);
    eval 'sub TP_FORCE () {0x1;}' unless defined(&TP_FORCE);
    eval 'sub TP_STRICT () {0x2;}' unless defined(&TP_STRICT);
    unless(defined(&MNULL)) {
	eval 'sub MNULL () {0;}' unless defined(&MNULL);
    }
    eval 'sub MT_XPD () {0x44;}' unless defined(&MT_XPD);
    eval 'sub MT_EOT () {0x40;}' unless defined(&MT_EOT);
    eval 'sub TP_ENOREF () {0x80000000;}' unless defined(&TP_ENOREF);
    eval 'sub DoEvent {
        local($x) = @_;
	    eval q((( ($E->{ev_number})=($x)),( &tp_driver( &tpcb, &E))));
    }' unless defined(&DoEvent);
    eval 'sub GET_CUR_TIME {
        local($tvalp) = @_;
	    eval q(((*$tvalp) =  &time));
    }' unless defined(&GET_CUR_TIME);
    eval 'sub GET_TIME_SINCE {
        local($oldtvalp, $diffp) = @_;
	    eval q({ ($diffp)-> &tv_sec =  ($time->{tv_sec}) - ($oldtvalp)-> &tv_sec; ($diffp)-> &tv_usec =  ($time->{tv_usec}) - ($oldtvalp)-> &tv_usec;  &if( ($diffp)-> &tv_usec <0) { ($diffp)-> &tv_sec --; ($diffp)-> &tv_usec = 1000000- ($diffp)-> &tv_usec; }});
    }' unless defined(&GET_TIME_SINCE);
    eval 'sub CHANGE_MTYPE {
        local($m, $TYPE) = @_;
	    eval q( &if(($m)-> &m_type != $TYPE) {  ($mbstat->{m_mtypes[&(m)}->{m_type]})--;  ($mbstat->{m_mtypes[$TYPE]})++; ($m)-> &m_type = $TYPE; });
    }' unless defined(&CHANGE_MTYPE);
    eval 'sub vbptr {
        local($x) = @_;
	    eval q((($x)));
    }' unless defined(&vbptr);
    eval 'sub vbval {
        local($x,$type) = @_;
	    eval q((*(((($x))-> &tpv_val))));
    }' unless defined(&vbval);
    eval 'sub vbcode {
        local($x) = @_;
	    eval q(( &vbptr($x)-> &tpv_code));
    }' unless defined(&vbcode);
    eval 'sub vblen {
        local($x) = @_;
	    eval q(( &vbptr($x)-> &tpv_len));
    }' unless defined(&vblen);
    eval 'sub vb_putval {
        local($dst,$type,$src) = @_;
	    eval q( &bcopy(&,((($dst))-> &tpv_val), $sizeof{$type}));
    }' unless defined(&vb_putval);
    eval 'sub vb_getval {
        local($src,$type,$dst) = @_;
	    eval q( &bcopy(((($src))-> &tpv_val),($dst),$sizeof{$type}));
    }' unless defined(&vb_getval);
    eval 'sub ADDOPTION {
        local($type, $DU, $len, $src) = @_;
	    eval q({  &register \'caddr_t\'  &P;  &P = + (-> &tpdu_li);  ($vbptr->{tpv_code}) = $type;  ($vbptr->{tpv_len}) = $len;  &bcopy($src, ( ($vbptr->{tpv_val})), $len);  ($DU->{tpdu_li}) += $len+2; });
    }' unless defined(&ADDOPTION);
    if(defined( &ARGO_DEBUG) &&!defined( &LOCAL_CREDIT_EXPAND)) {
	eval 'sub LOCAL_CREDIT {
	    local($tpcb) = @_;
    	    eval q( &tp_local_credit($tpcb));
	}' unless defined(&LOCAL_CREDIT);
    } else {
	eval 'sub LOCAL_CREDIT {
	    local($tpcb) = @_;
    	    eval q({  &if ( ($tpcb->{tp_rsycnt}) == 0) {  &register \'struct sockbuf\' * &xxsb = (($tpcb)-> ($tp_sock->{so_rcv}));  &register \'int\'  &xxi =  &sbspace( &xxsb);  &xxi = ( &xxi<0) ? 0: (( &xxi) / ($tpcb)-> &tp_l_tpdusize);  &xxi =  &min( &xxi, ($tpcb)-> &tp_maxlcredit);  &if (!( ($tpcb->{tp_cebit_off}))) { ($tpcb)-> &tp_lcredit =  &ROUND(($tpcb)-> &tp_win_recv);  &if ( &xxi < ($tpcb)-> &tp_lcredit) { ($tpcb)-> &tp_lcredit =  &xxi; } }  &else ($tpcb)-> &tp_lcredit =  &xxi; } });
	}' unless defined(&LOCAL_CREDIT);
    }
    if(defined(&_KERNEL)) {
	require 'sys/syslog.ph';
	eval 'sub printf () { &logpri( &LOG_DEBUG), &addlog;}' unless defined(&printf);
	unless(defined(&tp_NSTATES)) {
	    require 'netiso/tp_states.ph';
	    require 'netiso/tp_events.ph';
	    unless(defined(&__CONCAT3)) {
		if((defined(&__STDC__) ? &__STDC__ : 0)) {
		    eval 'sub __CONCAT3 {
		        local($a,$b,$c) = @_;
    			eval q($a  $b  $c);
		    }' unless defined(&__CONCAT3);
		} else {
		    eval 'sub __CONCAT3 {
		        local($a,$b,$c) = @_;
    			eval q($a $b $c);
		    }' unless defined(&__CONCAT3);
		}
	    }
	    eval 'sub TPDU_ATTR {
	        local($X) = @_;
    		eval q( &__CONCAT3( ($ev_union->{EV_}),$X, &_TPDU));
	    }' unless defined(&TPDU_ATTR);
	}
    }
}
1;
