Go to the documentation of this file.
32 #define TRACE_LEVEL SNMP_TRACE_LEVEL
45 #if (IF_MIB_SUPPORT == ENABLED)
85 value->integer = context->numInterfaces;
149 if(index < 1 || index > context->numInterfaces)
153 interface = &context->interfaces[index - 1];
158 if(
osStrcmp(object->name,
"ifIndex") == 0)
161 value->integer = index;
164 else if(
osStrcmp(object->name,
"ifDescr") == 0)
184 else if(
osStrcmp(object->name,
"ifType") == 0)
186 #if (ETH_VLAN_SUPPORT == ENABLED)
188 if(interface->vlanId != 0)
197 if(physicalInterface->nicDriver != NULL)
200 switch(physicalInterface->nicDriver->type)
231 else if(
osStrcmp(object->name,
"ifMtu") == 0)
234 if(physicalInterface->nicDriver != NULL)
236 value->integer = physicalInterface->nicDriver->mtu;
244 else if(
osStrcmp(object->name,
"ifSpeed") == 0)
247 value->gauge32 = interface->linkSpeed;
249 #if (ETH_SUPPORT == ENABLED)
251 else if(
osStrcmp(object->name,
"ifPhysAddress") == 0)
259 if(*valueLen >=
sizeof(
MacAddr))
274 else if(
osStrcmp(object->name,
"ifAdminStatus") == 0)
277 if(physicalInterface->nicDriver != NULL)
287 else if(
osStrcmp(object->name,
"ifOperStatus") == 0)
290 if(interface->linkState)
300 else if(
osStrcmp(object->name,
"ifLastChange") == 0)
303 value->timeTicks = interface->ifStats.lastChange;
306 else if(
osStrcmp(object->name,
"ifInOctets") == 0)
309 value->counter32 = (uint32_t) interface->ifStats.inOctets;
312 else if(
osStrcmp(object->name,
"ifInUcastPkts") == 0)
315 value->counter32 = (uint32_t) interface->ifStats.inUcastPkts;
318 else if(
osStrcmp(object->name,
"ifInDiscards") == 0)
321 value->counter32 = interface->ifStats.inDiscards;
324 else if(
osStrcmp(object->name,
"ifInErrors") == 0)
327 value->counter32 = interface->ifStats.inErrors;
330 else if(
osStrcmp(object->name,
"ifInUnknownProtos") == 0)
333 value->counter32 = interface->ifStats.inUnknownProtos;
336 else if(
osStrcmp(object->name,
"ifOutOctets") == 0)
339 value->counter32 = (uint32_t) interface->ifStats.outOctets;
342 else if(
osStrcmp(object->name,
"ifOutUcastPkts") == 0)
345 value->counter32 = (uint32_t) interface->ifStats.outUcastPkts;
348 else if(
osStrcmp(object->name,
"ifOutDiscards") == 0)
351 value->counter32 = interface->ifStats.outDiscards;
354 else if(
osStrcmp(object->name,
"ifOutErrors") == 0)
357 value->counter32 = interface->ifStats.outErrors;
382 size_t oidLen, uint8_t *nextOid,
size_t *nextOidLen)
393 if(*nextOidLen < object->
oidLen)
397 osMemcpy(nextOid, object->oid, object->oidLen);
400 for(index = 1; index <= context->numInterfaces; index++)
484 if(index < 1 || index > context->numInterfaces)
488 interface = &context->interfaces[index - 1];
491 if(
osStrcmp(object->name,
"ifName") == 0)
511 else if(
osStrcmp(object->name,
"ifInMulticastPkts") == 0)
514 value->counter32 = (uint32_t) interface->ifStats.inMulticastPkts;
517 else if(
osStrcmp(object->name,
"ifInBroadcastPkts") == 0)
520 value->counter32 = (uint32_t) interface->ifStats.inBroadcastPkts;
523 else if(
osStrcmp(object->name,
"ifOutMulticastPkts") == 0)
526 value->counter32 = (uint32_t) interface->ifStats.outMulticastPkts;
529 else if(
osStrcmp(object->name,
"ifOutBroadcastPkts") == 0)
532 value->counter32 = (uint32_t) interface->ifStats.outBroadcastPkts;
535 else if(
osStrcmp(object->name,
"ifHCInOctets") == 0)
538 value->counter64 = interface->ifStats.inOctets;
541 else if(
osStrcmp(object->name,
"ifHCInUcastPkts") == 0)
544 value->counter64 = interface->ifStats.inUcastPkts;
547 else if(
osStrcmp(object->name,
"ifHCInMulticastPkts") == 0)
550 value->counter64 = interface->ifStats.inMulticastPkts;
553 else if(
osStrcmp(object->name,
"ifHCInBroadcastPkts") == 0)
556 value->counter64 = interface->ifStats.inBroadcastPkts;
559 else if(
osStrcmp(object->name,
"ifHCOutOctets") == 0)
562 value->counter64 = interface->ifStats.outOctets;
565 else if(
osStrcmp(object->name,
"ifHCOutUcastPkts") == 0)
568 value->counter64 = interface->ifStats.outUcastPkts;
571 else if(
osStrcmp(object->name,
"ifHCOutMulticastPkts") == 0)
574 value->counter64 = interface->ifStats.outMulticastPkts;
577 else if(
osStrcmp(object->name,
"ifHCOutBroadcastPkts") == 0)
580 value->counter64 = interface->ifStats.outBroadcastPkts;
583 else if(
osStrcmp(object->name,
"ifLinkUpDownTrapEnable") == 0)
590 else if(
osStrcmp(object->name,
"ifHighSpeed") == 0)
593 value->gauge32 = interface->linkSpeed / 1000000;
596 else if(
osStrcmp(object->name,
"ifPromiscuousMode") == 0)
598 #if (ETH_SUPPORT == ENABLED)
600 if(interface->promiscuous)
615 else if(
osStrcmp(object->name,
"ifConnectorPresent") == 0)
622 else if(
osStrcmp(object->name,
"ifAlias") == 0)
629 else if(
osStrcmp(object->name,
"ifCounterDiscontinuityTime") == 0)
633 value->timeTicks = 0;
658 size_t oidLen, uint8_t *nextOid,
size_t *nextOidLen)
669 if(*nextOidLen < object->
oidLen)
673 osMemcpy(nextOid, object->oid, object->oidLen);
676 for(index = 1; index <= context->numInterfaces; index++)
767 for(index = 1; index <= context->numInterfaces; index++)
770 if(higherLayer == 0 && lowerLayer == index)
774 else if(higherLayer == index && lowerLayer == 0)
781 if(index > context->numInterfaces)
785 if(
osStrcmp(object->name,
"ifStackStatus") == 0)
813 size_t oidLen, uint8_t *nextOid,
size_t *nextOidLen)
827 if(*nextOidLen < object->
oidLen)
831 osMemcpy(nextOid, object->oid, object->oidLen);
835 for(k = 0; k < 2; k++)
838 for(index = 1; index <= context->numInterfaces; index++)
918 #if (ETH_SUPPORT == ENABLED)
951 if(index < 1 || index > context->numInterfaces)
955 interface = &context->interfaces[index - 1];
963 if(
macCompAddr(&macAddr, &logicalInterface->macAddr))
981 if(interface->macAddrFilter[i].refCount > 0)
984 if(
macCompAddr(&macAddr, &interface->macAddrFilter[i].addr))
997 if(
osStrcmp(object->name,
"ifRcvAddressStatus") == 0)
1003 else if(
osStrcmp(object->name,
"ifRcvAddressType") == 0)
1006 if(
macCompAddr(&macAddr, &logicalInterface->macAddr) ||
1046 size_t oidLen, uint8_t *nextOid,
size_t *nextOidLen)
1048 #if (ETH_SUPPORT == ENABLED)
1069 if(*nextOidLen < object->
oidLen)
1073 osMemcpy(nextOid, object->oid, object->oidLen);
1076 for(curIndex = 1; curIndex <= context->numInterfaces; curIndex++)
1079 interface = &context->interfaces[curIndex - 1];
1089 curMacAddr = logicalInterface->macAddr;
1099 if(interface->macAddrFilter[i].refCount > 0)
1101 curMacAddr = interface->macAddrFilter[i].addr;
1136 else if(curIndex < index)
1140 else if(curIndex > index)
1157 macAddr = curMacAddr;
error_t ifMibSetIfStackEntry(const MibObject *object, const uint8_t *oid, size_t oidLen, const MibVariant *value, size_t valueLen, bool_t commit)
Set ifStackEntry object value.
error_t ifMibGetIfEntry(const MibObject *object, const uint8_t *oid, size_t oidLen, MibVariant *value, size_t *valueLen)
Get ifEntry object value.
@ IF_MIB_IF_ADMIN_STATUS_DOWN
error_t ifMibGetNextIfXEntry(const MibObject *object, const uint8_t *oid, size_t oidLen, uint8_t *nextOid, size_t *nextOidLen)
Get next ifXEntry object.
error_t mibEncodePhysAddr(uint8_t *oid, size_t maxOidLen, size_t *pos, const MacAddr *macAddr)
Encode instance identifier (physical address)
error_t mibDecodePhysAddr(const uint8_t *oid, size_t oidLen, size_t *pos, MacAddr *macAddr)
Decode instance identifier (physical address)
error_t ifMibSetIfRcvAddressEntry(const MibObject *object, const uint8_t *oid, size_t oidLen, const MibVariant *value, size_t valueLen, bool_t commit)
Set ifRcvAddressEntry object value.
error_t ifMibSetIfXEntry(const MibObject *object, const uint8_t *oid, size_t oidLen, const MibVariant *value, size_t valueLen, bool_t commit)
Set ifXEntry object value.
#define MAC_ADDR_FILTER_SIZE
error_t ifMibGetIfStackEntry(const MibObject *object, const uint8_t *oid, size_t oidLen, MibVariant *value, size_t *valueLen)
Get ifStackEntry object value.
@ IF_MIB_RCV_ADDRESS_TYPE_VOLATILE
#define osMemcmp(p1, p2, length)
IfMibBase ifMibBase
Interfaces Group MIB base.
@ IF_MIB_IF_LINK_UP_DOWN_TRAP_DISABLED
error_t ifMibGetNextIfStackEntry(const MibObject *object, const uint8_t *oid, size_t oidLen, uint8_t *nextOid, size_t *nextOidLen)
Get next ifStackEntry object.
Interfaces Group MIB module implementation.
@ IF_MIB_IF_TYPE_ETHERNET_CSMACD
#define macIsMulticastAddr(macAddr)
int_t oidComp(const uint8_t *oid1, size_t oidLen1, const uint8_t *oid2, size_t oidLen2)
Compare object identifiers.
error_t ifMibGetNextIfEntry(const MibObject *object, const uint8_t *oid, size_t oidLen, uint8_t *nextOid, size_t *nextOidLen)
Get next ifEntry object.
#define macCopyAddr(destMacAddr, srcMacAddr)
error_t ifMibInit(void)
Interfaces Group MIB module initialization.
#define osMemcpy(dest, src, length)
NetInterface * nicGetPhysicalInterface(NetInterface *interface)
Retrieve physical interface.
@ ERROR_INSTANCE_NOT_FOUND
error_t ifMibSetIfEntry(const MibObject *object, const uint8_t *oid, size_t oidLen, const MibVariant *value, size_t valueLen, bool_t commit)
Set ifEntry object value.
General definitions for cryptographic algorithms.
NetContext * netGetDefaultContext(void)
Get default TCP/IP stack context.
error_t ifMibGetIfRcvAddressEntry(const MibObject *object, const uint8_t *oid, size_t oidLen, MibVariant *value, size_t *valueLen)
Get ifRcvAddressEntry object value.
@ IF_MIB_RCV_ADDRESS_TYPE_NON_VOLATILE
@ IF_MIB_IF_OPER_STATUS_UP
Interfaces Group MIB module.
@ NIC_TYPE_PPP
PPP interface.
error_t mibDecodeIndex(const uint8_t *oid, size_t oidLen, size_t *pos, uint_t *index)
Decode instance identifier (index)
@ IF_MIB_IF_OPER_STATUS_DOWN
Common definitions for MIB modules.
error_t ifMibGetIfXEntry(const MibObject *object, const uint8_t *oid, size_t oidLen, MibVariant *value, size_t *valueLen)
Get ifXEntry object value.
error_t ifMibGetIfNumber(const MibObject *object, const uint8_t *oid, size_t oidLen, MibVariant *value, size_t *valueLen)
Get ifNumber object value.
#define macCompAddr(macAddr1, macAddr2)
error_t ifMibGetNextIfRcvAddressEntry(const MibObject *object, const uint8_t *oid, size_t oidLen, uint8_t *nextOid, size_t *nextOidLen)
Get next ifRcvAddressEntry object.
@ IF_MIB_IF_ADMIN_STATUS_UP
error_t mibEncodeIndex(uint8_t *oid, size_t maxOidLen, size_t *pos, uint_t index)
Encode instance identifier (index)
@ IF_MIB_IF_TYPE_IEEE_802_15_4
@ NIC_TYPE_6LOWPAN
6LoWPAN interface
#define osMemset(p, value, length)
NetInterface * nicGetLogicalInterface(NetInterface *interface)
Retrieve logical interface.
const MacAddr MAC_UNSPECIFIED_ADDR
ASN.1 (Abstract Syntax Notation One)
const MacAddr MAC_BROADCAST_ADDR
@ NIC_TYPE_ETHERNET
Ethernet interface.