xref: /onnv-gate/usr/src/cmd/agents/snmp/snmprelayd/subtree.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  *
22*0Sstevel@tonic-gate  * Copyright 1996 Sun Microsystems, Inc.  All Rights Reserved.
23*0Sstevel@tonic-gate  * Use is subject to license terms.
24*0Sstevel@tonic-gate  */
25*0Sstevel@tonic-gate 
26*0Sstevel@tonic-gate /*
27*0Sstevel@tonic-gate  * HISTORY
28*0Sstevel@tonic-gate  * 5-21-96	Jerry Yeung	support MIB
29*0Sstevel@tonic-gate  * 6-4-96	Jerry Yeung	support table
30*0Sstevel@tonic-gate  */
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate #ifndef _SUBTREE_H_
33*0Sstevel@tonic-gate #define _SUBTREE_H_
34*0Sstevel@tonic-gate 
35*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
36*0Sstevel@tonic-gate 
37*0Sstevel@tonic-gate #ifndef _SH_TABLE_H_
38*0Sstevel@tonic-gate #include "sh_table.h"
39*0Sstevel@tonic-gate #endif
40*0Sstevel@tonic-gate 
41*0Sstevel@tonic-gate #define TBL_TAG_TYPE_UNKNOWN 0
42*0Sstevel@tonic-gate #define TBL_TAG_TYPE_COL 1
43*0Sstevel@tonic-gate #define TBL_TAG_TYPE_LEAF 2
44*0Sstevel@tonic-gate 
45*0Sstevel@tonic-gate typedef struct _TblTag {
46*0Sstevel@tonic-gate 	int entry_index; /* lowest row index of the table */
47*0Sstevel@tonic-gate 	int type; /* col or leaf */
48*0Sstevel@tonic-gate 	Table *table;
49*0Sstevel@tonic-gate } TblTag;
50*0Sstevel@tonic-gate 
51*0Sstevel@tonic-gate typedef struct _MirrorTag {
52*0Sstevel@tonic-gate 	Table *table;
53*0Sstevel@tonic-gate } MirrorTag;
54*0Sstevel@tonic-gate 
55*0Sstevel@tonic-gate typedef struct _Subtree {
56*0Sstevel@tonic-gate         Integer regTreeIndex;
57*0Sstevel@tonic-gate         Integer regTreeAgentID;
58*0Sstevel@tonic-gate 	Oid		name;
59*0Sstevel@tonic-gate /* rename regTreeOID to name, which has already used
60*0Sstevel@tonic-gate         Oid regTreeOID;
61*0Sstevel@tonic-gate */
62*0Sstevel@tonic-gate         Integer regTreeStatus;
63*0Sstevel@tonic-gate 	String regTreeView;
64*0Sstevel@tonic-gate         Integer regTreePriority;
65*0Sstevel@tonic-gate 	struct _Subtree	*next_subtree;
66*0Sstevel@tonic-gate 	struct _Agent	*agent;
67*0Sstevel@tonic-gate 	struct _Subtree	*next_agent_subtree;
68*0Sstevel@tonic-gate 	struct _TblTag *tbl_tag;
69*0Sstevel@tonic-gate 	struct _MirrorTag *mirror_tag;
70*0Sstevel@tonic-gate 
71*0Sstevel@tonic-gate /* things to be addeded
72*0Sstevel@tonic-gate  * char view_selected;
73*0Sstevel@tonic-gate  * char bulk_selected;
74*0Sstevel@tonic-gate  * int priority;
75*0Sstevel@tonic-gate  */
76*0Sstevel@tonic-gate 
77*0Sstevel@tonic-gate } Subtree;
78*0Sstevel@tonic-gate 
79*0Sstevel@tonic-gate extern Subtree *first_subtree;
80*0Sstevel@tonic-gate 
81*0Sstevel@tonic-gate extern int sap_reg_tree_index;
82*0Sstevel@tonic-gate 
83*0Sstevel@tonic-gate int subtree_add(Agent *agent, Subid *subids, int len, TblTag *tbl_tag);
84*0Sstevel@tonic-gate 
85*0Sstevel@tonic-gate /* if the the oid doesn't find, it will be created and inserted */
86*0Sstevel@tonic-gate Subtree* subtree_find(Subid *subids, int len);
87*0Sstevel@tonic-gate 
88*0Sstevel@tonic-gate Subtree *subtree_match(u_char type, Oid *oid);
89*0Sstevel@tonic-gate 
90*0Sstevel@tonic-gate void subtree_list_delete();
91*0Sstevel@tonic-gate 
92*0Sstevel@tonic-gate void subtree_free(Subtree *sp); /* to be modified */
93*0Sstevel@tonic-gate 
94*0Sstevel@tonic-gate void subtree_detach(Subtree *sp);
95*0Sstevel@tonic-gate 
96*0Sstevel@tonic-gate void trace_subtrees();
97*0Sstevel@tonic-gate 
98*0Sstevel@tonic-gate void subtree_remove_from_agent_list(Subtree *subtree);
99*0Sstevel@tonic-gate 
100*0Sstevel@tonic-gate int subtree_is_valid(Subtree *subtree);
101*0Sstevel@tonic-gate 
102*0Sstevel@tonic-gate Subtree* subtree_next(Subtree *subtree);
103*0Sstevel@tonic-gate 
104*0Sstevel@tonic-gate void delete_all_subtree_from_agent(Agent* agent);
105*0Sstevel@tonic-gate 
106*0Sstevel@tonic-gate int subtree_purge(Subid *subids, int len);
107*0Sstevel@tonic-gate 
108*0Sstevel@tonic-gate int sync_subtrees_with_agent(Agent *agent);
109*0Sstevel@tonic-gate 
110*0Sstevel@tonic-gate #endif
111