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 7 - Datagram Delivery Protocol (DDP) / DDP Reference
Routines / Sending DDP Datagrams


BuildDDPwds

The BuildDDPwds procedure creates a write-data structure that you can use to send a DDP packet to a remote socket.

PROCEDURE BuildDDPwds (wdsPtr,headerPtr,dataPtr: Ptr; 
                        destAddress: AddrBlock; DDPType: Integer;
                        dataLen: Integer);
wdsPtr
A pointer to a buffer that you provide that will contain the write-
data structure. The write-data structure created by BuildDDPwds is
14 bytes long.
headerPtr
A pointer to a buffer that you provide that will contain the packet header. This buffer must be at least 17 bytes long.
dataPtr
A pointer to the data that you want to send. The maximum amount of data that you can include in a DDP data packet is 586 bytes.
destAddress
The address of the socket to which you want to send the data. The address consists of the network number, the node ID, and the socket number in AddrBlock format; see "The Address Block Record" on page 7-35.
A node ID of 255 is the broadcast address; that is, the datagram is broadcast to all nodes in the network. Note, however, that broadcast datagrams are not forwarded by routers and so are not sent to nodes
on other networks in the internet.
DDPType
The DDP protocol type of the packet you are sending. DDP protocol types 1 through 15 are reserved for use by Apple Computer, Inc. You can use other protocol types as you see fit.
dataLen
The length of the data pointed to by the dataPtr parameter.
DESCRIPTION
The BuildDDPwds procedure creates a write-data structure that consists of a pointer for the header, a length word and pointer for the data, and a terminating 0 word. Because the first pointer in the write-data structure must point to an odd address, it is difficult
to use Pascal to create a write-data structure. In this case, using the BuildDDPwds procedure simplifies the process. However, the BuildDDPwds procedure assumes that the data that you are sending is in a single block. In most cases, if you are using DDP directly to send data across a network, a single block of data should be adequate.

You must provide a 17-byte buffer for the header block, a 14-byte buffer to hold the write-data structure, and a pointer to the data you want to send. (The header block
is only 16 bytes, but because it begins on an odd address, the first byte is not used.)

SPECIAL CONSIDERATIONS
Memory that you allocate for the write-data structure buffers belongs to DDP and must be nonrelocatable until the PWriteDDP function completes execution, after which you can either reuse the memory or release it.

ASSEMBLY-LANGUAGE INFORMATION
The BuildDDPwds procedure is implemented entirely in the MPW interface files. There is no assembly-language equivalent to this procedure.

SEE ALSO
The write-data structure is defined in "Creating a DDP Write-Data Structure" on page 7-12.

To send the data pointed to by your write-data structure, use the PWriteDDP function described on page 7-41.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996