⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mib2.c

📁 《嵌入式网络系统设计-基于Atmel ARM7 系列》这个本书的光盘资料
💻 C
📖 第 1 页 / 共 5 页
字号:
  MIB_NODE_AR,  3,  atentry_ids,  atentry_nodes};const s32_t attable_id = 1;struct mib_node* const attable_node = (struct mib_node* const)&atentry;const struct mib_array_node attable = {  &noleafs_get_object_def,  &noleafs_get_value,  &noleafs_set_test,  &noleafs_set_value,  MIB_NODE_AR,  1,  &attable_id,  &attable_node};/* at .1.3.6.1.2.1.3 */s32_t at_id = 1;struct mib_node* at_node = (struct mib_node* const)&attable;struct mib_ram_array_node at = {  &noleafs_get_object_def,  &noleafs_get_value,  &noleafs_set_test,  &noleafs_set_value,  MIB_NODE_RA,  0,  &at_id,  &at_node};/** index root node for ifTable */struct mib_list_rootnode iflist_root = {  &ifentry_get_object_def,  &ifentry_get_value,  &noleafs_set_test,  &noleafs_set_value,  MIB_NODE_LR,  0,  NULL,  NULL,  0};const s32_t ifentry_ids[22] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22 };struct mib_node* const ifentry_nodes[22] = {  (struct mib_node* const)&iflist_root, (struct mib_node* const)&iflist_root,  (struct mib_node* const)&iflist_root, (struct mib_node* const)&iflist_root,  (struct mib_node* const)&iflist_root, (struct mib_node* const)&iflist_root,  (struct mib_node* const)&iflist_root, (struct mib_node* const)&iflist_root,  (struct mib_node* const)&iflist_root, (struct mib_node* const)&iflist_root,  (struct mib_node* const)&iflist_root, (struct mib_node* const)&iflist_root,  (struct mib_node* const)&iflist_root, (struct mib_node* const)&iflist_root,  (struct mib_node* const)&iflist_root, (struct mib_node* const)&iflist_root,  (struct mib_node* const)&iflist_root, (struct mib_node* const)&iflist_root,  (struct mib_node* const)&iflist_root, (struct mib_node* const)&iflist_root,  (struct mib_node* const)&iflist_root, (struct mib_node* const)&iflist_root};const struct mib_array_node ifentry = {  &noleafs_get_object_def,  &noleafs_get_value,  &noleafs_set_test,  &noleafs_set_value,  MIB_NODE_AR,  22,  ifentry_ids,  ifentry_nodes};s32_t iftable_id = 1;struct mib_node* iftable_node = (struct mib_node* const)&ifentry;struct mib_ram_array_node iftable = {  &noleafs_get_object_def,  &noleafs_get_value,  &noleafs_set_test,  &noleafs_set_value,  MIB_NODE_RA,  0,  &iftable_id,  &iftable_node};/* interfaces .1.3.6.1.2.1.2 */const mib_scalar_node interfaces_scalar = {  &interfaces_get_object_def,  &interfaces_get_value,  &noleafs_set_test,  &noleafs_set_value,  MIB_NODE_SC,  0};const s32_t interfaces_ids[2] = { 1, 2 };struct mib_node* const interfaces_nodes[2] = {  (struct mib_node* const)&interfaces_scalar, (struct mib_node* const)&iftable};const struct mib_array_node interfaces = {  &noleafs_get_object_def,  &noleafs_get_value,  &noleafs_set_test,  &noleafs_set_value,  MIB_NODE_AR,  2,  interfaces_ids,  interfaces_nodes};/*             0 1 2 3 4 5 6 *//* system .1.3.6.1.2.1.1 */const mib_scalar_node sys_tem_scalar = {  &system_get_object_def,  &system_get_value,  &system_set_test,  &system_set_value,  MIB_NODE_SC,  0};const s32_t sys_tem_ids[7] = { 1, 2, 3, 4, 5, 6, 7 };struct mib_node* const sys_tem_nodes[7] = {  (struct mib_node* const)&sys_tem_scalar, (struct mib_node* const)&sys_tem_scalar,  (struct mib_node* const)&sys_tem_scalar, (struct mib_node* const)&sys_tem_scalar,  (struct mib_node* const)&sys_tem_scalar, (struct mib_node* const)&sys_tem_scalar,  (struct mib_node* const)&sys_tem_scalar};/* work around name issue with 'sys_tem', some compiler(s?) seem to reserve 'system' */const struct mib_array_node sys_tem = {  &noleafs_get_object_def,  &noleafs_get_value,  &noleafs_set_test,  &noleafs_set_value,  MIB_NODE_AR,  7,  sys_tem_ids,  sys_tem_nodes};/* mib-2 .1.3.6.1.2.1 */#if LWIP_TCP#define MIB2_GROUPS 8#else#define MIB2_GROUPS 7#endifconst s32_t mib2_ids[MIB2_GROUPS] ={  1,  2,  3,  4,  5,#if LWIP_TCP  6,#endif  7,  11};struct mib_node* const mib2_nodes[MIB2_GROUPS] = {  (struct mib_node* const)&sys_tem,  (struct mib_node* const)&interfaces,  (struct mib_node* const)&at,  (struct mib_node* const)&ip,  (struct mib_node* const)&icmp,#if LWIP_TCP  (struct mib_node* const)&tcp,#endif  (struct mib_node* const)&udp,  (struct mib_node* const)&snmp};const struct mib_array_node mib2 = {  &noleafs_get_object_def,  &noleafs_get_value,  &noleafs_set_test,  &noleafs_set_value,  MIB_NODE_AR,  MIB2_GROUPS,  mib2_ids,  mib2_nodes};/* mgmt .1.3.6.1.2 */const s32_t mgmt_ids[1] = { 1 };struct mib_node* const mgmt_nodes[1] = { (struct mib_node* const)&mib2 };const struct mib_array_node mgmt = {  &noleafs_get_object_def,  &noleafs_get_value,  &noleafs_set_test,  &noleafs_set_value,  MIB_NODE_AR,  1,  mgmt_ids,  mgmt_nodes};/* internet .1.3.6.1 */#if SNMP_PRIVATE_MIBs32_t internet_ids[2] = { 2, 4 };struct mib_node* const internet_nodes[2] = { (struct mib_node* const)&mgmt, (struct mib_node* const)&private };const struct mib_array_node internet = {  &noleafs_get_object_def,  &noleafs_get_value,  &noleafs_set_test,  &noleafs_set_value,  MIB_NODE_AR,  2,  internet_ids,  internet_nodes};#elseconst s32_t internet_ids[1] = { 2 };struct mib_node* const internet_nodes[1] = { (struct mib_node* const)&mgmt };const struct mib_array_node internet = {  &noleafs_get_object_def,  &noleafs_get_value,  &noleafs_set_test,  &noleafs_set_value,  MIB_NODE_AR,  1,  internet_ids,  internet_nodes};#endif/** mib-2.system.sysObjectID  */static struct snmp_obj_id sysobjid = {SNMP_SYSOBJID_LEN, SNMP_SYSOBJID};/** enterprise ID for generic TRAPs, .iso.org.dod.internet.mgmt.mib-2.snmp */static struct snmp_obj_id snmpgrp_id = {7,{1,3,6,1,2,1,11}};/** mib-2.system.sysServices */static const s32_t sysservices = SNMP_SYSSERVICES;/** mib-2.system.sysDescr */static const u8_t sysdescr_len_default = 4;static const u8_t sysdescr_default[] = "lwIP";static u8_t* sysdescr_len_ptr = (u8_t*)&sysdescr_len_default;static u8_t* sysdescr_ptr = (u8_t*)&sysdescr_default[0];/** mib-2.system.sysContact */static const u8_t syscontact_len_default = 0;static const u8_t syscontact_default[] = "";static u8_t* syscontact_len_ptr = (u8_t*)&syscontact_len_default;static u8_t* syscontact_ptr = (u8_t*)&syscontact_default[0];/** mib-2.system.sysName */static const u8_t sysname_len_default = 8;static const u8_t sysname_default[] = "FQDN-unk";static u8_t* sysname_len_ptr = (u8_t*)&sysname_len_default;static u8_t* sysname_ptr = (u8_t*)&sysname_default[0];/** mib-2.system.sysLocation */static const u8_t syslocation_len_default = 0;static const u8_t syslocation_default[] = "";static u8_t* syslocation_len_ptr = (u8_t*)&syslocation_len_default;static u8_t* syslocation_ptr = (u8_t*)&syslocation_default[0];/** mib-2.snmp.snmpEnableAuthenTraps */static const u8_t snmpenableauthentraps_default = 2; /* disabled */static u8_t* snmpenableauthentraps_ptr = (u8_t*)&snmpenableauthentraps_default;/** mib-2.interfaces.ifTable.ifEntry.ifSpecific (zeroDotZero) */static const struct snmp_obj_id ifspecific = {2, {0, 0}};/** mib-2.ip.ipRouteTable.ipRouteEntry.ipRouteInfo (zeroDotZero) */static const struct snmp_obj_id iprouteinfo = {2, {0, 0}};/* mib-2.system counter(s) */static u32_t sysuptime = 0;/* mib-2.ip counter(s) */static u32_t ipinreceives = 0,             ipinhdrerrors = 0,             ipinaddrerrors = 0,             ipforwdatagrams = 0,             ipinunknownprotos = 0,             ipindiscards = 0,             ipindelivers = 0,             ipoutrequests = 0,             ipoutdiscards = 0,             ipoutnoroutes = 0,             ipreasmreqds = 0,             ipreasmoks = 0,             ipreasmfails = 0,             ipfragoks = 0,             ipfragfails = 0,             ipfragcreates = 0,             iproutingdiscards = 0;/* mib-2.icmp counter(s) */static u32_t icmpinmsgs = 0,             icmpinerrors = 0,             icmpindestunreachs = 0,             icmpintimeexcds = 0,             icmpinparmprobs = 0,             icmpinsrcquenchs = 0,             icmpinredirects = 0,             icmpinechos = 0,             icmpinechoreps = 0,             icmpintimestamps = 0,             icmpintimestampreps = 0,             icmpinaddrmasks = 0,             icmpinaddrmaskreps = 0,             icmpoutmsgs = 0,             icmpouterrors = 0,             icmpoutdestunreachs = 0,             icmpouttimeexcds = 0,             icmpoutparmprobs = 0,             icmpoutsrcquenchs = 0,             icmpoutredirects = 0,             icmpoutechos = 0,             icmpoutechoreps = 0,             icmpouttimestamps = 0,             icmpouttimestampreps = 0,             icmpoutaddrmasks = 0,             icmpoutaddrmaskreps = 0;/* mib-2.tcp counter(s) */static u32_t tcpactiveopens = 0,             tcppassiveopens = 0,             tcpattemptfails = 0,             tcpestabresets = 0,             tcpinsegs = 0,             tcpoutsegs = 0,             tcpretranssegs = 0,             tcpinerrs = 0,             tcpoutrsts = 0;/* mib-2.udp counter(s) */static u32_t udpindatagrams = 0,             udpnoports = 0,             udpinerrors = 0,             udpoutdatagrams = 0;/* mib-2.snmp counter(s) */static u32_t snmpinpkts = 0,             snmpoutpkts = 0,             snmpinbadversions = 0,             snmpinbadcommunitynames = 0,             snmpinbadcommunityuses = 0,             snmpinasnparseerrs = 0,             snmpintoobigs = 0,             snmpinnosuchnames = 0,             snmpinbadvalues = 0,             snmpinreadonlys = 0,             snmpingenerrs = 0,             snmpintotalreqvars = 0,             snmpintotalsetvars = 0,             snmpingetrequests = 0,             snmpingetnexts = 0,             snmpinsetrequests = 0,             snmpingetresponses = 0,             snmpintraps = 0,             snmpouttoobigs = 0,             snmpoutnosuchnames = 0,             snmpoutbadvalues = 0,             snmpoutgenerrs = 0,             snmpoutgetrequests = 0,             snmpoutgetnexts = 0,             snmpoutsetrequests = 0,             snmpoutgetresponses = 0,             snmpouttraps = 0;/* prototypes of the following functions are in lwip/src/include/lwip/snmp.h *//** * Copy octet string. * * @param dst points to destination * @param src points to source * @param n number of octets to copy. */void ocstrncpy(u8_t *dst, u8_t *src, u8_t n){  while (n > 0)  {    n--;    *dst++ = *src++;  }}/** * Copy object identifier (s32_t) array. * * @param dst points to destination * @param src points to source * @param n number of sub identifiers to copy. */void objectidncpy(s32_t *dst, s32_t *src, u8_t n){  while(n > 0)  {    n--;    *dst++ = *src++;  }}/** * Initializes sysDescr pointers. * * @param str if non-NULL then copy str pointer * @param strlen points to string length, excluding zero terminator */void snmp_set_sysdesr(u8_t *str, u8_t *strlen){  if (str != NULL)  {    sysdescr_ptr = str;    sysdescr_len_ptr = strlen;  }}void snmp_get_sysobjid_ptr(struct snmp_obj_id **oid){  *oid = &sysobjid;}/** * Initializes sysObjectID value. * * @param oid points to stuct snmp_obj_id to copy */void snmp_set_sysobjid(struct snmp_obj_id *oid){  sysobjid = *oid;}/** * Must be called at regular 10 msec interval from a timer interrupt * or signal handler depending on your runtime environment. */void snmp_inc_sysuptime(void){  sysuptime++;}void snmp_get_sysuptime(u32_t *value){  *value = sysuptime;}/** * Initializes sysContact pointers, * e.g. ptrs to non-volatile memory external to lwIP. * * @param str if non-NULL then copy str pointer * @param strlen points to string length, excluding zero terminator */void snmp_set_syscontact(u8_t *ocstr, u8_t *ocstrlen){  if (ocstr != NULL)  {    syscontact_ptr = ocstr;    syscontact_len_ptr = ocstrlen;  }}/** * Initializes sysName pointers, * e.g. ptrs to non-volatile memory external to lwIP. * * @param str if non-NULL then copy str pointer * @param strlen points to string length, excluding zero terminator */void snmp_set_sysname(u8_t *ocstr, u8_t *ocstrlen){  if (ocstr != NULL)  {    sysname_ptr = ocstr;    sysname_len_ptr = ocstrlen;  }}/** * Initializes sysLocation pointers, * e.g. ptrs to non-volatile memory external to lwIP. * * @param str if non-NULL then copy str pointer * @param strlen points to string length, excluding zero terminator */void snmp_set_syslocation(u8_t *ocstr, u8_t *ocstrlen){  if (ocstr != NULL)  {    syslocation_ptr = ocstr;    syslocation_len_ptr = ocstrlen;  }}void snmp_add_ifinoctets(struct netif *ni, u32_t value){  ni->ifinoctets += value;}void snmp_inc_ifinucastpkts(struct netif *ni){  (ni->ifinucastpkts)++;}void snmp_inc_ifinnucastpkts(struct netif *ni){  (ni->ifinnucastpkts)++;}void snmp_inc_ifindiscards(struct netif *ni){  (ni->ifindiscards)++;}void snmp_add_ifoutoctets(struct netif *ni, u32_t value){  ni->ifoutoctets += value;}void snmp_inc_ifoutucastpkts(struct netif *ni){  (ni->ifoutucastpkts)++;}void snmp_inc_ifoutnucastpkts(struct netif *ni){  (ni->ifoutnucastpkts)++;}void snmp_inc_ifoutdiscards(struct netif *ni){  (ni->ifoutdiscards)++;}void snmp_inc_iflist(void)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -