示例#1
0
int
pingResultsTable_inadd(struct pingResultsTable_data *thedata)
{
    netsnmp_variable_list *vars_list;
    vars_list = NULL;


    snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) thedata->pingCtlOwnerIndex, thedata->pingCtlOwnerIndexLen);  /* pingCtlOwnerIndex */
    snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) thedata->pingCtlTestName, thedata->pingCtlTestNameLen);      /* pingCtlTestName */

    /*
     * XXX: fill in default row values here into StorageNew 
     * 
     */


    DEBUGMSGTL(("pingResultsTable", "adding data...  "));
    /*
     * add the index variables to the varbind list, which is 
     * used by header_complex to index the data 
     */

    header_complex_add_data(&pingResultsTableStorage, vars_list, thedata);
    DEBUGMSGTL(("pingResultsTable", "registered an entry\n"));


    DEBUGMSGTL(("pingResultsTable", "done.\n"));
    return SNMPERR_SUCCESS;
}
示例#2
0
int
expObjectTable_add(struct expObjectTable_data *thedata)
{
    netsnmp_variable_list *vars = NULL;


    DEBUGMSGTL(("expObjectTable", "adding data...  "));
    /*
     * add the index variables to the varbind list, which is
     * used by header_complex to index the data
     */


    snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->expExpressionOwner, thedata->expExpressionOwnerLen);     /* expExpressionOwner */
    snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->expExpressionName, thedata->expExpressionNameLen);       /* expExpressionName */
    snmp_varlist_add_variable(&vars, NULL, 0, ASN_UNSIGNED, (char *) &thedata->expObjectIndex, sizeof(thedata->expObjectIndex));        /* expExpressionName */




    header_complex_add_data(&expObjectTableStorage, vars, thedata);
    DEBUGMSGTL(("expObjectTable", "registered an entry\n"));


    DEBUGMSGTL(("expObjectTable", "done.\n"));
    return SNMPERR_SUCCESS;
}
void
traceRouteProbeHistoryTable_inadd(struct traceRouteProbeHistoryTable_data
                                  *thedata)
{
    netsnmp_variable_list *vars_list = NULL;


    snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlOwnerIndex, thedata->traceRouteCtlOwnerIndexLen);      /* traceRouteCtlOwnerIndex */
    snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlTestName, thedata->traceRouteCtlTestNameLen);  /* traceRouteCtlTestName */
    snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_UNSIGNED, (char *) &thedata->traceRouteProbeHistoryIndex, sizeof(thedata->traceRouteProbeHistoryIndex)); /* traceRouteProbeHistoryIndex */
    snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_UNSIGNED, (char *) &thedata->traceRouteProbeHistoryHopIndex, sizeof(thedata->traceRouteProbeHistoryHopIndex));   /* traceRouteProbeHistoryHopIndex */
    snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_UNSIGNED, (char *) &thedata->traceRouteProbeHistoryProbeIndex, sizeof(thedata->traceRouteProbeHistoryProbeIndex));       /* traceRouteProbeHistoryProbeIndex */


    /*
     * XXX: fill in default row values here into StorageNew 
     * 
     */


    DEBUGMSGTL(("traceRouteProbeHistoryTable", "adding data...  "));
    /*
     * add the index variables to the varbind list, which is 
     * used by header_complex to index the data 
     */

    header_complex_add_data(&traceRouteProbeHistoryTableStorage, vars_list,
                            thedata);
    DEBUGMSGTL(("traceRouteProbeHistoryTable", "registered an entry\n"));


    DEBUGMSGTL(("traceRouteProbeHistoryTable", "done.\n"));
}
/*
 * snmpNotifyFilterProfileTable_add(): adds a structure node to our data set 
 */
