xref: /onnv-gate/usr/src/cmd/agents/snmp/agent/node.h (revision 0:68f95e015346)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  *
22  * Copyright 1999 Sun Microsystems, Inc.  All Rights Reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _NODE_H_
27 #define _NODE_H_
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #include "asn1.h"
32 #define COLUMN		1
33 #define OBJECT		2
34 #define NODE		3
35 
36 #define READ_FLAG	0x1
37 #define WRITE_FLAG	0x2
38 
39 
40 typedef struct _Enum {
41 	struct _Enum *next_enum;
42 	char *label;
43 	Integer value;
44 } Enum;
45 
46 typedef struct _Object {
47 	Oid name;
48 	u_char asn1_type;
49 	Enum *first_enum;
50 	int access;
51         int type;
52 	int (*get)();
53 	int (*set)();
54 	void (*dealloc)();
55 } Object;
56 
57 typedef struct _Index {
58 	struct _Index *next_index;
59 	char *label;
60         int index_type;
61         int index_len;         /* for strings only */
62 	struct _Node *node;
63 } Index;
64 
65 typedef struct _Entry {
66 	struct _Index *first_index;
67 	int n_indexs;
68 	int (*get)();
69 	void (*dealloc)();
70 } Entry;
71 
72 
73 typedef struct _Column {
74 	Oid name;
75 	u_char asn1_type;
76 	Enum *first_enum;
77 	int access;
78         int type;
79         int (*get)();
80 	int (*set)();
81 	Entry *entry;
82 	int offset;
83 } Column;
84 
85 
86 typedef struct _Node {
87 	struct _Node *parent;
88 	struct _Node *first_child;
89 	struct _Node *next_peer;
90 	struct _Node *next;
91 
92 	char *label;
93 	Subid subid;
94 
95 	int type;
96 	union {
97 		Object *object;
98 		Column *column;
99 	} data;
100 } Node;
101 
102 struct CallbackItem {
103         Object *ptr;
104         int type,next;
105 };
106 struct TrapHndlCxt {
107         char name[256];
108         int is_sun_enterprise;
109         int generic,specific;
110 };
111 
112 struct TrapEnterpriseInfo {
113         Subid subids[7];
114 };
115 
116 /* Handling arbitrary length enterprise OID in traps */
117 struct TrapAnyEnterpriseInfo {
118         Subid subids[MAX_OID_LEN+1];
119 };
120 
121 
122 extern Enum enum_table[];
123 extern int enum_table_size;
124 
125 extern Object object_table[];
126 extern int object_table_size;
127 
128 extern Index index_table[];
129 extern int index_table_size;
130 
131 extern Entry entry_table[];
132 extern int entry_table_size;
133 
134 extern Column column_table[];
135 extern int column_table_size;
136 
137 extern Node node_table[];
138 extern int node_table_size;
139 
140 extern struct CallbackItem *callItem;
141 extern int numCallItem;
142 
143 extern int *trapTableMap;
144 
145 extern struct TrapHndlCxt *trapBucket;
146 extern int numTrapElem;
147 
148 extern struct TrapEnterpriseInfo *trapEnterpriseInfo;
149 /* For arbitrary length enterprise OID in traps - bug 4133978 */
150 extern struct TrapAnyEnterpriseInfo *trapAnyEnterpriseInfo;
151 
152 
153 extern Node *node_find(int search_type, Oid *name, Oid *suffix);
154 
155 #endif
156