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 Oct 30, 2014
1 parent 708bdaf commit 71191fc
Show file tree
Hide file tree
Showing 4 changed files with 124 additions and 6 deletions.
18 changes: 18 additions & 0 deletions ethernet/ethernetUtils.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,24 @@ ieee8021BridgeDot1dPortRowStatus_update (
return bRetCode;
}

bool
ieee8021QBridgeVlanCurrentTable_vlanUpdate (
ieee8021BridgeBaseEntry_t *pComponent,
ieee8021QBridgeVlanCurrentEntry_t *poEntry,
uint8_t *pu8EnabledPorts, uint8_t *pu8DisabledPorts, uint8_t *pu8UntaggedPorts)
{
return false;
}

bool
ieee8021QBridgeVlanStaticTable_vlanUpdate (
ieee8021BridgeBaseEntry_t *pComponent,
ieee8021QBridgeVlanStaticEntry_t *poEntry,
uint8_t *pu8EnabledPorts, uint8_t *pu8DisabledPorts, uint8_t *pu8UntaggedPorts)
{
return false;
}



#endif // __ETHERNET_UTILS_C__
11 changes: 11 additions & 0 deletions ethernet/ethernetUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ extern "C" {


#include "ieee8021BridgeMib.h"
#include "ieee8021QBridgeMib.h"

#include <stdbool.h>
#include <stdint.h>
Expand All @@ -46,6 +47,16 @@ bool
bool
ieee8021BridgeDot1dPortRowStatus_update (
ieee8021BridgeDot1dPortEntry_t *poEntry, uint8_t u8RowStatus);
bool
ieee8021QBridgeVlanCurrentTable_vlanUpdate (
ieee8021BridgeBaseEntry_t *pComponent,
ieee8021QBridgeVlanCurrentEntry_t *poEntry,
uint8_t *pu8DisabledPorts, uint8_t *pu8TaggedPorts, uint8_t *pu8UntaggedPorts);
bool
ieee8021QBridgeVlanStaticTable_vlanUpdate (
ieee8021BridgeBaseEntry_t *pComponent,
ieee8021QBridgeVlanStaticEntry_t *poEntry,
uint8_t *pu8EnabledPorts, uint8_t *pu8DisabledPorts, uint8_t *pu8UntaggedPorts);



Expand Down
99 changes: 93 additions & 6 deletions ethernet/ieee8021QBridgeMib.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
#include "system/systemMIB.h"
#include "ethernetUtils.h"
#include "ieee8021BridgeMib.h"
#include "ieee8021QBridgeMib.h"

#include "lib/bitmap.h"
#include "lib/binaryTree.h"
#include "lib/buffer.h"
#include "lib/snmp.h"
Expand Down Expand Up @@ -4407,11 +4409,48 @@ ieee8021QBridgeVlanCurrentTable_createExt (
uint32_t u32ComponentId,
uint32_t u32Index)
{
return NULL;
ieee8021QBridgeVlanCurrentEntry_t *poEntry = NULL;

poEntry = ieee8021QBridgeVlanCurrentTable_createEntry (
u32TimeMark,
u32ComponentId,
u32Index);
if (poEntry == NULL)
{
return NULL;
}

if (!ieee8021QBridgeVlanCurrentTable_createHier (poEntry))
{
ieee8021QBridgeVlanCurrentTable_removeEntry (poEntry);
return NULL;
}

return poEntry;
}

bool
ieee8021QBridgeVlanCurrentTable_removeExt (ieee8021QBridgeVlanCurrentEntry_t *poEntry)
{
if (!ieee8021QBridgeVlanCurrentTable_removeHier (poEntry))
{
return false;
}
ieee8021QBridgeVlanCurrentTable_removeEntry (poEntry);

return true;
}

bool
ieee8021QBridgeVlanCurrentTable_createHier (
ieee8021QBridgeVlanCurrentEntry_t *poEntry)
{
return true;
}

bool
ieee8021QBridgeVlanCurrentTable_removeHier (
ieee8021QBridgeVlanCurrentEntry_t *poEntry)
{
return true;
}
Expand All @@ -4422,7 +4461,24 @@ ieee8021QBridgeVlanCurrentTable_vlanHandler (
ieee8021QBridgeVlanCurrentEntry_t *poEntry,
uint8_t *pu8EnabledPorts, uint8_t *pu8DisabledPorts, uint8_t *pu8UntaggedPorts)
{
return false;
register bool bRetCode = false;

if (!ieee8021QBridgeVlanCurrentTable_vlanUpdate (pComponent, poEntry, pu8EnabledPorts, pu8DisabledPorts, pu8UntaggedPorts))
{
goto ieee8021QBridgeVlanCurrentTable_vlanHandler_cleanup;
}

xBitmap_or (poEntry->au8EgressPorts, poEntry->au8EgressPorts, pu8EnabledPorts, xBitmap_bitLength (poEntry->u16EgressPorts_len));
xBitmap_sub (poEntry->au8EgressPorts, poEntry->au8EgressPorts, pu8DisabledPorts, xBitmap_bitLength (poEntry->u16EgressPorts_len));
xBitmap_or (poEntry->au8UntaggedPorts, poEntry->au8UntaggedPorts, pu8UntaggedPorts, xBitmap_bitLength (poEntry->u16UntaggedPorts_len));
xBitmap_sub (poEntry->au8UntaggedPorts, poEntry->au8UntaggedPorts, pu8DisabledPorts, xBitmap_bitLength (poEntry->u16UntaggedPorts_len));

poEntry->u32TimeMark++; /* TODO */
bRetCode = true;

ieee8021QBridgeVlanCurrentTable_vlanHandler_cleanup:

return bRetCode;
}

/* example iterator hook routines - using 'getNext' to do most of the work */
Expand Down Expand Up @@ -4726,13 +4782,15 @@ ieee8021QBridgeVlanStaticTable_createHier (
ieee8021QBridgeVlanStaticEntry_t *poEntry)
{
register bool bRetCode = false;
register ieee8021QBridgeVlanCurrentEntry_t *poIeee8021QBridgeVlanCurrentEntry = NULL;

if (ieee8021QBridgeVlanCurrentTable_Vlan_getByIndex (poEntry->u32ComponentId, poEntry->u32VlanIndex) == NULL &&
ieee8021QBridgeVlanCurrentTable_createExt (0, poEntry->u32ComponentId, poEntry->u32VlanIndex) == NULL)
if ((poIeee8021QBridgeVlanCurrentEntry = ieee8021QBridgeVlanCurrentTable_Vlan_getByIndex (poEntry->u32ComponentId, poEntry->u32VlanIndex)) == NULL &&
(poIeee8021QBridgeVlanCurrentEntry = ieee8021QBridgeVlanCurrentTable_createExt (0, poEntry->u32ComponentId, poEntry->u32VlanIndex)) == NULL)
{
goto ieee8021QBridgeVlanStaticTable_createHier_cleanup;
}

poIeee8021QBridgeVlanCurrentEntry->i32Status = ieee8021QBridgeVlanStatus_permanent_c;
bRetCode = true;

ieee8021QBridgeVlanStaticTable_createHier_cleanup:
Expand All @@ -4748,8 +4806,14 @@ ieee8021QBridgeVlanStaticTable_removeHier (
register uint8_t *pu8EnabledPorts = NULL;
register uint8_t *pu8DisabledPorts = NULL;
register uint8_t *pu8UntaggedPorts = NULL;
register ieee8021BridgeBaseEntry_t *poIeee8021BridgeBaseEntry = NULL;
register ieee8021QBridgeVlanCurrentEntry_t *poIeee8021QBridgeVlanCurrentEntry = NULL;

if ((poIeee8021BridgeBaseEntry = ieee8021BridgeBaseTable_getByIndex (poEntry->u32ComponentId)) == NULL)
{
goto ieee8021QBridgeVlanStaticTable_removeHier_cleanup;
}

if ((poIeee8021QBridgeVlanCurrentEntry = ieee8021QBridgeVlanCurrentTable_Vlan_getByIndex (poEntry->u32ComponentId, poEntry->u32VlanIndex)) == NULL)
{
goto ieee8021QBridgeVlanStaticTable_removeHier_success;
Expand All @@ -4774,10 +4838,11 @@ ieee8021QBridgeVlanStaticTable_removeHier (
}
else
{
if (!ieee8021QBridgeVlanCurrentTable_vlanHandler (NULL, poIeee8021QBridgeVlanCurrentEntry, pu8EnabledPorts, pu8DisabledPorts, pu8UntaggedPorts))
if (!ieee8021QBridgeVlanCurrentTable_vlanHandler (poIeee8021BridgeBaseEntry, poIeee8021QBridgeVlanCurrentEntry, pu8EnabledPorts, pu8DisabledPorts, pu8UntaggedPorts))
{
goto ieee8021QBridgeVlanStaticTable_removeHier_cleanup;
}
poIeee8021QBridgeVlanCurrentEntry->i32Status = ieee8021QBridgeVlanStatus_dynamicMvrp_c;
}

ieee8021QBridgeVlanStaticTable_removeHier_success:
Expand All @@ -4802,7 +4867,29 @@ ieee8021QBridgeVlanStaticTable_vlanUpdater (
ieee8021QBridgeVlanStaticEntry_t *poEntry,
uint8_t *pu8EnabledPorts, uint8_t *pu8DisabledPorts, uint8_t *pu8UntaggedPorts)
{
return false;
register bool bRetCode = false;
register ieee8021QBridgeVlanCurrentEntry_t *poIeee8021QBridgeVlanCurrentEntry = NULL;

if ((poIeee8021QBridgeVlanCurrentEntry = ieee8021QBridgeVlanCurrentTable_Vlan_getByIndex (poEntry->u32ComponentId, poEntry->u32VlanIndex)) == NULL)
{
goto ieee8021QBridgeVlanStaticTable_vlanUpdater_cleanup;
}

if (!ieee8021QBridgeVlanCurrentTable_vlanHandler (pComponent, poIeee8021QBridgeVlanCurrentEntry, pu8EnabledPorts, pu8DisabledPorts, pu8UntaggedPorts))
{
goto ieee8021QBridgeVlanStaticTable_vlanUpdater_cleanup;
}

if (!ieee8021QBridgeVlanStaticTable_vlanUpdate (pComponent, poEntry, pu8EnabledPorts, pu8DisabledPorts, pu8UntaggedPorts))
{
goto ieee8021QBridgeVlanStaticTable_vlanUpdater_cleanup;
}

bRetCode = true;

ieee8021QBridgeVlanStaticTable_vlanUpdater_cleanup:

return bRetCode;
}

bool
Expand Down
2 changes: 2 additions & 0 deletions ethernet/ieee8021QBridgeMib.h
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,8 @@ ieee8021QBridgeVlanCurrentEntry_t * ieee8021QBridgeVlanCurrentTable_createExt (
uint32_t u32ComponentId,
uint32_t u32Index);
bool ieee8021QBridgeVlanCurrentTable_removeExt (ieee8021QBridgeVlanCurrentEntry_t *poEntry);
bool ieee8021QBridgeVlanCurrentTable_createHier (ieee8021QBridgeVlanCurrentEntry_t *poEntry);
bool ieee8021QBridgeVlanCurrentTable_removeHier (ieee8021QBridgeVlanCurrentEntry_t *poEntry);
bool ieee8021QBridgeVlanCurrentTable_vlanHandler (
ieee8021BridgeBaseEntry_t *pComponent,
ieee8021QBridgeVlanCurrentEntry_t *poEntry,
Expand Down

0 comments on commit 71191fc

Please sign in to comment.