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 Mar 15, 2015
1 parent 7780aa3 commit fb4bcfd
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 20 deletions.
44 changes: 25 additions & 19 deletions ethernet/ieee8021BridgeMib.c
Original file line number Diff line number Diff line change
Expand Up @@ -4463,7 +4463,7 @@ ieee8021BridgePortOutboundAccessPriorityTable_getNext (
idx = idx->next_variable;
// snmp_set_var_typed_integer (idx, ASN_UNSIGNED, poEntry->u32RegenUserPriority);
*my_data_context = (void*) poEntry;
// *my_loop_context = (void*) xBTree_nodeGetNext (&poEntry->oBTreeNode, &oIeee8021BridgePortOutboundAccessPriorityTable_BTree);
*my_loop_context = (void*) xBTree_nodeGetNext (&poEntry->oBTreeNode, &oIeee8021BridgePortOutboundAccessPriorityTable_BTree);
return put_index_data;
}

Expand Down Expand Up @@ -4970,10 +4970,8 @@ ieee8021BridgePortEncodingTable_BTreeNodeCmp (
return
(pEntry1->u32ComponentId < pEntry2->u32ComponentId) ||
(pEntry1->u32ComponentId == pEntry2->u32ComponentId && pEntry1->u32PortNum < pEntry2->u32PortNum) ||
(pEntry1->u32ComponentId == pEntry2->u32ComponentId && pEntry1->u32PortNum == pEntry2->u32PortNum && pEntry1->i32PriorityCodePointRow < pEntry2->i32PriorityCodePointRow) ||
(pEntry1->u32ComponentId == pEntry2->u32ComponentId && pEntry1->u32PortNum == pEntry2->u32PortNum && pEntry1->i32PriorityCodePointRow == pEntry2->i32PriorityCodePointRow && pEntry1->i32PriorityCodePoint < pEntry2->i32PriorityCodePoint) ||
(pEntry1->u32ComponentId == pEntry2->u32ComponentId && pEntry1->u32PortNum == pEntry2->u32PortNum && pEntry1->i32PriorityCodePointRow == pEntry2->i32PriorityCodePointRow && pEntry1->i32PriorityCodePoint == pEntry2->i32PriorityCodePoint && pEntry1->u8DropEligible < pEntry2->u8DropEligible) ? -1:
(pEntry1->u32ComponentId == pEntry2->u32ComponentId && pEntry1->u32PortNum == pEntry2->u32PortNum && pEntry1->i32PriorityCodePointRow == pEntry2->i32PriorityCodePointRow && pEntry1->i32PriorityCodePoint == pEntry2->i32PriorityCodePoint && pEntry1->u8DropEligible == pEntry2->u8DropEligible) ? 0: 1;
(pEntry1->u32ComponentId == pEntry2->u32ComponentId && pEntry1->u32PortNum == pEntry2->u32PortNum && pEntry1->i32PriorityCodePointRow < pEntry2->i32PriorityCodePointRow) ? -1:
(pEntry1->u32ComponentId == pEntry2->u32ComponentId && pEntry1->u32PortNum == pEntry2->u32PortNum && pEntry1->i32PriorityCodePointRow == pEntry2->i32PriorityCodePointRow) ? 0: 1;
}