int
snmpNotifyFilterProfileTable_add(struct snmpNotifyFilterProfileTable_data
                                 *thedata)
{
    netsnmp_variable_list *vars = NULL;


    DEBUGMSGTL(("snmpNotifyFilterProfileTable", "adding data...  "));
    /*
     * add the index variables to the varbind list, which is 
     * used by header_complex to index the data 
     */

    snmp_varlist_add_variable(&vars, NULL, 0, ASN_PRIV_IMPLIED_OCTET_STR,
                              (u_char *) thedata->snmpTargetParamsName,
                              thedata->snmpTargetParamsNameLen);

    header_complex_add_data(&snmpNotifyFilterProfileTableStorage, vars,
                            thedata);
    DEBUGMSGTL(("snmpNotifyFilterProfileTable", "registered an entry\n"));


    DEBUGMSGTL(("snmpNotifyFilterProfileTable", "done.\n"));
    return SNMPERR_SUCCESS;
}
示例#5
0
static int
expValueTable_set(struct expExpressionTable_data *expression_data,
                  const char *owner, size_t owner_len, const char *name,
                  size_t name_len, oid *index, size_t index_len)
{
    netsnmp_variable_list *vars = NULL;
    struct expValueTable_data *thedata;
    struct header_complex_index *hcindex;
    int             found = 0;

    for (hcindex = expValueTableStorage; hcindex; hcindex = hcindex->next) {
        thedata = hcindex->data;
        if (strcmp(thedata->expExpressionOwner, owner) == 0 &&
            thedata->expExpressionOwnerLen == owner_len &&
            strcmp(thedata->expExpressionName, name) == 0 &&
            thedata->expExpressionNameLen == name_len) {
            found = 1;
            break;
        }

    }

    if (found) {
        if (snmp_oid_compare(thedata->expValueInstance,
                             thedata->expValueInstanceLen, index,
                             index_len) != 0) {
            SNMP_FREE(thedata->expValueInstance);
            thedata->expValueInstance = netsnmp_memdup(index, index_len);
            thedata->expValueInstanceLen = index_len;
        } else {
            SNMP_FREE(index);
        }
    } else if ((thedata = calloc(1, sizeof(*thedata)))) {
        thedata->expExpressionOwner = owner;
        thedata->expExpressionOwnerLen = owner_len;
        thedata->expExpressionName = name;
        thedata->expExpressionNameLen = name_len;
        thedata->expValueInstance = index;
        thedata->expValueInstanceLen = index_len;
        thedata->expression_data = expression_data;

        snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR,
                                  (const char *) thedata->expExpressionOwner,
                                  thedata->expExpressionOwnerLen);
        snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR,
                                  (const char *) thedata->expExpressionName,
                                  thedata->expExpressionNameLen);
        snmp_varlist_add_variable(&vars, NULL, 0, ASN_PRIV_IMPLIED_OBJECT_ID,
                                  (u_char *) thedata->expValueInstance,
                                  thedata->expValueInstanceLen * sizeof(oid));

        header_complex_add_data(&expValueTableStorage, vars, thedata);
    } else {
        return SNMPERR_GENERR;
    }

    thedata->set = 1;

    return SNMPERR_SUCCESS;
}
示例#6
0
void traceRouteResultsTable_inadd (struct traceRouteResultsTable_data *thedata)
{
    netsnmp_variable_list *vars_list = NULL;

    snmp_varlist_add_variable (&vars_list, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlOwnerIndex, thedata->traceRouteCtlOwnerIndexLen);    /* traceRouteCtlOwnerIndex */
    snmp_varlist_add_variable (&vars_list, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlTestName, thedata->traceRouteCtlTestNameLen);    /* traceRouteCtlTestName */

    DEBUGMSGTL (("traceRouteResultsTable", "adding data...  "));
    /*
     * add the index variables to the varbind list, which is 
     * used by header_complex to index the data 
     */

    header_complex_add_data (&traceRouteResultsTableStorage, vars_list, thedata);
    DEBUGMSGTL (("traceRouteResultsTable", "registered an entry\n"));


    DEBUGMSGTL (("traceRouteResultsTable", "done.\n"));
}
示例#7
0
main()
{
    oid             oidsave[MAX_OID_LEN];
    int             len = MAX_OID_LEN, len2;
    netsnmp_variable_list *vars;
    long            ltmp = 4242, ltmp2 = 88, ltmp3 = 1, ltmp4 = 4200;
    oid             ourprefix[] = { 1, 2, 3, 4 };
    oid             testparse[] = { 4, 116, 101, 115, 116, 4200 };
    int             ret;

    char           *string = "wes", *string2 = "dawn", *string3 = "test";

    struct header_complex_index *thestorage = NULL;

    debug_register_tokens("header_complex");
    snmp_set_do_debugging(1);

    vars = NULL;
    len2 = sizeof(ltmp);
    snmp_varlist_add_variable(&vars, NULL, 0, ASN_INTEGER, (char *) &ltmp,
                              len2);
    header_complex_add_data(&thestorage, vars, ourprefix);

    vars = NULL;
    len2 = strlen(string);
    snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, string, len2);
    header_complex_add_data(&thestorage, vars, ourprefix);

    vars = NULL;
    len2 = sizeof(ltmp2);
    snmp_varlist_add_variable(&vars, NULL, 0, ASN_INTEGER, (char *) &ltmp2,
                              len2);
    header_complex_add_data(&thestorage, vars, ourprefix);

    vars = NULL;
    len2 = strlen(string2);
    snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, string2,
                              len2);
    header_complex_add_data(&thestorage, vars, ourprefix);

    vars = NULL;
    len2 = sizeof(ltmp3);
    snmp_varlist_add_variable(&vars, NULL, 0, ASN_INTEGER, (char *) &ltmp3,
                              len2);
    header_complex_add_data(&thestorage, vars, ourprefix);

    vars = NULL;
    len2 = strlen(string3);
    snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, string3,
                              len2);
    len2 = sizeof(ltmp4);
    snmp_varlist_add_variable(&vars, NULL, 0, ASN_INTEGER, (char *) &ltmp4,
                              len2);
    header_complex_add_data(&thestorage, vars, ourprefix);

    header_complex_dump(thestorage);

    vars = NULL;
    snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, NULL, 0);
    snmp_varlist_add_variable(&vars, NULL, 0, ASN_INTEGER, NULL, 0);
    ret =
        header_complex_parse_oid(testparse,
                                 sizeof(testparse) / sizeof(oid), vars);
    DEBUGMSGTL(("header_complex_test", "parse returned %d...\n", ret));

}
示例#8
0
/*
 * mteTriggerTable_add(): adds a structure node to our data set 
 */
