示例#1
0
/** Initializes the snmp module */
void
init_snmp_mib(void)
{
    DEBUGMSGTL(("snmp", "Initializing\n"));

    netsnmp_register_scalar_group(
      netsnmp_create_handler_registration(
	"mibII/snmp", handle_snmp, snmp_oid, OID_LENGTH(snmp_oid),
	HANDLER_CAN_RONLY), 1, 32);
    {
        const oid snmpEnableAuthenTraps_oid[] = { 1, 3, 6, 1, 2, 1, 11, 30, 0 };
	static netsnmp_watcher_info enableauthen_info;
        netsnmp_handler_registration *reg =
            netsnmp_create_update_handler_registration(
                "mibII/snmpEnableAuthenTraps",
                snmpEnableAuthenTraps_oid,
                OID_LENGTH(snmpEnableAuthenTraps_oid),
                HANDLER_CAN_RWRITE, &snmp_enableauthentrapsset);
        netsnmp_inject_handler(reg, netsnmp_get_truthvalue());
        netsnmp_register_watched_instance(
            reg,
            netsnmp_init_watcher_info(
		&enableauthen_info,
                &snmp_enableauthentraps, sizeof(snmp_enableauthentraps),
                ASN_INTEGER, WATCHER_FIXED_SIZE));
    }

#ifdef USING_MIBII_SYSTEM_MIB_MODULE
    if (++system_module_count == 3)
        REGISTER_SYSOR_TABLE(system_module_oid, system_module_oid_len,
                             "The MIB module for SNMPv2 entities");
#endif
    snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
                           snmp_enableauthentraps_store, NULL);
}
示例#2
0
netsnmp_watcher_info *
netsnmp_create_watcher_info(void *data, size_t size, u_char type, int flags)
{
    netsnmp_watcher_info *winfo = SNMP_MALLOC_TYPEDEF(netsnmp_watcher_info);
    if (winfo)
        netsnmp_init_watcher_info(winfo, data, size, type, flags);
    return winfo;
}
示例#3
0
/*
 * Our initialization routine, called automatically by the agent 
 * (Note that the function name must match init_FILENAME()) 
 */
void
init_gpDroneMIB(void)
{
  netsnmp_handler_registration *reg;

	//Series of OIDs and variable watchers. Not all of them are fully implemented thought :(
    const oid sysAircraftID_oid[] = {1,3,6,1,4,1,12620,1,1 };
  static netsnmp_watcher_info sysAircraftID_winfo;
    const oid sysAircraftType_oid[] = {1,3,6,1,4,1,12620,1,2 };
  static netsnmp_watcher_info sysAircraftType_winfo;
    const oid sysTimeUp_oid[] = { 1,3,6,1,4,1,12620,1,4 };
  static netsnmp_watcher_info sysTimeUp_winfo;
 //static netsnmp_watcher_info instPosMagneticCompass_winfo;
    const oid instPosGpsLatitude_oid[] = { 1,3,6,1,4,1,12620,2,1,5 };
  static netsnmp_watcher_info instPosGpsLatitude_winfo;
     const oid instPosGpsLongitude_oid[] = { 1,3,6,1,4,1,12620,2,1,6 };
  static netsnmp_watcher_info instPosGpsLongitude_winfo;
    const oid instPosAltitude_oid[] = { 1,3,6,1,4,1,12620,2,1,7 };
  static netsnmp_watcher_info instPosAltitude_winfo;
    const oid instClTime_oid[] = { 1,3,6,1,4,1,12620,2,2,1 };
  static netsnmp_watcher_info instClTime_winfo;
   const oid instSpeedGround_oid[] = { 1,3,6,1,4,1,12620,2,3,3 };
  static netsnmp_watcher_info instSpeedGround_winfo;
   const oid instSpeedVertical_oid[] = { 1,3,6,1,4,1,12620,2,3,4 };
   static netsnmp_watcher_info instSpeedVertical_winfo;
   const oid lgSetPosition_oid[] = { 1,3,6,1,4,1,12620,7,3 };
  static netsnmp_watcher_info lgSetPosition_winfo;
    const oid lightNum_oid[] = { 1,3,6,1,4,1,12620,5,1 };
  static netsnmp_watcher_info lightNum_winfo;
//New variable (not in the original MIB definition)...
    const oid instTotalFuel_oid[] = { 1,3,6,1,4,1,12620,2,5 };
  static netsnmp_watcher_info instTotalFuel_winfo;


  DEBUGMSGTL(("gpDroneMIB", "Initializing the gpDroneMIB module\n"));

/*
	Now we register the variables of the MIB...
*/

/*sysAircraftID*/
    DEBUGMSGTL(("gpDroneMIB",
                "Initializing sysAircraftID scalar octet string.  Default value = %s\n",
                sysAircraftID));
    reg = netsnmp_create_handler_registration(
             "sysAircraftID", NULL,
              sysAircraftID_oid, OID_LENGTH(sysAircraftID_oid),
              HANDLER_CAN_RONLY);
    netsnmp_init_watcher_info(&sysAircraftID_winfo, sysAircraftID, strlen(sysAircraftID),
			      ASN_OCTET_STR, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, &sysAircraftID_winfo ) < 0 ) {
        snmp_log( LOG_ERR, "Failed to register watched sysAircraftID" );
    }
