]>
Commit | Line | Data |
---|---|---|
1c2facd1 RW |
1 | /* |
2 | * Copyright (C) 2018 NetDEF, Inc. | |
3 | * Renato Westphal | |
4 | * | |
5 | * This program is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU General Public License as published by the Free | |
7 | * Software Foundation; either version 2 of the License, or (at your option) | |
8 | * any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, but WITHOUT | |
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
13 | * more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License along | |
16 | * with this program; see the file COPYING; if not, write to the Free Software | |
17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
18 | */ | |
19 | ||
20 | #ifndef _FRR_NORTHBOUND_WRAPPERS_H_ | |
21 | #define _FRR_NORTHBOUND_WRAPPERS_H_ | |
22 | ||
23 | #include "prefix.h" | |
24 | ||
17e38209 RW |
25 | #ifdef __cplusplus |
26 | extern "C" { | |
27 | #endif | |
28 | ||
1c2facd1 RW |
29 | /* bool */ |
30 | extern bool yang_str2bool(const char *value); | |
31 | extern struct yang_data *yang_data_new_bool(const char *xpath, bool value); | |
32 | extern bool yang_dnode_get_bool(const struct lyd_node *dnode, | |
0f9de11a DL |
33 | const char *xpath_fmt, ...) PRINTFRR(2, 3); |
34 | extern bool yang_get_default_bool(const char *xpath_fmt, ...) PRINTFRR(1, 2); | |
1c2facd1 RW |
35 | |
36 | /* dec64 */ | |
37 | extern double yang_str2dec64(const char *xpath, const char *value); | |
38 | extern struct yang_data *yang_data_new_dec64(const char *xpath, double value); | |
39 | extern double yang_dnode_get_dec64(const struct lyd_node *dnode, | |
0f9de11a DL |
40 | const char *xpath_fmt, ...) PRINTFRR(2, 3); |
41 | extern double yang_get_default_dec64(const char *xpath_fmt, ...) PRINTFRR(1, 2); | |
1c2facd1 RW |
42 | |
43 | /* enum */ | |
44 | extern int yang_str2enum(const char *xpath, const char *value); | |
45 | extern struct yang_data *yang_data_new_enum(const char *xpath, int value); | |
46 | extern int yang_dnode_get_enum(const struct lyd_node *dnode, | |
0f9de11a DL |
47 | const char *xpath_fmt, ...) PRINTFRR(2, 3); |
48 | extern int yang_get_default_enum(const char *xpath_fmt, ...) PRINTFRR(1, 2); | |
1c2facd1 RW |
49 | |
50 | /* int8 */ | |
51 | extern int8_t yang_str2int8(const char *value); | |
52 | extern struct yang_data *yang_data_new_int8(const char *xpath, int8_t value); | |
53 | extern int8_t yang_dnode_get_int8(const struct lyd_node *dnode, | |
0f9de11a DL |
54 | const char *xpath_fmt, ...) PRINTFRR(2, 3); |
55 | extern int8_t yang_get_default_int8(const char *xpath_fmt, ...) PRINTFRR(1, 2); | |
1c2facd1 RW |
56 | |
57 | /* int16 */ | |
58 | extern int16_t yang_str2int16(const char *value); | |
59 | extern struct yang_data *yang_data_new_int16(const char *xpath, int16_t value); | |
60 | extern int16_t yang_dnode_get_int16(const struct lyd_node *dnode, | |
0f9de11a DL |
61 | const char *xpath_fmt, ...) PRINTFRR(2, 3); |
62 | extern int16_t yang_get_default_int16(const char *xpath_fmt, ...) | |
63 | PRINTFRR(1, 2); | |
1c2facd1 RW |
64 | |
65 | /* int32 */ | |
66 | extern int32_t yang_str2int32(const char *value); | |
67 | extern struct yang_data *yang_data_new_int32(const char *xpath, int32_t value); | |
68 | extern int32_t yang_dnode_get_int32(const struct lyd_node *dnode, | |
0f9de11a DL |
69 | const char *xpath_fmt, ...) PRINTFRR(2, 3); |
70 | extern int32_t yang_get_default_int32(const char *xpath_fmt, ...) | |
71 | PRINTFRR(1, 2); | |
1c2facd1 RW |
72 | |
73 | /* int64 */ | |
74 | extern int64_t yang_str2int64(const char *value); | |
75 | extern struct yang_data *yang_data_new_int64(const char *xpath, int64_t value); | |
76 | extern int64_t yang_dnode_get_int64(const struct lyd_node *dnode, | |
0f9de11a DL |
77 | const char *xpath_fmt, ...) PRINTFRR(2, 3); |
78 | extern int64_t yang_get_default_int64(const char *xpath_fmt, ...) | |
79 | PRINTFRR(1, 2); | |
1c2facd1 RW |
80 | |
81 | /* uint8 */ | |
82 | extern uint8_t yang_str2uint8(const char *value); | |
83 | extern struct yang_data *yang_data_new_uint8(const char *xpath, uint8_t value); | |
84 | extern uint8_t yang_dnode_get_uint8(const struct lyd_node *dnode, | |
0f9de11a DL |
85 | const char *xpath_fmt, ...) PRINTFRR(2, 3); |
86 | extern uint8_t yang_get_default_uint8(const char *xpath_fmt, ...) | |
87 | PRINTFRR(1, 2); | |
1c2facd1 RW |
88 | |
89 | /* uint16 */ | |
90 | extern uint16_t yang_str2uint16(const char *value); | |
91 | extern struct yang_data *yang_data_new_uint16(const char *xpath, | |
92 | uint16_t value); | |
93 | extern uint16_t yang_dnode_get_uint16(const struct lyd_node *dnode, | |
0f9de11a DL |
94 | const char *xpath_fmt, ...) |
95 | PRINTFRR(2, 3); | |
96 | extern uint16_t yang_get_default_uint16(const char *xpath_fmt, ...) | |
97 | PRINTFRR(1, 2); | |
1c2facd1 RW |
98 | |
99 | /* uint32 */ | |
100 | extern uint32_t yang_str2uint32(const char *value); | |
101 | extern struct yang_data *yang_data_new_uint32(const char *xpath, | |
102 | uint32_t value); | |
103 | extern uint32_t yang_dnode_get_uint32(const struct lyd_node *dnode, | |
0f9de11a DL |
104 | const char *xpath_fmt, ...) |
105 | PRINTFRR(2, 3); | |
106 | extern uint32_t yang_get_default_uint32(const char *xpath_fmt, ...) | |
107 | PRINTFRR(1, 2); | |
1c2facd1 RW |
108 | |
109 | /* uint64 */ | |
110 | extern uint64_t yang_str2uint64(const char *value); | |
111 | extern struct yang_data *yang_data_new_uint64(const char *xpath, | |
112 | uint64_t value); | |
113 | extern uint64_t yang_dnode_get_uint64(const struct lyd_node *dnode, | |
0f9de11a DL |
114 | const char *xpath_fmt, ...) |
115 | PRINTFRR(2, 3); | |
116 | extern uint64_t yang_get_default_uint64(const char *xpath_fmt, ...) | |
117 | PRINTFRR(1, 2); | |
1c2facd1 RW |
118 | |
119 | /* string */ | |
120 | extern struct yang_data *yang_data_new_string(const char *xpath, | |
121 | const char *value); | |
122 | extern const char *yang_dnode_get_string(const struct lyd_node *dnode, | |
0f9de11a DL |
123 | const char *xpath_fmt, ...) |
124 | PRINTFRR(2, 3); | |
1c2facd1 RW |
125 | extern void yang_dnode_get_string_buf(char *buf, size_t size, |
126 | const struct lyd_node *dnode, | |
0f9de11a DL |
127 | const char *xpath_fmt, ...) |
128 | PRINTFRR(4, 5); | |
129 | extern const char *yang_get_default_string(const char *xpath_fmt, ...) | |
130 | PRINTFRR(1, 2); | |
1c2facd1 | 131 | extern void yang_get_default_string_buf(char *buf, size_t size, |
0f9de11a DL |
132 | const char *xpath_fmt, ...) |
133 | PRINTFRR(3, 4); | |
1c2facd1 | 134 | |
ac313345 | 135 | /* binary */ |
136 | extern struct yang_data *yang_data_new_binary(const char *xpath, | |
137 | const char *value, size_t len); | |
138 | extern size_t yang_dnode_get_binary_buf(char *buf, size_t size, | |
139 | const struct lyd_node *dnode, | |
0f9de11a DL |
140 | const char *xpath_fmt, ...) |
141 | PRINTFRR(4, 5); | |
ac313345 | 142 | |
b71df689 CS |
143 | /* empty */ |
144 | extern struct yang_data *yang_data_new_empty(const char *xpath); | |
47cd2234 | 145 | extern bool yang_dnode_get_empty(const struct lyd_node *dnode, |
0f9de11a | 146 | const char *xpath_fmt, ...) PRINTFRR(2, 3); |
b71df689 | 147 | |
eed84494 RW |
148 | /* ip prefix */ |
149 | extern void yang_str2prefix(const char *value, union prefixptr prefix); | |
150 | extern struct yang_data *yang_data_new_prefix(const char *xpath, | |
151 | union prefixconstptr prefix); | |
46fcb2df | 152 | extern void yang_dnode_get_prefix(struct prefix *prefix, |
eed84494 | 153 | const struct lyd_node *dnode, |
0f9de11a | 154 | const char *xpath_fmt, ...) PRINTFRR(3, 4); |
eed84494 | 155 | extern void yang_get_default_prefix(union prefixptr var, const char *xpath_fmt, |
0f9de11a | 156 | ...) PRINTFRR(2, 3); |
eed84494 | 157 | |
1c2facd1 RW |
158 | /* ipv4 */ |
159 | extern void yang_str2ipv4(const char *value, struct in_addr *addr); | |
160 | extern struct yang_data *yang_data_new_ipv4(const char *xpath, | |
161 | const struct in_addr *addr); | |
162 | extern void yang_dnode_get_ipv4(struct in_addr *addr, | |
163 | const struct lyd_node *dnode, | |
0f9de11a | 164 | const char *xpath_fmt, ...) PRINTFRR(3, 4); |
1c2facd1 | 165 | extern void yang_get_default_ipv4(struct in_addr *var, const char *xpath_fmt, |
0f9de11a | 166 | ...) PRINTFRR(2, 3); |
1c2facd1 RW |
167 | |
168 | /* ipv4p */ | |
169 | extern void yang_str2ipv4p(const char *value, union prefixptr prefix); | |
170 | extern struct yang_data *yang_data_new_ipv4p(const char *xpath, | |
70065793 | 171 | union prefixconstptr prefix); |
1c2facd1 RW |
172 | extern void yang_dnode_get_ipv4p(union prefixptr prefix, |
173 | const struct lyd_node *dnode, | |
0f9de11a | 174 | const char *xpath_fmt, ...) PRINTFRR(3, 4); |
1c2facd1 | 175 | extern void yang_get_default_ipv4p(union prefixptr var, const char *xpath_fmt, |
0f9de11a | 176 | ...) PRINTFRR(2, 3); |
1c2facd1 RW |
177 | |
178 | /* ipv6 */ | |
179 | extern void yang_str2ipv6(const char *value, struct in6_addr *addr); | |
180 | extern struct yang_data *yang_data_new_ipv6(const char *xpath, | |
181 | const struct in6_addr *addr); | |
182 | extern void yang_dnode_get_ipv6(struct in6_addr *addr, | |
183 | const struct lyd_node *dnode, | |
0f9de11a | 184 | const char *xpath_fmt, ...) PRINTFRR(3, 4); |
1c2facd1 | 185 | extern void yang_get_default_ipv6(struct in6_addr *var, const char *xpath_fmt, |
0f9de11a | 186 | ...) PRINTFRR(2, 3); |
1c2facd1 RW |
187 | |
188 | /* ipv6p */ | |
189 | extern void yang_str2ipv6p(const char *value, union prefixptr prefix); | |
190 | extern struct yang_data *yang_data_new_ipv6p(const char *xpath, | |
70065793 | 191 | union prefixconstptr prefix); |
1c2facd1 RW |
192 | extern void yang_dnode_get_ipv6p(union prefixptr prefix, |
193 | const struct lyd_node *dnode, | |
0f9de11a | 194 | const char *xpath_fmt, ...) PRINTFRR(3, 4); |
1c2facd1 | 195 | extern void yang_get_default_ipv6p(union prefixptr var, const char *xpath_fmt, |
0f9de11a | 196 | ...) PRINTFRR(2, 3); |
1c2facd1 | 197 | |
b0584ad3 QY |
198 | /* ip */ |
199 | extern void yang_str2ip(const char *value, struct ipaddr *addr); | |
200 | extern struct yang_data *yang_data_new_ip(const char *xpath, | |
201 | const struct ipaddr *addr); | |
202 | extern void yang_dnode_get_ip(struct ipaddr *addr, const struct lyd_node *dnode, | |
0f9de11a DL |
203 | const char *xpath_fmt, ...) PRINTFRR(3, 4); |
204 | extern void yang_get_default_ip(struct ipaddr *var, const char *xpath_fmt, ...) | |
205 | PRINTFRR(2, 3); | |
b0584ad3 | 206 | |
dd9ef518 CS |
207 | /* mac */ |
208 | extern struct yang_data *yang_data_new_mac(const char *xpath, | |
209 | const struct ethaddr *mac); | |
210 | extern void yang_str2mac(const char *value, struct ethaddr *mac); | |
211 | ||
8d0c8ff5 CS |
212 | /*data-and-time */ |
213 | extern struct yang_data *yang_data_new_date_and_time(const char *xpath, | |
214 | time_t time); | |
215 | ||
216 | /* nexthop enum2str */ | |
cad46cfd CS |
217 | extern const char *yang_nexthop_type2str(uint32_t ntype); |
218 | ||
755100ac | 219 | const char *yang_afi_safi_value2identity(afi_t afi, safi_t safi); |
220 | void yang_afi_safi_identity2value(const char *key, afi_t *afi, safi_t *safi); | |
221 | ||
17e38209 RW |
222 | #ifdef __cplusplus |
223 | } | |
224 | #endif | |
225 | ||
1c2facd1 | 226 | #endif /* _FRR_NORTHBOUND_WRAPPERS_H_ */ |