Skip to content

Commit

Permalink
[nes]: STP changes ...
Browse files Browse the repository at this point in the history
  • Loading branch information
nes-repo committed Jun 6, 2015
1 parent 400670d commit 9a89b67
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
29 changes: 20 additions & 9 deletions stp/ieee8021SpanningTreeMib.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
#include "lib/buffer.h"
#include "lib/snmp.h"

#include <stdbool.h>
#include <stdint.h>

#define ROLLBACK_BUFFER "ROLLBACK_BUFFER"


Expand Down Expand Up @@ -125,9 +128,9 @@ ieee8021SpanningTreeEntry_t *
ieee8021SpanningTreeTable_createEntry (
uint32_t u32ComponentId)
{
ieee8021SpanningTreeEntry_t *poEntry = NULL;
register ieee8021SpanningTreeEntry_t *poEntry = NULL;

if ((poEntry = xBuffer_cAlloc (sizeof (ieee8021SpanningTreeEntry_t))) == NULL)
if ((poEntry = xBuffer_cAlloc (sizeof (*poEntry))) == NULL)
{
return NULL;
}
Expand All @@ -139,7 +142,12 @@ ieee8021SpanningTreeTable_createEntry (
return NULL;
}

poEntry->i32RstpTxHoldCount = 3;
poEntry->i32Priority = 32768;
poEntry->i32BridgeMaxAge = 2000;
poEntry->i32BridgeHelloTime = 200;
poEntry->i32BridgeForwardDelay = 1500;
poEntry->i32Version = ieee8021SpanningTreeVersion_mstp_c;
poEntry->i32RstpTxHoldCount = 6;

xBTree_nodeAdd (&poEntry->oBTreeNode, &oIeee8021SpanningTreeTable_BTree);
return poEntry;
Expand All @@ -152,7 +160,7 @@ ieee8021SpanningTreeTable_getByIndex (
register ieee8021SpanningTreeEntry_t *poTmpEntry = NULL;
register xBTree_Node_t *poNode = NULL;

if ((poTmpEntry = xBuffer_cAlloc (sizeof (ieee8021SpanningTreeEntry_t))) == NULL)
if ((poTmpEntry = xBuffer_cAlloc (sizeof (*poTmpEntry))) == NULL)
{
return NULL;
}
Expand All @@ -175,7 +183,7 @@ ieee8021SpanningTreeTable_getNextIndex (
register ieee8021SpanningTreeEntry_t *poTmpEntry = NULL;
register xBTree_Node_t *poNode = NULL;

if ((poTmpEntry = xBuffer_cAlloc (sizeof (ieee8021SpanningTreeEntry_t))) == NULL)
if ((poTmpEntry = xBuffer_cAlloc (sizeof (*poTmpEntry))) == NULL)
{
return NULL;
}
Expand Down Expand Up @@ -687,9 +695,9 @@ ieee8021SpanningTreePortTable_createEntry (
uint32_t u32ComponentId,
uint32_t u32Port)
{
ieee8021SpanningTreePortEntry_t *poEntry = NULL;
register ieee8021SpanningTreePortEntry_t *poEntry = NULL;

if ((poEntry = xBuffer_cAlloc (sizeof (ieee8021SpanningTreePortEntry_t))) == NULL)
if ((poEntry = xBuffer_cAlloc (sizeof (*poEntry))) == NULL)
{
return NULL;
}
Expand All @@ -702,6 +710,9 @@ ieee8021SpanningTreePortTable_createEntry (
return NULL;
}

poEntry->i32Priority = 128;
poEntry->u8Enabled = ieee8021SpanningTreePortEnabled_true_c;

xBTree_nodeAdd (&poEntry->oBTreeNode, &oIeee8021SpanningTreePortTable_BTree);
return poEntry;
}
Expand All @@ -714,7 +725,7 @@ ieee8021SpanningTreePortTable_getByIndex (
register ieee8021SpanningTreePortEntry_t *poTmpEntry = NULL;
register xBTree_Node_t *poNode = NULL;

if ((poTmpEntry = xBuffer_cAlloc (sizeof (ieee8021SpanningTreePortEntry_t))) == NULL)
if ((poTmpEntry = xBuffer_cAlloc (sizeof (*poTmpEntry))) == NULL)
{
return NULL;
}
Expand All @@ -739,7 +750,7 @@ ieee8021SpanningTreePortTable_getNextIndex (
register ieee8021SpanningTreePortEntry_t *poTmpEntry = NULL;
register xBTree_Node_t *poNode = NULL;

if ((poTmpEntry = xBuffer_cAlloc (sizeof (ieee8021SpanningTreePortEntry_t))) == NULL)
if ((poTmpEntry = xBuffer_cAlloc (sizeof (*poTmpEntry))) == NULL)
{
return NULL;
}
Expand Down
1 change: 1 addition & 0 deletions stp/ieee8021SpanningTreeMib.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ enum
ieee8021SpanningTreeVersion_stp_c = 0,
ieee8021SpanningTreeVersion_rstp_c = 2,
ieee8021SpanningTreeVersion_mstp_c = 3,
ieee8021SpanningTreeVersion_spb_c = 4,
};

/* table ieee8021SpanningTreeTable row entry data structure */
Expand Down

0 comments on commit 9a89b67

Please sign in to comment.