-
Notifications
You must be signed in to change notification settings - Fork 5
/
spfutil.h
126 lines (96 loc) · 3.63 KB
/
spfutil.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/*
* =====================================================================================
*
* Filename: spfutil.h
*
* Description: This file contains utilities for SPFComputation project
*
* Version: 1.0
* Created: Sunday 27 August 2017 01:52:40 IST
* Revision: 1.0
* Compiler: gcc
*
* Author: Er. Abhishek Sagar, Networking Developer (AS), sachinites@gmail.com
* Company: Brocade Communications(Jul 2012- Mar 2016), Current : Juniper Networks(Apr 2017 - Present)
*
* This file is part of the SPFComputation distribution (https://github.com/sachinites).
* Copyright (c) 2017 Abhishek Sagar.
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* =====================================================================================
*/
#ifndef __SPFUTIL__
#define __SPFUTIL__
#include "instance.h"
#define IS_LEVEL_SET(input_level, level) ((input_level) & (level))
#define SET_LEVEL(input_level, level) ((input_level) |= (level))
void
print_nh_list2(internal_nh_t *nh_list);
boolean
is_present2(internal_nh_t *list, internal_nh_t *nh);
void
copy_nh_list2(internal_nh_t *src_nh_list, internal_nh_t *dst_nh_list);
boolean
is_nh_list_empty2(internal_nh_t *nh_list);
void
union_direct_nh_list2(internal_nh_t *src_direct_nh_list, internal_nh_t *dst_nh_list);
char *
get_str_level(LEVEL level);
void
union_nh_list2(internal_nh_t *src_nh_list, internal_nh_t *dst_nh_list);
char*
get_str_node_area(AREA area);
boolean
is_all_nh_list_empty2(node_t *node, LEVEL level);
void
spf_determine_multi_area_attachment(spf_info_t *spf_info,
node_t *spf_root);
#if 0
#define THREAD_NODE_TO_STRUCT(structure, member_name, fn_name) \
static inline structure * fn_name (char *member_addr){ \
unsigned int member_offset = (unsigned int)&((structure *)0)->member_name; \
return (structure *)(member_addr - member_offset); \
}
#endif
void
apply_mask(char *prefix, char mask, char *str_prefix);
void
apply_mask2(char *prefix, char mask, char *str_prefix);
node_t *
get_system_id_from_router_id(node_t *ingress_lsr,
char *tail_end_ip, LEVEL level);
boolean
is_broadcast_link(edge_t *edge, LEVEL level);
/*Return True if D is a member node on S's broadcast LAN segment connected
* by interface 'interface' */
boolean
is_broadcast_member_node(node_t *S, edge_t *interface, node_t *D, LEVEL level);
unsigned int
get_nh_count(internal_nh_t *nh_list);
void
empty_nh_list(node_t *node, LEVEL level, nh_type_t nh);
boolean
is_empty_internal_nh(internal_nh_t *nh);
void
add_to_nh_list(internal_nh_t *nh_list, internal_nh_t *nh);
char *
hrs_min_sec_format(unsigned int seconds);
#define get_next_hop_empty_slot(internal_nhlist_ptr) \
(&(internal_nhlist_ptr[get_nh_count(internal_nhlist_ptr)]))
int
is_internal_nh_exist(ll_t *lst, internal_nh_t *nh);
unsigned int
get_new_if_index();
unsigned int
hash_code(void *ptr, unsigned int size);
#endif /* __SPFUTIL__ */