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 8, 2015
1 parent 70f37a7 commit e21c37a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
31 changes: 19 additions & 12 deletions ethernet/ieee8021BridgeMib.c
Original file line number Diff line number Diff line change
Expand Up @@ -3970,9 +3970,8 @@ ieee8021BridgeTrafficClassTable_BTreeNodeCmp (

return
(pEntry1->u32BasePortComponentId < pEntry2->u32BasePortComponentId) ||
(pEntry1->u32BasePortComponentId == pEntry2->u32BasePortComponentId && pEntry1->u32BasePort < pEntry2->u32BasePort) ||
(pEntry1->u32BasePortComponentId == pEntry2->u32BasePortComponentId && pEntry1->u32BasePort == pEntry2->u32BasePort && pEntry1->u32Priority < pEntry2->u32Priority) ? -1:
(pEntry1->u32BasePortComponentId == pEntry2->u32BasePortComponentId && pEntry1->u32BasePort == pEntry2->u32BasePort && pEntry1->u32Priority == pEntry2->u32Priority) ? 0: 1;
(pEntry1->u32BasePortComponentId == pEntry2->u32BasePortComponentId && pEntry1->u32BasePort < pEntry2->u32BasePort) ? -1:
(pEntry1->u32BasePortComponentId == pEntry2->u32BasePortComponentId && pEntry1->u32BasePort == pEntry2->u32BasePort) ? 0: 1;
}

xBTree_t oIeee8021BridgeTrafficClassTable_BTree = xBTree_initInline (&ieee8021BridgeTrafficClassTable_BTreeNodeCmp);
Expand All @@ -3986,14 +3985,18 @@ ieee8021BridgeTrafficClassTable_createEntry (
{
register ieee8021BridgeTrafficClassEntry_t *poEntry = NULL;

if (!ieee8021BridgePriority_isValid (u32Priority))
{
return NULL;
}
if ((poEntry = xBuffer_cAlloc (sizeof (*poEntry))) == NULL)
{
return NULL;
}

poEntry->u32BasePortComponentId = u32BasePortComponentId;
poEntry->u32BasePort = u32BasePort;
poEntry->u32Priority = u32Priority;
// poEntry->u32Priority = u32Priority;
if (xBTree_nodeFind (&poEntry->oBTreeNode, &oIeee8021BridgeTrafficClassTable_BTree) != NULL)
{
xBuffer_free (poEntry);
Expand All @@ -4013,14 +4016,18 @@ ieee8021BridgeTrafficClassTable_getByIndex (
register ieee8021BridgeTrafficClassEntry_t *poTmpEntry = NULL;
register xBTree_Node_t *poNode = NULL;

if (!ieee8021BridgePriority_isValid (u32Priority))
{
return NULL;
}
if ((poTmpEntry = xBuffer_cAlloc (sizeof (*poTmpEntry))) == NULL)
{
return NULL;
}

poTmpEntry->u32BasePortComponentId = u32BasePortComponentId;
poTmpEntry->u32BasePort = u32BasePort;
poTmpEntry->u32Priority = u32Priority;
// poTmpEntry->u32Priority = u32Priority;
if ((poNode = xBTree_nodeFind (&poTmpEntry->oBTreeNode, &oIeee8021BridgeTrafficClassTable_BTree)) == NULL)
{
xBuffer_free (poTmpEntry);
Expand All @@ -4047,7 +4054,7 @@ ieee8021BridgeTrafficClassTable_getNextIndex (

poTmpEntry->u32BasePortComponentId = u32BasePortComponentId;
poTmpEntry->u32BasePort = u32BasePort;
poTmpEntry->u32Priority = u32Priority;
// poTmpEntry->u32Priority = u32Priority;
if ((poNode = xBTree_nodeFindNext (&poTmpEntry->oBTreeNode, &oIeee8021BridgeTrafficClassTable_BTree)) == NULL)
{
xBuffer_free (poTmpEntry);
Expand Down Expand Up @@ -4101,7 +4108,7 @@ ieee8021BridgeTrafficClassTable_getNext (
idx = idx->next_variable;
snmp_set_var_typed_integer (idx, ASN_UNSIGNED, poEntry->u32BasePort);
idx = idx->next_variable;
snmp_set_var_typed_integer (idx, ASN_UNSIGNED, poEntry->u32Priority);
// snmp_set_var_typed_integer (idx, ASN_UNSIGNED, poEntry->u32Priority);
*my_data_context = (void*) poEntry;
*my_loop_context = (void*) xBTree_nodeGetNext (&poEntry->oBTreeNode, &oIeee8021BridgeTrafficClassTable_BTree);
return put_index_data;
Expand Down Expand Up @@ -4163,7 +4170,7 @@ ieee8021BridgeTrafficClassTable_mapper (
switch (table_info->colnum)
{
case IEEE8021BRIDGETRAFFICCLASS:
snmp_set_var_typed_integer (request->requestvb, ASN_INTEGER, table_entry->i32Class);
snmp_set_var_typed_integer (request->requestvb, ASN_INTEGER, table_entry->au8Class[0]);
break;

default:
Expand Down Expand Up @@ -4227,18 +4234,18 @@ ieee8021BridgeTrafficClassTable_mapper (
switch (table_info->colnum)
{
case IEEE8021BRIDGETRAFFICCLASS:
if (pvOldDdata == NULL && (pvOldDdata = xBuffer_cAlloc (sizeof (table_entry->i32Class))) == NULL)
if (pvOldDdata == NULL && (pvOldDdata = xBuffer_cAlloc (sizeof (table_entry->au8Class[0]))) == NULL)
{
netsnmp_set_request_error (reqinfo, request, SNMP_ERR_RESOURCEUNAVAILABLE);
return SNMP_ERR_NOERROR;
}
else if (pvOldDdata != table_entry)
{
memcpy (pvOldDdata, &table_entry->i32Class, sizeof (table_entry->i32Class));
memcpy (pvOldDdata, &table_entry->au8Class[0], sizeof (table_entry->au8Class[0]));
netsnmp_request_add_list_data (request, netsnmp_create_data_list (ROLLBACK_BUFFER, pvOldDdata, &xBuffer_free));
}

table_entry->i32Class = *request->requestvb->val.integer;
table_entry->au8Class[0] = *request->requestvb->val.integer;
break;
}
}
Expand All @@ -4258,7 +4265,7 @@ ieee8021BridgeTrafficClassTable_mapper (
switch (table_info->colnum)
{
case IEEE8021BRIDGETRAFFICCLASS:
memcpy (&table_entry->i32Class, pvOldDdata, sizeof (table_entry->i32Class));
memcpy (&table_entry->au8Class[0], pvOldDdata, sizeof (table_entry->au8Class[0]));
break;
}
}
Expand Down
4 changes: 2 additions & 2 deletions ethernet/ieee8021BridgeMib.h
Original file line number Diff line number Diff line change
Expand Up @@ -706,10 +706,10 @@ typedef struct ieee8021BridgeTrafficClassEntry_t
/* Index values */
uint32_t u32BasePortComponentId;
uint32_t u32BasePort;
uint32_t u32Priority;
// uint32_t u32Priority;

/* Column values */
int32_t i32Class;
uint8_t au8Class[ieee8021BridgePriority_count_c];

xBTree_Node_t oBTreeNode;
} ieee8021BridgeTrafficClassEntry_t;
Expand Down

0 comments on commit e21c37a

Please sign in to comment.