z/OS Communications Server: IP Programmer's Guide and Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Overview of subagent processing

z/OS Communications Server: IP Programmer's Guide and Reference
SC27-3659-02

This overview assumes that the subagent communicates with the agent over a TCP connection. Other connection implementations are possible and, in that case, the processing approach might be a bit different.

In this overview, the agent is requested to send at most one varBind per DPI packet, so there is no need to loop through a list of varBinds. You might gain performance improvements if you allow for multiple varBinds per DPI packet on GET, GETNEXT, SET requests. To allow multiple varBinds, your code must loop through the varBind list, which makes the situation more complicated. The DPI subagent programmer can handle that when you understand the basics of the DPI API.

The following sample shows the supported MIB variable definitions for DPI_SIMPLE:
DPISimple-MIB DEFINITIONS ::= BEGIN
 
   IMPORTS
        MODULE-IDENTITY, OBJECT-TYPE, snmpModules, enterprises
                   FROM SNMPv2-SMI
        DisplayString
                   FROM SNMPv2-TC
 
   ibm      OBJECT IDENTIFIER ::= { enterprises 2 }
   ibmDPI   OBJECT IDENTIFIER ::= { ibm 2 }
   dpi20MIB OBJECT IDENTIFIER ::= { ibmDPI 1 }
 
-- dpiSimpleMIB MODULE-IDENTITY
--   LAST-UPDATED "9401310000Z"

--   DESCRIPTION
--          "The MIB module describing DPI Simple Objects for
--           the dpi_samp.c program"
--   ::= { snmpModules x }
 
   dpiSimpleMIB OBJECT IDENTIFIER ::= { dpi20MIB 5 }
 
   dpiSimpleInteger         OBJECT-TYPE
        SYNTAX  INTEGER
        ACCESS  read-only
        STATUS  mandatory
        DESCRIPTION
            "A sample integer32 value"
        ::= { dpiSimpleMIB 1 }
 
   dpiSimpleString          OBJECT-TYPE
        SYNTAX  DisplayString
        ACCESS  read-write
        STATUS  mandatory
        DESCRIPTION
            "A sample Display String"
        ::= { dpiSimpleMIB 2 }
 
   dpiSimpleCounter32       OBJECT-TYPE
        SYNTAX  Counter     -- Counter32 is SNMPv2
        ACCESS  read-only
        STATUS  mandatory
        DESCRIPTION
            "A sample 32-bit counter"
        ::= { dpiSimpleMIB 3 }
 
   dpiSimpleCounter64       OBJECT-TYPE
        SYNTAX  Counter     -- Counter64 is SNMPv2,
                            -- No SMI support for it yet
        ACCESS  read-only
        STATUS  mandatory
        DESCRIPTION
            "A sample 64-bit counter"
        ::= { dpiSimpleMIB 4 }
END
To make the code more readable, the following names have been defined in our dpi_mvs_sample.c source file.
#define DPI_SIMPLE_SUBAGENT   "1.3.6.1.4.1.2.2.1.5"                     
#define DPI_SIMPLE_MIB        "1.3.6.1.4.1.2.2.1.5."                    
#define DPI_SIMPLE_INTEGER    "1.0"       /* dpiSimpleInteger.0      */ 
#define DPI_SIMPLE_STRING     "2.0"       /* dpiSimpleString.0       */ 
#define DPI_SIMPLE_COUNTER32  "3.0"       /* dpiSimpleCounter32.0    */ 
#define DPI_SIMPLE_COUNTER64  "4.0"       /* dpiSimpleCounter64.0    */ 
 
In addition, the following variables have been defined as global variables in our dpi_mvs_sample.c source file.
static int                                     /*handle has global scope  */
int global_role=0;                             /*flag for debug macros  */
static int           instance_level = 0;                                 
static long int      value1      = 5;                                    
#define              value2_p      cur_val_p   /* writable object    */  
#define              value2_len    cur_val_len /* writable object    */  
static char         *cur_val_p   = (char *)0;                            
static char         *new_val_p   = (char *)0;                            
static char         *old_val_p   = (char *)0;                            
static unsigned long cur_val_len = 0;                                    
static unsigned long new_val_len = 0;                                    
static unsigned long old_val_len = 0;                                    
static unsigned long value3      = 1;                                    
#ifndef EXCLUDE_SNMP_SMIv2_SUPPORT                                          
static snmp_dpi_u64  value4      = {0x80000000,1L};
#endif/*ndef EXCLUDE_SNMP_SMIv2_SUPPORT*/
static int   unix_sock =0;  /*default use TCP  */
static unsigned short timeout  = 3;   /*default timeout  */                        

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014