/*end sysAircraftID*/

    fetch_string("sysAircraftType",sysAircraftType);
/*sysAircraftType*/
    DEBUGMSGTL(("gpDroneMIB",
                "Initializing sysAircraftType scalar octet string.  Default value = %s\n",
                sysAircraftType));
    reg = netsnmp_create_handler_registration(
             "sysAircraftType", NULL,
              sysAircraftType_oid, OID_LENGTH(sysAircraftType_oid),
              HANDLER_CAN_RONLY);
    netsnmp_init_watcher_info(&sysAircraftType_winfo, sysAircraftType, strlen(sysAircraftType),
			      ASN_OCTET_STR, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, &sysAircraftType_winfo ) < 0 ) {
        snmp_log( LOG_ERR, "Failed to register watched sysAircraftID" );
    }
/*end sysAircraftType*/


    DEBUGMSGTL(("gpDroneMIB",
                "Initializing sysTimeUp scalar integer.  Default value = %d\n",
                sysTimeUp));
    reg = netsnmp_create_handler_registration(
             "sysTimeUp", sysTimeUpHandler,
              sysTimeUp_oid, OID_LENGTH(sysTimeUp_oid),
              HANDLER_CAN_RONLY);
    netsnmp_init_watcher_info(&sysTimeUp_winfo, &sysTimeUp, sizeof(u_long),
			      ASN_TIMETICKS, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, &sysTimeUp_winfo ) < 0 ) {
        snmp_log( LOG_ERR, "Failed to register watched sysTimeUp" );
    }

/*instPosGpsLatitude*/
    DEBUGMSGTL(("gpDroneMIB",
                "Initializing instPosGpsLatitude scalar octet string.  Default value = %s\n",
                instPosGpsLatitude));
    reg = netsnmp_create_handler_registration(
             "instPosGpsLatitude", instPosGpsLatitudeHandler,
              instPosGpsLatitude_oid, OID_LENGTH(instPosGpsLatitude_oid),
              HANDLER_CAN_RONLY);
    netsnmp_init_watcher_info(&instPosGpsLatitude_winfo, instPosGpsLatitude, strlen(instPosGpsLatitude),
			      ASN_OCTET_STR, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, &instPosGpsLatitude_winfo ) < 0 ) {
        snmp_log( LOG_ERR, "Failed to register watched instPosGpsLatitude" );
    }
/*end instPosGpsLatitude*/
/*instPosGpsLongitude*/
    DEBUGMSGTL(("gpDroneMIB",
                "Initializing instPosGpsLongitude scalar octet string.  Default value = %s\n",
                instPosGpsLongitude));
    reg = netsnmp_create_handler_registration(
             "instPosGpsLongitude", instPosGpsLongitudeHandler,
              instPosGpsLongitude_oid, OID_LENGTH(instPosGpsLongitude_oid),
              HANDLER_CAN_RONLY);
    netsnmp_init_watcher_info(&instPosGpsLongitude_winfo, instPosGpsLongitude, strlen(instPosGpsLongitude),
                              ASN_OCTET_STR, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, &instPosGpsLongitude_winfo ) < 0 ) {
        snmp_log( LOG_ERR, "Failed to register watched instPosGpsLongitude" );
    }
/*end instPosGpsLongitude*/

/*instPosAltitude*/
    DEBUGMSGTL(("gpDroneMIB",
                "Initializing instPosAltitude scalar octet string.  Default value = %s\n",
                instPosAltitude));
    reg = netsnmp_create_handler_registration(
             "instPosAltitude", instPosAltitudeHandler,
              instPosAltitude_oid, OID_LENGTH(instPosAltitude_oid),
              HANDLER_CAN_RONLY);
    netsnmp_init_watcher_info(&instPosAltitude_winfo, instPosAltitude, strlen(instPosAltitude),
                              ASN_OCTET_STR, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, &instPosAltitude_winfo ) < 0 ) {
        snmp_log( LOG_ERR, "Failed to register watched instPosGpsLongitude" );
    }
