/*
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
*
- * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * @APPLE_LICENSE_HEADER_START@
*
- * 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.
+ * 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.
*
- * 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
+ * This 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
+ * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
+ * License for the specific language governing rights and limitations
+ * under the License.
*
- * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ * @APPLE_LICENSE_HEADER_END@
*/
/*
* Packet.c
gbuf_t *mp;
ADSP_FRAMEPtr adspp;
ADSP_OPEN_DATAPtr adspop;
+ int s;
op = (ADSP_OPEN_DATAPtr)&f->data[0]; /* Point to Open-Connection parms */
len -= ADSP_FRAME_LEN;
adspop = (ADSP_OPEN_DATAPtr)gbuf_wptr(mp);
gbuf_winc(mp,ADSP_OPEN_FRAME_LEN);
UAS_UAS(adspop->dstCID, f->CID);
- UAS_ASSIGN_HTON(adspop->version, 0x100);
+ UAS_ASSIGN(adspop->version, 0x100);
adsp_sendddp(0, mp, DDPL_FRAME_LEN + ADSP_FRAME_LEN +
ADSP_OPEN_FRAME_LEN, &addr, DDP_ADSP);
m.addr = addr;
m.socket = dsoc;
m.descriptor = f->descriptor;
- m.srcCID = UAS_VALUE_NTOH(f->CID);
- m.dstCID = UAS_VALUE_NTOH(op->dstCID); /* On even-byte boundry */
+ m.srcCID = UAS_VALUE(f->CID);
+ m.dstCID = UAS_VALUE(op->dstCID); /* On even-byte boundry */
m.idx = ((f->descriptor & ADSP_CONTROL_MASK) - 1) * 4;
/*
(ProcPtr)MatchListener)) == 0)
return 1;
+ ATDISABLE(s, sp->lock);
p = (struct adspcmd *)&sp->opb;
while (n = (struct adspcmd *)p->qLink) /* Hunt down list of listens */
{
p->qLink = n->qLink; /* Unlink this param block */
n->u.openParams.remoteCID = m.srcCID;
*((AddrUnionPtr)&n->u.openParams.remoteAddress) = addr;
- n->u.openParams.sendSeq = UAL_VALUE_NTOH(f->pktNextRecvSeq);
- n->u.openParams.sendWindow = UAS_VALUE_NTOH(f->pktRecvWdw);
- n->u.openParams.attnSendSeq = UAL_VALUE_NTOH(op->pktAttnRecvSeq);
+ n->u.openParams.sendSeq = netdw(UAL_VALUE(f->pktNextRecvSeq));
+ n->u.openParams.sendWindow = netw(UAS_VALUE(f->pktRecvWdw));
+ n->u.openParams.attnSendSeq = netdw(UAL_VALUE(op->pktAttnRecvSeq));
n->ioResult = 0;
+ ATENABLE(s, sp->lock);
completepb(sp, n); /* complete copy of request */
/* complete(n, 0); */
return 0;
} /* while */
+ ATENABLE(s, sp->lock);
return 1;
}
*spPtr = sp; /* Save ptr to stream we just found */
+ ATDISABLE(s, sp->lock);
sp->openState = m.t->openState; /* Move to next state (may be same) */
sp->state = m.t->state; /* Move to next state (may be same) */
if (m.t->action & A_SAVEPARMS) { /* Need to Save open-conn parms */
- sp->firstRtmtSeq = sp->sendSeq = UAL_VALUE_NTOH(f->pktNextRecvSeq);
- sp->sendWdwSeq = UAL_VALUE_NTOH(f->pktNextRecvSeq) + UAS_VALUE_NTOH(f->pktRecvWdw) - 1;
- sp->attnSendSeq = UAL_VALUE_NTOH(op->pktAttnRecvSeq); /* on even boundry */
+ sp->firstRtmtSeq = sp->sendSeq = netdw(UAL_VALUE(f->pktNextRecvSeq));
+ sp->sendWdwSeq = netdw(UAL_VALUE(f->pktNextRecvSeq)) + netw(UAS_VALUE(f->pktRecvWdw)) - 1;
+ sp->attnSendSeq = netdw(UAL_VALUE(op->pktAttnRecvSeq)); /* on even boundry */
- sp->remCID = UAS_VALUE_NTOH(f->CID); /* Save Source CID as RemCID */
+ sp->remCID = UAS_VALUE(f->CID); /* Save Source CID as RemCID */
UAS_UAS(sp->of.dstCID, f->CID); /* Save CID in open ctl packet */
sp->remoteAddress = addr; /* Save his address */
}
+ ATENABLE(s, sp->lock);
if (m.t->action & A_DENY) { /* We've been denied ! */
DoClose(sp, errOpenDenied, -1);
int len;
AddrUnion a;
int dsoc;
+ int s;
register DDPX_FRAME *ddp; /* DDP frame pointer */
register ADSP_FRAMEPtr f; /* Frame */
CCBPtr sp;
return -1;
f = (ADSP_FRAMEPtr)(bp + DDPL_FRAME_LEN);
- len = UAS_VALUE_NTOH(ddp->ddpx_length) & 0x3ff; /* (ten bits of length) */
+ len = UAS_VALUE(ddp->ddpx_length) & 0x3ff; /* (ten bits of length) */
len -= DDPL_FRAME_LEN;
if (len < (sizeof(ADSP_FRAME) - 1)) /* Packet too small */
return -1; /* mark the failure */
/* This pkt may also ack some data we sent */
CheckRecvSeq(sp, f);
RemoveTimerElem(&adspGlobal.fastTimers, &sp->RetryTimer);
+ ATDISABLE(s, sp->lock);
sp->sendSeq = sp->firstRtmtSeq;
sp->pktSendCnt = 0;
sp->waitingAck = 0;
sp->callSend = 1;
+ ATENABLE(s, sp->lock);
} else
goto ignore;
break;