Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Networking /
Chapter 5 - AppleTalk Data Stream Protocol (ADSP) / ADSP Reference
Routines / Establishing and Terminating an ADSP Connection


dspOpen

The dspOpen routine opens a connection end. You can open a connection end in request mode, passive mode, accept mode, or establish mode. You use the PBControl function to call the dspOpen routine. See "Routines" on page 5-43 for a description of the PBControl function.

-->ioCompletionProcPtrA pointer to completion routine.
<--ioResultOSErrThe function result.
-->ioCRefNumIntegerThe driver reference number.
-->csCodeIntegerAlways dspOpen for this function.
-->ccbRefNumIntegerThe CCB reference number.
<--localCIDIntegerThe ID of this connection end.
<->remoteCIDIntegerThe ID of remote connection end.
<->remoteAddressAddrBlockA remote internet address.
-->filterAddressAddrBlockA filter for open-connection requests.
<->sendSeqLongIntThe initial send sequence number.
<->sendWindowIntegerThe initial size of remote receive queue.
-->recvSeqLongIntThe initial receive sequence number.
<->attnSendSeqLongIntThe attention send sequence number.
-->attnRecvSeqLongIntThe attention receive sequence number.
-->ocModeByteThe connection-opening mode.
-->ocIntervalByteThe interval between open requests.
-->ocMaximumByteThe number of open-connection
request retries.

The use of parameters by the dspOpen routine depends on the mode in which the routine is executed, as follows:
ocRequestocPassiveocAcceptocEstablish
-->ioCompletion-->ioCompletion-->ioCompletion-->ioCompletion
<--ioResult<--ioResult<--ioResult<--ioResult
-->ioCRefNum-->ioCRefNum-->ioCRefNum-->ioCRefNum
-->csCode-->csCode-->csCode-->csCode
-->ccbRefNum-->ccbRefNum-->ccbRefNum-->ccbRefNum
<--localCID<--localCID<--localCID--localCID
<--remoteCID<--remoteCID-->remoteCID-->remoteCID
-->remoteAddress<--remoteAddress-->remoteAddress-->remoteAddress
-->filterAddress-->filterAddress--filterAddress--filterAddress
<--sendSeq<--sendSeq-->sendSeq-->sendSeq
<--sendWindow<--sendWindow-->sendWindow-->sendWindow
--recvSeq--recvSeq--recvSeq-->recvSeq
<--attnSendSeq<--attnSendSeq-->attnSendSeq-->attnSendSeq
--attnRecvSeq--attnRecvSeq--attnRecvSeq-->attnRecvSeq
-->ocMode-->ocMode-->ocMode-->ocMode
-->ocInterval-->ocInterval-->ocInterval--ocInterval
-->ocMaximum-->ocMaximum-->ocMaximum--ocMaximum
Key: --> input <-- output <-> input and output -- not used

