require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_NET80211_IEEE80211_VAR_H_)) {
    eval 'sub _NET80211_IEEE80211_VAR_H_ () {1;}' unless defined(&_NET80211_IEEE80211_VAR_H_);
    require 'net80211/ieee80211.ph';
    require 'net80211/ieee80211_crypto.ph';
    require 'net80211/ieee80211_ioctl.ph';
    require 'net80211/ieee80211_node.ph';
    require 'net80211/ieee80211_proto.ph';
    eval 'sub IEEE80211_CHAN_MAX () {255;}' unless defined(&IEEE80211_CHAN_MAX);
    eval 'sub IEEE80211_CHAN_ANY () {0xffff;}' unless defined(&IEEE80211_CHAN_ANY);
    eval 'sub IEEE80211_CHAN_ANYC () {(  &IEEE80211_CHAN_ANY);}' unless defined(&IEEE80211_CHAN_ANYC);
    eval 'sub IEEE80211_TXPOWER_MAX () {100;}' unless defined(&IEEE80211_TXPOWER_MAX);
    eval 'sub IEEE80211_TXPOWER_MIN () {-50;}' unless defined(&IEEE80211_TXPOWER_MIN);
    eval("sub IEEE80211_T_DS () { 0; }") unless defined(&IEEE80211_T_DS);
    eval("sub IEEE80211_T_FH () { 1; }") unless defined(&IEEE80211_T_FH);
    eval("sub IEEE80211_T_OFDM () { 2; }") unless defined(&IEEE80211_T_OFDM);
    eval("sub IEEE80211_T_TURBO () { 3; }") unless defined(&IEEE80211_T_TURBO);
    eval("sub IEEE80211_T_XR () { 4; }") unless defined(&IEEE80211_T_XR);
    eval 'sub IEEE80211_T_CCK () { &IEEE80211_T_DS;}' unless defined(&IEEE80211_T_CCK);
    eval("sub IEEE80211_MODE_AUTO () { 0; }") unless defined(&IEEE80211_MODE_AUTO);
    eval("sub IEEE80211_MODE_11A () { 1; }") unless defined(&IEEE80211_MODE_11A);
    eval("sub IEEE80211_MODE_11B () { 2; }") unless defined(&IEEE80211_MODE_11B);
    eval("sub IEEE80211_MODE_11G () { 3; }") unless defined(&IEEE80211_MODE_11G);
    eval("sub IEEE80211_MODE_FH () { 4; }") unless defined(&IEEE80211_MODE_FH);
    eval("sub IEEE80211_MODE_TURBO () { 5; }") unless defined(&IEEE80211_MODE_TURBO);
    eval 'sub IEEE80211_MODE_MAX () {( &IEEE80211_MODE_TURBO+1);}' unless defined(&IEEE80211_MODE_MAX);
    eval("sub IEEE80211_M_STA () { 1; }") unless defined(&IEEE80211_M_STA);
    eval("sub IEEE80211_M_IBSS () { 0; }") unless defined(&IEEE80211_M_IBSS);
    eval("sub IEEE80211_M_AHDEMO () { 3; }") unless defined(&IEEE80211_M_AHDEMO);
    eval("sub IEEE80211_M_HOSTAP () { 6; }") unless defined(&IEEE80211_M_HOSTAP);
    eval("sub IEEE80211_M_MONITOR () { 8; }") unless defined(&IEEE80211_M_MONITOR);
    eval("sub IEEE80211_PROT_NONE () { 0; }") unless defined(&IEEE80211_PROT_NONE);
    eval("sub IEEE80211_PROT_CTSONLY () { 1; }") unless defined(&IEEE80211_PROT_CTSONLY);
    eval("sub IEEE80211_PROT_RTSCTS () { 2; }") unless defined(&IEEE80211_PROT_RTSCTS);
    eval 'sub IEEE80211_IS_CHAN_FHSS {
        my($_c) = @_;
	    eval q(((($_c)-> &ic_flags &  &IEEE80211_CHAN_FHSS) ==  &IEEE80211_CHAN_FHSS));
    }' unless defined(&IEEE80211_IS_CHAN_FHSS);
    eval 'sub IEEE80211_IS_CHAN_A {
        my($_c) = @_;
	    eval q(((($_c)-> &ic_flags &  &IEEE80211_CHAN_A) ==  &IEEE80211_CHAN_A));
    }' unless defined(&IEEE80211_IS_CHAN_A);
    eval 'sub IEEE80211_IS_CHAN_B {
        my($_c) = @_;
	    eval q(((($_c)-> &ic_flags &  &IEEE80211_CHAN_B) ==  &IEEE80211_CHAN_B));
    }' unless defined(&IEEE80211_IS_CHAN_B);
    eval 'sub IEEE80211_IS_CHAN_PUREG {
        my($_c) = @_;
	    eval q(((($_c)-> &ic_flags &  &IEEE80211_CHAN_PUREG) ==  &IEEE80211_CHAN_PUREG));
    }' unless defined(&IEEE80211_IS_CHAN_PUREG);
    eval 'sub IEEE80211_IS_CHAN_G {
        my($_c) = @_;
	    eval q(((($_c)-> &ic_flags &  &IEEE80211_CHAN_G) ==  &IEEE80211_CHAN_G));
    }' unless defined(&IEEE80211_IS_CHAN_G);
    eval 'sub IEEE80211_IS_CHAN_T {
        my($_c) = @_;
	    eval q(((($_c)-> &ic_flags &  &IEEE80211_CHAN_T) ==  &IEEE80211_CHAN_T));
    }' unless defined(&IEEE80211_IS_CHAN_T);
    eval 'sub IEEE80211_IS_CHAN_TG {
        my($_c) = @_;
	    eval q(((($_c)-> &ic_flags &  &IEEE80211_CHAN_TG) ==  &IEEE80211_CHAN_TG));
    }' unless defined(&IEEE80211_IS_CHAN_TG);
    eval 'sub IEEE80211_IS_CHAN_2GHZ {
        my($_c) = @_;
	    eval q(((($_c)-> &ic_flags &  &IEEE80211_CHAN_2GHZ) != 0));
    }' unless defined(&IEEE80211_IS_CHAN_2GHZ);
    eval 'sub IEEE80211_IS_CHAN_5GHZ {
        my($_c) = @_;
	    eval q(((($_c)-> &ic_flags &  &IEEE80211_CHAN_5GHZ) != 0));
    }' unless defined(&IEEE80211_IS_CHAN_5GHZ);
    eval 'sub IEEE80211_IS_CHAN_OFDM {
        my($_c) = @_;
	    eval q(((($_c)-> &ic_flags &  &IEEE80211_CHAN_OFDM) != 0));
    }' unless defined(&IEEE80211_IS_CHAN_OFDM);
    eval 'sub IEEE80211_IS_CHAN_CCK {
        my($_c) = @_;
	    eval q(((($_c)-> &ic_flags &  &IEEE80211_CHAN_CCK) != 0));
    }' unless defined(&IEEE80211_IS_CHAN_CCK);
    eval 'sub IEEE80211_IS_CHAN_GFSK {
        my($_c) = @_;
	    eval q(((($_c)-> &ic_flags &  &IEEE80211_CHAN_GFSK) != 0));
    }' unless defined(&IEEE80211_IS_CHAN_GFSK);
    eval 'sub IEEE80211_IS_CHAN_XR {
        my($_c) = @_;
	    eval q(((($_c)-> &ic_flags &  &IEEE80211_CHAN_XR) != 0));
    }' unless defined(&IEEE80211_IS_CHAN_XR);
    eval 'sub IEEE80211_FH_CHANMOD () {80;}' unless defined(&IEEE80211_FH_CHANMOD);
    eval 'sub IEEE80211_FH_CHAN {
        my($set,$pat) = @_;
	    eval q(((($set)-1)* &IEEE80211_FH_CHANMOD+($pat)));
    }' unless defined(&IEEE80211_FH_CHAN);
    eval 'sub IEEE80211_FH_CHANSET {
        my($chan) = @_;
	    eval q((($chan)/ &IEEE80211_FH_CHANMOD+1));
    }' unless defined(&IEEE80211_FH_CHANSET);
    eval 'sub IEEE80211_FH_CHANPAT {
        my($chan) = @_;
	    eval q((($chan)% &IEEE80211_FH_CHANMOD));
    }' unless defined(&IEEE80211_FH_CHANPAT);
    eval 'sub IEEE80211_PS_SLEEP () {0x1;}' unless defined(&IEEE80211_PS_SLEEP);
    eval 'sub IEEE80211_PS_MAX_QUEUE () {50;}' unless defined(&IEEE80211_PS_MAX_QUEUE);
    eval 'sub IEEE80211_SCAN_UNLOCKED () {0x;}' unless defined(&IEEE80211_SCAN_UNLOCKED);
    eval 'sub IEEE80211_SCAN_LOCKED () {0x1;}' unless defined(&IEEE80211_SCAN_LOCKED);
    eval 'sub IEEE80211_SCAN_REQUEST () {0x2;}' unless defined(&IEEE80211_SCAN_REQUEST);
    eval 'sub IEEE80211_SCAN_RESUME () {0x4;}' unless defined(&IEEE80211_SCAN_RESUME);
    eval 'sub ic_if () { ($ic_ac->{ac_if});}' unless defined(&ic_if);
    eval 'sub ic_softc () { ($ic_if->{if_softc});}' unless defined(&ic_softc);
    eval 'sub IEEE80211_ADDR_EQ {
        my($a1,$a2) = @_;
	    eval q(( &memcmp($a1,$a2, &IEEE80211_ADDR_LEN) == 0));
    }' unless defined(&IEEE80211_ADDR_EQ);
    eval 'sub IEEE80211_ADDR_COPY {
        my($dst,$src) = @_;
	    eval q( &memcpy($dst,$src, &IEEE80211_ADDR_LEN));
    }' unless defined(&IEEE80211_ADDR_COPY);
    eval 'sub IEEE80211_F_ASCAN () {0x1;}' unless defined(&IEEE80211_F_ASCAN);
    eval 'sub IEEE80211_F_SIBSS () {0x2;}' unless defined(&IEEE80211_F_SIBSS);
    eval 'sub IEEE80211_F_WEPON () {0x100;}' unless defined(&IEEE80211_F_WEPON);
    eval 'sub IEEE80211_F_IBSSON () {0x200;}' unless defined(&IEEE80211_F_IBSSON);
    eval 'sub IEEE80211_F_PMGTON () {0x400;}' unless defined(&IEEE80211_F_PMGTON);
    eval 'sub IEEE80211_F_DESBSSID () {0x800;}' unless defined(&IEEE80211_F_DESBSSID);
    eval 'sub IEEE80211_F_SCANAP () {0x1000;}' unless defined(&IEEE80211_F_SCANAP);
    eval 'sub IEEE80211_F_ROAMING () {0x2000;}' unless defined(&IEEE80211_F_ROAMING);
    eval 'sub IEEE80211_F_SWRETRY () {0x4000;}' unless defined(&IEEE80211_F_SWRETRY);
    eval 'sub IEEE80211_F_TXPMGT () {0x18000;}' unless defined(&IEEE80211_F_TXPMGT);
    eval 'sub IEEE80211_F_TXPOW_OFF () {0x;}' unless defined(&IEEE80211_F_TXPOW_OFF);
    eval 'sub IEEE80211_F_TXPOW_FIXED () {0x8000;}' unless defined(&IEEE80211_F_TXPOW_FIXED);
    eval 'sub IEEE80211_F_TXPOW_AUTO () {0x10000;}' unless defined(&IEEE80211_F_TXPOW_AUTO);
    eval 'sub IEEE80211_F_SHSLOT () {0x20000;}' unless defined(&IEEE80211_F_SHSLOT);
    eval 'sub IEEE80211_F_SHPREAMBLE () {0x40000;}' unless defined(&IEEE80211_F_SHPREAMBLE);
    eval 'sub IEEE80211_F_USEPROT () {0x100000;}' unless defined(&IEEE80211_F_USEPROT);
    eval 'sub IEEE80211_F_USERMASK () {0xf0000000;}' unless defined(&IEEE80211_F_USERMASK);
    eval 'sub IEEE80211_C_WEP () {0x1;}' unless defined(&IEEE80211_C_WEP);
    eval 'sub IEEE80211_C_IBSS () {0x2;}' unless defined(&IEEE80211_C_IBSS);
    eval 'sub IEEE80211_C_PMGT () {0x4;}' unless defined(&IEEE80211_C_PMGT);
    eval 'sub IEEE80211_C_HOSTAP () {0x8;}' unless defined(&IEEE80211_C_HOSTAP);
    eval 'sub IEEE80211_C_AHDEMO () {0x10;}' unless defined(&IEEE80211_C_AHDEMO);
    eval 'sub IEEE80211_C_SWRETRY () {0x20;}' unless defined(&IEEE80211_C_SWRETRY);
    eval 'sub IEEE80211_C_TXPMGT () {0x40;}' unless defined(&IEEE80211_C_TXPMGT);
    eval 'sub IEEE80211_C_SHSLOT () {0x80;}' unless defined(&IEEE80211_C_SHSLOT);
    eval 'sub IEEE80211_C_SHPREAMBLE () {0x100;}' unless defined(&IEEE80211_C_SHPREAMBLE);
    eval 'sub IEEE80211_C_MONITOR () {0x200;}' unless defined(&IEEE80211_C_MONITOR);
    eval 'sub IEEE80211_C_SCANALL () {0x400;}' unless defined(&IEEE80211_C_SCANALL);
    eval 'sub IEEE80211_F_DOSORT () {0x1;}' unless defined(&IEEE80211_F_DOSORT);
    eval 'sub IEEE80211_F_DOFRATE () {0x2;}' unless defined(&IEEE80211_F_DOFRATE);
    eval 'sub IEEE80211_F_DONEGO () {0x4;}' unless defined(&IEEE80211_F_DONEGO);
    eval 'sub IEEE80211_F_DODEL () {0x8;}' unless defined(&IEEE80211_F_DODEL);
    if(defined(&IEEE80211_DEBUG)) {
	eval 'sub IEEE80211_DPRINTF {
	    my($X) = @_;
    	    eval q( &do {  &if ( &ieee80211_debug)  &printf $X; }  &while(0));
	}' unless defined(&IEEE80211_DPRINTF);
	eval 'sub IEEE80211_DPRINTF2 {
	    my($X) = @_;
    	    eval q( &do {  &if ( &ieee80211_debug>1)  &printf $X; }  &while(0));
	}' unless defined(&IEEE80211_DPRINTF2);
    } else {
	eval 'sub IEEE80211_DPRINTF {
	    my($X) = @_;
    	    eval q();
	}' unless defined(&IEEE80211_DPRINTF);
	eval 'sub IEEE80211_DPRINTF2 {
	    my($X) = @_;
    	    eval q();
	}' unless defined(&IEEE80211_DPRINTF2);
    }
}
1;
