call_EncodeCallRequest()
Encode address, facilities and user data into a call request packet.
#include "call.h" LResult call_EncodeCallRequest ( CallSetupData data, CallBuffer buffer, CallBufferSize size );
data | input for data to encode |
buffer | output buffer for call request packet |
size | size 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.
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.
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 */ } else { lgo_ConnectRequest(cid, packet, result); }