madman_api_test_2.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 1996 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "stdio.h"
#include "errno.h"
#include "snmp_msg.h"
#include "error.h"
#include "trace.h"
#include "madman_api.h"
/***** NEW CONSTANTS *****/
#define MSG_END_OF_TABLE "end of table for request %s on %s\n\n"
#define ERR_MSG_REQUEST_FAILED "the request %s on %s failed: %s\n\n"
/***** NEW TYPES *****/
typedef struct _Target {
struct _Target *next_target;
char name[100];
} Target;
/***** STATIC VARIABLES *****/
static int snmp_session_num = 0;
/****** STATIC FUNCTIONS *****/
/**************************************************************/
{
error_label[0] = '\0';
{
return -1;
}
{
return -1;
}
first_target = new;
return 0;
}
/**************************************************************/
/*
* do not free response!
*/
static void snmp_callback(int operation, SNMP_session *session, int request_id, int predefined_id, SNMP_pdu *response, void *snmp_callback_magic)
{
char *request_name = NULL;
switch(operation)
{
case RECEIVED_MESSAGE:
switch(predefined_id)
{
case APPL_ENTRY_REQ:
{
if(snmp_errno == SNMP_ERR_NOSUCHNAME)
{
{
}
}
else
{
}
}
else
{
{
}
}
break;
case ASSOC_ENTRY_REQ:
if(assocEntry == NULL)
{
if(snmp_errno == SNMP_ERR_NOSUCHNAME)
{
{
}
}
else
{
}
}
else
{
if(assocEntry_send_request(session, GETNEXT_REQ_MSG, assocEntry->applIndex, assocEntry->assocIndex, error_label))
{
}
}
break;
case MTA_ENTRY_REQ:
{
if(snmp_errno == SNMP_ERR_NOSUCHNAME)
{
{
}
}
else
{
}
}
else
{
{
}
}
break;
case MTA_GROUP_ENTRY_REQ:
if(mtaGroupEntry == NULL)
{
if(snmp_errno == SNMP_ERR_NOSUCHNAME)
{
}
else
{
}
}
else
{
}
break;
mtaGroupAssociationEntry = mtaGroupAssociationEntry_process_response(session, response, error_label);
if(mtaGroupAssociationEntry == NULL)
{
if(snmp_errno == SNMP_ERR_NOSUCHNAME)
{
{
}
}
else
{
}
}
else
{
if(mtaGroupAssociationEntry_send_request(session, GETNEXT_REQ_MSG, mtaGroupAssociationEntry->applIndex, mtaGroupAssociationEntry->mtaGroupIndex, mtaGroupAssociationEntry->mtaGroupAssociationIndex, error_label))
{
}
}
break;
case DSA_OPS_ENTRY_REQ:
if(dsaOpsEntry == NULL)
{
if(snmp_errno == SNMP_ERR_NOSUCHNAME)
{
{
}
}
else
{
}
}
else
{
{
}
}
break;
case DSA_ENTRIES_ENTRY_REQ:
if(dsaEntriesEntry == NULL)
{
if(snmp_errno == SNMP_ERR_NOSUCHNAME)
{
{
}
}
else
{
}
}
else
{
{
}
}
break;
case DSA_INT_ENTRY_REQ:
if(dsaIntEntry == NULL)
{
if(snmp_errno == SNMP_ERR_NOSUCHNAME)
{
{
}
}
else
{
}
}
else
{
if(dsaIntEntry_send_request(session, GETNEXT_REQ_MSG, dsaIntEntry->applIndex, dsaIntEntry->dsaIntIndex, error_label))
{
}
}
break;
case X4MS_MTA_ENTRY_REQ:
if(x4msMtaEntry == NULL)
{
if(snmp_errno == SNMP_ERR_NOSUCHNAME)
{
{
}
}
else
{
}
}
else
{
{
}
}
break;
if(x4msUserEntryPart1 == NULL)
{
if(snmp_errno == SNMP_ERR_NOSUCHNAME)
{
{
}
}
else
{
}
}
else
{
if(x4msUserEntryPart2_send_request(session, GET_REQ_MSG, x4msUserEntryPart1->x4msUserIndex, error_label))
{
}
if(x4msUserEntryPart1_send_request(session, GETNEXT_REQ_MSG, x4msUserEntryPart1->x4msUserIndex, error_label))
{
}
}
break;
if(x4msUserEntryPart2 == NULL)
{
}
else
{
}
break;
x4msUserAssociationEntry = x4msUserAssociationEntry_process_response(session, response, error_label);
if(x4msUserAssociationEntry == NULL)
{
if(snmp_errno == SNMP_ERR_NOSUCHNAME)
{
{
}
}
else
{
}
}
else
{
if(x4msUserAssociationEntry_send_request(session, GETNEXT_REQ_MSG, x4msUserAssociationEntry->x4msUserIndex, x4msUserAssociationEntry->x4msUserAssociationIndex, error_label))
{
}
}
break;
case X4GRP_ENTRY_REQ:
if(x4grpEntry == NULL)
{
if(snmp_errno == SNMP_ERR_NOSUCHNAME)
{
{
}
}
else
{
}
}
else
{
{
}
}
break;
case X4GRP_MAPPING_ENTRY_REQ:
if(x4grpMappingEntry == NULL)
{
if(snmp_errno == SNMP_ERR_NOSUCHNAME)
{
{
}
}
else
{
}
}
else
{
if(x4grpMappingEntry_send_request(session, GETNEXT_REQ_MSG, x4grpMappingEntry->x4grpIndex, x4grpMappingEntry->x4grpMappingMSIndex, x4grpMappingEntry->x4grpMappingMTAIndex, error_label))
{
}
}
break;
if(x5dsaReferenceEntry == NULL)
{
if(snmp_errno == SNMP_ERR_NOSUCHNAME)
{
}
else
{
}
}
else
{
if(x5dsaReferenceEntry_send_request(session, GETNEXT_REQ_MSG, x5dsaReferenceEntry->x5dsaReferenceIndex, error_label))
{
}
}
break;
default:
break;
}
break;
case TIMED_OUT:
switch(predefined_id)
{
case APPL_ENTRY_REQ:
case ASSOC_ENTRY_REQ:
case MTA_ENTRY_REQ:
case MTA_GROUP_ENTRY_REQ:
case X4MS_MTA_ENTRY_REQ:
case X4GRP_ENTRY_REQ:
case X4GRP_MAPPING_ENTRY_REQ:
break;
default:
break;
}
break;
}
if(snmp_session_num == 0)
{
exit(0);
}
}
/**************************************************************/
{
int numfds;
int count;
char targets[1000];
char target[1000];
char c;
char *ptr;
int i = 0;
Target *t;
{
switch(c)
{
case 't':
break;
case 'v':
trace_flags = 0xFFFF;
}
}
i = 0;
{
{
if(i == 0)
{
continue;
}
}
{
target[i] = '\0';
{
}
i = 0;
}
}
for(t = first_target; t; t = t->next_target)
{
{
t->name, error_label);
continue;
}
{
}
}
if(snmp_session_num == 0)
{
exit(0);
}
while(1)
{
numfds = 0;
if(count > 0)
{
}
else
{
switch(count)
{
case 0:
break;
case -1:
{
continue;
}
else
{
errno_string());
}
}
}
}
}