Skip to content

Commit

Permalink
[nes]: TED changes ...
Browse files Browse the repository at this point in the history
  • Loading branch information
nes-repo committed Sep 19, 2015
1 parent 69abafc commit 4719c88
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
42 changes: 42 additions & 0 deletions ted/teLinkStdMIB.c
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,22 @@ teLinkSwCapTable_BTreeNodeCmp (
(pEntry1->u32IfIndex == pEntry2->u32IfIndex && pEntry1->u32Id == pEntry2->u32Id) ? 0: 1;
}

static int8_t
teLinkSwCapTable_SwCap_BTreeNodeCmp (
xBTree_Node_t *pNode1, xBTree_Node_t *pNode2, xBTree_t *pBTree)
{
register teLinkSwCapEntry_t *pEntry1 = xBTree_entry (pNode1, teLinkSwCapEntry_t, oSwCap_BTreeNode);
register teLinkSwCapEntry_t *pEntry2 = xBTree_entry (pNode2, teLinkSwCapEntry_t, oSwCap_BTreeNode);

return
(pEntry1->u32IfIndex < pEntry2->u32IfIndex) ||
(pEntry1->u32IfIndex == pEntry2->u32IfIndex && pEntry1->oK.i32Type < pEntry2->oK.i32Type) ||
(pEntry1->u32IfIndex == pEntry2->u32IfIndex && pEntry1->oK.i32Type == pEntry2->oK.i32Type && pEntry1->oK.i32Encoding < pEntry2->oK.i32Encoding) ? -1:
(pEntry1->u32IfIndex == pEntry2->u32IfIndex && pEntry1->oK.i32Type == pEntry2->oK.i32Type && pEntry1->oK.i32Encoding == pEntry2->oK.i32Encoding) ? 0: 1;
}

xBTree_t oTeLinkSwCapTable_BTree = xBTree_initInline (&teLinkSwCapTable_BTreeNodeCmp);
xBTree_t oTeLinkSwCapTable_SwCap_BTree = xBTree_initInline (&teLinkSwCapTable_SwCap_BTreeNodeCmp);

/* create a new row in the table */
teLinkSwCapEntry_t *
Expand Down Expand Up @@ -993,6 +1008,33 @@ teLinkSwCapTable_getByIndex (
return xBTree_entry (poNode, teLinkSwCapEntry_t, oBTreeNode);
}

teLinkSwCapEntry_t *
teLinkSwCapTable_SwCap_getByIndex (
uint32_t u32IfIndex,
int32_t i32Type,
int32_t i32Encoding)
{
register teLinkSwCapEntry_t *poTmpEntry = NULL;
register xBTree_Node_t *poNode = NULL;

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

poTmpEntry->u32IfIndex = u32IfIndex;
poTmpEntry->oK.i32Type = i32Type;
poTmpEntry->oK.i32Encoding = i32Encoding;
if ((poNode = xBTree_nodeFind (&poTmpEntry->oSwCap_BTreeNode, &oTeLinkSwCapTable_SwCap_BTree)) == NULL)
{
xBuffer_free (poTmpEntry);
return NULL;
}

xBuffer_free (poTmpEntry);
return xBTree_entry (poNode, teLinkSwCapEntry_t, oSwCap_BTreeNode);
}

teLinkSwCapEntry_t *
teLinkSwCapTable_getNextIndex (
uint32_t u32IfIndex,
Expand Down
11 changes: 11 additions & 0 deletions ted/teLinkStdMIB.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,11 @@ typedef struct teLinkSwCapEntry_t
uint32_t u32IfIndex;
uint32_t u32Id;

struct {
int32_t i32Type;
int32_t i32Encoding;
} oK;

/* Column values */
int32_t i32Type;
int32_t i32Encoding;
Expand All @@ -252,9 +257,11 @@ typedef struct teLinkSwCapEntry_t
uint8_t u8StorageType;

xBTree_Node_t oBTreeNode;
xBTree_Node_t oSwCap_BTreeNode;
} teLinkSwCapEntry_t;

extern xBTree_t oTeLinkSwCapTable_BTree;
extern xBTree_t oTeLinkSwCapTable_SwCap_BTree;

/* teLinkSwCapTable table mapper */
void teLinkSwCapTable_init (void);
Expand All @@ -264,6 +271,10 @@ teLinkSwCapEntry_t * teLinkSwCapTable_createEntry (
teLinkSwCapEntry_t * teLinkSwCapTable_getByIndex (
uint32_t u32IfIndex,
uint32_t u32Id);
teLinkSwCapEntry_t * teLinkSwCapTable_SwCap_getByIndex (
uint32_t u32IfIndex,
int32_t i32Type,
int32_t i32Encoding);
teLinkSwCapEntry_t * teLinkSwCapTable_getNextIndex (
uint32_t u32IfIndex,
uint32_t u32Id);
Expand Down

0 comments on commit 4719c88

Please sign in to comment.