/*
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
*
- * @APPLE_LICENSE_HEADER_START@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
- * The contents of this file constitute Original Code as defined in and
- * are subject to the Apple Public Source License Version 1.1 (the
- * "License"). You may not use this file except in compliance with the
- * License. Please obtain a copy of the License at
- * http://www.apple.com/publicsource and read it before using this file.
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
*
- * This Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
- * @APPLE_LICENSE_HEADER_END@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Copyright (c) 1996 Apple Computer, Inc.
*
* File: ri.c
*/
+
+#ifdef AURP_SUPPORT
+
#include <sys/errno.h>
#include <sys/types.h>
#include <sys/param.h>
gbuf_t *m;
aurp_hdr_t *hdrp;
short len = 0;
- int s, msize = 0;
+ int msize = 0;
- ATDISABLE(s, aurpgen_lock);
/* make sure we're in a valid state to send RI response */
if ((state->snd_state == AURPSTATE_Unconnected) ||
(state->snd_state == AURPSTATE_WaitingForRIAck2)) {
- ATENABLE(s, aurpgen_lock);
return;
}
state->snd_state = AURPSTATE_WaitingForRIAck1;
if (state->rsp_m == 0) {
- ATENABLE(s, aurpgen_lock);
msize = sizeof(aurp_hdr_t);
if ((m = (gbuf_t *)gbuf_alloc(msize+AURP_MaxPktSize, PRI_MED)) == 0) {
timeout(AURPsndRIRsp_locked, state, AURP_RetryInterval*HZ);
timeout(AURPsndRIRsp_locked, state, AURP_RetryInterval*HZ);
state->snd_tmo = 1;
- if (msize == 0)
- ATENABLE(s, aurpgen_lock);
/* send the packet */
if (m) {
short len = 0;
int s, msize = 0;
- ATDISABLE(s, aurpgen_lock);
/* make sure we're in a valid state to send update */
if (state->snd_next_entry || (state->upd_m == 0) ||
(state->snd_state == AURPSTATE_Unconnected) ||
(state->snd_state == AURPSTATE_WaitingForRIAck1)) {
- ATENABLE(s, aurpgen_lock);
return;
}
state->snd_state = AURPSTATE_WaitingForRIAck2;
if (state->snd_tmo == 0) {
- ATENABLE(s, aurpgen_lock);
msize = sizeof(aurp_hdr_t);
m = state->upd_m;
len = gbuf_len(m);
timeout(AURPsndRIUpd_locked, state, AURP_RetryInterval*HZ);
state->snd_tmo = 1;
- if (msize == 0)
- ATENABLE(s, aurpgen_lock);
/* send the packet */
if (m) {
aurp_hdr_t *hdrp = (aurp_hdr_t *)gbuf_rptr(m);
int s;
- ATDISABLE(s, aurpgen_lock);
/* make sure we're in a valid state to accept it */
if ((state->snd_state == AURPSTATE_Unconnected) ||
(state->snd_state == AURPSTATE_WaitingForRIAck2)) {
- ATENABLE(s, aurpgen_lock);
dPrintf(D_M_AURP, D_L_WARNING, ("AURPrcvRIReq: unexpected request\n"));
gbuf_freem(m);
return;
/* check for the correct connection id */
if (hdrp->connection_id != state->snd_connection_id) {
- ATENABLE(s, aurpgen_lock);
dPrintf(D_M_AURP, D_L_WARNING,
("AURPrcvRIReq: invalid connection id, r=%d, m=%d\n",
hdrp->connection_id, state->snd_connection_id));
gbuf_freem(state->rsp_m);
state->rsp_m = 0;
}
- ATENABLE(s, aurpgen_lock);
AURPsndRIRsp(state);
- } else
- ATENABLE(s, aurpgen_lock);
+ }
gbuf_freem(m);
}
gbuf_t *m;
{
aurp_hdr_t *hdrp = (aurp_hdr_t *)gbuf_rptr(m);
- int s;
- ATDISABLE(s, aurpgen_lock);
/* make sure we're in a valid state to accept it */
if (state->rcv_state != AURPSTATE_WaitingForRIRsp) {
- ATENABLE(s, aurpgen_lock);
dPrintf(D_M_AURP, D_L_WARNING, ("AURPrcvRIRsp: unexpected response\n"));
gbuf_freem(m);
return;
/* check for the correct connection id */
if (hdrp->connection_id != state->rcv_connection_id) {
- ATENABLE(s, aurpgen_lock);
dPrintf(D_M_AURP, D_L_WARNING,
("AURPrcvRIRsp: invalid connection id, r=%d, m=%d\n",
hdrp->connection_id, state->rcv_connection_id));
/* check for the correct sequence number */
if (hdrp->sequence_number != state->rcv_sequence_number) {
- ATENABLE(s, aurpgen_lock);
if ( ((state->rcv_sequence_number == AURP_FirstSeqNum) &&
(hdrp->sequence_number == AURP_LastSeqNum)) ||
(hdrp->sequence_number == (state->rcv_sequence_number-1)) ) {
gbuf_rinc(m,sizeof(*hdrp));
if (hdrp->flags & AURPFLG_LAST)
state->rcv_state = AURPSTATE_Connected;
- ATENABLE(s, aurpgen_lock);
dPrintf(D_M_AURP, D_L_INFO, ("AURPrcvRIRsp: len=%ld\n", gbuf_len(m)));
gbuf_t *dat_m;
aurp_hdr_t *hdrp = (aurp_hdr_t *)gbuf_rptr(m);
unsigned char snd_state;
- int s;
int flag;
dPrintf(D_M_AURP, D_L_INFO, ("AURPrcvRIAck: state=%d\n",
state->snd_state));
- ATDISABLE(s, aurpgen_lock);
/* make sure we're in a valid state to accept it */
snd_state = state->snd_state;
/* update state info */
state->snd_state = AURPSTATE_Connected;
- ATENABLE(s, aurpgen_lock);
if (state->snd_next_entry) /* more RI responses to send? */
AURPsndRIRsp(state);
AURPsndZRsp(state, dat_m, flag);
else if (dat_m)
gbuf_freem(dat_m);
- } else
- ATENABLE(s, aurpgen_lock);
+ }
gbuf_freem(m);
}
(!(state->snd_sui & AURPFLG_ND))) continue;
if ((ev == AURPEV_NetDistChange) &&
(!(state->snd_sui & AURPFLG_NDC))) continue;
- ATDISABLE(s, aurpgen_lock);
if ((state->snd_state != AURPSTATE_Unconnected) &&
(state->snd_state != AURPSTATE_WaitingForRIAck2)) {
if ((m = state->upd_m) == 0) {
/*
* we don't have the RI update buffer yet, allocate one
*/
- ATENABLE(s, aurpgen_lock);
if ((m = (gbuf_t *)gbuf_alloc(msize+AURP_MaxPktSize, PRI_HI)) == 0)
continue;
- ATDISABLE(s, aurpgen_lock);
state->upd_m = m;
gbuf_rinc(m,msize);
gbuf_wset(m,0);
* if the RI update buffer is full, send the RI update now
*/
if (gbuf_len(m) > (AURP_MaxPktSize-6)) {
- ATENABLE(s, aurpgen_lock);
AURPsndRIUpd(state);
continue;
}
}
- ATENABLE(s, aurpgen_lock);
}
}
+
+#endif /* AURP_SUPPORT */