require '_h2ph_pre.ph';

unless(defined(&DECBIT)) {
    sub DECBIT () {	1;}
}
unless(defined(&IS_CLUSTER)) {
    sub IS_CLUSTER {
	local($m) = @_;
	eval q((($m)-> &m_flags &  &M_EXT));
    }
}
unless(defined(&HTOC)) {
    sub HTOC {
	local($msb, $lsb, $hword) = @_;
	eval q( = ( >> 8); = (($hword) & 0xff));
    }
}
unless(defined(&CTOH)) {
    sub CTOH {
	local($msb, $lsb, $hword) = @_;
	eval q(($hword) = (($msb) << 8) | ($lsb));
    }
}
unless(defined(&CKSUM_REQUIRED)) {
    sub CKSUM_REQUIRED {
	local($clnp) = @_;
	eval q(((($clnp)-> &cnf_cksum_msb != 0) || (($clnp)-> &cnf_cksum_lsb != 0)));
    }
}
unless(defined(&CNF_TYPE)) {
    sub CNF_TYPE () {	0x1f;}
}
unless(defined(&CNF_ERR_OK)) {
    sub CNF_ERR_OK () {	0x20;}
}
unless(defined(&CNF_MORE_SEGS)) {
    sub CNF_MORE_SEGS () {	0x40;}
}
unless(defined(&CNF_SEG_OK)) {
    sub CNF_SEG_OK () {	0x80;}
}
unless(defined(&CLNP_CKSUM_OFF)) {
    sub CLNP_CKSUM_OFF () {	0x7;}
}
unless(defined(&clnl_fixed)) {
    sub clnl_fixed () {	 &clnp_fixed;}
}
unless(defined(&ER_INVALREAS)) {
    sub ER_INVALREAS () {	0xff;}
}
unless(defined(&CLNP_OPTTOOFF)) {
    sub CLNP_OPTTOOFF {
	local($m, $opt) = @_;
	eval q(( ($opt -  &mtod($m, 'caddr_t'))));
    }
}
unless(defined(&CLNP_OFFTOOPT)) {
    sub CLNP_OFFTOOPT {
	local($m, $off) = @_;
	eval q(( ( &mtod($m, 'caddr_t') + $off)));
    }
}
unless(defined(&CLNPSRCRT_VALID)) {
    sub CLNPSRCRT_VALID {
	local($oidx) = @_;
	eval q((($oidx)  && ( ($oidx->{cni_srcrt_s}))));
    }
}
unless(defined(&CLNPSRCRT_OFF)) {
    sub CLNPSRCRT_OFF {
	local($oidx, $options) = @_;
	eval q((*(( &CLNP_OFFTOOPT($options,  ($oidx->{cni_srcrt_s})) + 1))));
    }
}
unless(defined(&CLNPSRCRT_TYPE)) {
    sub CLNPSRCRT_TYPE {
	local($oidx, $options) = @_;
	eval q(((*( &CLNP_OFFTOOPT($options,  ($oidx->{cni_srcrt_s}))))));
    }
}
unless(defined(&CLNPSRCRT_CLEN)) {
    sub CLNPSRCRT_CLEN {
	local($oidx, $options) = @_;
	eval q(((*( &CLNP_OFFTOOPT($options,  ($oidx->{cni_srcrt_s})) +  &CLNPSRCRT_OFF($oidx, $options) - 1))));
    }
}
unless(defined(&CLNPSRCRT_CADDR)) {
    sub CLNPSRCRT_CADDR {
	local($oidx, $options) = @_;
	eval q((( &CLNP_OFFTOOPT($options,  ($oidx->{cni_srcrt_s})) +  &CLNPSRCRT_OFF($oidx, $options))));
    }
}
unless(defined(&CLNPSRCRT_TERM)) {
    sub CLNPSRCRT_TERM {
	local($oidx, $options) = @_;
	eval q(( &CLNPSRCRT_OFF($oidx, $options) >  ($oidx->{cni_srcrt_len})));
    }
}
unless(defined(&CLNPOPT_FLAGS)) {
    sub CLNPOPT_FLAGS () {	0x1;}
}
unless(defined(&CLNPOPT_OPTS)) {
    sub CLNPOPT_OPTS () {	0x2;}
}
unless(defined(&CLNPOVAL_PAD)) {
    sub CLNPOVAL_PAD () {	0xcc;}
}
unless(defined(&CLNPOVAL_SECURE)) {
    sub CLNPOVAL_SECURE () {	0xc5;}
}
unless(defined(&CLNPOVAL_SRCRT)) {
    sub CLNPOVAL_SRCRT () {	0xc8;}
}
unless(defined(&CLNPOVAL_RECRT)) {
    sub CLNPOVAL_RECRT () {	0xcb;}
}
unless(defined(&CLNPOVAL_QOS)) {
    sub CLNPOVAL_QOS () {	0xc3;}
}
unless(defined(&CLNPOVAL_PRIOR)) {
    sub CLNPOVAL_PRIOR () {	0xcd;}
}
unless(defined(&CLNPOVAL_ERREAS)) {
    sub CLNPOVAL_ERREAS () {	0xc1;}
}
unless(defined(&CLNPOVAL_SRCSPEC)) {
    sub CLNPOVAL_SRCSPEC () {	0x40;}
}
unless(defined(&CLNPOVAL_DSTSPEC)) {
    sub CLNPOVAL_DSTSPEC () {	0x80;}
}
unless(defined(&CLNPOVAL_GLOBAL)) {
    sub CLNPOVAL_GLOBAL () {	0xc0;}
}
unless(defined(&CLNPOVAL_SEQUENCING)) {
    sub CLNPOVAL_SEQUENCING () {	0x10;}
}
unless(defined(&CLNPOVAL_CONGESTED)) {
    sub CLNPOVAL_CONGESTED () {	0x8;}
}
unless(defined(&CLNPOVAL_LOWDELAY)) {
    sub CLNPOVAL_LOWDELAY () {	0x4;}
}
unless(defined(&CLNPOVAL_PARTRT)) {
    sub CLNPOVAL_PARTRT () {	0x;}
}
unless(defined(&CLNPOVAL_COMPRT)) {
    sub CLNPOVAL_COMPRT () {	0x1;}
}
unless(defined(&CLNP_NO_SEG)) {
    sub CLNP_NO_SEG () {	0x10;}
}
unless(defined(&CLNP_NO_ER)) {
    sub CLNP_NO_ER () {	0x20;}
}
unless(defined(&CLNP_SEND_RAW)) {
    sub CLNP_SEND_RAW () {	0x80;}
}
unless(defined(&CLNP_NO_CKSUM)) {
    sub CLNP_NO_CKSUM () {	0x100;}
}
unless(defined(&CLNP_ECHO)) {
    sub CLNP_ECHO () {	0x200;}
}
unless(defined(&CLNP_NOCACHE)) {
    sub CLNP_NOCACHE () {	0x400;}
}
unless(defined(&CLNP_ECHOR)) {
    sub CLNP_ECHOR () {	0x800;}
}
unless(defined(&CLNP_VFLAGS)) {
    sub CLNP_VFLAGS () {	( &CLNP_SEND_RAW| &CLNP_NO_SEG| &CLNP_NO_ER| &CLNP_NO_CKSUM|  &CLNP_ECHO| &CLNP_NOCACHE| &CLNP_ECHOR);}
}
unless(defined(&CLNP_HDR_MIN)) {
    sub CLNP_HDR_MIN () {	($sizeof{'struct clnp_fixed'});}
}
unless(defined(&CLNP_HDR_MAX)) {
    sub CLNP_HDR_MAX () {	(254);}
}
unless(defined(&CLNP_TTL_UNITS)) {
    sub CLNP_TTL_UNITS () {	2;}
}
unless(defined(&CLNP_TTL)) {
    sub CLNP_TTL () {	15* &CLNP_TTL_UNITS;}
}
unless(defined(&ISO8473_V1)) {
    sub ISO8473_V1 () {	0x1;}
}
unless(defined(&CLNP_DT)) {
    sub CLNP_DT () {	0x1c;}
}
unless(defined(&CLNP_ER)) {
    sub CLNP_ER () {	0x1;}
}
unless(defined(&CLNP_RAW)) {
    sub CLNP_RAW () {	0x1d;}
}
unless(defined(&CLNP_EC)) {
    sub CLNP_EC () {	0x1e;}
}
unless(defined(&CLNP_ECR)) {
    sub CLNP_ECR () {	0x1f;}
}
unless(defined(&GEN_NOREAS)) {
    sub GEN_NOREAS () {	0x;}
}
unless(defined(&GEN_PROTOERR)) {
    sub GEN_PROTOERR () {	0x1;}
}
unless(defined(&GEN_BADCSUM)) {
    sub GEN_BADCSUM () {	0x2;}
}
unless(defined(&GEN_CONGEST)) {
    sub GEN_CONGEST () {	0x3;}
}
unless(defined(&GEN_HDRSYNTAX)) {
    sub GEN_HDRSYNTAX () {	0x4;}
}
unless(defined(&GEN_SEGNEEDED)) {
    sub GEN_SEGNEEDED () {	0x5;}
}
unless(defined(&GEN_INCOMPLETE)) {
    sub GEN_INCOMPLETE () {	0x6;}
}
unless(defined(&GEN_DUPOPT)) {
    sub GEN_DUPOPT () {	0x7;}
}
unless(defined(&ADDR_DESTUNREACH)) {
    sub ADDR_DESTUNREACH () {	0x80;}
}
unless(defined(&ADDR_DESTUNKNOWN)) {
    sub ADDR_DESTUNKNOWN () {	0x81;}
}
unless(defined(&SRCRT_UNSPECERR)) {
    sub SRCRT_UNSPECERR () {	0x90;}
}
unless(defined(&SRCRT_SYNTAX)) {
    sub SRCRT_SYNTAX () {	0x91;}
}
unless(defined(&SRCRT_UNKNOWNADDR)) {
    sub SRCRT_UNKNOWNADDR () {	0x92;}
}
unless(defined(&SRCRT_BADPATH)) {
    sub SRCRT_BADPATH () {	0x93;}
}
unless(defined(&TTL_EXPTRANSIT)) {
    sub TTL_EXPTRANSIT () {	0xa0;}
}
unless(defined(&TTL_EXPREASS)) {
    sub TTL_EXPREASS () {	0xa1;}
}
unless(defined(&DISC_UNSUPPOPT)) {
    sub DISC_UNSUPPOPT () {	0xb0;}
}
unless(defined(&DISC_UNSUPPVERS)) {
    sub DISC_UNSUPPVERS () {	0xb1;}
}
unless(defined(&DISC_UNSUPPSECURE)) {
    sub DISC_UNSUPPSECURE () {	0xb2;}
}
unless(defined(&DISC_UNSUPPSRCRT)) {
    sub DISC_UNSUPPSRCRT () {	0xb3;}
}
unless(defined(&DISC_UNSUPPRECRT)) {
    sub DISC_UNSUPPRECRT () {	0xb4;}
}
unless(defined(&REASS_INTERFERE)) {
    sub REASS_INTERFERE () {	0xc0;}
}
unless(defined(&CLNP_ERRORS)) {
    sub CLNP_ERRORS () {	22;}
}
if(defined(&CLNP_ER_CODES)) {
}
if(defined(&TROLL)) {
    eval 'sub TR_DUPEND () {0x1;}' unless defined(&TR_DUPEND);
    eval 'sub TR_DUPPKT () {0x2;}' unless defined(&TR_DUPPKT);
    eval 'sub TR_DROPPKT () {0x4;}' unless defined(&TR_DROPPKT);
    eval 'sub TR_TRIM () {0x8;}' unless defined(&TR_TRIM);
    eval 'sub TR_CHANGE () {0x10;}' unless defined(&TR_CHANGE);
    eval 'sub TR_MTU () {0x20;}' unless defined(&TR_MTU);
    eval 'sub TR_CHUCK () {0x40;}' unless defined(&TR_CHUCK);
    eval 'sub TR_BLAST () {0x80;}' unless defined(&TR_BLAST);
    eval 'sub TR_RAWLOOP () {0x100;}' unless defined(&TR_RAWLOOP);
    eval 'sub SN_OUTPUT {
        local($clcp, $m) = @_;
	    eval q( &troll_output( ($clcp->{clc_ifp}), $m,  ($clcp->{clc_firsthop}),  ($clcp->{clc_rt})));
    }' unless defined(&SN_OUTPUT);
    eval 'sub SN_MTU {
        local($ifp, $rt) = @_;
	    eval q(((($rt  &&  ($rt->{rt_rmx}->{rmx_mtu})) ?  ($rt->{rt_rmx}->{rmx_mtu}) :  &clnp_badmtu($ifp, $rt,  &__LINE__,  &__FILE__)) -  ($trollctl->{tr_mtu_adj})));
    }' unless defined(&SN_MTU);
    if(defined(&_KERNEL)) {
    }
} else {
    eval 'sub SN_OUTPUT {
        local($clcp, $m) = @_;
	    eval q((* ($clcp->{clc_ifp}->{if_output}))( ($clcp->{clc_ifp}), $m,  ($clcp->{clc_firsthop}),  ($clcp->{clc_rt})));
    }' unless defined(&SN_OUTPUT);
    eval 'sub SN_MTU {
        local($ifp, $rt) = @_;
	    eval q(((($rt  &&  ($rt->{rt_rmx}->{rmx_mtu})) ?  ($rt->{rt_rmx}->{rmx_mtu}) :  &clnp_badmtu($ifp, $rt,  &__LINE__,  &__FILE__))));
    }' unless defined(&SN_MTU);
}
unless(defined(&CLNP_EXTRACT_ADDR)) {
    sub CLNP_EXTRACT_ADDR {
	local($isoa, $hoff, $hend) = @_;
	eval q({  ($isoa->{isoa_len}) = *$hoff;  &if ((((++$hoff) +  ($isoa->{isoa_len})) > $hend) || ( ($isoa->{isoa_len}) > 20) || ( ($isoa->{isoa_len}) == 0)) { $hoff = 0; }  &else {  &bcopy($hoff,  ($isoa->{isoa_genaddr}),  ($isoa->{isoa_len})); $hoff +=  ($isoa->{isoa_len}); } });
    }
}
unless(defined(&CLNP_INSERT_ADDR)) {
    sub CLNP_INSERT_ADDR {
	local($hoff, $isoa) = @_;
	eval q(*$hoff++ = . &isoa_len;  &bcopy((($isoa). &isoa_genaddr), $hoff, ($isoa). &isoa_len); $hoff += ($isoa). &isoa_len;);
    }
}
if(defined(&_KERNEL)) {
    if(defined(&TROLL)) {
    }
    if(defined(&TROLL)) {
    }
}
1;
