subtree.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 1998 Sun Microsystems, Inc. All Rights Reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* HISTORY
* 5-21-96 Jerry Yeung export first_subtree
* 5-24-96 Jerry Yeung skip invalid subtree
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "impl.h"
#include "error.h"
#include "trace.h"
#include "asn1.h"
#include "snmp.h"
#include "pdu.h"
#include "agent.h"
#include "subtree.h"
#include "session.h"
int sap_reg_tree_index=1;
{
int i, min;
return (-1);
return (-1);
return (-1);
}
}
/****************************************************************/
{
int ret;
{
error("malloc() failed");
return NULL;
}
{
if(ret == 0)
{
return sp;
}
else
if(ret < 0)
{
break;
}
}
return NULL;
}
{
int ret;
{
error("malloc() failed");
return FALSE;
}
{
if(ret == 0)
{
return TRUE;
}
else
if(ret < 0)
{
break;
}
}
return TRUE;
}
{
int ret;
{
error("BUG: subtree_add(): agent is NULL");
return -1;
}
{
error("malloc() failed");
return -1;
}
{
error("malloc() failed");
return -1;
}
{
if(ret == 0)
{
error("The subtree %s already belongs to the agent %s",
return -1;
}
else
if(ret < 0)
{
break;
}
}
{
first_subtree = new;
}
else
{
}
return 0;
}
/****************************************************************/
{
int ret;
{
error("subtree_match(): name is NULL");
return NULL;
}
if(first_subtree == NULL)
{
if(trace_level > 1)
{
trace("subtree_match() returned NULL\n\n");
}
return NULL;
}
if(type == GETNEXT_REQ_MSG)
{
/* grep the first valid subtree (vsb)*/
{
if(trace_level > 1)
{
trace("subtree_match() returned %s supported by %s\n\n",
}
return first_valid_subtree;
}
}
/* subtree is invalid skip (vsb)*/
continue;
if (ret == 0) {
if (trace_level > 1)
trace("subtree_match() full match returned %s supported by %s\n\n",
return sp;
}
if (ret < 0)
continue;
}
if(trace_level > 1) {
if (good) {
trace("subtree_match() returned %s supported by %s\n\n",
}
else {
trace("subtree_match() returned NULL\n\n");
}
}
return good;
}
/****************************************************************/
void trace_subtrees()
{
trace("SUBTREES:\n");
{
{
trace("\t%-30s %d %d %-30s %d %d\n",
sp->regTreeAgentID);
}
else
{
trace("\t%-30s %d %d %-30s\n",
"NO AGENT!");
}
}
trace("\n");
}
/****************************************************************/
{
{
return;
}
{
}
}
}
/****************************************************************/
void subtree_list_delete()
{
while(sp)
{
}
return;
}
/****************************************************************/
/* the subtree will be detached from both the agent_subtree list
* and the main subtree list
*/
{
while(sp)
{
}else{
}
}else{
}
}
}
{
{
{
break;
}
}
{
return;
}
{
}
else
{
}
/*(mibpatch) */
/*
table = subtree->mirror_tag->table;
if(table!=NULL){
table_detach(table);
table_free(table);
}
*/
}
return;
}
{
{
{
break;
}
}
{
}
else
{
}
}
int subtree_is_valid(Subtree *t)
{
return TRUE;
}
{
}
return NULL;
}
{
return 0;
}