int
expValueTable_add(struct expExpressionTable_data *expression_data,
                  char *owner, size_t owner_len, char *name,
                  size_t name_len, oid * index, size_t index_len)
{
    netsnmp_variable_list *vars = NULL;
    struct expValueTable_data *thedata, *StorageTmp;
    struct header_complex_index *hcindex;
    int             founded = 0;
    thedata = create_expValueTable_data();
    thedata->expValueCounter32Val = 0;
    thedata->expExpressionOwner = owner;
    thedata->expExpressionOwnerLen = owner_len;
    thedata->expExpressionName = name;
    thedata->expExpressionNameLen = name_len;
    thedata->expValueInstance = index;
    thedata->expValueInstanceLen = index_len;
    thedata->expression_data = expression_data;
    DEBUGMSGTL(("expValueTable", "adding data...  "));
    /*
     * add the index variables to the varbind list, which is 
     * used by header_complex to index the data 
     */


    snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->expExpressionOwner, thedata->expExpressionOwnerLen);     /* expExpressionOwner */
    snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->expExpressionName, thedata->expExpressionNameLen);       /* expExpressionName */
    snmp_varlist_add_variable(&vars, NULL, 0, ASN_PRIV_IMPLIED_OBJECT_ID,
                              (u_char *) thedata->expValueInstance,
                              thedata->expValueInstanceLen * sizeof(oid));

    for (hcindex = expValueTableStorage; hcindex != NULL;
         hcindex = hcindex->next) {
        StorageTmp = (struct expValueTable_data *) hcindex->data;
        if (!strcmp
            (StorageTmp->expExpressionOwner, thedata->expExpressionOwner)
            && (StorageTmp->expExpressionOwnerLen ==
                thedata->expExpressionOwnerLen)
            && !strcmp(StorageTmp->expExpressionName,
                       thedata->expExpressionName)
            && (StorageTmp->expExpressionNameLen ==
                thedata->expExpressionNameLen)
            && !snmp_oid_compare(StorageTmp->expValueInstance,
                                 StorageTmp->expValueInstanceLen,
                                 thedata->expValueInstance,
                                 thedata->expValueInstanceLen)) {
            founded = 1;
            break;
        }

    }
    if (!founded) {
        header_complex_add_data(&expValueTableStorage, vars, thedata);
        DEBUGMSGTL(("expValueTable", "registered an entry\n"));
    } else {
        SNMP_FREE(thedata);
        DEBUGMSGTL(("expValueTable",
                    "already have an entry, dont registe\n"));
    }


    DEBUGMSGTL(("expValueTable", "done.\n"));
    return SNMPERR_SUCCESS;
}