To use any of the following variables in a program, you should declare them in the variable declaration section of your C-language program in the manner shown under DECLARATION. The declaration must appear before any use of the variable. The header file BRKTHU.H includes all of these declarations.
####### VARIABLE NAME
btudtr — DTR level after channel reset
####### DECLARATION
extern int btudtr; what to do after bturst():
0 = lower DTR for 2 seconds
and then raise
1 = leave DTR high always
####### DESCRIPTION
HAYES UART
This command affects all channels that are based on the 8250-type UART. It specifies what happens after the channels are reset with bturst() (page 124). After reset, the DTR signal is set to this value for 2 seconds, then it is set high (active).
To vary your handling of individual ports, you could set btudtr just before every call to bturst().
Applies to: WG3.x
Header check:
btuhrtis not declared in the WG3.2 headers; see the note in chapter 11 (ticker,btuTicker(),BRKTHU.H:214-217).
####### VARIABLE NAME
btuhrt — high-rate 65536 Hz counter
####### DECLARATION
extern unsigned long btuhrt;
####### DESCRIPTION
This 32-bit integer increments at approximately 65536 Hertz. You’ll probably make the most use out of this by taking two samples and subtracting them — the unsigned difference reflects the time between the samples — similar to what ticker does (page 28), only faster.
You can use the upper 16 bits of btuhrt as a 1 Hz counter.
Actually btuhrt only simulates this rate. It really changes at a rate controlled by btumxs() (page 116). btuhrt increments in spurts, in a manner calculated to keep btuhrt looking like a 65536 Hertz counter. You may not be able to use btuhrt to measure time too finely. With btumxs(2400), for example, about 290 times a second, btuhrt increases by approximately 226 (226 x 290 = 65540, which is about 65536). A new btuhrt value will be available only 290 times a second, not 65536 times a second, so you couldn’t measure 1 millisecond intervals.
####### CAUTIONS
When reading this variable, you should temporarily disable interrupts to avoid skew between the 16-bit halves of the value. For example, we use this code in the Major BBS:
unsigned long
hrtval(void)
{
unsigned long hrtsmp;
dsairp();
hrtsmp=btuhrt;
enairp();
return(hrtsmp);
}####### VARIABLE NAME
btulan — LAN capability and status flags
####### DECLARATION
extern int btulan;
#define BTLIPXD 0x0001 /* bit 0: IPX Direct circuits supported */
#define BTLIPXV 0x0002 /* bit 1: IPX Virtual circuits supported */
#define BTLSPX 0x0004 /* bit 2: SPX circuits supported */
#define BTLI7A 0x0100 /* bit 8: IPX driver is loaded */
#define BTLSPXL 0x0200 /* bit 9: SPX is loaded */####### DESCRIPTION
Your C program could use btulan to make a report on these conditions:
printf("Your GSBL supports:\n");
if (btulan&BTLIPXD) {
printf(" IPX Direct Circuit channels\n");
}
if (btulan&BTLIPXV) {
printf(" IPX Virtual Circuit channels\n");
}
if (btulan&BTLSPX) {
printf(" SPX channels\n");
}
if ((btulan&(BTLIPXD+BTLIPXV+BTLSPX)) == 0) {
printf(" no LAN access at all\n");
}
printf("The IPX driver %s been loaded at interrupt vector hex 7A\n",
btulan&BTLI7A ? "has" : "has not");
printf("SPX %s installed on this node\n",
btulan&BTLSPXL ? "is" : "is not");####### CAUTIONS
Note that the first three bits are always available when your program is running. The last two are available only after calling btuitz() and before calling btuend(). The above program must include the header file BRKTHU.H, and be run between calls to btuitz() and btuend().
####### VARIABLE NAME
btusrs — number of users licensed
####### DECLARATION
extern int btusrs;
####### DESCRIPTION
This variable is the number of users licensed for your copy of the GSBL.
In the Major BBS, this variable is used to display the version code suffix (e.g. -32) in the SERVER UP audit trail message.
Channels defined beyond this number will always be non-hardware channels (bturst() will always return -10, see page 124). Non-hardware channels may be useful in simulating a user channel. See about the monitor feature on page 114 (and page 115).
####### VARIABLE NAME
btuver — GSBL version code
####### DECLARATION
extern char btuver[];
####### DESCRIPTION
This string is the software revision for the GSBL.
You could use it to display the version somewhere:
printf("Based on GSBL-%s for %d users",btuver,btusrs);Or, you could use this variable to do different things based on the version code of the GSBL, for example:
if (strcmp(btuver,"J") == 0) {
jspecific();
}
else if (strcmp(btuver,"K") == 0) {
kspecific();
}
else {
allelse();
}####### VARIABLE NAME
btux25 — whether or not GSBL supports X.25
####### DECLARATION
extern int btux25; 0=GSBL does not support X.25
1=GSBL supports X.25
####### DESCRIPTION
This global variable can be used to take special action based on whether the GSBL supports X.25 or not. For example, you might code your program to generate an error message when it is configured to talk to X.25 channels but the GSBL does not support them. The return value of btusdf() for channel type 4 (page 130) may be used in the same way.
####### CAUTIONS
The value of btux25 is not defined until after you call btuitz().
####### VARIABLE NAME
ictact — actual number of bytes read by btuict()
####### DECLARATION
extern unsigned ictact;
####### DESCRIPTION
When you use btuict() (page 96) to retrieve data bytes from the input buffer, as many as are available are copied, up to the trigger count (the trigger count is set by btutrg(), page 149). When less than the trigger count of bytes are available, the bytes are transferred anyway, but they are not taken out of the input buffer. This is when btuict() returns -2 (indicating insufficient bytes are available). In this situation, the global variable ictact is the way you have of determining how many bytes were copied into your buffer.
####### VARIABLE NAME
lanrev — LAN SPX revision
####### DECLARATION
extern char lanrev[2];
####### DESCRIPTION
LAN
This array contains the SPX version numbers, minor version first:
printf("SPX version %d.%d\n",lanrev[1],lanrev[0]);####### CAUTIONS
This array is only available after btuitz() has been called and only if SPX is available.
####### VARIABLE NAME
lansca — LAN SPX connections available
####### DECLARATION
extern int lansca;
####### DESCRIPTION
LAN
This is the number of SPX sessions that your program can support. To increase this number, you might be able to increase the SPX CONNECTIONS parameter in your Netware SHELL.CFG or NET.CFG file:
SPX CONNECTIONS = 100
Refer to your Novell documentation for proper placement of this line.
####### CAUTIONS
This value is only available after btuitz() has been called.
####### VARIABLE NAME
lansop — LAN socket opened by btusdf()
####### DECLARATION
extern int lansop;
####### DESCRIPTION
If you use btusdf() to define a Netware LAN channel with a socket of 0, then IPX will assign an unopened socket for you. The socket it picks is then retrievable from this lansop variable.
The socket number is in convenient “lo-hi” byte order.
####### CAUTIONS
lansop is only defined for hardware channels (i.e. bturst() returns non-negative), and only after calling btusdf().
####### VARIABLE NAME
ticker — second timer
####### DECLARATION
extern unsigned ticker; /* 0 to 65535 and back again*/
####### DESCRIPTION
Every second, the contents in this variable increments. After it reaches 65535, it goes back to 0 and starts over again. According to the properties of 16-bit unsigned arithmetic, you can sample the value of ticker at two different times, and the difference between the values will reflect the time between the samplings, as long as that time is less than 65535 seconds (about 18 hours).
If you need more resolution in your time measurement, use btuhrt (page 18).
####### CAUTIONS
This variable increments at a rate very close to 1 Hz (once a second), but don’t set your watch by it.
####### VARIABLE NAME
x25ign — count of ignored incoming packets
####### DECLARATION
extern int x25ign;
####### DESCRIPTION
An incoming packet will not be recognized if:
the packet is not a DATA, CALL REQUEST, CALL CONFIRM, or CLEAR packet.an incoming data packet has a logical channel number (virtual circuit number) that does not agree with that of any channel defined (by btusdf()) for the GSBL.You can set x25ign to 0 also. It will be incremented every time a packet is ignored.
####### VARIABLE NAME
x25udt — user data reporting flag
####### DECLARATION
extern int x25udt; set to 1 to capture the User Data Field of incoming packets
####### DESCRIPTION
If you set this flag to a 1, then the User Data field of an incoming call request packet is tacked onto the end of the RING xxx CALLING xxx string as a fifth word, as in:
RING 81020551 CALLING 30448512 IGNEOUS-7
####### CAUTIONS
The User Data field should be ASCII and have no imbedded control characters. The input buffer for the channel must be large enough (as specified by btusiz(), btulsz(), or btubsz()) to hold the entire string.