Field Description
csCode
The routine selector, always equal to dspOpen for this routine.
ccbRefNum
The connection control block (CCB) reference number that was returned by the dspInit routine for the connection end that you want to use.
localCID
The identification number of the local connection end. This number is assigned by ADSP when you open the connection. ADSP includes this number in every packet sent to a remote connection end. Before you call the dspOpen routine in ocEstablish mode, you must call the dspNewCID routine to cause ADSP to assign this value.
remoteCID
The identification number of the remote connection end. This parameter is returned by the dspOpen routine in the ocRequest and ocPassive modes. A connection server must provide this number to the dspOpen routine when the server executes the routine in ocAccept mode; in this case, the connection server obtains the remoteCID value from the dspCLListen routine. You must provide the remoteCID value to the dspOpen routine when you use the routine in ocEstablish mode.
remoteAddress
The internet address of the remote socket with which you wish to establish communications. This address consists of a 2-byte network number, a 1-byte node ID, and a 1-byte socket number. You must provide this parameter when you call the dspOpen routine in the ocRequest or ocEstablish mode. This parameter is returned by the dspOpen routine when you call the routine in the ocPassive mode. When you call the dspOpen routine in the ocAccept mode, you must use the value for the remoteAddress parameter that was returned by the dspCLListen routine.
filterAddress
The internet address of the socket from which you will accept a connection request. The address consists of three fields: a 2-byte network number, a 1-byte node ID, and a 1-byte socket number. Specify 0 for any of these fields for which you wish to impose no restrictions. If you specify a filter address of $00082500, for example, the connection end accepts a connection request from any socket at node $25 of network $0008. Set the filterAddress parameter equal to the remoteAddress parameter to accept a connection only with the socket to which you sent a connection request.
When you execute the dspOpen routine in the ocPassive mode, you can receive a connection request from any ADSP connection end on the internet. When you execute the dspOpen routine in the ocRequest mode, your connection end can receive a connection request acknowledgment from an address different from the one you specified in the remoteAddress parameter only if the remote address you specified was that of a connection listener. In either case, you can use the filterAddress parameter to avoid acknowl-
edging unwanted connection requests.
When you execute the dspOpen routine in the ocAccept mode, your connection listener has already received and decided to accept the connection request. You can specify a filter address for a connection listener with the dspCLListen routine. A connection server can use the dspCLDeny routine to deny a connection request that was accepted by its connection listener.
You cannot use the filter address when you execute the dspOpen routine in ocEstablish mode.
sendSeq
The sequence number of the first byte that the local connection end will send to the remote connection end. ADSP uses this number to coordinate communications and to check for errors. ADSP returns a value for the sendSeq parameter when you execute the dspOpen routine in the ocRequest or ocPassive mode. When you execute the dspOpen routine in the ocAccept mode, you must specify
the value for the sendSeq parameter that was returned by the dspCLListen routine. You must provide the value for this parameter when you execute the dspOpen routine in the ocEstablish mode.
sendWindow
The sequence number of the last byte that the remote connection end has buffer space to receive. ADSP uses this number to coordinate communications and to check for errors. ADSP returns
a value for the sendWindow parameter when you execute the dspOpen routine in the ocRequest or ocPassive mode. When you execute the dspOpen routine in the ocAccept mode, you must specify the value for the sendWindow parameter that was returned by the dspCLListen routine. You must provide the value for this parameter when you execute the dspOpen routine in the ocEstablish mode.
recvSeq
The sequence number of the next byte that the local connection
end expects to receive. ADSP uses this number to coordinate communications and to check for errors. You must provide the value for this parameter when you execute the dspOpen routine
in the ocEstablish mode. The dspOpen routine does not use
this parameter when you execute it in any other mode.
attnSendSeq
The sequence number of the next attention packet that the local connection end will transmit. ADSP uses this number to coordinate communications and to check for errors. ADSP returns a value
for the attnSendSeq parameter when you execute the dspOpen routine in the ocRequest or ocPassive mode. When you execute the dspOpen routine in the ocAccept mode, you must specify
the value for the attnSendSeq parameter that was returned
by the dspCLListen routine. You must provide the value for
this parameter when you execute the dspOpen routine in the ocEstablish mode.
attnRecvSeq
The sequence number of the next attention packet that the local connection end expects to receive. ADSP uses this number to ensure that packets are delivered in the correct order and to check for errors. You must provide a value for this parameter when you execute the dspOpen routine in the ocEstablish mode. The dspOpen routine does not use this parameter when you execute it in any other mode.
ocMode
The mode in which the dspOpen routine is to operate, as follows:
 ModeValueMeaning
 ocRequest1ADSP attempts to open a connection with the socket you specify.
 ocPassive2The connection end waits to receive a connection request.
 ocAccept3The connection server accepts and acknowledges receipt of a connection request.
 ocEstablish4ADSP considers the connection established and open; you are responsible for setting up and synchronizing both connection ends.
ocInterval
The period between transmissions of open-connection requests.
If the remote connection end does not acknowledge or deny an open-connection request, ADSP retransmits the request after a
time period specified by this parameter. The time period used by ADSP is (ocInterval 10) ticks, or (ocInterval/6) seconds. For example, if you set the ocInterval parameter to 3, the time period between retransmissions is 30 ticks (1/2 second). You can set the ocInterval parameter to any value from 1 (1/6 second) to
180 (30 seconds). If you specify 0 for the ocInterval parameter, ADSP uses the default value of 6 (1 second).
You must provide a value for the ocInterval parameter when you execute the dspOpen routine in the ocRequest, ocPassive, or ocAccept mode. The dspOpen routine does not use this parameter when you execute it in the ocEstablish mode.
ocMaximum
The maximum number of times to retransmit an open-connection request before ADSP terminates execution of the dspOpen routine. If you specify 0 for the ocMaximum parameter, ADSP uses the default value of 3. If you specify 255 for the ocMaximum parameter, ADSP retransmits the open-connection request indefinitely until the remote connection end either acknowledges or denies the request.
You must provide a value for the ocMaximum parameter when you execute the dspOpen routine in the ocRequest, ocPassive, or ocAccept mode. The dspOpen routine does not use this parameter when you execute it in the ocEstablish mode.
DESCRIPTION
The dspOpen routine opens a connection end. You set the ocMode field of the parameter block to specify the opening mode that the dspOpen routine is to use. The dspOpen routine puts a connection end into one of the four following opening modes:

ASSEMBLY-LANGUAGE INFORMATION
To execute the dspOpen routine from assembly language, call the _Control trap macro with a value of dspOpen in the csCode field of the parameter block.

RESULT CODES
noErr0No error
errOpenDenied-1273Open request denied by recipient
errOpening-1277Attempt to open connection failed
errState-1278Connection end must be closed
errAborted-1279Request aborted by dspRemove or dspClose routine
errRefNum-1280Bad connection reference number

Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996