/*end instPosAltitude*/

/*instSpeedGround*/
    DEBUGMSGTL(("gpDroneMIB",
                "Initializing instSpeedGround scalar octet string.  Default value = %s\n",
                instSpeedGround));
    reg = netsnmp_create_handler_registration(
             "instSpeedGround", instSpeedGroundHandler,
              instSpeedGround_oid, OID_LENGTH(instSpeedGround_oid),
              HANDLER_CAN_RONLY);
    netsnmp_init_watcher_info(&instSpeedGround_winfo, instSpeedGround, strlen(instSpeedGround),
                              ASN_OCTET_STR, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, &instSpeedGround_winfo ) < 0 ) {
        snmp_log( LOG_ERR, "Failed to register watched instPosGpsLongitude" );
    }
/*end instSpeedGround*/

/*instSpeedVertical*/
    DEBUGMSGTL(("gpDroneMIB",
                "Initializing instSpeedVertical scalar octet string.  Default value = %s\n",
                instSpeedVertical));
    reg = netsnmp_create_handler_registration(
             "instSpeedVertical", instSpeedVerticalHandler,
              instSpeedVertical_oid, OID_LENGTH(instSpeedVertical_oid),
              HANDLER_CAN_RONLY);
    netsnmp_init_watcher_info(&instSpeedVertical_winfo, instSpeedVertical, strlen(instSpeedVertical),
                              ASN_OCTET_STR, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, &instSpeedVertical_winfo ) < 0 ) {
        snmp_log( LOG_ERR, "Failed to register watched instPosGpsLongitude" );
    }
/*end instSpeedVertical*/



/*instClTime*/
    DEBUGMSGTL(("gpDroneMIB",
                "Initializing instClTime scalar octet string.  Default value = %s\n",
                instClTime));
    reg = netsnmp_create_handler_registration(
             "instClTime", instClTimeHandler,
              instClTime_oid, OID_LENGTH(instClTime_oid),
              HANDLER_CAN_RONLY);
    netsnmp_init_watcher_info(&instClTime_winfo, instClTime, strlen(instClTime),
                              ASN_OCTET_STR, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, &instClTime_winfo ) < 0 ) {
        snmp_log( LOG_ERR, "Failed to register watched instPosGpsLongitude" );
    }
/*end instClTime*/

    DEBUGMSGTL(("gpDroneMIB",
                "Initializing lightNum scalar integer.  Default value = %d\n",
                lightNum));
    reg = netsnmp_create_handler_registration(
             "lightNum", NULL,
              lightNum_oid, OID_LENGTH(lightNum_oid),
              HANDLER_CAN_RONLY);
    netsnmp_init_watcher_info(&lightNum_winfo, &lightNum, sizeof(long),
			      ASN_INTEGER, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, &lightNum_winfo ) < 0 ) {
        snmp_log( LOG_ERR, "Failed to register watched lightNum" );
    }

    DEBUGMSGTL(("gpDroneMIB",
                "Initializing lgSetPosition scalar integer.  Default value = %d\n",
                lgSetPosition));
    reg = netsnmp_create_handler_registration(
             "lgSetPosition", lgSetPositionHandler,
              lgSetPosition_oid, OID_LENGTH(lgSetPosition_oid),
              HANDLER_CAN_RWRITE);
    netsnmp_init_watcher_info(&lgSetPosition_winfo, &lgSetPosition, sizeof(long),
			      ASN_INTEGER, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, &lgSetPosition_winfo ) < 0 ) {
        snmp_log( LOG_ERR, "Failed to register watched lgSetPosition" );
    }


