require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_LBER_H)) {
    eval 'sub _LBER_H () {1;}' unless defined(&_LBER_H);
    require 'lber_types.ph';
    require 'string.ph';
    eval 'sub LBER_CLASS_UNIVERSAL () {(( &ber_tag_t) 0x);}' unless defined(&LBER_CLASS_UNIVERSAL);
    eval 'sub LBER_CLASS_APPLICATION () {(( &ber_tag_t) 0x40);}' unless defined(&LBER_CLASS_APPLICATION);
    eval 'sub LBER_CLASS_CONTEXT () {(( &ber_tag_t) 0x80);}' unless defined(&LBER_CLASS_CONTEXT);
    eval 'sub LBER_CLASS_PRIVATE () {(( &ber_tag_t) 0xc0);}' unless defined(&LBER_CLASS_PRIVATE);
    eval 'sub LBER_CLASS_MASK () {(( &ber_tag_t) 0xc0);}' unless defined(&LBER_CLASS_MASK);
    eval 'sub LBER_PRIMITIVE () {(( &ber_tag_t) 0x);}' unless defined(&LBER_PRIMITIVE);
    eval 'sub LBER_CONSTRUCTED () {(( &ber_tag_t) 0x20);}' unless defined(&LBER_CONSTRUCTED);
    eval 'sub LBER_ENCODING_MASK () {(( &ber_tag_t) 0x20);}' unless defined(&LBER_ENCODING_MASK);
    eval 'sub LBER_BIG_TAG_MASK () {(( &ber_tag_t) 0x1f);}' unless defined(&LBER_BIG_TAG_MASK);
    eval 'sub LBER_MORE_TAG_MASK () {(( &ber_tag_t) 0x80);}' unless defined(&LBER_MORE_TAG_MASK);
    eval 'sub LBER_ERROR () {(( &ber_tag_t) -1);}' unless defined(&LBER_ERROR);
    eval 'sub LBER_DEFAULT () {(( &ber_tag_t) -1);}' unless defined(&LBER_DEFAULT);
    eval 'sub LBER_BOOLEAN () {(( &ber_tag_t) 0x1);}' unless defined(&LBER_BOOLEAN);
    eval 'sub LBER_INTEGER () {(( &ber_tag_t) 0x2);}' unless defined(&LBER_INTEGER);
    eval 'sub LBER_BITSTRING () {(( &ber_tag_t) 0x3);}' unless defined(&LBER_BITSTRING);
    eval 'sub LBER_OCTETSTRING () {(( &ber_tag_t) 0x4);}' unless defined(&LBER_OCTETSTRING);
    eval 'sub LBER_NULL () {(( &ber_tag_t) 0x5);}' unless defined(&LBER_NULL);
    eval 'sub LBER_ENUMERATED () {(( &ber_tag_t) 0xa);}' unless defined(&LBER_ENUMERATED);
    eval 'sub LBER_SEQUENCE () {(( &ber_tag_t) 0x30);}' unless defined(&LBER_SEQUENCE);
    eval 'sub LBER_SET () {(( &ber_tag_t) 0x31);}' unless defined(&LBER_SET);
    eval 'sub LBER_USE_DER () {0x1;}' unless defined(&LBER_USE_DER);
    eval 'sub LBER_OPT_BER_OPTIONS () {0x1;}' unless defined(&LBER_OPT_BER_OPTIONS);
    eval 'sub LBER_OPT_BER_DEBUG () {0x2;}' unless defined(&LBER_OPT_BER_DEBUG);
    eval 'sub LBER_OPT_BER_REMAINING_BYTES () {0x3;}' unless defined(&LBER_OPT_BER_REMAINING_BYTES);
    eval 'sub LBER_OPT_BER_TOTAL_BYTES () {0x4;}' unless defined(&LBER_OPT_BER_TOTAL_BYTES);
    eval 'sub LBER_OPT_BER_BYTES_TO_WRITE () {0x5;}' unless defined(&LBER_OPT_BER_BYTES_TO_WRITE);
    eval 'sub LBER_OPT_BER_MEMCTX () {0x6;}' unless defined(&LBER_OPT_BER_MEMCTX);
    eval 'sub LBER_OPT_DEBUG_LEVEL () { &LBER_OPT_BER_DEBUG;}' unless defined(&LBER_OPT_DEBUG_LEVEL);
    eval 'sub LBER_OPT_REMAINING_BYTES () { &LBER_OPT_BER_REMAINING_BYTES;}' unless defined(&LBER_OPT_REMAINING_BYTES);
    eval 'sub LBER_OPT_TOTAL_BYTES () { &LBER_OPT_BER_TOTAL_BYTES;}' unless defined(&LBER_OPT_TOTAL_BYTES);
    eval 'sub LBER_OPT_BYTES_TO_WRITE () { &LBER_OPT_BER_BYTES_TO_WRITE;}' unless defined(&LBER_OPT_BYTES_TO_WRITE);
    eval 'sub LBER_OPT_LOG_PRINT_FN () {0x8001;}' unless defined(&LBER_OPT_LOG_PRINT_FN);
    eval 'sub LBER_OPT_MEMORY_FNS () {0x8002;}' unless defined(&LBER_OPT_MEMORY_FNS);
    eval 'sub LBER_OPT_ERROR_FN () {0x8003;}' unless defined(&LBER_OPT_ERROR_FN);
    eval 'sub LBER_OPT_LOG_PRINT_FILE () {0x8004;}' unless defined(&LBER_OPT_LOG_PRINT_FILE);
    eval 'sub LBER_OPT_MEMORY_INUSE () {0x8005;}' unless defined(&LBER_OPT_MEMORY_INUSE);
    eval 'sub LBER_OPT_LOG_PROC () {0x8006;}' unless defined(&LBER_OPT_LOG_PROC);
    eval 'sub LBER_SB_OPT_GET_FD () {1;}' unless defined(&LBER_SB_OPT_GET_FD);
    eval 'sub LBER_SB_OPT_SET_FD () {2;}' unless defined(&LBER_SB_OPT_SET_FD);
    eval 'sub LBER_SB_OPT_HAS_IO () {3;}' unless defined(&LBER_SB_OPT_HAS_IO);
    eval 'sub LBER_SB_OPT_SET_NONBLOCK () {4;}' unless defined(&LBER_SB_OPT_SET_NONBLOCK);
    eval 'sub LBER_SB_OPT_GET_SSL () {7;}' unless defined(&LBER_SB_OPT_GET_SSL);
    eval 'sub LBER_SB_OPT_DATA_READY () {8;}' unless defined(&LBER_SB_OPT_DATA_READY);
    eval 'sub LBER_SB_OPT_SET_READAHEAD () {9;}' unless defined(&LBER_SB_OPT_SET_READAHEAD);
    eval 'sub LBER_SB_OPT_DRAIN () {10;}' unless defined(&LBER_SB_OPT_DRAIN);
    eval 'sub LBER_SB_OPT_NEEDS_READ () {11;}' unless defined(&LBER_SB_OPT_NEEDS_READ);
    eval 'sub LBER_SB_OPT_NEEDS_WRITE () {12;}' unless defined(&LBER_SB_OPT_NEEDS_WRITE);
    eval 'sub LBER_SB_OPT_GET_MAX_INCOMING () {13;}' unless defined(&LBER_SB_OPT_GET_MAX_INCOMING);
    eval 'sub LBER_SB_OPT_SET_MAX_INCOMING () {14;}' unless defined(&LBER_SB_OPT_SET_MAX_INCOMING);
    eval 'sub LBER_SB_OPT_UNGET_BUF () {15;}' unless defined(&LBER_SB_OPT_UNGET_BUF);
    eval 'sub LBER_SB_OPT_OPT_MAX () {15;}' unless defined(&LBER_SB_OPT_OPT_MAX);
    eval 'sub LBER_SBIOD_LEVEL_PROVIDER () {10;}' unless defined(&LBER_SBIOD_LEVEL_PROVIDER);
    eval 'sub LBER_SBIOD_LEVEL_TRANSPORT () {20;}' unless defined(&LBER_SBIOD_LEVEL_TRANSPORT);
    eval 'sub LBER_SBIOD_LEVEL_APPLICATION () {30;}' unless defined(&LBER_SBIOD_LEVEL_APPLICATION);
    eval 'sub LBER_OPT_SOCKBUF_DESC () {0x1000;}' unless defined(&LBER_OPT_SOCKBUF_DESC);
    eval 'sub LBER_OPT_SOCKBUF_OPTIONS () {0x1001;}' unless defined(&LBER_OPT_SOCKBUF_OPTIONS);
    eval 'sub LBER_OPT_SOCKBUF_DEBUG () {0x1002;}' unless defined(&LBER_OPT_SOCKBUF_DEBUG);
    eval 'sub LBER_OPT_ON () {(( &void *)  &ber_pvt_opt_on);}' unless defined(&LBER_OPT_ON);
    eval 'sub LBER_OPT_OFF () {(( &void *) 0);}' unless defined(&LBER_OPT_OFF);
    eval 'sub LBER_OPT_SUCCESS () {(0);}' unless defined(&LBER_OPT_SUCCESS);
    eval 'sub LBER_OPT_ERROR () {(-1);}' unless defined(&LBER_OPT_ERROR);
    eval 'sub LBER_SBIOD_READ_NEXT {
        my( $sbiod, $buf, $len ) = @_;
	    eval q(( ($sbiod)-> ($sbiod_next->{sbiod_io}->{sbi_read})( ($sbiod)-> &sbiod_next, $buf, $len ) ));
    }' unless defined(&LBER_SBIOD_READ_NEXT);
    eval 'sub LBER_SBIOD_WRITE_NEXT {
        my( $sbiod, $buf, $len ) = @_;
	    eval q(( ($sbiod)-> ($sbiod_next->{sbiod_io}->{sbi_write})( ($sbiod)-> &sbiod_next, $buf, $len ) ));
    }' unless defined(&LBER_SBIOD_WRITE_NEXT);
    eval 'sub LBER_SBIOD_CTRL_NEXT {
        my( $sbiod, $opt, $arg ) = @_;
	    eval q(( ($sbiod)-> &sbiod_next ? ( ($sbiod)-> ($sbiod_next->{sbiod_io}->{sbi_ctrl})( ($sbiod)-> &sbiod_next, $opt, $arg ) ) : 0));
    }' unless defined(&LBER_SBIOD_CTRL_NEXT);
    eval 'sub LBER_BV_ALLOC () {0x1;}' unless defined(&LBER_BV_ALLOC);
    eval 'sub LBER_BV_NOTERM () {0x2;}' unless defined(&LBER_BV_NOTERM);
    eval 'sub LBER_BV_STRING () {0x4;}' unless defined(&LBER_BV_STRING);
    eval 'sub LBER_FLUSH_FREE_NEVER () {(0x);}' unless defined(&LBER_FLUSH_FREE_NEVER);
    eval 'sub LBER_FLUSH_FREE_ON_SUCCESS () {(0x1);}' unless defined(&LBER_FLUSH_FREE_ON_SUCCESS);
    eval 'sub LBER_FLUSH_FREE_ON_ERROR () {(0x2);}' unless defined(&LBER_FLUSH_FREE_ON_ERROR);
    eval 'sub LBER_FLUSH_FREE_ALWAYS () {( &LBER_FLUSH_FREE_ON_SUCCESS| &LBER_FLUSH_FREE_ON_ERROR);}' unless defined(&LBER_FLUSH_FREE_ALWAYS);
    eval 'sub ber_bvstr {
        my($a) = @_;
	    eval q((( &ber_str2bv)(($a), 0, 0,  &NULL)));
    }' unless defined(&ber_bvstr);
    eval 'sub ber_bvstrdup {
        my($a) = @_;
	    eval q((( &ber_str2bv)(($a), 0, 1,  &NULL)));
    }' unless defined(&ber_bvstrdup);
    eval 'sub ber_bvcmp {
        my($v1,$v2) = @_;
	    eval q((($v1)-> &bv_len < ($v2)-> &bv_len ? -1: (($v1)-> &bv_len > ($v2)-> &bv_len ? 1:  &memcmp(($v1)-> &bv_val, ($v2)-> &bv_val, ($v1)-> &bv_len) )));
    }' unless defined(&ber_bvcmp);
    eval 'sub ber_errno () {(*( &ber_errno_addr)());}' unless defined(&ber_errno);
    eval 'sub LBER_ERROR_NONE () {0;}' unless defined(&LBER_ERROR_NONE);
    eval 'sub LBER_ERROR_PARAM () {0x1;}' unless defined(&LBER_ERROR_PARAM);
    eval 'sub LBER_ERROR_MEMORY () {0x2;}' unless defined(&LBER_ERROR_MEMORY);
}
1;
