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 14, 2015
1 parent e699e09 commit 432aace
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 14 deletions.
45 changes: 35 additions & 10 deletions stp/ieee8021MstpMib.c
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,7 @@ ieee8021MstpCistPortTable_getNext (
snmp_set_var_typed_integer (idx, ASN_UNSIGNED, poEntry->u32ComponentId);
idx = idx->next_variable;
snmp_set_var_typed_integer (idx, ASN_UNSIGNED, poEntry->u32Port);
*my_data_context = (void*) &poEntry->oCist;
*my_data_context = (void*) poEntry;
*my_loop_context = (void*) xBTree_nodeGetNext (&poEntry->oBTreeNode, &oIeee8021SpanningTreePortTable_BTree);
return put_index_data;
}
Expand All @@ -1019,7 +1019,7 @@ ieee8021MstpCistPortTable_get (
return false;
}

*my_data_context = (void*) &poEntry->oCist;
*my_data_context = (void*) poEntry;
return true;
}

Expand All @@ -1034,6 +1034,7 @@ ieee8021MstpCistPortTable_mapper (
netsnmp_request_info *request;
netsnmp_table_request_info *table_info;
ieee8021MstpCistPortEntry_t *table_entry;
register ieee8021SpanningTreePortEntry_t *poEntry = NULL;
void *pvOldDdata = NULL;
int ret;

Expand All @@ -1045,13 +1046,14 @@ ieee8021MstpCistPortTable_mapper (
case MODE_GET:
for (request = requests; request != NULL; request = request->next)
{
table_entry = (ieee8021MstpCistPortEntry_t*) netsnmp_extract_iterator_context (request);
poEntry = (ieee8021SpanningTreePortEntry_t*) netsnmp_extract_iterator_context (request);
table_info = netsnmp_extract_table_info (request);
if (table_entry == NULL)
if (poEntry == NULL)
{
netsnmp_set_request_error (reqinfo, request, SNMP_NOSUCHINSTANCE);
continue;
}
table_entry = &poEntry->oCist;

switch (table_info->colnum)
{
Expand Down Expand Up @@ -1129,8 +1131,9 @@ ieee8021MstpCistPortTable_mapper (
case MODE_SET_RESERVE1:
for (request = requests; request != NULL; request = request->next)
{
table_entry = (ieee8021MstpCistPortEntry_t*) netsnmp_extract_iterator_context (request);
poEntry = (ieee8021SpanningTreePortEntry_t*) netsnmp_extract_iterator_context (request);
table_info = netsnmp_extract_table_info (request);
table_entry = &poEntry->oCist;

switch (table_info->colnum)
{
Expand Down Expand Up @@ -1225,13 +1228,33 @@ ieee8021MstpCistPortTable_mapper (
case MODE_SET_RESERVE2:
for (request = requests; request != NULL; request = request->next)
{
table_entry = (ieee8021MstpCistPortEntry_t*) netsnmp_extract_iterator_context (request);
poEntry = (ieee8021SpanningTreePortEntry_t*) netsnmp_extract_iterator_context (request);
table_info = netsnmp_extract_table_info (request);
if (table_entry == NULL)
if (poEntry == NULL)
{
netsnmp_set_request_error (reqinfo, request, SNMP_NOSUCHINSTANCE);
continue;
}

switch (table_info->colnum)
{
case IEEE8021MSTPCISTPORTADMINPATHCOST:
case IEEE8021MSTPCISTPORTADMINEDGEPORT:
case IEEE8021MSTPCISTPORTMACENABLED:
case IEEE8021MSTPCISTPORTRESTRICTEDROLE:
case IEEE8021MSTPCISTPORTRESTRICTEDTCN:
case IEEE8021MSTPCISTPORTPROTOCOLMIGRATION:
case IEEE8021MSTPCISTPORTENABLEBPDURX:
case IEEE8021MSTPCISTPORTENABLEBPDUTX:
case IEEE8021MSTPCISTPORTPSEUDOROOTID:
case IEEE8021MSTPCISTPORTISL2GP:
if (poEntry->u8RowStatus == xRowStatus_active_c || poEntry->u8RowStatus == xRowStatus_notReady_c)
{
netsnmp_set_request_error (reqinfo, request, SNMP_ERR_RESOURCEUNAVAILABLE);
return SNMP_ERR_NOERROR;
}
break;
}
}
break;

Expand All @@ -1242,8 +1265,9 @@ ieee8021MstpCistPortTable_mapper (
for (request = requests; request != NULL; request = request->next)
{
pvOldDdata = netsnmp_request_get_list_data (request, ROLLBACK_BUFFER);
table_entry = (ieee8021MstpCistPortEntry_t*) netsnmp_extract_iterator_context (request);
poEntry = (ieee8021SpanningTreePortEntry_t*) netsnmp_extract_iterator_context (request);
table_info = netsnmp_extract_table_info (request);
table_entry = &poEntry->oCist;

switch (table_info->colnum)
{
Expand Down Expand Up @@ -1399,12 +1423,13 @@ ieee8021MstpCistPortTable_mapper (
for (request = requests; request != NULL; request = request->next)
{
pvOldDdata = netsnmp_request_get_list_data (request, ROLLBACK_BUFFER);
table_entry = (ieee8021MstpCistPortEntry_t*) netsnmp_extract_iterator_context (request);
poEntry = (ieee8021SpanningTreePortEntry_t*) netsnmp_extract_iterator_context (request);
table_info = netsnmp_extract_table_info (request);
if (table_entry == NULL || pvOldDdata == NULL)
if (poEntry == NULL || pvOldDdata == NULL)
{
continue;
}
table_entry = &poEntry->oCist;

switch (table_info->colnum)
{
Expand Down
8 changes: 4 additions & 4 deletions stp/ieee8021MstpMib.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,8 @@ enum
typedef struct ieee8021MstpCistPortEntry_t
{
/* Index values */
uint32_t u32ComponentId;
uint32_t u32Num;
// uint32_t u32ComponentId;
// uint32_t u32Num;

/* Column values */
uint32_t u32Uptime;
Expand All @@ -301,10 +301,10 @@ typedef struct ieee8021MstpCistPortEntry_t
size_t u16PseudoRootId_len; /* # of uint8_t elements */
uint8_t u8IsL2Gp;

xBTree_Node_t oBTreeNode;
// xBTree_Node_t oBTreeNode;
} ieee8021MstpCistPortEntry_t;

extern xBTree_t oIeee8021MstpCistPortTable_BTree;
// extern xBTree_t oIeee8021MstpCistPortTable_BTree;

/* ieee8021MstpCistPortTable table mapper */
void ieee8021MstpCistPortTable_init (void);
Expand Down
1 change: 1 addition & 0 deletions stp/ieee8021SpanningTreeMib.h
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ ieee8021SpanningTreePortEntry_t * ieee8021SpanningTreePortTable_getNextIndex (
uint32_t u32ComponentId,
uint32_t u32Port);
#define ieee8021SpanningTreePortTable_getByExtensionEntry(poEntry) ((poEntry) == NULL ? NULL: xGetParentByMemberPtr ((poEntry), ieee8021SpanningTreePortEntry_t, oExtension))
#define ieee8021SpanningTreePortTable_getByMstpCistEntry(poEntry) ((poEntry) == NULL ? NULL: xGetParentByMemberPtr ((poEntry), ieee8021SpanningTreePortEntry_t, oCist))
void ieee8021SpanningTreePortTable_removeEntry (ieee8021SpanningTreePortEntry_t *poEntry);
bool ieee8021StpPortRowStatus_handler (
ieee8021SpanningTreePortEntry_t *poEntry, uint8_t u8RowStatus);
Expand Down

0 comments on commit 432aace

Please sign in to comment.