X.25 Call Setup

Encode Call Request


Encode address, facilities and user data into a call request packet.

#include "call.h"

LResult call_EncodeCallRequest
        CallSetupData     data,
        CallBuffer        buffer,
        CallBufferSize    size
datainput for data to encode
bufferoutput buffer for call request packet
sizesize of buffer in bytes

call_EncodeCallRequest() encodes a C language representation of address, facilities and user data into a call request packet. The example code given below shows how to set up the data structures passed to call_EncodeCallRequest(). Facilities and user data are optional.

Return Values

If successful, call_EncodeCallRequest() returns a non-negative value indicating the number of bytes of encoded data. Otherwise, it returns a negative value. Failure to encode indicates that the input parameters are invalid.

See Also


CallSetupDataStruct    callSetupData;
AddressBlock           addressBlock;
FacilitiesStruct       facilitiesStruct;
char                   userData[4];
char                   packet[128];
LResult                result;

/* Set up call setup data block */
callSetupData.address       = &addressBlock;
callSetupData.facilities    = &facilitiesStruct;
callSetupData.userData      = userData;
callSetupData.userDataCount = sizeof(userData);

/* Set up address information */
addressBlock.format = call_STANDARD_ADDRESS_FORMAT;
strcpy(addressBlock.dte.std.calledDTE,  calledDte);
strcpy(addressBlock.dte.std.callingDTE, callingDte);

/* Set up facilities information */
memset(&facilitiesStruct, 0x0, sizeof(facilitiesStruct));
facilitiesStruct.recvPacketSize = 256;
facilitiesStruct.sendPacketSize = 256;
facilitiesStruct.recvWindowSize = 5;
facilitiesStruct.sendWindowSize = 5;

/* Set up user data (4 bytes of 0) */
memset(userData, 0x0, sizeof(userData));

result = call_EncodeCallRequest(&callSetupData, packet, (uint) sizeof(packet));

if (result < 0)
    /* Error encoding */
    lgo_ConnectRequest(cid, packet, result);