6100 ADCCP Programming Manual

Appendix C ADCCP Programming Example
Using C
069225 Tandem Computers Incorporated C–1
This appendix contains a sample application written in the C programming language.
The example opens a line, makes a (1) SET CONFIGURATION request, then closes the
line after printing a message based on the status code returned by the SET
CONFIGURATION response.
/*
*--------------------------------------------------------------------
*
* This is an example for the 6100 ADCCP Programming Manual.
* It opens an ADCCP line, makes a (1) SET CONFIGURATION request,
* then closes the line after printing a message based on the
* status code returned by the SET CONFIGURATION response.
*
*--------------------------------------------------------------------
*/
#pragma XMEM
#pragma runnable, inspect, symbols
#include <talh> nolist
#include <stdlibh> nolist
#include <stringh> nolist
#include <fcntlh> nolist
#include <stdioh> nolist
#include <cextdecs (OPEN,DEVICEINFO,\
FILEINFO,DEBUG,\
ABEND,SETMODE,WRITEREAD)> nolist
extern short Open_line(char *open_name);
extern void Close_line(short rfnum,char *close_name);
extern void Receive(short rfnum,short fcode,short txtout,
short textin,short length,struct message *dPtr);
extern short Set_config(short rfnum);
extern void Status_codes(short code);
struct message {
unsigned short function : 1;
unsigned short modifier : 1;
unsigned short request_id : 1;
unsigned short text_out : 1;
unsigned short text_in : 1;
unsigned short MAXFRAME : 1;
unsigned short MODE : 1;
unsigned short AFLDn : 1;
unsigned short EXTENDED : 1;
unsigned short STATIONS : 1;
unsigned short TRANSLATE : 1;
unsigned short RNR_TIMER : 2;
unsigned short XOFFSET : 1;
unsigned short XLENGTH : 1;
unsigned short POLL : 1;
unsigned short SREJ : 1;
unsigned short NOREJ : 1;
unsigned short Reserved : 1;
unsigned short TWA : 1;
unsigned short WINDOW : 1;
unsigned short SWITCHED : 1;
unsigned short HALFDUPLEX : 1;
unsigned short NOCARRFATAL : 1;
unsigned short SWINCARRIER : 1;
unsigned short SWOUTCARRIER : 1;