Skip to content

Commit

Permalink
[nes]: GMPLS changes ...
Browse files Browse the repository at this point in the history
  • Loading branch information
nes-repo committed Aug 7, 2015
1 parent caff8e5 commit dbc89e0
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
37 changes: 37 additions & 0 deletions mpls/mplsTeStdMIB.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,20 @@ mplsTunnelTable_BTreeNodeCmp (
(pEntry1->u32Index == pEntry2->u32Index && pEntry1->u32Instance == pEntry2->u32Instance && pEntry1->u32IngressLSRId == pEntry2->u32IngressLSRId && pEntry1->u32EgressLSRId == pEntry2->u32EgressLSRId) ? 0: 1;
}

static int8_t
mplsTunnelTable_XC_BTreeNodeCmp (
xBTree_Node_t *pNode1, xBTree_Node_t *pNode2, xBTree_t *pBTree)
{
register mplsTunnelEntry_t *pEntry1 = xBTree_entry (pNode1, mplsTunnelEntry_t, oXC_BTreeNode);
register mplsTunnelEntry_t *pEntry2 = xBTree_entry (pNode2, mplsTunnelEntry_t, oXC_BTreeNode);

return
(xBinCmp (pEntry1->oK.au8XCIndex, pEntry2->oK.au8XCIndex, pEntry1->oK.u16XCIndex_len, pEntry2->oK.u16XCIndex_len) == -1) ? -1:
(xBinCmp (pEntry1->oK.au8XCIndex, pEntry2->oK.au8XCIndex, pEntry1->oK.u16XCIndex_len, pEntry2->oK.u16XCIndex_len) == 0) ? 0: 1;
}

xBTree_t oMplsTunnelTable_BTree = xBTree_initInline (&mplsTunnelTable_BTreeNodeCmp);
xBTree_t oMplsTunnelTable_XC_BTree = xBTree_initInline (&mplsTunnelTable_XC_BTreeNodeCmp);

/* create a new row in the table */
mplsTunnelEntry_t *
Expand Down Expand Up @@ -568,6 +581,30 @@ mplsTunnelTable_getByIndex (
return xBTree_entry (poNode, mplsTunnelEntry_t, oBTreeNode);
}

mplsTunnelEntry_t *
mplsTunnelTable_XC_getByIndex (
uint8_t *pau8XCIndex, size_t u16XCIndex_len)
{
register mplsTunnelEntry_t *poTmpEntry = NULL;
register xBTree_Node_t *poNode = NULL;

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

memcpy (poTmpEntry->oK.au8XCIndex, pau8XCIndex, u16XCIndex_len);
poTmpEntry->oK.u16XCIndex_len = u16XCIndex_len;
if ((poNode = xBTree_nodeFind (&poTmpEntry->oXC_BTreeNode, &oMplsTunnelTable_XC_BTree)) == NULL)
{
xBuffer_free (poTmpEntry);
return NULL;
}

xBuffer_free (poTmpEntry);
return xBTree_entry (poNode, mplsTunnelEntry_t, oXC_BTreeNode);
}

mplsTunnelEntry_t *
mplsTunnelTable_getNextIndex (
uint32_t u32Index,
Expand Down
9 changes: 9 additions & 0 deletions mpls/mplsTeStdMIB.h
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,11 @@ typedef struct mplsTunnelEntry_t
uint32_t u32IngressLSRId;
uint32_t u32EgressLSRId;

struct {
uint8_t au8XCIndex[24];
size_t u16XCIndex_len;
} oK;

/* Column values */
uint8_t au8Name[255];
size_t u16Name_len; /* # of uint8_t elements */
Expand Down Expand Up @@ -1035,9 +1040,11 @@ typedef struct mplsTunnelEntry_t
neMplsTunnelEntry_t oNe;

xBTree_Node_t oBTreeNode;
xBTree_Node_t oXC_BTreeNode;
} mplsTunnelEntry_t;

extern xBTree_t oMplsTunnelTable_BTree;
extern xBTree_t oMplsTunnelTable_XC_BTree;

/* mplsTunnelTable table mapper */
void mplsTunnelTable_init (void);
Expand All @@ -1051,6 +1058,8 @@ mplsTunnelEntry_t * mplsTunnelTable_getByIndex (
uint32_t u32Instance,
uint32_t u32IngressLSRId,
uint32_t u32EgressLSRId);
mplsTunnelEntry_t * mplsTunnelTable_XC_getByIndex (
uint8_t *pau8XCIndex, size_t u16XCIndex_len);
mplsTunnelEntry_t * mplsTunnelTable_getNextIndex (
uint32_t u32Index,
uint32_t u32Instance,
Expand Down

0 comments on commit dbc89e0

Please sign in to comment.