Operator Services
Statistics
You can add your own statistical graphs to those already available on the operator console. There are two parts to this:
Generating the graphDisplaying the graphThe first part is up to you. You could create a 4000 byte file that stores the exact display image of the statistics screen. Only a 42 by 17 character portion of that screen may be used for your graph:
Statistics Sub-Screen
columns 15 through 56, inclusive, out of 0 through 79
rows 1 through 17, inclusive, out of 0 through 24
You’ll create this file offline, perhaps during the nightly auto-cleanup (that’s when we create the standard screens used in DFTSTATS.C).
Or you could just create a background file. At the moment when the Sysop brings up your screen, you can have special code that fills in all the figures or draws some kind of drawings.
The second part is up to the Sysop to do, and you to prepare for. Use the function register_stascn() to register your statistics screen. Then your screen will be available on the scrolling menu of the Statistics and Graphs screen when the Worldgroup server is on the air.
So, to register your screen:
1. Create one copy of the statsc data structure in your online code. This structure is defined in STATSCNS.H. Here is an example, with the blanks filled in:
struct statsc mygraph={ /* statistic screen interface structure */
"Sat activity", /* name of statistic screen */
"DDDSTA1.BIN", /* filename to get screen from */
NULL, /* initialize (bring up scn) routine */
NULL, /* key hit handler routine */
NULL, /* occasional update (every 60 secs) */
NULL, /* once-per-cycle routine */
NULL /* take down screen routine */
};The name appears in the menu of choices on the Statistics and Graphs screen. The 42 by 17 region of the file is displayed first (as background, or as your finished display) when the Sysop calls up your screen. Note that the statistics screen file has the Developer-ID prefix on it. All the NULLs are the non-implementation of five special purpose routines for your screen.
These routines do:
void (*inirou)(); A routine to call whenever your screen should appear. The routine could make computations and display them on your screen. Of course, you should only write to the 42 by 17 character area reserved for your screen as shown above.
unsigned (*keyhit) This routine is called with each and every
(unsigned scncod); keystroke from the Sysop when your screen is on display. The parameter if the routine is the same as the getchc() return value (page 274). The routine should either handle the keystroke and return 0, or just return the keystroke value if it doesn’t know what to do with it.
void (*occrou)(); This routine will get called every 60 seconds that your screen is on display. You can update your display with the up-to-the-minute data.
void (*cycrou)(); This routine gets called about 16 times a second when your screen is on display. If you use it (put something other than NULL here), be sure that it executes fast, so the system doesn’t get bogged down updating your display.
void (*finrou)(); This routine gets called when your display goes away. It gets called once for each call to the inirou() routine.
2. Register the statistics screen in your initialization routine.
register_stascn(&mygraph);This all swings into place when the Sysop switches to the statistics screen (by typing alt+T) and selecting your statistics screen from the list of choices.
Audit Trail
Applies to: WG3.x
Editor's note: the single
audit()call described below remains. Worldgroup 3.12 stores the Audit Trail in a new flat file format (not the BtrieveWGSAUDT2.DAT), with a file API (audf*()functions,HAUDFILE,struct audEntry) documented in chapter 26, and a Year 2000 explanation in chapter 24. Offline utilities obtain the file name fromAUDITFILE("wgsaudit.adt",MAJORBBS.H:430).
To display a message in the audit trail:
shocst(tex1,tex2,p1,...,pN);
Enter a string into the Audit Trail
char *tex1; summary string (up to 32 chars long)
char *tex2; detail string, as in printf()
p1,...,pN parameters for control string. The detail string can be up to 63 characters long. The parameters passed can take up to 12 bytes on the stack.
This function makes an entry in the audit trail. Just the date, time and summary information appear on the Summary screen. The summary, detail and source information, along with time and date, appear on the Audit Trail Detail screen, and get written to the Audit Trail database.
| Sources for Audit Trail messages | |
| -3 | Event N (1 to 4) |
| -2 | Cleanup |
| -1 | Console |
| 0..nterms-1 | Chan NN (00 to FF) |
The global variable usrnum is an implicit input to shocst(). It must be set to a valid user number (0 to nterms-1) or -1 to -3.
Channel Status Reporting
shochl(legend,sing,attr);
Show a line on the Online User Info screen
char *legend; information, up to 29 characters
char sing; single-character indicator for the user matrix (Summary screen too)
int attr; IBM color display attribute
If your Add-on Option does not manage sessions or connections in some way, you probably don’t want to use this routine. The convention is that the User-ID appears on the Online User Information screen and a double arrow appears in the user matrix there and on the Summary screen.
One of the conventions of the Online User Information screen is to color-code the information based on the user’s baud rate. You can do this by computing the last parameter of shochl() using baudat() (as we do many times in MAJORBBS.C).
attr=baudat(baud,blink);
Compute the display attribute based on the user’s baud rate
int attr; IBM 8-bit display attribute
unsigned baud; baud rate, 300 to 38400
int blink; 1=give us a blinking attribute