SNMP Subagent Programmer's Guide
System Time Manager
2-76 119728—SNMP Subagent Programmer’s Guide
Programming Tutorials
Example 2-15. System Time Manager Main Program (page 1 of 2)
#include "tdmporth" nolist
#include "machtyph" nolist
#include "syspubh"  nolist
#include "smitypeh" nolist
#include "mgmtpubh" nolist
/*   global attributes that will be referenced by SMI
 *   compiler generated code. */
static char      text[20];  /* 20 bytes for "YYYY/MM/DD HH:MM:SS"\0 */
static DisplayString   systemTimeString = {0, (ubyte *) text};          
<-- 1
static long long    juliantime; /* used by TEST to communicate to SET */
#pragma nowarn (93)
#include "systmh" nolist   /* SMI compiler output */
#pragma warn (93)
#include "accessfc"      /* our access functions */           
<-- 2
/*************************************************************************
 *  main - system-time demo of C_ACCESS_FUNC
 ************************************************************************/
int main(int argc, char *argv[])
{
 short dummy = 0;
 /* handles to the management environment and our group */
 void         *mgmt_env = NULL;
 void         *mgmt_systime_handle = NULL;
 /*  Make sure we were properly invoked */
 if (argc != 2)
 {
 (void) fprintf(stderr, "Usage: run %s: $<agent>\n", argv[0]);
 return(1);
 }
 /*  Set up the management environment. We'll talk to the indicated
 *   agent, registering ourselves as 1.3.6.1.4.1.169.3.155.1.101
 *   with no password.  */
 if ((mgmt_env = mgmt_init_env(argv[1],                  
<-- 3
            (ObjId_t *) &GI_systime,
            "get/set/test C_ACCESS_FUNC system time example",
            (Octets_t *) NULL,
            (void_function) NULL)) == NULL)
 {
 (void) fprintf(stderr, "%s: mgmt_init_env failure\n", argv[0], stderr);
 return(3);
 }










