1 #ifndef VAR_STRUCT_H
2 #define VAR_STRUCT_H
3 /*
4  * The subtree structure contains a subtree prefix which applies to
5  * all variables in the associated variable list.
6  *
7  * By converting to a tree of subtree structures, entries can
8  * now be subtrees of another subtree in the structure. i.e:
9  * 1.2
10  * 1.2.0
11  */
12 
13 #define UCD_REGISTRY_OID_MAX_LEN	128
14 
15 /*
16  * subtree flags
17  */
18 #define FULLY_QUALIFIED_INSTANCE    0x01
19 #define SUBTREE_ATTACHED	    	0x02
20 
21 typedef struct netsnmp_subtree_s {
22     oid		   *name_a;	/* objid prefix of registered subtree */
23     u_char          namelen;    /* number of subid's in name above */
24     oid            *start_a;	/* objid of start of covered range */
25     u_char          start_len;  /* number of subid's in start name */
26     oid            *end_a;	/* objid of end of covered range   */
27     u_char          end_len;    /* number of subid's in end name */
28     struct variable *variables; /* pointer to variables array */
29     int             variables_len;      /* number of entries in above array */
30     int             variables_width;    /* sizeof each variable entry */
31     char           *label_a;	/* calling module's label */
32     netsnmp_session *session;
33     u_char          flags;
34     u_char          priority;
35     int             timeout;
36     struct netsnmp_subtree_s *next;       /* List of 'sibling' subtrees */
37     struct netsnmp_subtree_s *prev;       /* (doubly-linked list) */
38     struct netsnmp_subtree_s *children;   /* List of 'child' subtrees */
39     int             range_subid;
40     oid             range_ubound;
41     netsnmp_handler_registration *reginfo;      /* new API */
42     int             cacheid;
43     int             global_cacheid;
44     size_t          oid_off;
45 } netsnmp_subtree;
46 
47 /*
48  * This is a new variable structure that doesn't have as much memory
49  * tied up in the object identifier.  It's elements have also been re-arranged
50  * so that the name field can be variable length.  Any number of these
51  * structures can be created with lengths tailor made to a particular
52  * application.  The first 5 elements of the structure must remain constant.
53  */
54 struct variable1 {
55     u_char          magic;      /* passed to function as a hint */
56     u_char          type;       /* type of variable */
57     u_short         acl;        /* access control list for variable */
58     FindVarMethod  *findVar;    /* function that finds variable */
59     u_char          namelen;    /* length of name below */
60     oid             name[1];    /* object identifier of variable */
61 };
62 
63 struct variable2 {
64     u_char          magic;      /* passed to function as a hint */
65     u_char          type;       /* type of variable */
66     u_short         acl;        /* access control list for variable */
67     FindVarMethod  *findVar;    /* function that finds variable */
68     u_char          namelen;    /* length of name below */
69     oid             name[2];    /* object identifier of variable */
70 };
71 
72 struct variable3 {
73     u_char          magic;      /* passed to function as a hint */
74     u_char          type;       /* type of variable */
75     u_short         acl;        /* access control list for variable */
76     FindVarMethod  *findVar;    /* function that finds variable */
77     u_char          namelen;    /* length of name below */
78     oid             name[3];    /* object identifier of variable */
79 };
80 
81 struct variable4 {
82     u_char          magic;      /* passed to function as a hint */
83     u_char          type;       /* type of variable */
84     u_short         acl;        /* access control list for variable */
85     FindVarMethod  *findVar;    /* function that finds variable */
86     u_char          namelen;    /* length of name below */
87     oid             name[4];    /* object identifier of variable */
88 };
89 
90 struct variable7 {
91     u_char          magic;      /* passed to function as a hint */
92     u_char          type;       /* type of variable */
93     u_short         acl;        /* access control list for variable */
94     FindVarMethod  *findVar;    /* function that finds variable */
95     u_char          namelen;    /* length of name below */
96     oid             name[7];    /* object identifier of variable */
97 };
98 
99 struct variable8 {
100     u_char          magic;      /* passed to function as a hint */
101     u_char          type;       /* type of variable */
102     u_short         acl;        /* access control list for variable */
103     FindVarMethod  *findVar;    /* function that finds variable */
104     u_char          namelen;    /* length of name below */
105     oid             name[8];    /* object identifier of variable */
106 };
107 
108 struct variable13 {
109     u_char          magic;      /* passed to function as a hint */
110     u_char          type;       /* type of variable */
111     u_short         acl;        /* access control list for variable */
112     FindVarMethod  *findVar;    /* function that finds variable */
113     u_char          namelen;    /* length of name below */
114     oid             name[13];   /* object identifier of variable */
115 };
116 #endif                          /* VAR_STRUCT_H */
117