5 * This file is part of GNU Zebra.
7 * GNU Zebra is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published
9 * by the Free Software Foundation; either version 2, or (at your
10 * option) any later version.
12 * GNU Zebra is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; see the file COPYING; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 #include "command_match.h"
33 #define ASN_STRING_MAX_SIZE 12
35 enum asnotation_mode
{
42 typedef uint32_t as_t
;
44 extern bool asn_str2asn(const char *asstring
, as_t
*asn
);
45 extern const char *asn_asn2asplain(as_t asn
);
46 extern const char *asn_str2asn_parse(const char *asstring
, as_t
*asn
,
48 extern enum match_type
asn_str2asn_match(const char *str
);
49 extern bool asn_str2asn_notation(const char *asstring
, as_t
*asn
,
50 enum asnotation_mode
*asnotation
);
51 extern const char *asn_mode2str(enum asnotation_mode asnotation
);
52 void asn_asn2json_array(json_object
*jseg_list
, as_t asn
,
53 enum asnotation_mode asnotation
);
54 void asn_asn2json(json_object
*jseg_list
, const char *attr
,
55 as_t asn
, enum asnotation_mode asnotation
);
56 extern char *asn_asn2string(const as_t
*as
, char *buf
, size_t len
,
57 enum asnotation_mode asnotation
);
58 /* display AS in appropriate format */
59 #ifdef _FRR_ATTRIBUTE_PRINTFRR
60 #pragma FRR printfrr_ext "%pASP" (as_t *)
61 #pragma FRR printfrr_ext "%pASD" (as_t *)
62 #pragma FRR printfrr_ext "%pASE" (as_t *)
65 #define ASN_FORMAT(mode) \
66 ((mode == ASNOTATION_DOT) ? "%pASD" : \
67 ((mode == ASNOTATION_DOTPLUS) ? "%pASE" : \
69 #define ASN_FORMAT_SPACE(mode) \
70 ((mode == ASNOTATION_DOT) ? "%10pASD" : \
71 ((mode == ASNOTATION_DOTPLUS) ? "%10pASE" : \
75 extern void asn_relax_as_zero(bool relax
);
81 #endif /* _FRR_ASN_H */