Go to the documentation of this file.
32 #define TRACE_LEVEL SNMP_TRACE_LEVEL
46 #if (MIB2_SUPPORT == ENABLED && MIB2_IF_GROUP_SUPPORT == ENABLED)
68 value->integer = context->numInterfaces;
132 if(index < 1 || index > context->numInterfaces)
136 interface = &context->interfaces[index - 1];
141 if(
osStrcmp(object->name,
"ifIndex") == 0)
144 value->integer = index;
147 else if(
osStrcmp(object->name,
"ifDescr") == 0)
167 else if(
osStrcmp(object->name,
"ifType") == 0)
169 #if (ETH_VLAN_SUPPORT == ENABLED)
171 if(interface->vlanId != 0)
180 if(physicalInterface->nicDriver != NULL)
183 switch(physicalInterface->nicDriver->type)
214 else if(
osStrcmp(object->name,
"ifMtu") == 0)
217 if(physicalInterface->nicDriver != NULL)
219 value->integer = physicalInterface->nicDriver->mtu;
227 else if(
osStrcmp(object->name,
"ifSpeed") == 0)
230 value->gauge32 = interface->linkSpeed;
232 #if (ETH_SUPPORT == ENABLED)
234 else if(
osStrcmp(object->name,
"ifPhysAddress") == 0)
257 else if(
osStrcmp(object->name,
"ifAdminStatus") == 0)
260 if(physicalInterface->nicDriver != NULL)
270 else if(
osStrcmp(object->name,
"ifOperStatus") == 0)
273 if(interface->linkState)
283 else if(
osStrcmp(object->name,
"ifLastChange") == 0)
286 value->timeTicks = interface->ifStats.lastChange;
289 else if(
osStrcmp(object->name,
"ifInOctets") == 0)
292 value->counter32 = (uint32_t) interface->ifStats.inOctets;
295 else if(
osStrcmp(object->name,
"ifInUcastPkts") == 0)
298 value->counter32 = (uint32_t) interface->ifStats.inUcastPkts;
301 else if(
osStrcmp(object->name,
"ifInNUcastPkts") == 0)
304 value->counter32 = interface->ifStats.inNUcastPkts;
307 else if(
osStrcmp(object->name,
"ifInDiscards") == 0)
310 value->counter32 = interface->ifStats.inDiscards;
313 else if(
osStrcmp(object->name,
"ifInErrors") == 0)
316 value->counter32 = interface->ifStats.inErrors;
319 else if(
osStrcmp(object->name,
"ifInUnknownProtos") == 0)
322 value->counter32 = interface->ifStats.inUnknownProtos;
325 else if(
osStrcmp(object->name,
"ifOutOctets") == 0)
328 value->counter32 = (uint32_t) interface->ifStats.outOctets;
331 else if(
osStrcmp(object->name,
"ifOutUcastPkts") == 0)
334 value->counter32 = (uint32_t) interface->ifStats.outUcastPkts;
337 else if(
osStrcmp(object->name,
"ifOutNUcastPkts") == 0)
340 value->counter32 = interface->ifStats.outNUcastPkts;
343 else if(
osStrcmp(object->name,
"ifOutDiscards") == 0)
346 value->counter32 = interface->ifStats.outDiscards;
349 else if(
osStrcmp(object->name,
"ifOutErrors") == 0)
352 value->counter32 = interface->ifStats.outErrors;
355 else if(
osStrcmp(object->name,
"ifOutQLen") == 0)
361 else if(
osStrcmp(object->name,
"ifSpecific") == 0)
402 size_t oidLen, uint8_t *nextOid,
size_t *nextOidLen)
413 if(*nextOidLen < object->
oidLen)
417 osMemcpy(nextOid, object->oid, object->oidLen);
420 for(index = 1; index <= context->numInterfaces; index++)
error_t mib2SetIfEntry(const MibObject *object, const uint8_t *oid, size_t oidLen, const MibVariant *value, size_t valueLen, bool_t commit)
Set ifEntry object value.
#define MIB2_PHYS_ADDRESS_SIZE
@ MIB2_IF_TYPE_ETHERNET_CSMACD
error_t mib2GetIfEntry(const MibObject *object, const uint8_t *oid, size_t oidLen, MibVariant *value, size_t *valueLen)
Get ifEntry object value.
@ MIB2_IF_TYPE_IEEE_802_15_4
int_t oidComp(const uint8_t *oid1, size_t oidLen1, const uint8_t *oid2, size_t oidLen2)
Compare object identifiers.
#define macCopyAddr(destMacAddr, srcMacAddr)
@ MIB2_IF_ADMIN_STATUS_UP
#define osMemcpy(dest, src, length)
NetInterface * nicGetPhysicalInterface(NetInterface *interface)
Retrieve physical interface.
@ ERROR_INSTANCE_NOT_FOUND
@ MIB2_IF_OPER_STATUS_DOWN
General definitions for cryptographic algorithms.
NetContext * netGetDefaultContext(void)
Get default TCP/IP stack context.
@ MIB2_IF_ADMIN_STATUS_DOWN
@ NIC_TYPE_PPP
PPP interface.
MIB-II module implementation.
error_t mibDecodeIndex(const uint8_t *oid, size_t oidLen, size_t *pos, uint_t *index)
Decode instance identifier (index)
MIB-II module implementation (Interface group)
Common definitions for MIB modules.
error_t mib2GetNextIfEntry(const MibObject *object, const uint8_t *oid, size_t oidLen, uint8_t *nextOid, size_t *nextOidLen)
Get next ifEntry object.
error_t mib2GetIfNumber(const MibObject *object, const uint8_t *oid, size_t oidLen, MibVariant *value, size_t *valueLen)
Get ifNumber object value.
error_t mibEncodeIndex(uint8_t *oid, size_t maxOidLen, size_t *pos, uint_t index)
Encode instance identifier (index)
@ NIC_TYPE_6LOWPAN
6LoWPAN interface
NetInterface * nicGetLogicalInterface(NetInterface *interface)
Retrieve logical interface.
ASN.1 (Abstract Syntax Notation One)
@ NIC_TYPE_ETHERNET
Ethernet interface.