require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_NET_IF_BRIDGEVAR_H_)) {
    eval 'sub _NET_IF_BRIDGEVAR_H_ () {1;}' unless defined(&_NET_IF_BRIDGEVAR_H_);
    require 'sys/callout.ph';
    require 'sys/queue.ph';
    require 'sys/mutex.ph';
    require 'sys/condvar.ph';
    eval 'sub BRDGADD () {0;}' unless defined(&BRDGADD);
    eval 'sub BRDGDEL () {1;}' unless defined(&BRDGDEL);
    eval 'sub BRDGGIFFLGS () {2;}' unless defined(&BRDGGIFFLGS);
    eval 'sub BRDGSIFFLGS () {3;}' unless defined(&BRDGSIFFLGS);
    eval 'sub BRDGSCACHE () {4;}' unless defined(&BRDGSCACHE);
    eval 'sub BRDGGCACHE () {5;}' unless defined(&BRDGGCACHE);
    eval 'sub OBRDGGIFS () {6;}' unless defined(&OBRDGGIFS);
    eval 'sub OBRDGRTS () {7;}' unless defined(&OBRDGRTS);
    eval 'sub BRDGSADDR () {8;}' unless defined(&BRDGSADDR);
    eval 'sub BRDGSTO () {9;}' unless defined(&BRDGSTO);
    eval 'sub BRDGGTO () {10;}' unless defined(&BRDGGTO);
    eval 'sub BRDGDADDR () {11;}' unless defined(&BRDGDADDR);
    eval 'sub BRDGFLUSH () {12;}' unless defined(&BRDGFLUSH);
    eval 'sub BRDGGPRI () {13;}' unless defined(&BRDGGPRI);
    eval 'sub BRDGSPRI () {14;}' unless defined(&BRDGSPRI);
    eval 'sub BRDGGHT () {15;}' unless defined(&BRDGGHT);
    eval 'sub BRDGSHT () {16;}' unless defined(&BRDGSHT);
    eval 'sub BRDGGFD () {17;}' unless defined(&BRDGGFD);
    eval 'sub BRDGSFD () {18;}' unless defined(&BRDGSFD);
    eval 'sub BRDGGMA () {19;}' unless defined(&BRDGGMA);
    eval 'sub BRDGSMA () {20;}' unless defined(&BRDGSMA);
    eval 'sub BRDGSIFPRIO () {21;}' unless defined(&BRDGSIFPRIO);
    eval 'sub BRDGSIFCOST () {22;}' unless defined(&BRDGSIFCOST);
    eval 'sub BRDGGFILT () {23;}' unless defined(&BRDGGFILT);
    eval 'sub BRDGSFILT () {24;}' unless defined(&BRDGSFILT);
    eval 'sub BRDGGIFS () {25;}' unless defined(&BRDGGIFS);
    eval 'sub BRDGRTS () {26;}' unless defined(&BRDGRTS);
    eval 'sub IFBIF_LEARNING () {0x1;}' unless defined(&IFBIF_LEARNING);
    eval 'sub IFBIF_DISCOVER () {0x2;}' unless defined(&IFBIF_DISCOVER);
    eval 'sub IFBIF_STP () {0x4;}' unless defined(&IFBIF_STP);
    eval 'sub IFBIF_PROTECTED () {0x8;}' unless defined(&IFBIF_PROTECTED);
    eval 'sub IFBIFBITS () {"\\020\\1LEARNING\\2DISCOVER\\3STP\\4PROTECTED";}' unless defined(&IFBIFBITS);
    eval 'sub IFBF_FLUSHDYN () {0x;}' unless defined(&IFBF_FLUSHDYN);
    eval 'sub IFBF_FLUSHALL () {0x1;}' unless defined(&IFBF_FLUSHALL);
    eval 'sub IFBF_FILT_USEIPF () {0x1;}' unless defined(&IFBF_FILT_USEIPF);
    eval 'sub IFBF_FILT_MASK () {0x1;}' unless defined(&IFBF_FILT_MASK);
    eval 'sub BSTP_IFSTATE_DISABLED () {0;}' unless defined(&BSTP_IFSTATE_DISABLED);
    eval 'sub BSTP_IFSTATE_LISTENING () {1;}' unless defined(&BSTP_IFSTATE_LISTENING);
    eval 'sub BSTP_IFSTATE_LEARNING () {2;}' unless defined(&BSTP_IFSTATE_LEARNING);
    eval 'sub BSTP_IFSTATE_FORWARDING () {3;}' unless defined(&BSTP_IFSTATE_FORWARDING);
    eval 'sub BSTP_IFSTATE_BLOCKING () {4;}' unless defined(&BSTP_IFSTATE_BLOCKING);
    eval 'sub ifbic_buf () { ($ifbic_ifbicu->{ifbicu_buf});}' unless defined(&ifbic_buf);
    eval 'sub ifbic_req () { ($ifbic_ifbicu->{ifbicu_req});}' unless defined(&ifbic_req);
    eval 'sub IFBAF_TYPEMASK () {0x3;}' unless defined(&IFBAF_TYPEMASK);
    eval 'sub IFBAF_DYNAMIC () {0x;}' unless defined(&IFBAF_DYNAMIC);
    eval 'sub IFBAF_STATIC () {0x1;}' unless defined(&IFBAF_STATIC);
    eval 'sub IFBAFBITS () {"\\020\\1STATIC";}' unless defined(&IFBAFBITS);
    eval 'sub ifbac_buf () { ($ifbac_ifbacu->{ifbacu_buf});}' unless defined(&ifbac_buf);
    eval 'sub ifbac_req () { ($ifbac_ifbacu->{ifbacu_req});}' unless defined(&ifbac_req);
    eval 'sub ifbrp_csize () { ($ifbrp_ifbrpu->{ifbrpu_int32});}' unless defined(&ifbrp_csize);
    eval 'sub ifbrp_ctime () { ($ifbrp_ifbrpu->{ifbrpu_int32});}' unless defined(&ifbrp_ctime);
    eval 'sub ifbrp_prio () { ($ifbrp_ifbrpu->{ifbrpu_int16});}' unless defined(&ifbrp_prio);
    eval 'sub ifbrp_hellotime () { ($ifbrp_ifbrpu->{ifbrpu_int8});}' unless defined(&ifbrp_hellotime);
    eval 'sub ifbrp_fwddelay () { ($ifbrp_ifbrpu->{ifbrpu_int8});}' unless defined(&ifbrp_fwddelay);
    eval 'sub ifbrp_maxage () { ($ifbrp_ifbrpu->{ifbrpu_int8});}' unless defined(&ifbrp_maxage);
    eval 'sub ifbrp_filter () { ($ifbrp_ifbrpu->{ifbrpu_int32});}' unless defined(&ifbrp_filter);
    if(defined(&_KERNEL)) {
	if(defined(&_KERNEL_OPT)) {
	    require './net/opt_net_mpsafe.ph';
	}
	require 'sys/pserialize.ph';
	require 'sys/pslist.ph';
	require 'sys/psref.ph';
	require 'sys/workqueue.ph';
	require 'net/pktqueue.ph';
	eval 'sub BRIDGE_LOCK_OBJ {
	    my($_sc) = @_;
    	    eval q((($_sc)-> ($sc_iflist_psref->{bip_lock})));
	}' unless defined(&BRIDGE_LOCK_OBJ);
	eval 'sub BRIDGE_LOCK {
	    my($_sc) = @_;
    	    eval q( &mutex_enter( &BRIDGE_LOCK_OBJ($_sc)));
	}' unless defined(&BRIDGE_LOCK);
	eval 'sub BRIDGE_UNLOCK {
	    my($_sc) = @_;
    	    eval q( &mutex_exit( &BRIDGE_LOCK_OBJ($_sc)));
	}' unless defined(&BRIDGE_UNLOCK);
	eval 'sub BRIDGE_LOCKED {
	    my($_sc) = @_;
    	    eval q( &mutex_owned( &BRIDGE_LOCK_OBJ($_sc)));
	}' unless defined(&BRIDGE_LOCKED);
	eval 'sub BRIDGE_PSZ_RENTER {
	    my($__s) = @_;
    	    eval q( &do { $__s =  &pserialize_read_enter(); }  &while (0));
	}' unless defined(&BRIDGE_PSZ_RENTER);
	eval 'sub BRIDGE_PSZ_REXIT {
	    my($__s) = @_;
    	    eval q( &do {  &pserialize_read_exit($__s); }  &while (0));
	}' unless defined(&BRIDGE_PSZ_REXIT);
	eval 'sub BRIDGE_PSZ_PERFORM {
	    my($_sc) = @_;
    	    eval q( &pserialize_perform(($_sc)-> ($sc_iflist_psref->{bip_psz})));
	}' unless defined(&BRIDGE_PSZ_PERFORM);
	eval 'sub BRIDGE_IFLIST_READER_FOREACH {
	    my($_bif, $_sc) = @_;
    	    eval q( &PSLIST_READER_FOREACH(($_bif), (($_sc)-> ($sc_iflist_psref->{bip_iflist})), \'struct bridge_iflist\',  &bif_next));
	}' unless defined(&BRIDGE_IFLIST_READER_FOREACH);
	eval 'sub BRIDGE_IFLIST_WRITER_FOREACH {
	    my($_bif, $_sc) = @_;
    	    eval q( &PSLIST_WRITER_FOREACH(($_bif), (($_sc)-> ($sc_iflist_psref->{bip_iflist})), \'struct bridge_iflist\',  &bif_next));
	}' unless defined(&BRIDGE_IFLIST_WRITER_FOREACH);
    }
}
1;
