User guide

August 2001 103
Configuring the E1 Environment
Example 5 shows how to load the R2-CCITT protocol using
RHT_LOAD_PROTOCOL.
Example 5. RHT_LOAD_PROTOCOL Sample Code
#include brktddm.h
int main(int argc, char **argv)
{
BRKT_HANDLE BoardHandle;
FILE* ProtocolFile;
BOOLEAN IoctlResult;
BRKT_SIZE_T BytesReturned;
BRKT_SIZE_T FileSize, BytesRead;
USHORT* pProtocolBuffer;
struct LoadProtocol_s Protocol;
BoardHandle = BrktOpenDevice (BRKT_DEVICE_E1_BOARD, 0);
/* Open Protocol File */
ProtocolFile = fopen ("R2_CCITT.MTO", "rb");
FileSize = _filelength (_fileno (ProtocolFile);
pProtocolBuffer = malloc (FileSize);
if (pProtocolBuffer == NULL)
{
printf ("Can't allocate memory for protocol.\n");
return(2);
}
BytesRead = fread (pProtocolBuffer, sizeof (UCHAR), FileSize,
ProtocolFile);
fclose (ProtocolFile);