mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-22 09:41:54 +00:00
Display examples more nicely
This commit is contained in:
parent
1d9622e10d
commit
5dc4b0aae2
@ -58,7 +58,7 @@ generate nice printed copy.
|
|||||||
<p>Bird is configured using text configuration file. At startup, bird reads <file/bird.conf/
|
<p>Bird is configured using text configuration file. At startup, bird reads <file/bird.conf/
|
||||||
(unless -c command line parameter is given). Really simple configuration file might look like this:
|
(unless -c command line parameter is given). Really simple configuration file might look like this:
|
||||||
|
|
||||||
<cf>
|
<cf><verb>
|
||||||
|
|
||||||
protocol kernel {
|
protocol kernel {
|
||||||
persist; # Don't remove routes on bird shutdown
|
persist; # Don't remove routes on bird shutdown
|
||||||
@ -74,7 +74,7 @@ protocol rip {
|
|||||||
export all;
|
export all;
|
||||||
import all;
|
import all;
|
||||||
}
|
}
|
||||||
</cf>
|
</verb></cf>
|
||||||
|
|
||||||
<p>You can find example of more complicated configuration file in <file>doc/bird.conf.example</file>.
|
<p>You can find example of more complicated configuration file in <file>doc/bird.conf.example</file>.
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ value and value.
|
|||||||
|
|
||||||
<p>Filter basically looks like this:
|
<p>Filter basically looks like this:
|
||||||
|
|
||||||
<cf>
|
<cf><verb>
|
||||||
filter not_too_far
|
filter not_too_far
|
||||||
int var;
|
int var;
|
||||||
{
|
{
|
||||||
@ -117,7 +117,7 @@ int var;
|
|||||||
else
|
else
|
||||||
accept "ok";
|
accept "ok";
|
||||||
}
|
}
|
||||||
</cf>
|
</verb></cf>
|
||||||
|
|
||||||
<p>As you can see, filter has a header, list of local variables, and body. Header consists of <cf/filter/ keyword, followed by (unique) name of filter. List of local variables consists of
|
<p>As you can see, filter has a header, list of local variables, and body. Header consists of <cf/filter/ keyword, followed by (unique) name of filter. List of local variables consists of
|
||||||
pairs <cf><I>type name</I>;</cf>, where each pair defines one local variable. Body consists of
|
pairs <cf><I>type name</I>;</cf>, where each pair defines one local variable. Body consists of
|
||||||
@ -188,7 +188,7 @@ is true if element is in given set or if ip adress is inside given prefix.
|
|||||||
over. Functions can have zero or more parameters, and can have local variables. Function basically
|
over. Functions can have zero or more parameters, and can have local variables. Function basically
|
||||||
looks like this:
|
looks like this:
|
||||||
|
|
||||||
<cf>
|
<cf><verb>
|
||||||
function name ()
|
function name ()
|
||||||
int local_variable;
|
int local_variable;
|
||||||
{
|
{
|
||||||
@ -199,7 +199,7 @@ function with_parameters (int parameter)
|
|||||||
{
|
{
|
||||||
print parameter;
|
print parameter;
|
||||||
}
|
}
|
||||||
</cf>
|
</verb></cf>
|
||||||
|
|
||||||
<p>Unlike C, variables are declared after function line but before first {. You can not declare
|
<p>Unlike C, variables are declared after function line but before first {. You can not declare
|
||||||
variables in nested blocks. Functions are called like in C: <cf>name(); with_parameters(5);</cf>.
|
variables in nested blocks. Functions are called like in C: <cf>name(); with_parameters(5);</cf>.
|
||||||
@ -216,13 +216,13 @@ case. Syntax of if/then/else is <cf>if <I>expression</I> then
|
|||||||
or both commands. <cf>else</cf> clause may be ommited. Case is
|
or both commands. <cf>else</cf> clause may be ommited. Case is
|
||||||
used like this:
|
used like this:
|
||||||
|
|
||||||
<cf>
|
<cf><verb>
|
||||||
case <I>argument</I> {
|
case <I>argument</I> {
|
||||||
2: print "dva"; print "jeste jednou dva";
|
2: print "dva"; print "jeste jednou dva";
|
||||||
3 .. 5: print "tri az pet";
|
3 .. 5: print "tri az pet";
|
||||||
else: print "neco jineho";
|
else: print "neco jineho";
|
||||||
}
|
}
|
||||||
</cf>
|
</verb></cf>
|
||||||
|
|
||||||
where <I>argument</I> is any argument that can be on the left side of ~ operator, and anything that
|
where <I>argument</I> is any argument that can be on the left side of ~ operator, and anything that
|
||||||
could be member of set is allowed before :. Multiple commands are allowed without {} grouping. If
|
could be member of set is allowed before :. Multiple commands are allowed without {} grouping. If
|
||||||
@ -293,7 +293,7 @@ other than equally (mis-)configured bird. I warned you.
|
|||||||
<p>In addition, rip defines two filter variables, both of type it. <cf>rip_metric</cf> is rip
|
<p>In addition, rip defines two filter variables, both of type it. <cf>rip_metric</cf> is rip
|
||||||
metric of current route, <cf>rip_tag</cf> is tag of current route.
|
metric of current route, <cf>rip_tag</cf> is tag of current route.
|
||||||
|
|
||||||
<cf>
|
<cf><verb>
|
||||||
|
|
||||||
protocol rip MyRIP_test {
|
protocol rip MyRIP_test {
|
||||||
debug all;
|
debug all;
|
||||||
@ -309,6 +309,6 @@ protocol rip MyRIP_test {
|
|||||||
import filter { print "importing"; accept; };
|
import filter { print "importing"; accept; };
|
||||||
export filter { print "exporting"; accept; };
|
export filter { print "exporting"; accept; };
|
||||||
}
|
}
|
||||||
</cf>
|
</verb></cf>
|
||||||
|
|
||||||
</article>
|
</article>
|
||||||
|
Loading…
Reference in New Issue
Block a user