[ Previous | Next | Contents | Home | Search ]
7318 Model S20 Guide and Reference

Appendix L: Buddy Mode Application Program Interface (API)

The following information describes the API for buddy mode. Included is a short explanation of how to show or change buddy mode settings, using the cnsview command.

#include <stropts.h>
#include <cs_term.h>
 
main()
{
struct strioctl strioctl;
long controls = 0;
int fid = 0;   /* use stdin for ioctl */
  
strioctl.ic_cmd = CS_TIOCMGET;
strioctl.ic_timout = 5;      /* timeout value unimportant */
strioctl.ic_dp = (char *)&controls;
strioctl.ic_len = sizeof(controls);
if (ioctl(fid, I_STR, &strioctl) < 0) {
perror("modem");
exit(1);
}
printf("modem controls=0x%lx\n", controls);
exit(0);
}                                                                             

The CS_TIOCMGET IOCTL fetches the current state of 7318 modem controls, including the extended controls that are only valid when the port is in buddy mode. The CS_TIOCMSET IOCTL sets the current state of 7318 serial port modem controls. Only output bits can be set. Changes to the input controls are ignored.

The available modem controls are:

CS_TIOCM_DTR     Data terminal ready (output)
CS_TIOCM_RTS     Request to send (output)
CS_TIOCM_CTS     Clear to send (input)
CS_TIOCM_CD      Carrier Detected (input)
CS_TIOCM_RI      Ring Indicator (input, buddy mode)
CS_TIOCM_DSR     Data Set Ready (input, buddy mode)
CS_TIOCM_ALOOP   Analog Loopback (output, buddy mode)
CS_TIOCM_DLOOP   Digital Loopback (output, buddy mode)

When a port is not in buddy mode, CS_TIOCM_RI is always 0 and CS_TIOCM_DSR is always 1.

Note: These IOCTLS are only available to 7318s running the direct connect protocols (Model P10s and S20s with direct attach enabled).

The cnsview command also has a way to read and set the buddy mode controls. You can set and show the extmodem property on 7318 serial ports in buddy mode. This property reports an error if the port is not in buddy mode. For example:

cnsview /dev/tty2
>>show extmodem
dsr:   1
ri:    0
aloop: 0
dloop: 0
 
>>set extmodem aloop
 
>>show extmodem
dsr:   1
ri:    0
aloop: 1
dloop: 0

Routing Error Numbers

Error # Description Resolution
route 17 Desintation already exists. The destination address is already in the routine table. A full Internet compare is only done if this is a host route. Otherwise, if it is a gateway, only subnets are compared. Fix the destination.
route 63 Out of streams resources. The 7318 does not have enough memory to complete the operation. This should never happen during configuration.
route 105 There is no route to the gateway. The gateway must be reachable either directly or through routes already in the routing table, excluding the default gateway entry.
route 113 Gateway points to a 7318 provider. The gateway may not be the IPAddress of one of the 7318 providers.

[ Previous | Next | Contents | Home | Search ]