电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

NET-SNMP服务端添加自定义节点

NET-SNMP服务端添加自定义节点_第1页
1/10
NET-SNMP服务端添加自定义节点_第2页
2/10
NET-SNMP服务端添加自定义节点_第3页
3/10
NET-SNMP 服务端添加自定义节点编译生成.c 和.h 文件后,只是一个 mib 节点文件模板。1 代码修改:blue.h/* * Note: this file originally auto-generated by mib2c using * : mib2c.old-api.conf 14476 2024-04-18 17:36:51Z hardaker $ */#ifndef BLUE_H#define BLUE_H/* * function declarations */void init_blue(void);FindVarMethod var_blue;WriteMethod write_bluenum;#endif /* BLUE_H */我们会发现生成的 C 文件,其实只是一个模版。其中功能实现的地方,以与某些关键地方都留了空,并且有较为详细的英文注释。只需要修改两处即可通过编译,其余部分可根据情况决定是否修改,以与如何修改。blue.c/* * Note: this file originally auto-generated by mib2c using * : mib2c.old-api.conf 14476 2024-04-18 17:36:51Z hardaker $ */#include #include #include #include "blue.h"/* * blue_variables_oid: * this is the top level oid that we want to register under. This * is essentially a prefix, with the suffix appearing in the * variable below. */oid blue_variables_oid[] = { 1, 3, 6, 1, 4, 1, 1, 1 };/* * variable4 blue_variables: * this variable defines function callbacks and type return information * for the blue mib section */struct variable7 blue_variables[] = { /* * magic number , variable type , ro/rw , callback fn , L, oidsuffix */#define BLUENUM1 {BLUENUM, ASN_INTEGER, RWRITE, var_blue, 1, {4}},};/* * (L = length of the oidsuffix) *//** Initializes the blue module */voidinit_blue(void){ DEBUGMSGTL(("blue", "Initializing\n")); /* * register ourselves with the agent to handle our mib tree */ REGISTER_MIB("blue", blue_variables, variable4, blue_variables_oid); /* * place any other initialization junk you need here */}/* * var_blue(): * This function is called every time the agent gets a request for * a scalar ...

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

NET-SNMP服务端添加自定义节点

确认删除?
VIP
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群
客服邮箱
回到顶部