xBTree_t oIeee8021BridgePortEncodingTable_BTree = xBTree_initInline (&ieee8021BridgePortEncodingTable_BTreeNodeCmp);
Expand All @@ -4989,6 +4987,10 @@ ieee8021BridgePortEncodingTable_createEntry (
{
register ieee8021BridgePortEncodingEntry_t *poEntry = NULL;

if (!ieee8021BridgePriority_isValid (i32PriorityCodePoint) || !ieee8021BridgeDEI_isValid (u8DropEligible))
{
return NULL;
}
if ((poEntry = xBuffer_cAlloc (sizeof (*poEntry))) == NULL)
{
return NULL;
Expand All @@ -4997,8 +4999,8 @@ ieee8021BridgePortEncodingTable_createEntry (
poEntry->u32ComponentId = u32ComponentId;
poEntry->u32PortNum = u32PortNum;
poEntry->i32PriorityCodePointRow = i32PriorityCodePointRow;
poEntry->i32PriorityCodePoint = i32PriorityCodePoint;
poEntry->u8DropEligible = u8DropEligible;
// poEntry->i32PriorityCodePoint = i32PriorityCodePoint;
// poEntry->u8DropEligible = u8DropEligible;
if (xBTree_nodeFind (&poEntry->oBTreeNode, &oIeee8021BridgePortEncodingTable_BTree) != NULL)
{
xBuffer_free (poEntry);
Expand All @@ -5020,6 +5022,10 @@ ieee8021BridgePortEncodingTable_getByIndex (
register ieee8021BridgePortEncodingEntry_t *poTmpEntry = NULL;
register xBTree_Node_t *poNode = NULL;

if (!ieee8021BridgePriority_isValid (i32PriorityCodePoint) || !ieee8021BridgeDEI_isValid (u8DropEligible))
{
return NULL;
}
if ((poTmpEntry = xBuffer_cAlloc (sizeof (*poTmpEntry))) == NULL)
{
return NULL;
Expand All @@ -5028,8 +5034,8 @@ ieee8021BridgePortEncodingTable_getByIndex (
poTmpEntry->u32ComponentId = u32ComponentId;
poTmpEntry->u32PortNum = u32PortNum;
poTmpEntry->i32PriorityCodePointRow = i32PriorityCodePointRow;
poTmpEntry->i32PriorityCodePoint = i32PriorityCodePoint;
poTmpEntry->u8DropEligible = u8DropEligible;
// poTmpEntry->i32PriorityCodePoint = i32PriorityCodePoint;
// poTmpEntry->u8DropEligible = u8DropEligible;
if ((poNode = xBTree_nodeFind (&poTmpEntry->oBTreeNode, &oIeee8021BridgePortEncodingTable_BTree)) == NULL)
{
xBuffer_free (poTmpEntry);
Expand Down Expand Up @@ -5059,8 +5065,8 @@ ieee8021BridgePortEncodingTable_getNextIndex (
poTmpEntry->u32ComponentId = u32ComponentId;
poTmpEntry->u32PortNum = u32PortNum;
poTmpEntry->i32PriorityCodePointRow = i32PriorityCodePointRow;
poTmpEntry->i32PriorityCodePoint = i32PriorityCodePoint;
poTmpEntry->u8DropEligible = u8DropEligible;
// poTmpEntry->i32PriorityCodePoint = i32PriorityCodePoint;
// poTmpEntry->u8DropEligible = u8DropEligible;
if ((poNode = xBTree_nodeFindNext (&poTmpEntry->oBTreeNode, &oIeee8021BridgePortEncodingTable_BTree)) == NULL)
{
xBuffer_free (poTmpEntry);
Expand Down Expand Up @@ -5116,9 +5122,9 @@ ieee8021BridgePortEncodingTable_getNext (
idx = idx->next_variable;
snmp_set_var_typed_integer (idx, ASN_INTEGER, poEntry->i32PriorityCodePointRow);
idx = idx->next_variable;
snmp_set_var_typed_integer (idx, ASN_INTEGER, poEntry->i32PriorityCodePoint);
// snmp_set_var_typed_integer (idx, ASN_INTEGER, poEntry->i32PriorityCodePoint);
idx = idx->next_variable;
snmp_set_var_typed_integer (idx, ASN_INTEGER, poEntry->u8DropEligible);
// snmp_set_var_typed_integer (idx, ASN_INTEGER, poEntry->u8DropEligible);
*my_data_context = (void*) poEntry;
*my_loop_context = (void*) xBTree_nodeGetNext (&poEntry->oBTreeNode, &oIeee8021BridgePortEncodingTable_BTree);
return put_index_data;
Expand Down Expand Up @@ -5184,7 +5190,7 @@ ieee8021BridgePortEncodingTable_mapper (
switch (table_info->colnum)
{
case IEEE8021BRIDGEPORTENCODINGPRIORITY:
snmp_set_var_typed_integer (request->requestvb, ASN_UNSIGNED, table_entry->u32Priority);
snmp_set_var_typed_integer (request->requestvb, ASN_UNSIGNED, table_entry->au8Priority[0][0]);
break;

default:
Expand Down Expand Up @@ -5248,18 +5254,18 @@ ieee8021BridgePortEncodingTable_mapper (
switch (table_info->colnum)
{
case IEEE8021BRIDGEPORTENCODINGPRIORITY:
if (pvOldDdata == NULL && (pvOldDdata = xBuffer_cAlloc (sizeof (table_entry->u32Priority))) == NULL)
if (pvOldDdata == NULL && (pvOldDdata = xBuffer_cAlloc (sizeof (table_entry->au8Priority[0][0]))) == NULL)
{
netsnmp_set_request_error (reqinfo, request, SNMP_ERR_RESOURCEUNAVAILABLE);
return SNMP_ERR_NOERROR;
}
else if (pvOldDdata != table_entry)
{
memcpy (pvOldDdata, &table_entry->u32Priority, sizeof (table_entry->u32Priority));
memcpy (pvOldDdata, &table_entry->au8Priority[0][0], sizeof (table_entry->au8Priority[0][0]));
netsnmp_request_add_list_data (request, netsnmp_create_data_list (ROLLBACK_BUFFER, pvOldDdata, &xBuffer_free));
}

table_entry->u32Priority = *request->requestvb->val.integer;
table_entry->au8Priority[0][0] = *request->requestvb->val.integer;
break;
}
}
Expand All @@ -5279,7 +5285,7 @@ ieee8021BridgePortEncodingTable_mapper (
switch (table_info->colnum)
{
case IEEE8021BRIDGEPORTENCODINGPRIORITY:
memcpy (&table_entry->u32Priority, pvOldDdata, sizeof (table_entry->u32Priority));
memcpy (&table_entry->au8Priority[0][0], pvOldDdata, sizeof (table_entry->au8Priority[0][0]));
break;
}
}
Expand Down Expand Up @@ -5477,7 +5483,7 @@ ieee8021BridgeServiceAccessPriorityTable_getNext (
idx = idx->next_variable;
// snmp_set_var_typed_integer (idx, ASN_UNSIGNED, poEntry->u32Received);
*my_data_context = (void*) poEntry;
// *my_loop_context = (void*) xBTree_nodeGetNext (&poEntry->oBTreeNode, &oIeee8021BridgeServiceAccessPriorityTable_BTree);
*my_loop_context = (void*) xBTree_nodeGetNext (&poEntry->oBTreeNode, &oIeee8021BridgeServiceAccessPriorityTable_BTree);
return put_index_data;
}

Expand Down
9 changes: 8 additions & 1 deletion ethernet/ieee8021BridgeMib.h
Original file line number Diff line number Diff line change
Expand Up @@ -567,12 +567,19 @@ enum
ieee8021BridgePriority_max_c = 7,
ieee8021BridgePriority_invalid_c = 8,
ieee8021BridgePriority_count_c = 8,

ieee8021BridgeDEI_min_c = 1,
ieee8021BridgeDEI_max_c = 2,
ieee8021BridgeDEI_count_c = 2,
};

#define ieee8021BridgePriority_getNext(_p) (ieee8021BridgePriority_min_c <= (_p) && (_p) < ieee8021BridgePriority_max_c ? (_p) + 1: ieee8021BridgePriority_min_c)
#define ieee8021BridgePriority_isLast(_p) ((_p) == ieee8021BridgePriority_max_c)
#define ieee8021BridgePriority_isValid(_p) (ieee8021BridgePriority_min_c <= (_p) && (_p) <= ieee8021BridgePriority_max_c)

#define ieee8021BridgeDEI_getNext(_p) (ieee8021BridgeDEI_min_c <= (_p) && (_p) < ieee8021BridgeDEI_max_c ? (_p) + 1: ieee8021BridgeDEI_min_c)
#define ieee8021BridgeDEI_isLast(_p) ((_p) == ieee8021BridgeDEI_max_c)
#define ieee8021BridgeDEI_isValid(_p) (ieee8021BridgeDEI_min_c <= (_p) && (_p) <= ieee8021BridgeDEI_max_c)

/**
* table ieee8021BridgePortPriorityTable definitions
Expand Down Expand Up @@ -886,7 +893,7 @@ typedef struct ieee8021BridgePortEncodingEntry_t
uint8_t u8DropEligible;

/* Column values */
uint32_t u32Priority;
uint8_t au8Priority[ieee8021BridgePriority_count_c][ieee8021BridgeDEI_count_c];

xBTree_Node_t oBTreeNode;
} ieee8021BridgePortEncodingEntry_t;
Expand Down

0 comments on commit fb4bcfd

Please sign in to comment.