3 * Copyright (C) James R. Leu 2001
6 * This software is covered under the LGPL, for more
7 * info check out http://www.gnu.org/copyleft/lgpl.html
10 #include "ldp_struct.h"
11 #include "ldp_hop_list.h"
14 #include "mpls_assert.h"
15 #include "mpls_mm_impl.h"
16 #include "mpls_trace_impl.h"
18 ldp_hop
*ldp_hop_create()
20 ldp_hop
*h
= (ldp_hop
*) mpls_malloc(sizeof(ldp_hop
));
23 memset(h
, 0, sizeof(ldp_hop
));
24 MPLS_REFCNT_INIT(h
, 0);
25 MPLS_LIST_ELEM_INIT(h
, _hop_list
);
30 void ldp_hop_delete(ldp_hop
* h
)
32 // LDP_PRINT(g->user_data,"hop delete\n");
33 MPLS_REFCNT_ASSERT(h
, 0);
37 mpls_return_enum
_ldp_hop_add_hop_list(ldp_hop
* h
, ldp_hop_list
* hl
)
47 mpls_return_enum
_ldp_hop_del_hop_list(ldp_hop
* h
)
49 if (h
&& h
->hop_list
) {
50 MPLS_REFCNT_RELEASE(h
->hop_list
, ldp_hop_list_delete
);
57 mpls_bool
ldp_hop_in_use(ldp_hop
* h
)
59 if (h
->hop_list
&& h
->hop_list
->tunnel
&&
60 (h
->hop_list
->tunnel
->admin_state
== MPLS_ADMIN_ENABLE
)) {
61 return MPLS_BOOL_TRUE
;
63 return MPLS_BOOL_FALSE
;