mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-11-09 12:48:43 +00:00
Support for address family constants
We already had them defined on BGP level, but they are more general.
This commit is contained in:
parent
08c4c9a30b
commit
0edf0c8cd9
@ -30,6 +30,7 @@ class BIRDFValPrinter(BIRDPrinter):
|
|||||||
"T_ENUM_ROA": "i",
|
"T_ENUM_ROA": "i",
|
||||||
"T_ENUM_NETTYPE": "i",
|
"T_ENUM_NETTYPE": "i",
|
||||||
"T_ENUM_RA_PREFERENCE": "i",
|
"T_ENUM_RA_PREFERENCE": "i",
|
||||||
|
"T_ENUM_AF": "i",
|
||||||
"T_IP": "ip",
|
"T_IP": "ip",
|
||||||
"T_NET": "net",
|
"T_NET": "net",
|
||||||
"T_STRING": "s",
|
"T_STRING": "s",
|
||||||
|
@ -34,9 +34,11 @@ m4_define(CF_CLI, `CF_KEYWORDS(m4_translit($1, [[ ]], [[,]]))
|
|||||||
')
|
')
|
||||||
|
|
||||||
# Enums are translated to C initializers: use CF_ENUM(typename, prefix, values)
|
# Enums are translated to C initializers: use CF_ENUM(typename, prefix, values)
|
||||||
m4_define(CF_enum, `m4_divert(1){ "CF_enum_prefix[[]]$1", -((CF_enum_type<<16) | CF_enum_prefix[[]]$1), NULL },
|
# For different prefix: CF_ENUM_PX(typename, external prefix, C prefix, values)
|
||||||
|
m4_define(CF_enum, `m4_divert(1){ "CF_enum_prefix_ext[[]]$1", -((CF_enum_type<<16) | CF_enum_prefix_int[[]]$1), NULL },
|
||||||
m4_divert(-1)')
|
m4_divert(-1)')
|
||||||
m4_define(CF_ENUM, `m4_define([[CF_enum_type]],$1)m4_define([[CF_enum_prefix]],$2)CF_iterate([[CF_enum]], [[m4_shift(m4_shift($@))]])DNL')
|
m4_define(CF_ENUM, `m4_define([[CF_enum_type]],$1)m4_define([[CF_enum_prefix_ext]],$2)m4_define([[CF_enum_prefix_int]],$2)CF_iterate([[CF_enum]], [[m4_shift(m4_shift($@))]])DNL')
|
||||||
|
m4_define(CF_ENUM_PX, `m4_define([[CF_enum_type]],$1)m4_define([[CF_enum_prefix_ext]],$2)m4_define([[CF_enum_prefix_int]],$3)CF_iterate([[CF_enum]], [[m4_shift(m4_shift(m4_shift($@)))]])DNL')
|
||||||
|
|
||||||
# After all configuration templates end, we generate the
|
# After all configuration templates end, we generate the
|
||||||
m4_m4wrap(`
|
m4_m4wrap(`
|
||||||
|
@ -44,6 +44,7 @@ m4_define(CF_CLI_HELP, `')
|
|||||||
|
|
||||||
# ENUM declarations are ignored
|
# ENUM declarations are ignored
|
||||||
m4_define(CF_ENUM, `')
|
m4_define(CF_ENUM, `')
|
||||||
|
m4_define(CF_ENUM_PX, `')
|
||||||
|
|
||||||
# After all configuration templates end, we finally generate the grammar file.
|
# After all configuration templates end, we finally generate the grammar file.
|
||||||
m4_m4wrap(`
|
m4_m4wrap(`
|
||||||
|
@ -38,6 +38,7 @@ enum f_type {
|
|||||||
T_ENUM_ROA = 0x35,
|
T_ENUM_ROA = 0x35,
|
||||||
T_ENUM_NETTYPE = 0x36,
|
T_ENUM_NETTYPE = 0x36,
|
||||||
T_ENUM_RA_PREFERENCE = 0x37,
|
T_ENUM_RA_PREFERENCE = 0x37,
|
||||||
|
T_ENUM_AF = 0x38,
|
||||||
|
|
||||||
/* new enums go here */
|
/* new enums go here */
|
||||||
T_ENUM_EMPTY = 0x3f, /* Special hack for atomic_aggr */
|
T_ENUM_EMPTY = 0x3f, /* Special hack for atomic_aggr */
|
||||||
|
7
lib/ip.h
7
lib/ip.h
@ -48,6 +48,13 @@
|
|||||||
#define UDP_HEADER_LENGTH 8
|
#define UDP_HEADER_LENGTH 8
|
||||||
|
|
||||||
|
|
||||||
|
/* IANA Address Family Numbers */
|
||||||
|
/* https://www.iana.org/assignments/address-family-numbers/address-family-numbers.xhtml */
|
||||||
|
/* Would use AF_ prefix, but that collides with POSIX address family numbers */
|
||||||
|
#define AFI_IPV4 1
|
||||||
|
#define AFI_IPV6 2
|
||||||
|
|
||||||
|
|
||||||
#ifdef DEBUGGING
|
#ifdef DEBUGGING
|
||||||
|
|
||||||
typedef struct ip4_addr {
|
typedef struct ip4_addr {
|
||||||
|
@ -85,6 +85,7 @@ CF_ENUM(T_ENUM_RTS, RTS_, DUMMY, STATIC, INHERIT, DEVICE, STATIC_DEVICE, REDIREC
|
|||||||
CF_ENUM(T_ENUM_SCOPE, SCOPE_, HOST, LINK, SITE, ORGANIZATION, UNIVERSE, UNDEFINED)
|
CF_ENUM(T_ENUM_SCOPE, SCOPE_, HOST, LINK, SITE, ORGANIZATION, UNIVERSE, UNDEFINED)
|
||||||
CF_ENUM(T_ENUM_RTD, RTD_, UNICAST, BLACKHOLE, UNREACHABLE, PROHIBIT)
|
CF_ENUM(T_ENUM_RTD, RTD_, UNICAST, BLACKHOLE, UNREACHABLE, PROHIBIT)
|
||||||
CF_ENUM(T_ENUM_ROA, ROA_, UNKNOWN, VALID, INVALID)
|
CF_ENUM(T_ENUM_ROA, ROA_, UNKNOWN, VALID, INVALID)
|
||||||
|
CF_ENUM_PX(T_ENUM_AF, AF_, AFI_, IPV4, IPV6)
|
||||||
|
|
||||||
%type <i32> idval
|
%type <i32> idval
|
||||||
%type <f> imexport
|
%type <f> imexport
|
||||||
|
Loading…
Reference in New Issue
Block a user