*
* 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 */