Fixed next hop processing
[mpls-ldp-portable.git] / ldp / ldp_l2cc.c
blob86cf9c5e7fe46c1cdece3864f9b54e52a379f438
2 /*
3 * Copyright (C) James R. Leu 2000
4 * jleu@mindspring.com
6 * This software is covered under the LGPL, for more
7 * info check out http://www.gnu.org/copyleft/lgpl.html
8 */
10 #include "ldp_struct.h"
11 #include "ldp_l2cc.h"
13 #include "mpls_assert.h"
14 #include "mpls_lock_impl.h"
15 #include "mpls_mm_impl.h"
17 uint32_t _ldp_l2cc_next_index = 1;
19 ldp_l2cc *ldp_l2cc_create()
21 ldp_l2cc *l = (ldp_l2cc *) mpls_malloc(sizeof(ldp_l2cc));
23 if (l) {
24 memset(l, 0, sizeof(ldp_l2cc));
25 MPLS_REFCNT_INIT(l, 0);
26 MPLS_LIST_ELEM_INIT(l, _global);
27 MPLS_LIST_ELEM_INIT(l, _addr);
28 l->index = _ldp_l2cc_get_next_index();
30 return l;
33 void ldp_l2cc_delete(ldp_l2cc * l)
35 // LDP_PRINT(g->user_data,"l2cc delete\n");
36 MPLS_REFCNT_ASSERT(l, 0);
37 mpls_free(l);
40 uint32_t _ldp_l2cc_get_next_index()
42 uint32_t retval = _ldp_l2cc_next_index;
44 _ldp_l2cc_next_index++;
45 if (retval > _ldp_l2cc_next_index) {
46 _ldp_l2cc_next_index = 1;
48 return retval;
51 mpls_bool ldp_l2cc_is_active(ldp_l2cc *l) {
52 return MPLS_BOOL_TRUE;
55 mpls_bool ldp_l2cc_is_ready(ldp_l2cc *l) {
56 return MPLS_BOOL_TRUE;
59 mpls_return_enum ldp_l2cc_startup(ldp_global * g, ldp_l2cc * l) {
60 return MPLS_SUCCESS;
63 mpls_return_enum ldp_l2cc_shutdown(ldp_global * g, ldp_l2cc * l) {
64 return MPLS_SUCCESS;