SNMP Configuration and Management Manual

Trap Multiplexer Subagent/Manager
SNMP Configuration and Management Manual424777-006
12-56
Application Source Code
Example 12-3. Sample Application Source Code (page 1 of 14)
/************************************************************************
TMUXAPPC : Trap Multiplexer Application Program : Starts an EMS
consumer distributor using a collector and filter provided by the
user on the command-line parameters "-c" and "-f" respectively.
By default, the program assumes $0 as the collector and tmxfo in
the current subvolme as the filter. All filtered trap events are
then displayed on the terminal.
Usage : run tmuxax [-c <collector-name>] [-f <filter-name>]
Eg. : run tmuxax -c $acol -f myfilto
To compile the program :
c/in tmuxappc,out $s.#tmuxapp/tmuxax;&
ssv0 "$system.zspidef", ssv1 "$system.system"
Note : zspidef location (ssv0) may vary according to system configuration.
*************************************************************************/
#pragma WIDE <-- 1
#pragma INSPECT
#pragma SYMBOLS
#pragma NOMAP
#pragma NOLMAP
#pragma RUNNABLE
#pragma XMEM
#include <stdio.h> nolist <-- 2
#include <string.h> nolist
#include <stdlib.h> nolist
#include <memory.h> nolist
#include <tal.h> nolist
#include <CEXTDECS (DEBUG, EMSGETTKN, FILE_CLOSE_, FILE_OPEN_, \
FILE_GETINFO_, FILENAME_RESOLVE_, \
FILENAME_TO_OLDFILENAME_, PROCESS_CREATE_, \
SSGETTKN, SSINIT, SSPUTTKN, WRITEREADX)> nolist
/* function prototypes */
void send_spi_cmd (char* spi_buf, short distr) ; <-- 3
void spi_cmd_set_source (char* spi_buf, char* coll_name, short distr) ;
void spi_cmd_load_filter (char* spi_buf, char* filt_name, short distr) ;
char* insert_null (char* pt_buffer, short* len) ;
void print_octetstring (char* buffer, int buflen, char* title) ;
void getevent_loop (char* spi_buf, short distr) ;
#include <zspic> nolist <-- 4
#include <zemsc> nolist
#include <ztmxc> nolist
#include <zcomc> nolist