43 lines
1.4 KiB
C
43 lines
1.4 KiB
C
#ifndef _SNMP_TABLE_H
|
|
#define _SNMP_TABLE_H
|
|
|
|
#define MAX_COLUMNAR_OF_TABLE 48
|
|
|
|
typedef struct table_index {
|
|
u8 len;
|
|
u32 oid[32];
|
|
} table_index;
|
|
|
|
/* Get an exist instance from the inclusive one pointed to by address 'instance' */
|
|
typedef int (*table_get_instance)(u32 *instance);
|
|
typedef int (*table_get_resp)(u32 column, u32 *instance, u8 *pdata, u8 *vartype);
|
|
typedef int (*table_set_resp)(u32 column, u32 *instance, u8 *pdata, u16 datalen);
|
|
|
|
struct snmp_table_profile {
|
|
char name[32];
|
|
table_index index; /* oid of table with entry exclusive */
|
|
u32 column[MAX_COLUMNAR_OF_TABLE]; /* define all columns of a table, use '0' indicating the end */
|
|
u8 level; /* level of instance in order to identify a row */
|
|
table_get_instance get_instance;
|
|
table_get_resp get_resp;
|
|
table_set_resp set_resp;
|
|
};
|
|
|
|
struct snmp_register {
|
|
char name[32];
|
|
u8 prefix_len; /* Module prefix len */
|
|
u32 prefix_oid[32]; /* Module prefix oid */
|
|
u8 num_of_table; /* how many tables being registered, such tables is pointed to by address 'table' */
|
|
struct snmp_table_profile *table;
|
|
|
|
/* In case no table is matched, default callback function is invoked if it is not NULL. Hence,
|
|
you can implement get/set in much the same way before, i.e. traveling all branches of MIB */
|
|
getcall default_get_resp;
|
|
setcall default_set_resp;
|
|
};
|
|
|
|
extern int register_snmp_table(struct snmp_register *reg);
|
|
|
|
#endif
|
|
|