EMS Manual

Example of Reporting Events
EMS Manual426909-005
B-6
The C Source File
2: XOUR-TKN-IO-FILE
3: XOUR-TKN-IO-MSG
4: XOUR-TKN-IO-TIME,I10
The C Source File
This file contains the C source code. The program decides an event has occurred if
you take more than 10 seconds to give it data. If you take more than a half a minute,
the program decides the event is critical.
Assumption: These files should be available in the same subvolume or directory with
this file in order to compile and to create the object for this file:
The DDL source file “xourddl”
The file “xourc” (generate from DDL)
/*
* The C source file
* The following file contains the C source code:
*/
#include <stdio.h> nolist
#include <string.h> nolist
#include <stdlib.h> nolist
#include <memory.h> nolist
#include <tal.h> nolist
#include <CEXTDECS(EMSINIT, EMSADDTOKENS, EMSADDTOKENMAPS)> nolist
#include <CEXTDECS(SSNULL, SSGETTKN, FILE_OPEN_, FILE_CLOSE_)> nolist
#include <CEXTDECS(WRITEREADX, WRITEX, DEBUG)> nolist
#include <CEXTDECS(PROCESS_LAUNCH_, PROCESS_STOP_, JULIANTIMESTAMP)> nolist
#include <dlaunch.h> nolist
#include "$system.zsysdefs.zsysc(zsys_ddl_phandle)"
#include "$system.zsysdefs.zsysc(zsys_ddl_smsg_proccreate, process_constant)"
#include "$system.Zspidef.ZSPIC" nolist
#include "$system.Zspidef.ZEMSC(constants)" nolist
#include "xourc" /* Includes DDL generated from xourddl */
#pragma PAGE "Globals and defines"
/* Define is used for zspi struct to shorten names */
#define SPIDDLDEF zspi_ddl_ssid_def
/*
* SSID's used in generating event message
*/
SPIDDLDEF our_ssid;
SPIDDLDEF ems_ssid;
/*
* Maps are effectively constants like SSIDs
*/
#define XOUR_MAP_TOO_LONG sizeof(xour_map_too_long_stats)
short map_too_long_stats[XOUR_MAP_TOO_LONG];
/*
* This is the buffer in which event message are built
*/
xour_ddl_evt_buffer_def *event_buf;
/*
* Global counter for TOO_LONG proc
*/
short evt_calls = 0; /* number of event */