Warning, cross-references for /kernel/include/lwip/snmp_structs.h need to be fixed.
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037 #ifndef __LWIP_SNMP_STRUCTS_H__
0038 #define __LWIP_SNMP_STRUCTS_H__
0039
0040 #include "lwip/opt.h"
0041
0042 #if LWIP_SNMP
0043
0044 #include "lwip/snmp.h"
0045
0046 #if SNMP_PRIVATE_MIB
0047 #include "private_mib.h"
0048 #endif
0049
0050 #ifdef __cplusplus
0051 extern "C" {
0052 #endif
0053
0054
0055 #define MIB_OBJECT_NONE 0
0056 #define MIB_OBJECT_SCALAR 1
0057 #define MIB_OBJECT_TAB 2
0058
0059
0060 #define MIB_OBJECT_READ_ONLY 0
0061 #define MIB_OBJECT_READ_WRITE 1
0062 #define MIB_OBJECT_WRITE_ONLY 2
0063 #define MIB_OBJECT_NOT_ACCESSIBLE 3
0064
0065
0066 struct obj_def
0067 {
0068
0069 u8_t instance;
0070
0071 u8_t access;
0072
0073 u8_t asn_type;
0074
0075 u16_t v_len;
0076
0077 u8_t id_inst_len;
0078
0079 s32_t *id_inst_ptr;
0080 };
0081
0082 struct snmp_name_ptr
0083 {
0084 u8_t ident_len;
0085 s32_t *ident;
0086 };
0087
0088
0089 #define MIB_NODE_SC 0x01
0090
0091 #define MIB_NODE_AR 0x02
0092
0093 #define MIB_NODE_RA 0x03
0094
0095 #define MIB_NODE_LR 0x04
0096
0097 #define MIB_NODE_EX 0x05
0098
0099
0100 struct mib_node
0101 {
0102
0103 void (*get_object_def)(u8_t ident_len, s32_t *ident, struct obj_def *od);
0104
0105
0106 void (*get_value)(struct obj_def *od, u16_t len, void *value);
0107
0108 u8_t (*set_test)(struct obj_def *od, u16_t len, void *value);
0109
0110 void (*set_value)(struct obj_def *od, u16_t len, void *value);
0111
0112 const u8_t node_type;
0113
0114 const u16_t maxlength;
0115 };
0116
0117
0118 typedef struct mib_node mib_scalar_node;
0119
0120
0121
0122 struct mib_array_node
0123 {
0124
0125 void (* const get_object_def)(u8_t ident_len, s32_t *ident, struct obj_def *od);
0126 void (* const get_value)(struct obj_def *od, u16_t len, void *value);
0127 u8_t (*set_test)(struct obj_def *od, u16_t len, void *value);
0128 void (*set_value)(struct obj_def *od, u16_t len, void *value);
0129
0130 const u8_t node_type;
0131 const u16_t maxlength;
0132
0133
0134 const s32_t *objid;
0135 struct mib_node* const *nptr;
0136 };
0137
0138
0139
0140 struct mib_ram_array_node
0141 {
0142
0143 void (*get_object_def)(u8_t ident_len, s32_t *ident, struct obj_def *od);
0144 void (*get_value)(struct obj_def *od, u16_t len, void *value);
0145 u8_t (*set_test)(struct obj_def *od, u16_t len, void *value);
0146 void (*set_value)(struct obj_def *od, u16_t len, void *value);
0147
0148 u8_t node_type;
0149 u16_t maxlength;
0150
0151
0152 s32_t *objid;
0153 struct mib_node **nptr;
0154 };
0155
0156 struct mib_list_node
0157 {
0158 struct mib_list_node *prev;
0159 struct mib_list_node *next;
0160 s32_t objid;
0161 struct mib_node *nptr;
0162 };
0163
0164
0165
0166 struct mib_list_rootnode
0167 {
0168
0169 void (*get_object_def)(u8_t ident_len, s32_t *ident, struct obj_def *od);
0170 void (*get_value)(struct obj_def *od, u16_t len, void *value);
0171 u8_t (*set_test)(struct obj_def *od, u16_t len, void *value);
0172 void (*set_value)(struct obj_def *od, u16_t len, void *value);
0173
0174 u8_t node_type;
0175 u16_t maxlength;
0176
0177
0178 struct mib_list_node *head;
0179 struct mib_list_node *tail;
0180
0181 u16_t count;
0182 };
0183
0184
0185
0186 struct mib_external_node
0187 {
0188
0189 void (*get_object_def)(u8_t ident_len, s32_t *ident, struct obj_def *od);
0190 void (*get_value)(struct obj_def *od, u16_t len, void *value);
0191 u8_t (*set_test)(struct obj_def *od, u16_t len, void *value);
0192 void (*set_value)(struct obj_def *od, u16_t len, void *value);
0193
0194 u8_t node_type;
0195 u16_t maxlength;
0196
0197
0198
0199
0200 void* addr_inf;
0201
0202 u8_t tree_levels;
0203
0204 u16_t (*level_length)(void* addr_inf, u8_t level);
0205
0206
0207 s32_t (*ident_cmp)(void* addr_inf, u8_t level, u16_t idx, s32_t sub_id);
0208 void (*get_objid)(void* addr_inf, u8_t level, u16_t idx, s32_t *sub_id);
0209
0210
0211 void (*get_object_def_q)(void* addr_inf, u8_t rid, u8_t ident_len, s32_t *ident);
0212 void (*get_value_q)(u8_t rid, struct obj_def *od);
0213 void (*set_test_q)(u8_t rid, struct obj_def *od);
0214 void (*set_value_q)(u8_t rid, struct obj_def *od, u16_t len, void *value);
0215
0216 void (*get_object_def_a)(u8_t rid, u8_t ident_len, s32_t *ident, struct obj_def *od);
0217 void (*get_value_a)(u8_t rid, struct obj_def *od, u16_t len, void *value);
0218 u8_t (*set_test_a)(u8_t rid, struct obj_def *od, u16_t len, void *value);
0219 void (*set_value_a)(u8_t rid, struct obj_def *od, u16_t len, void *value);
0220
0221
0222 void (*get_object_def_pc)(u8_t rid, u8_t ident_len, s32_t *ident);
0223 void (*get_value_pc)(u8_t rid, struct obj_def *od);
0224 void (*set_test_pc)(u8_t rid, struct obj_def *od);
0225 void (*set_value_pc)(u8_t rid, struct obj_def *od);
0226 };
0227
0228
0229 extern const struct mib_array_node internet;
0230
0231
0232 void noleafs_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od);
0233 void noleafs_get_value(struct obj_def *od, u16_t len, void *value);
0234 u8_t noleafs_set_test(struct obj_def *od, u16_t len, void *value);
0235 void noleafs_set_value(struct obj_def *od, u16_t len, void *value);
0236
0237 void snmp_oidtoip(s32_t *ident, struct ip_addr *ip);
0238 void snmp_iptooid(struct ip_addr *ip, s32_t *ident);
0239 void snmp_ifindextonetif(s32_t ifindex, struct netif **netif);
0240 void snmp_netiftoifindex(struct netif *netif, s32_t *ifidx);
0241
0242 struct mib_list_node* snmp_mib_ln_alloc(s32_t id);
0243 void snmp_mib_ln_free(struct mib_list_node *ln);
0244 struct mib_list_rootnode* snmp_mib_lrn_alloc(void);
0245 void snmp_mib_lrn_free(struct mib_list_rootnode *lrn);
0246
0247 s8_t snmp_mib_node_insert(struct mib_list_rootnode *rn, s32_t objid, struct mib_list_node **insn);
0248 s8_t snmp_mib_node_find(struct mib_list_rootnode *rn, s32_t objid, struct mib_list_node **fn);
0249 struct mib_list_rootnode *snmp_mib_node_delete(struct mib_list_rootnode *rn, struct mib_list_node *n);
0250
0251 struct mib_node* snmp_search_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snmp_name_ptr *np);
0252 struct mib_node* snmp_expand_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snmp_obj_id *oidret);
0253 u8_t snmp_iso_prefix_tst(u8_t ident_len, s32_t *ident);
0254 u8_t snmp_iso_prefix_expand(u8_t ident_len, s32_t *ident, struct snmp_obj_id *oidret);
0255
0256 #ifdef __cplusplus
0257 }
0258 #endif
0259
0260 #endif
0261
0262 #endif