Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
labs
BIRD Internet Routing Daemon
Commits
720d911d
Commit
720d911d
authored
Oct 07, 1999
by
Pavel Machek
Browse files
Added constants of type prefix and pair, added their printing
parent
4872cef4
Changes
2
Hide whitespace changes
Inline
Side-by-side
filter/config.Y
View file @
720d911d
...
...
@@ -5,7 +5,7 @@
*
* Can be freely distributed and used under the terms of the GNU GPL.
*
FIXME:
constant prefix
es, make prefix.ip and prefix.length work
FIXME:
prefix variabl
es, make prefix.ip and prefix.length work
FIXME: define keyword
FIXME: case without { }'s
FIXME: allow px+, px- px^pair in prefix sets
...
...
@@ -13,6 +13,8 @@
FIXME: whole system of paths, path ~ string, path.prepend(), path.originate
FIXME: create community lists
FIXME: access to dynamic attributes
FIXME: do not allow function call by callme(1,2,)
FIXME: pairs of integers: define compare
*/
CF_HDR
...
...
@@ -147,6 +149,7 @@ block:
set_atom:
NUM { $$.type = T_INT; $$.val.i = $1; }
| IPA { $$.type = T_IP; $$.val.ip = $1; }
;
set_item:
...
...
@@ -165,7 +168,9 @@ constant:
| TRUE { $$ = f_new_inst(); $$->code = 'c'; $$->a1.i = T_BOOL; $$->a2.i = 1; }
| FALSE { $$ = f_new_inst(); $$->code = 'c'; $$->a1.i = T_BOOL; $$->a2.i = 0; }
| TEXT { $$ = f_new_inst(); $$->code = 'c'; $$->a1.i = T_STRING; $$->a2.p = $1; }
| '(' NUM ',' NUM ')' { $$ = f_new_inst(); $$->code = 'c'; $$->a1.i = T_PAIR; $$->a2.i = $2 << 16 | $4; }
| IPA { struct f_val * val; val = cfg_alloc(sizeof(struct f_val)); $$ = f_new_inst(); $$->code = 'C'; $$->a1.p = val; val->type = T_IP; val->val.ip = $1; }
| IPA '/' NUM { struct f_val * val; val = cfg_alloc(sizeof(struct f_val)); $$ = f_new_inst(); $$->code = 'C'; $$->a1.p = val; val->type = T_PREFIX; val->val.px.ip = $1; val->val.px.len = $3; printf( "ook, we have prefix here\n" ); }
| '[' set_items ']' { printf( "We've got a set here..." ); $$ = f_new_inst(); $$->code = 'c'; $$->a1.i = T_SET; $$->a2.p = build_tree($2); printf( "ook\n" ); }
;
...
...
filter/filter.c
View file @
720d911d
...
...
@@ -6,6 +6,8 @@
* Can be freely distributed and used under the terms of the GNU GPL.
*
* FIXME: local namespace for functions
*
* Notice that pair is stored as integer: first << 16 | second
*/
#include <stdio.h>
...
...
@@ -99,6 +101,8 @@ val_print(struct f_val v)
case
T_INT
:
PRINTF
(
"%d "
,
v
.
val
.
i
);
break
;
case
T_STRING
:
PRINTF
(
"%s"
,
v
.
val
.
s
);
break
;
case
T_IP
:
PRINTF
(
"%I"
,
v
.
val
.
ip
);
break
;
case
T_PREFIX
:
PRINTF
(
"%I/%d"
,
v
.
val
.
px
.
ip
,
v
.
val
.
px
.
len
);
break
;
case
T_PAIR
:
PRINTF
(
"(%d,%d)"
,
v
.
val
.
i
>>
16
,
v
.
val
.
i
&
0xffff
);
break
;
case
T_SET
:
tree_print
(
v
.
val
.
t
);
PRINTF
(
"
\n
"
);
break
;
default:
PRINTF
(
"[unknown type %x]"
,
v
.
type
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment