Go to the documentation of this file.
32 #define TRACE_LEVEL SNMP_TRACE_LEVEL
45 #if (IF_MIB_SUPPORT == ENABLED)
148 if(
osStrcmp(object->name,
"ifIndex") == 0)
151 value->integer = index;
154 else if(
osStrcmp(object->name,
"ifDescr") == 0)
174 else if(
osStrcmp(object->name,
"ifType") == 0)
176 #if (ETH_VLAN_SUPPORT == ENABLED)
178 if(interface->vlanId != 0)
187 if(physicalInterface->nicDriver != NULL)
190 switch(physicalInterface->nicDriver->type)
218 else if(
osStrcmp(object->name,
"ifMtu") == 0)
221 if(physicalInterface->nicDriver != NULL)
223 value->integer = physicalInterface->nicDriver->mtu;
231 else if(
osStrcmp(object->name,
"ifSpeed") == 0)
234 value->gauge32 = interface->linkSpeed;
236 #if (ETH_SUPPORT == ENABLED)
238 else if(
osStrcmp(object->name,
"ifPhysAddress") == 0)
246 if(*valueLen >=
sizeof(
MacAddr))
261 else if(
osStrcmp(object->name,
"ifAdminStatus") == 0)
264 if(physicalInterface->nicDriver != NULL)
274 else if(
osStrcmp(object->name,
"ifOperStatus") == 0)
277 if(interface->linkState)
287 else if(
osStrcmp(object->name,
"ifLastChange") == 0)
293 else if(
osStrcmp(object->name,
"ifInOctets") == 0)
299 else if(
osStrcmp(object->name,
"ifInUcastPkts") == 0)
305 else if(
osStrcmp(object->name,
"ifInDiscards") == 0)
311 else if(
osStrcmp(object->name,
"ifInErrors") == 0)
317 else if(
osStrcmp(object->name,
"ifInUnknownProtos") == 0)
323 else if(
osStrcmp(object->name,
"ifOutOctets") == 0)
329 else if(
osStrcmp(object->name,
"ifOutUcastPkts") == 0)
335 else if(
osStrcmp(object->name,
"ifOutDiscards") == 0)
341 else if(
osStrcmp(object->name,
"ifOutErrors") == 0)
369 size_t oidLen, uint8_t *nextOid,
size_t *nextOidLen)
376 if(*nextOidLen < object->
oidLen)
380 osMemcpy(nextOid, object->oid, object->oidLen);
473 if(
osStrcmp(object->name,
"ifName") == 0)
493 else if(
osStrcmp(object->name,
"ifInMulticastPkts") == 0)
499 else if(
osStrcmp(object->name,
"ifInBroadcastPkts") == 0)
505 else if(
osStrcmp(object->name,
"ifOutMulticastPkts") == 0)
511 else if(
osStrcmp(object->name,
"ifOutBroadcastPkts") == 0)
517 else if(
osStrcmp(object->name,
"ifHCInOctets") == 0)
523 else if(
osStrcmp(object->name,
"ifHCInUcastPkts") == 0)
529 else if(
osStrcmp(object->name,
"ifHCInMulticastPkts") == 0)
535 else if(
osStrcmp(object->name,
"ifHCInBroadcastPkts") == 0)
541 else if(
osStrcmp(object->name,
"ifHCOutOctets") == 0)
547 else if(
osStrcmp(object->name,
"ifHCOutUcastPkts") == 0)
553 else if(
osStrcmp(object->name,
"ifHCOutMulticastPkts") == 0)
559 else if(
osStrcmp(object->name,
"ifHCOutBroadcastPkts") == 0)
565 else if(
osStrcmp(object->name,
"ifLinkUpDownTrapEnable") == 0)
571 else if(
osStrcmp(object->name,
"ifHighSpeed") == 0)
574 value->gauge32 = interface->linkSpeed / 1000000;
577 else if(
osStrcmp(object->name,
"ifPromiscuousMode") == 0)
583 else if(
osStrcmp(object->name,
"ifConnectorPresent") == 0)
589 else if(
osStrcmp(object->name,
"ifAlias") == 0)
596 else if(
osStrcmp(object->name,
"ifCounterDiscontinuityTime") == 0)
599 value->timeTicks = 0;
624 size_t oidLen, uint8_t *nextOid,
size_t *nextOidLen)
631 if(*nextOidLen < object->
oidLen)
635 osMemcpy(nextOid, object->oid, object->oidLen);
728 if(higherLayer == 0 && lowerLayer == index)
732 else if(higherLayer == index && lowerLayer == 0)
743 if(
osStrcmp(object->name,
"ifStackStatus") == 0)
771 size_t oidLen, uint8_t *nextOid,
size_t *nextOidLen)
781 if(*nextOidLen < object->
oidLen)
785 osMemcpy(nextOid, object->oid, object->oidLen);
789 for(k = 0; k < 2; k++)
872 #if (ETH_SUPPORT == ENABLED)
913 if(
macCompAddr(&macAddr, &logicalInterface->macAddr))
931 if(interface->macAddrFilter[i].refCount > 0)
934 if(
macCompAddr(&macAddr, &interface->macAddrFilter[i].addr))
947 if(
osStrcmp(object->name,
"ifRcvAddressStatus") == 0)
953 else if(
osStrcmp(object->name,
"ifRcvAddressType") == 0)
956 if(
macCompAddr(&macAddr, &logicalInterface->macAddr) ||
996 size_t oidLen, uint8_t *nextOid,
size_t *nextOidLen)
998 #if (ETH_SUPPORT == ENABLED)
1015 if(*nextOidLen < object->
oidLen)
1019 osMemcpy(nextOid, object->oid, object->oidLen);
1035 curMacAddr = logicalInterface->macAddr;
1045 if(interface->macAddrFilter[i].refCount > 0)
1047 curMacAddr = interface->macAddrFilter[i].addr;
1082 else if(curIndex < index)
1086 else if(curIndex > index)
1103 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.
uint64_t ifHCInMulticastPkts
@ 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.
int32_t ifLinkUpDownTrapEnable
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.
#define NET_INTERFACE_COUNT
@ IF_MIB_IF_LINK_UP_DOWN_TRAP_DISABLED
int32_t ifPromiscuousMode
uint32_t ifInUnknownProtos
Extension to the interface table.
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
uint32_t ifInMulticastPkts
#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.
uint64_t ifHCInBroadcastPkts
uint64_t ifHCOutMulticastPkts
#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.
uint64_t ifHCOutUcastPkts
General definitions for cryptographic algorithms.
error_t ifMibGetIfRcvAddressEntry(const MibObject *object, const uint8_t *oid, size_t oidLen, MibVariant *value, size_t *valueLen)
Get ifRcvAddressEntry object value.
IfMibIfEntry ifTable[NET_INTERFACE_COUNT]
@ IF_MIB_RCV_ADDRESS_TYPE_NON_VOLATILE
@ IF_MIB_IF_OPER_STATUS_UP
Interfaces Group MIB module.
int32_t ifConnectorPresent
uint32_t ifOutMulticastPkts
@ 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)
uint64_t ifHCOutBroadcastPkts
@ IF_MIB_IF_OPER_STATUS_DOWN
IfMibIfXEntry ifXTable[NET_INTERFACE_COUNT]
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.
#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)
uint32_t ifInBroadcastPkts
@ IF_MIB_IF_TYPE_IEEE_802_15_4
@ NIC_TYPE_6LOWPAN
6LoWPAN interface
#define osMemset(p, value, length)
uint32_t ifOutBroadcastPkts
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.