//New fuel variable...

    DEBUGMSGTL(("gpDroneMIB",
                "Initializing instTotalFuel scalar octet string.  Default value = %s\n",
                instTotalFuel));
    reg = netsnmp_create_handler_registration(
             "instTotalFuel", instTotalFuelHandler,
              instTotalFuel_oid, OID_LENGTH(instTotalFuel_oid),
              HANDLER_CAN_RONLY);
    netsnmp_init_watcher_info(&instTotalFuel_winfo, instTotalFuel, strlen(instTotalFuel),
                              ASN_OCTET_STR, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, &instTotalFuel_winfo ) < 0 ) {
        snmp_log( LOG_ERR, "Failed to register watched instPosGpsLongitude" );
    }






  /* here we initialize all the tables we're planning on supporting */
  initialize_table_lightingTable();

  DEBUGMSGTL(("gpDroneMIB",
              "Done initalizing gpDroneMIB module\n"));
}
示例#4
0
/** Initializes the sysORTable module */
void
init_sysORTable(void)
{
    const oid sysORLastChange_oid[] = { 1, 3, 6, 1, 2, 1, 1, 8 };
    const oid sysORTable_oid[] = { 1, 3, 6, 1, 2, 1, 1, 9 };

    sysORTable_table_info =
        SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);

    table = netsnmp_container_find("sysORTable:table_container");

    if (sysORTable_table_info == NULL || table == NULL) {
        SNMP_FREE(sysORTable_table_info);
        CONTAINER_FREE(table);
        return;
    }
    table->container_name = strdup("sysORTable");

    netsnmp_table_helper_add_indexes(sysORTable_table_info,
                                     ASN_INTEGER, /** index: sysORIndex */
                                     0);
    sysORTable_table_info->min_column = COLUMN_SYSORID;
    sysORTable_table_info->max_column = COLUMN_SYSORUPTIME;

    sysORLastChange_reg =
        netsnmp_create_handler_registration(
            "mibII/sysORLastChange", NULL,
            sysORLastChange_oid, OID_LENGTH(sysORLastChange_oid),
            HANDLER_CAN_RONLY);
    netsnmp_init_watcher_info(
	    &sysORLastChange_winfo,
            &sysORLastChange, sizeof(u_long),
            ASN_TIMETICKS, WATCHER_FIXED_SIZE);
    netsnmp_register_watched_scalar(sysORLastChange_reg,
				    &sysORLastChange_winfo);

    sysORTable_reg =
        netsnmp_create_handler_registration(
            "mibII/sysORTable", sysORTable_handler,
            sysORTable_oid, OID_LENGTH(sysORTable_oid), HANDLER_CAN_RONLY);
    netsnmp_container_table_register(sysORTable_reg, sysORTable_table_info,
                                     table, TABLE_CONTAINER_KEY_NETSNMP_INDEX);

    sysORLastChange = netsnmp_get_agent_uptime();

    /*
     * Initialise the contents of the table here
     */
    netsnmp_sysORTable_foreach(&register_foreach, NULL);

    /*
     * Register callbacks
     */
    snmp_register_callback(SNMP_CALLBACK_APPLICATION,
                           SNMPD_CALLBACK_REG_SYSOR, register_cb, NULL);
    snmp_register_callback(SNMP_CALLBACK_APPLICATION,
                           SNMPD_CALLBACK_UNREG_SYSOR, unregister_cb, NULL);

#ifdef USING_MIBII_SYSTEM_MIB_MODULE
    if (++system_module_count == 3)
        REGISTER_SYSOR_TABLE(system_module_oid, system_module_oid_len,
                             "The MIB module for SNMPv2 entities");
#endif
}
示例#5
0
void
init_system_mib(void)
{

#ifdef HAVE_UNAME
    struct utsname  utsName;

    uname(&utsName);
    snprintf(version_descr, sizeof(version_descr),
            "%s %s %s %s %s", utsName.sysname,
            utsName.nodename, utsName.release, utsName.version,
            utsName.machine);
    version_descr[ sizeof(version_descr)-1 ] = 0;
#else
#if HAVE_EXECV
    struct extensible extmp;

    /*
     * set default values of system stuff 
     */
    if (asprintf(&extmp.command, "%s -a", UNAMEPROG) < 0)
        extmp.command = NULL;
    /*
     * setup defaults 
     */
    extmp.type = EXECPROC;
    extmp.next = NULL;
    exec_command(&extmp);
    strlcpy(version_descr, extmp.output, sizeof(version_descr));
    if (strlen(version_descr) >= 1)
        version_descr[strlen(version_descr) - 1] = 0; /* chomp new line */
#else
#if (defined (WIN32) && defined (HAVE_WIN32_PLATFORM_SDK)) || defined (mingw32)
    windowsOSVersionString(version_descr, sizeof(version_descr));
#else
    strcpy(version_descr, "unknown");
#endif
#endif
#endif

#ifdef HAVE_GETHOSTNAME
    gethostname(sysName, sizeof(sysName));
#else
#ifdef HAVE_UNAME
    strlcpy(sysName, utsName.nodename, sizeof(sysName));
#else
#if defined (HAVE_EXECV) && !defined (mingw32)
    if (asprintf(&extmp.command, "%s -n", UNAMEPROG) < 0)
        extmp.command = NULL;
    /*
     * setup defaults 
     */
    extmp.type = EXECPROC;
    extmp.next = NULL;
    exec_command(&extmp);
    strlcpy(sysName, extmp.output, sizeof(sysName));
    if (strlen(sysName) >= 1)
        sysName[strlen(sysName) - 1] = 0; /* chomp new line */
#else
    strcpy(sysName, "unknown");
#endif                          /* HAVE_EXECV */
#endif                          /* HAVE_UNAME */
#endif                          /* HAVE_GETHOSTNAME */

#if (defined (WIN32) && defined (HAVE_WIN32_PLATFORM_SDK)) || defined (mingw32)
    {
      HKEY hKey;
      /* Default sysContact is the registered windows user */
      if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
                       "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", 0,
                       KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS) {
          char registeredOwner[256] = "";
          DWORD registeredOwnerSz = 256;
          if (RegQueryValueEx(hKey, "RegisteredOwner", NULL, NULL,
                              (LPBYTE)registeredOwner,
                              &registeredOwnerSz) == ERROR_SUCCESS) {
              strlcpy(sysContact, registeredOwner, sizeof(sysContact));
          }
          RegCloseKey(hKey);
      }
    }
