Skip to content

Commit

Permalink
[nes]: ETHERNET changes ...
Browse files Browse the repository at this point in the history
  • Loading branch information
nes-repo committed Jun 1, 2015
1 parent 6db19a2 commit d392286
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 2 deletions.
56 changes: 54 additions & 2 deletions ethernet/ieee8021BridgeMib.c
Original file line number Diff line number Diff line change
Expand Up @@ -2717,10 +2717,10 @@ ieee8021BridgePhyPortTable_removeRegister (
goto ieee8021BridgePhyPortTable_removeRegister_cleanup;
}

/*if (!ieee8021BridgePhyPortTable_detachComponent (poPort, poEntry))
if (!ieee8021BridgePhyPortTable_detachComponent (poPort, poEntry))
{
goto ieee8021BridgePhyPortTable_removeRegister_cleanup;
}*/
}


ieee8021BridgePhyPortTable_removeRegister_remove:
Expand All @@ -2742,6 +2742,58 @@ ieee8021BridgePhyPortTable_removeRegister (
return bRetCode;
}

bool
ieee8021BridgePhyPortTable_attachComponent (
ieee8021BridgeBaseEntry_t *poComponent, ieee8021BridgeBasePortEntry_t *poPort,
ieee8021BridgePhyPortEntry_t *poPhy)
{
register bool bRetCode = false;

if (poComponent == NULL || poPort == NULL || poPhy == NULL)
{
goto ieee8021BridgePhyPortTable_attachComponent_cleanup;
}

if (poComponent->u32ChassisId != 0 && poPhy->u32ChassisId != 0 && poComponent->u32ChassisId != poPhy->u32ChassisId)
{
goto ieee8021BridgePhyPortTable_attachComponent_cleanup;
}

poPhy->oIf.u32ComponentId = poPort->u32ComponentId;
poPhy->oIf.u32Port = poPort->u32Port;
memcpy (poPort->au8Capabilities, poPhy->au8TypeCapabilities, sizeof (poPort->au8Capabilities));
poPort->u32IfIndex = poPhy->u32IfIndex;
poPort->u8External = poPhy->u32Port == 0 ? ieee8021BridgeBasePortExternal_false_c: ieee8021BridgeBasePortExternal_true_c;
bRetCode = true;

ieee8021BridgePhyPortTable_attachComponent_cleanup:

return bRetCode;
}

bool
ieee8021BridgePhyPortTable_detachComponent (
ieee8021BridgeBasePortEntry_t *poPort,
ieee8021BridgePhyPortEntry_t *poPhy)
{
register bool bRetCode = false;

if (poPort == NULL || poPhy == NULL)
{
goto ieee8021BridgePhyPortTable_detachComponent_cleanup;
}

poPhy->oIf.u32ComponentId = 0;
poPhy->oIf.u32Port = 0;
memset (poPort->au8Capabilities, 0, sizeof (poPort->au8Capabilities));
poPort->u8External = ieee8021BridgeBasePortExternal_false_c;
bRetCode = true;

ieee8021BridgePhyPortTable_detachComponent_cleanup:

return bRetCode;
}

/* example iterator hook routines - using 'getNext' to do most of the work */
netsnmp_variable_list *
ieee8021BridgePhyPortTable_getFirst (
Expand Down
6 changes: 6 additions & 0 deletions ethernet/ieee8021BridgeMib.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,12 @@ ieee8021BridgePhyPortEntry_t * ieee8021BridgePhyPortTable_createExt (
bool ieee8021BridgePhyPortTable_removeExt (ieee8021BridgePhyPortEntry_t *poEntry);
bool ieee8021BridgePhyPortTable_createHier (ieee8021BridgePhyPortEntry_t *poEntry);
bool ieee8021BridgePhyPortTable_removeHier (ieee8021BridgePhyPortEntry_t *poEntry);
bool ieee8021BridgePhyPortTable_attachComponent (
ieee8021BridgeBaseEntry_t *poComponent, ieee8021BridgeBasePortEntry_t *poPort,
ieee8021BridgePhyPortEntry_t *poPhy);
bool ieee8021BridgePhyPortTable_detachComponent (
ieee8021BridgeBasePortEntry_t *poPort,
ieee8021BridgePhyPortEntry_t *poPhy);
#ifdef SNMP_SRC
Netsnmp_First_Data_Point ieee8021BridgePhyPortTable_getFirst;
Netsnmp_Next_Data_Point ieee8021BridgePhyPortTable_getNext;
Expand Down

0 comments on commit d392286

Please sign in to comment.