require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_NET_PPP_COMP_H_)) {
    eval 'sub _NET_PPP_COMP_H_ () {1;}' unless defined(&_NET_PPP_COMP_H_);
    unless(defined(&DO_BSD_COMPRESS)) {
	eval 'sub DO_BSD_COMPRESS () {1;}' unless defined(&DO_BSD_COMPRESS);
    }
    unless(defined(&DO_DEFLATE)) {
	eval 'sub DO_DEFLATE () {1;}' unless defined(&DO_DEFLATE);
    }
    eval 'sub DO_PREDICTOR_1 () {0;}' unless defined(&DO_PREDICTOR_1);
    eval 'sub DO_PREDICTOR_2 () {0;}' unless defined(&DO_PREDICTOR_2);
    unless(defined(&PPP_COMPRESSORS_MAX)) {
	eval 'sub PPP_COMPRESSORS_MAX () {8;}' unless defined(&PPP_COMPRESSORS_MAX);
    }
    if(defined(&PACKETPTR)) {
	require 'sys/queue.ph';
    }
    eval 'sub DECOMP_OK () {0;}' unless defined(&DECOMP_OK);
    eval 'sub DECOMP_ERROR () {1;}' unless defined(&DECOMP_ERROR);
    eval 'sub DECOMP_FATALERROR () {2;}' unless defined(&DECOMP_FATALERROR);
    eval 'sub CCP_CONFREQ () {1;}' unless defined(&CCP_CONFREQ);
    eval 'sub CCP_CONFACK () {2;}' unless defined(&CCP_CONFACK);
    eval 'sub CCP_CONFNAK () {3;}' unless defined(&CCP_CONFNAK);
    eval 'sub CCP_CONFREJ () {4;}' unless defined(&CCP_CONFREJ);
    eval 'sub CCP_TERMREQ () {5;}' unless defined(&CCP_TERMREQ);
    eval 'sub CCP_TERMACK () {6;}' unless defined(&CCP_TERMACK);
    eval 'sub CCP_RESETREQ () {14;}' unless defined(&CCP_RESETREQ);
    eval 'sub CCP_RESETACK () {15;}' unless defined(&CCP_RESETACK);
    eval 'sub CCP_MAX_OPTION_LENGTH () {64;}' unless defined(&CCP_MAX_OPTION_LENGTH);
    eval 'sub CCP_CODE {
        my($dp) = @_;
	    eval q((($dp)[0]));
    }' unless defined(&CCP_CODE);
    eval 'sub CCP_ID {
        my($dp) = @_;
	    eval q((($dp)[1]));
    }' unless defined(&CCP_ID);
    eval 'sub CCP_LENGTH {
        my($dp) = @_;
	    eval q(((($dp)[2] << 8) + ($dp)[3]));
    }' unless defined(&CCP_LENGTH);
    eval 'sub CCP_HDRLEN () {4;}' unless defined(&CCP_HDRLEN);
    eval 'sub CCP_OPT_CODE {
        my($dp) = @_;
	    eval q((($dp)[0]));
    }' unless defined(&CCP_OPT_CODE);
    eval 'sub CCP_OPT_LENGTH {
        my($dp) = @_;
	    eval q((($dp)[1]));
    }' unless defined(&CCP_OPT_LENGTH);
    eval 'sub CCP_OPT_MINLEN () {2;}' unless defined(&CCP_OPT_MINLEN);
    eval 'sub CI_BSD_COMPRESS () {21;}' unless defined(&CI_BSD_COMPRESS);
    eval 'sub CILEN_BSD_COMPRESS () {3;}' unless defined(&CILEN_BSD_COMPRESS);
    eval 'sub BSD_NBITS {
        my($x) = @_;
	    eval q((($x) & 0x1f));
    }' unless defined(&BSD_NBITS);
    eval 'sub BSD_VERSION {
        my($x) = @_;
	    eval q((($x) >> 5));
    }' unless defined(&BSD_VERSION);
    eval 'sub BSD_CURRENT_VERSION () {1;}' unless defined(&BSD_CURRENT_VERSION);
    eval 'sub BSD_MAKE_OPT {
        my($v, $n) = @_;
	    eval q(((($v) << 5) | ($n)));
    }' unless defined(&BSD_MAKE_OPT);
    eval 'sub BSD_MIN_BITS () {9;}' unless defined(&BSD_MIN_BITS);
    eval 'sub BSD_MAX_BITS () {15;}' unless defined(&BSD_MAX_BITS);
    eval 'sub CI_DEFLATE () {26;}' unless defined(&CI_DEFLATE);
    eval 'sub CI_DEFLATE_DRAFT () {24;}' unless defined(&CI_DEFLATE_DRAFT);
    eval 'sub CILEN_DEFLATE () {4;}' unless defined(&CILEN_DEFLATE);
    eval 'sub DEFLATE_MIN_SIZE () {8;}' unless defined(&DEFLATE_MIN_SIZE);
    eval 'sub DEFLATE_MAX_SIZE () {15;}' unless defined(&DEFLATE_MAX_SIZE);
    eval 'sub DEFLATE_METHOD_VAL () {8;}' unless defined(&DEFLATE_METHOD_VAL);
    eval 'sub DEFLATE_SIZE {
        my($x) = @_;
	    eval q(((($x) >> 4) +  &DEFLATE_MIN_SIZE));
    }' unless defined(&DEFLATE_SIZE);
    eval 'sub DEFLATE_METHOD {
        my($x) = @_;
	    eval q((($x) & 0xf));
    }' unless defined(&DEFLATE_METHOD);
    eval 'sub DEFLATE_MAKE_OPT {
        my($w) = @_;
	    eval q((((($w) -  &DEFLATE_MIN_SIZE) << 4) +  &DEFLATE_METHOD_VAL));
    }' unless defined(&DEFLATE_MAKE_OPT);
    eval 'sub DEFLATE_CHK_SEQUENCE () {0;}' unless defined(&DEFLATE_CHK_SEQUENCE);
    eval 'sub CI_MPPE () {18;}' unless defined(&CI_MPPE);
    eval 'sub CILEN_MPPE () {6;}' unless defined(&CILEN_MPPE);
    eval 'sub MPPE_PAD () {4;}' unless defined(&MPPE_PAD);
    eval 'sub MPPE_MAX_KEY_LEN () {16;}' unless defined(&MPPE_MAX_KEY_LEN);
    eval 'sub MPPE_OPT_40 () {0x1;}' unless defined(&MPPE_OPT_40);
    eval 'sub MPPE_OPT_128 () {0x2;}' unless defined(&MPPE_OPT_128);
    eval 'sub MPPE_OPT_STATEFUL () {0x4;}' unless defined(&MPPE_OPT_STATEFUL);
    eval 'sub MPPE_OPT_56 () {0x8;}' unless defined(&MPPE_OPT_56);
    eval 'sub MPPE_OPT_MPPC () {0x10;}' unless defined(&MPPE_OPT_MPPC);
    eval 'sub MPPE_OPT_D () {0x20;}' unless defined(&MPPE_OPT_D);
    eval 'sub MPPE_OPT_UNSUPPORTED () {( &MPPE_OPT_56| &MPPE_OPT_MPPC| &MPPE_OPT_D);}' unless defined(&MPPE_OPT_UNSUPPORTED);
    eval 'sub MPPE_OPT_UNKNOWN () {0x40;}' unless defined(&MPPE_OPT_UNKNOWN);
    eval 'sub MPPE_C_BIT () {0x1;}' unless defined(&MPPE_C_BIT);
    eval 'sub MPPE_D_BIT () {0x10;}' unless defined(&MPPE_D_BIT);
    eval 'sub MPPE_L_BIT () {0x20;}' unless defined(&MPPE_L_BIT);
    eval 'sub MPPE_S_BIT () {0x40;}' unless defined(&MPPE_S_BIT);
    eval 'sub MPPE_M_BIT () {0x80;}' unless defined(&MPPE_M_BIT);
    eval 'sub MPPE_H_BIT () {0x1;}' unless defined(&MPPE_H_BIT);
    eval 'sub MPPE_ALL_BITS () {( &MPPE_D_BIT| &MPPE_L_BIT| &MPPE_S_BIT| &MPPE_M_BIT| &MPPE_H_BIT);}' unless defined(&MPPE_ALL_BITS);
    eval 'sub MPPE_OPTS_TO_CI {
        my($opts, $ci) = @_;
	    eval q( &do { \'u_char\' * &ptr = $ci;  &if ($opts &  &MPPE_OPT_STATEFUL) * &ptr++ = 0x;  &else * &ptr++ =  &MPPE_H_BIT; * &ptr++ = 0; * &ptr++ = 0; * &ptr = 0;  &if ($opts &  &MPPE_OPT_128) * &ptr |=  &MPPE_S_BIT;  &if ($opts &  &MPPE_OPT_40) * &ptr |=  &MPPE_L_BIT; }  &while ( 0));
    }' unless defined(&MPPE_OPTS_TO_CI);
    eval 'sub MPPE_CI_TO_OPTS {
        my($ci, $opts) = @_;
	    eval q( &do { \'u_char\' * &ptr = $ci; $opts = 0;  &if (!( $ptr[0] &  &MPPE_H_BIT)) $opts |=  &MPPE_OPT_STATEFUL;  &if ( $ptr[3] &  &MPPE_S_BIT) $opts |=  &MPPE_OPT_128;  &if ( $ptr[3] &  &MPPE_L_BIT) $opts |=  &MPPE_OPT_40;  &if ( $ptr[3] &  &MPPE_M_BIT) $opts |=  &MPPE_OPT_56;  &if ( $ptr[3] &  &MPPE_D_BIT) $opts |=  &MPPE_OPT_D;  &if ( $ptr[3] &  &MPPE_C_BIT) $opts |=  &MPPE_OPT_MPPC;  &if ( $ptr[0] & ~ &MPPE_H_BIT) $opts |=  &MPPE_OPT_UNKNOWN;  &if ( $ptr[1] ||  $ptr[2]) $opts |=  &MPPE_OPT_UNKNOWN;  &if ( $ptr[3] & ~ &MPPE_ALL_BITS) $opts |=  &MPPE_OPT_UNKNOWN; }  &while ( 0));
    }' unless defined(&MPPE_CI_TO_OPTS);
    eval 'sub CI_PREDICTOR_1 () {1;}' unless defined(&CI_PREDICTOR_1);
    eval 'sub CILEN_PREDICTOR_1 () {2;}' unless defined(&CILEN_PREDICTOR_1);
    eval 'sub CI_PREDICTOR_2 () {2;}' unless defined(&CI_PREDICTOR_2);
    eval 'sub CILEN_PREDICTOR_2 () {2;}' unless defined(&CILEN_PREDICTOR_2);
}
1;