#endif

    /* default sysObjectID */
    memcpy(sysObjectID, version_sysoid, version_sysoid_len * sizeof(oid));
    sysObjectIDByteLength = version_sysoid_len * sizeof(oid);

    {
        const oid sysDescr_oid[] = { 1, 3, 6, 1, 2, 1, 1, 1 };
        static netsnmp_watcher_info sysDescr_winfo;
        netsnmp_register_watched_scalar(
            netsnmp_create_handler_registration(
                "mibII/sysDescr", NULL, sysDescr_oid, OID_LENGTH(sysDescr_oid),
                HANDLER_CAN_RONLY),
            netsnmp_init_watcher_info(&sysDescr_winfo, version_descr, 0,
				      ASN_OCTET_STR, WATCHER_SIZE_STRLEN));
    }
    {
        const oid sysObjectID_oid[] = { 1, 3, 6, 1, 2, 1, 1, 2 };
        static netsnmp_watcher_info sysObjectID_winfo;
        netsnmp_register_watched_scalar(
            netsnmp_create_handler_registration(
                "mibII/sysObjectID", NULL,
                sysObjectID_oid, OID_LENGTH(sysObjectID_oid),
                HANDLER_CAN_RONLY),
            netsnmp_init_watcher_info6(
		&sysObjectID_winfo, sysObjectID, 0, ASN_OBJECT_ID,
                WATCHER_MAX_SIZE | WATCHER_SIZE_IS_PTR,
                MAX_OID_LEN, &sysObjectIDByteLength));
    }
    {
        const oid sysUpTime_oid[] = { 1, 3, 6, 1, 2, 1, 1, 3 };
        netsnmp_register_scalar(
            netsnmp_create_handler_registration(
                "mibII/sysUpTime", handle_sysUpTime,
                sysUpTime_oid, OID_LENGTH(sysUpTime_oid),
                HANDLER_CAN_RONLY));
    }
    {
        const oid sysContact_oid[] = { 1, 3, 6, 1, 2, 1, 1, 4 };
        static netsnmp_watcher_info sysContact_winfo;
#ifndef NETSNMP_NO_WRITE_SUPPORT
        netsnmp_register_watched_scalar(
            netsnmp_create_update_handler_registration(
                "mibII/sysContact", sysContact_oid, OID_LENGTH(sysContact_oid), 
                HANDLER_CAN_RWRITE, &sysContactSet),
            netsnmp_init_watcher_info(
                &sysContact_winfo, sysContact, SYS_STRING_LEN - 1,
                ASN_OCTET_STR, WATCHER_MAX_SIZE | WATCHER_SIZE_STRLEN));
#else  /* !NETSNMP_NO_WRITE_SUPPORT */
        netsnmp_register_watched_scalar(
            netsnmp_create_update_handler_registration(
                "mibII/sysContact", sysContact_oid, OID_LENGTH(sysContact_oid),
                HANDLER_CAN_RONLY, &sysContactSet),
            netsnmp_init_watcher_info(
                &sysContact_winfo, sysContact, SYS_STRING_LEN - 1,
                ASN_OCTET_STR, WATCHER_MAX_SIZE | WATCHER_SIZE_STRLEN));
#endif /* !NETSNMP_NO_WRITE_SUPPORT */
    }
    {
        const oid sysName_oid[] = { 1, 3, 6, 1, 2, 1, 1, 5 };
        static netsnmp_watcher_info sysName_winfo;
#ifndef NETSNMP_NO_WRITE_SUPPORT
        netsnmp_register_watched_scalar(
            netsnmp_create_update_handler_registration(
                "mibII/sysName", sysName_oid, OID_LENGTH(sysName_oid),
                HANDLER_CAN_RWRITE, &sysNameSet),
            netsnmp_init_watcher_info(
                &sysName_winfo, sysName, SYS_STRING_LEN - 1, ASN_OCTET_STR,
                WATCHER_MAX_SIZE | WATCHER_SIZE_STRLEN));
#else  /* !NETSNMP_NO_WRITE_SUPPORT */
        netsnmp_register_watched_scalar(
            netsnmp_create_update_handler_registration(
                "mibII/sysName", sysName_oid, OID_LENGTH(sysName_oid),
                HANDLER_CAN_RONLY, &sysNameSet),
            netsnmp_init_watcher_info(
                &sysName_winfo, sysName, SYS_STRING_LEN - 1, ASN_OCTET_STR,
                WATCHER_MAX_SIZE | WATCHER_SIZE_STRLEN));
#endif /* !NETSNMP_NO_WRITE_SUPPORT */
    }
    {
        const oid sysLocation_oid[] = { 1, 3, 6, 1, 2, 1, 1, 6 };
        static netsnmp_watcher_info sysLocation_winfo;
#ifndef NETSNMP_NO_WRITE_SUPPORT
        netsnmp_register_watched_scalar(
            netsnmp_create_update_handler_registration(
                "mibII/sysLocation", sysLocation_oid,
                OID_LENGTH(sysLocation_oid),
                HANDLER_CAN_RWRITE, &sysLocationSet),
            netsnmp_init_watcher_info(
		&sysLocation_winfo, sysLocation, SYS_STRING_LEN - 1,
		ASN_OCTET_STR, WATCHER_MAX_SIZE | WATCHER_SIZE_STRLEN));
#else  /* !NETSNMP_NO_WRITE_SUPPORT */
        netsnmp_register_watched_scalar(
            netsnmp_create_update_handler_registration(
                "mibII/sysLocation", sysLocation_oid,
                OID_LENGTH(sysLocation_oid),
                HANDLER_CAN_RONLY, &sysLocationSet),
            netsnmp_init_watcher_info(
		&sysLocation_winfo, sysLocation, SYS_STRING_LEN - 1,
		ASN_OCTET_STR, WATCHER_MAX_SIZE | WATCHER_SIZE_STRLEN));
#endif /* !NETSNMP_NO_WRITE_SUPPORT */
    }
    {
        const oid sysServices_oid[] = { 1, 3, 6, 1, 2, 1, 1, 7 };
        netsnmp_register_read_only_int_scalar(
            "mibII/sysServices", sysServices_oid, OID_LENGTH(sysServices_oid),
            &sysServices, handle_sysServices);
    }
    if (++system_module_count == 3)
        REGISTER_SYSOR_ENTRY(system_module_oid,
                             "The MIB module for SNMPv2 entities");

    sysContactSet = sysLocationSet = sysNameSet = 0;

    /*
     * register our config handlers 
     */
    snmpd_register_config_handler("sysdescr",
                                  system_parse_config_sysdescr, NULL,
                                  "description");
    snmpd_register_config_handler("syslocation",
                                  system_parse_config_sysloc, NULL,
                                  "location");
    snmpd_register_config_handler("syscontact", system_parse_config_syscon,
                                  NULL, "contact-name");
    snmpd_register_config_handler("sysname", system_parse_config_sysname,
                                  NULL, "node-name");
    snmpd_register_config_handler("psyslocation",
                                  system_parse_config_sysloc, NULL, NULL);
    snmpd_register_config_handler("psyscontact",
                                  system_parse_config_syscon, NULL, NULL);
    snmpd_register_config_handler("psysname", system_parse_config_sysname,
                                  NULL, NULL);
    snmpd_register_config_handler("sysservices",
                                  system_parse_config_sysServices, NULL,
                                  "NUMBER");
    snmpd_register_config_handler("sysobjectid",
                                  system_parse_config_sysObjectID, NULL,
                                  "OID");
    snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
                           system_store, NULL);
}