require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_NET_ND_H_)) {
    eval 'sub _NET_ND_H_ () {1;}' unless defined(&_NET_ND_H_);
    eval 'sub ND_LLINFO_PURGE () {-3;}' unless defined(&ND_LLINFO_PURGE);
    eval 'sub ND_LLINFO_NOSTATE () {-2;}' unless defined(&ND_LLINFO_NOSTATE);
    eval 'sub ND_LLINFO_WAITDELETE () {-1;}' unless defined(&ND_LLINFO_WAITDELETE);
    eval 'sub ND_LLINFO_INCOMPLETE () {0;}' unless defined(&ND_LLINFO_INCOMPLETE);
    eval 'sub ND_LLINFO_REACHABLE () {1;}' unless defined(&ND_LLINFO_REACHABLE);
    eval 'sub ND_LLINFO_STALE () {2;}' unless defined(&ND_LLINFO_STALE);
    eval 'sub ND_LLINFO_DELAY () {3;}' unless defined(&ND_LLINFO_DELAY);
    eval 'sub ND_LLINFO_PROBE () {4;}' unless defined(&ND_LLINFO_PROBE);
    eval 'sub ND_LLINFO_UNREACHABLE () {5;}' unless defined(&ND_LLINFO_UNREACHABLE);
    if(defined(&_KERNEL)) {
	eval 'sub ND_IS_LLINFO_PROBREACH {
	    my($ln) = @_;
    	    eval q((($ln)-> &ln_state >  &ND_LLINFO_INCOMPLETE));
	}' unless defined(&ND_IS_LLINFO_PROBREACH);
	eval 'sub ND_IS_LLINFO_PERMANENT {
	    my($ln) = @_;
    	    eval q(((($ln)-> &ln_expire == 0)  && (($ln)-> &ln_state >  &ND_LLINFO_INCOMPLETE)));
	}' unless defined(&ND_IS_LLINFO_PERMANENT);
	eval 'sub ND_TIMER_IMMEDIATE () {0;}' unless defined(&ND_TIMER_IMMEDIATE);
	eval 'sub ND_TIMER_TICK () {1;}' unless defined(&ND_TIMER_TICK);
	eval 'sub ND_TIMER_REACHABLE () {2;}' unless defined(&ND_TIMER_REACHABLE);
	eval 'sub ND_TIMER_RETRANS () {3;}' unless defined(&ND_TIMER_RETRANS);
	eval 'sub ND_TIMER_RETRANS_BACKOFF () {4;}' unless defined(&ND_TIMER_RETRANS_BACKOFF);
	eval 'sub ND_TIMER_EXPIRE () {5;}' unless defined(&ND_TIMER_EXPIRE);
	eval 'sub ND_TIMER_DELAY () {6;}' unless defined(&ND_TIMER_DELAY);
	eval 'sub ND_TIMER_GC () {7;}' unless defined(&ND_TIMER_GC);
	eval 'sub MAX_REACHABLE_TIME () {3600000;}' unless defined(&MAX_REACHABLE_TIME);
	eval 'sub REACHABLE_TIME () {30000;}' unless defined(&REACHABLE_TIME);
	eval 'sub RETRANS_TIMER () {1000;}' unless defined(&RETRANS_TIMER);
	eval 'sub MAX_RETRANS_TIMER () {60000;}' unless defined(&MAX_RETRANS_TIMER);
	eval 'sub BACKOFF_MULTIPLE () {3;}' unless defined(&BACKOFF_MULTIPLE);
	eval 'sub MIN_RANDOM_FACTOR () {512;}' unless defined(&MIN_RANDOM_FACTOR);
	eval 'sub MAX_RANDOM_FACTOR () {1536;}' unless defined(&MAX_RANDOM_FACTOR);
	eval 'sub ND_COMPUTE_RTIME {
	    my($x) = @_;
    	    eval q((( &MIN_RANDOM_FACTOR * ($x >> 10)) + ( &cprng_fast32() & (( &MAX_RANDOM_FACTOR -  &MIN_RANDOM_FACTOR) * ($x >> 10)))));
	}' unless defined(&ND_COMPUTE_RTIME);
    }
}
1;
