require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_NETGRAPH_BLUETOOTH_H_)) {
    eval 'sub _NETGRAPH_BLUETOOTH_H_ () {1;}' unless defined(&_NETGRAPH_BLUETOOTH_H_);
    undef(&KASSERT) if defined(&KASSERT);
    eval 'sub KASSERT {
        my($a, $b) = @_;
	    eval q();
    }' unless defined(&KASSERT);
    undef(&mtx_init) if defined(&mtx_init);
    undef(&mtx_lock) if defined(&mtx_lock);
    undef(&mtx_unlock) if defined(&mtx_unlock);
    undef(&mtx_assert) if defined(&mtx_assert);
    undef(&mtx_destroy) if defined(&mtx_destroy);
    eval 'sub mtx_init {
        my($a, $b, $c, $d) = @_;
	    eval q();
    }' unless defined(&mtx_init);
    eval 'sub mtx_lock {
        my($a) = @_;
	    eval q();
    }' unless defined(&mtx_lock);
    eval 'sub mtx_unlock {
        my($a) = @_;
	    eval q();
    }' unless defined(&mtx_unlock);
    eval 'sub mtx_assert {
        my($a, $b) = @_;
	    eval q();
    }' unless defined(&mtx_assert);
    eval 'sub mtx_destroy {
        my($a) = @_;
	    eval q();
    }' unless defined(&mtx_destroy);
    eval 'sub ACCEPT_LOCK () {
        eval q();
    }' unless defined(&ACCEPT_LOCK);
    eval 'sub SOCK_LOCK {
        my($a) = @_;
	    eval q();
    }' unless defined(&SOCK_LOCK);
    eval 'sub NG_FREE_M {
        my($m) = @_;
	    eval q( &do {  &if (($m)) {  &m_freem(($m)); ($m) =  &NULL; } }  &while (0));
    }' unless defined(&NG_FREE_M);
    eval 'sub NG_BLUETOOTH_VERSION () {1;}' unless defined(&NG_BLUETOOTH_VERSION);
    if(defined(&SYSCTL_DECL)) {
    }
    eval 'sub NG_BT_MBUFQ_INIT {
        my($q, $_maxlen) = @_;
	    eval q( &do { ($q)-> &head =  &NULL; ($q)-> &tail =  &NULL; ($q)-> &len = 0; ($q)-> &maxlen = ($_maxlen); ($q)-> &drops = 0; }  &while (0));
    }' unless defined(&NG_BT_MBUFQ_INIT);
    eval 'sub NG_BT_MBUFQ_DESTROY {
        my($q) = @_;
	    eval q( &do {  &NG_BT_MBUFQ_DRAIN(($q)); }  &while (0));
    }' unless defined(&NG_BT_MBUFQ_DESTROY);
    eval 'sub NG_BT_MBUFQ_FIRST {
        my($q) = @_;
	    eval q(($q)-> &head);
    }' unless defined(&NG_BT_MBUFQ_FIRST);
    eval 'sub NG_BT_MBUFQ_LEN {
        my($q) = @_;
	    eval q(($q)-> &len);
    }' unless defined(&NG_BT_MBUFQ_LEN);
    eval 'sub NG_BT_MBUFQ_FULL {
        my($q) = @_;
	    eval q((($q)-> &len >= ($q)-> &maxlen));
    }' unless defined(&NG_BT_MBUFQ_FULL);
    eval 'sub NG_BT_MBUFQ_DROP {
        my($q) = @_;
	    eval q(($q)-> &drops ++);
    }' unless defined(&NG_BT_MBUFQ_DROP);
    eval 'sub NG_BT_MBUFQ_ENQUEUE {
        my($q, $i) = @_;
	    eval q( &do { ($i)-> &m_nextpkt =  &NULL;  &if (($q)-> &tail ==  &NULL) ($q)-> &head = ($i);  &else ($q)-> ($tail->{m_nextpkt}) = ($i); ($q)-> &tail = ($i); ($q)-> &len ++; }  &while (0));
    }' unless defined(&NG_BT_MBUFQ_ENQUEUE);
    eval 'sub NG_BT_MBUFQ_DEQUEUE {
        my($q, $i) = @_;
	    eval q( &do { ($i) = ($q)-> &head;  &if (($i) !=  &NULL) { ($q)-> &head = ($q)-> ($head->{m_nextpkt});  &if (($q)-> &head ==  &NULL) ($q)-> &tail =  &NULL; ($q)-> &len --; ($i)-> &m_nextpkt =  &NULL; } }  &while (0));
    }' unless defined(&NG_BT_MBUFQ_DEQUEUE);
    eval 'sub NG_BT_MBUFQ_PREPEND {
        my($q, $i) = @_;
	    eval q( &do { ($i)-> &m_nextpkt = ($q)-> &head;  &if (($q)-> &tail ==  &NULL) ($q)-> &tail = ($i); ($q)-> &head = ($i); ($q)-> &len ++; }  &while (0));
    }' unless defined(&NG_BT_MBUFQ_PREPEND);
    eval 'sub NG_BT_MBUFQ_DRAIN {
        my($q) = @_;
	    eval q( &do { \'struct mbuf\' * &m =  &NULL;  &for (;;) {  &NG_BT_MBUFQ_DEQUEUE(($q),  &m);  &if ( &m ==  &NULL)  &break;  &NG_FREE_M( &m); } }  &while (0));
    }' unless defined(&NG_BT_MBUFQ_DRAIN);
    eval 'sub NG_BT_ITEMQ_INIT {
        my($q, $_maxlen) = @_;
	    eval q( &NG_BT_MBUFQ_INIT(($q), ($_maxlen)));
    }' unless defined(&NG_BT_ITEMQ_INIT);
    eval 'sub NG_BT_ITEMQ_DESTROY {
        my($q) = @_;
	    eval q( &do {  &NG_BT_ITEMQ_DRAIN(($q)); }  &while (0));
    }' unless defined(&NG_BT_ITEMQ_DESTROY);
    eval 'sub NG_BT_ITEMQ_FIRST {
        my($q) = @_;
	    eval q( &NG_BT_MBUFQ_FIRST(($q)));
    }' unless defined(&NG_BT_ITEMQ_FIRST);
    eval 'sub NG_BT_ITEMQ_LEN {
        my($q) = @_;
	    eval q( &NG_BT_MBUFQ_LEN(($q)));
    }' unless defined(&NG_BT_ITEMQ_LEN);
    eval 'sub NG_BT_ITEMQ_FULL {
        my($q) = @_;
	    eval q( &NG_BT_MBUFQ_FULL(($q)));
    }' unless defined(&NG_BT_ITEMQ_FULL);
    eval 'sub NG_BT_ITEMQ_DROP {
        my($q) = @_;
	    eval q( &NG_BT_MBUFQ_DROP(($q)));
    }' unless defined(&NG_BT_ITEMQ_DROP);
    eval 'sub NG_BT_ITEMQ_ENQUEUE {
        my($q, $i) = @_;
	    eval q( &do { ($i)-> &el_next =  &NULL;  &if (($q)-> &tail ==  &NULL) ($q)-> &head = ($i);  &else ($q)-> ($tail->{el_next}) = ($i); ($q)-> &tail = ($i); ($q)-> &len ++; }  &while (0));
    }' unless defined(&NG_BT_ITEMQ_ENQUEUE);
    eval 'sub NG_BT_ITEMQ_DEQUEUE {
        my($q, $i) = @_;
	    eval q( &do { ($i) = ($q)-> &head;  &if (($i) !=  &NULL) { ($q)-> &head = ($q)-> ($head->{el_next});  &if (($q)-> &head ==  &NULL) ($q)-> &tail =  &NULL; ($q)-> &len --; ($i)-> &el_next =  &NULL; } }  &while (0));
    }' unless defined(&NG_BT_ITEMQ_DEQUEUE);
    eval 'sub NG_BT_ITEMQ_PREPEND {
        my($q, $i) = @_;
	    eval q( &do { ($i)-> &el_next = ($q)-> &head;  &if (($q)-> &tail ==  &NULL) ($q)-> &tail = ($i); ($q)-> &head = ($i); ($q)-> &len ++; }  &while (0));
    }' unless defined(&NG_BT_ITEMQ_PREPEND);
    eval 'sub NG_BT_ITEMQ_DRAIN {
        my($q) = @_;
	    eval q( &do { \'struct ng_item\' * &i =  &NULL;  &for (;;) {  &NG_BT_ITEMQ_DEQUEUE(($q),  &i);  &if ( &i ==  &NULL)  &break;  &NG_FREE_ITEM( &i); } }  &while (0));
    }' unless defined(&NG_BT_ITEMQ_DRAIN);
}
1;
