As per Relevance of the word information, we have this rfc below:











Network Working Group N.
Request for Comments: 2723 The University of
Category: Informational October 1999


SRL: A Language for Describing Traffic Flows
Specifying Actions for Flow

Status of this

This memo provides information for the Internet community. It
not specify an Internet standard of any kind. Distribution of
memo is unlimited

Copyright

Copyright (C) The Internet Society (1999). All Rights Reserved



This document describes a language for specifying rulesets, i.e
configuration files which may be loaded into a traffic flow meter
as to specify which traffic flows are measured by the meter, and
information it will store for each flow

Table of

1 Purpose and Scope . . . . . . . . . . . . . . . . . . . . . . 2
1.1 RTFM Meters and Traffic Flows . . . . . . . . . . . . . . 2
1.2 SRL Overview . . . . . . . . . . . . . . . . . . . . . . 3
2 SRL Language Description . . . . . . . . . . . . . . . . . . 4
2.1 Define Directive . . . . . . . . . . . . . . . . . . . . 4
2.2 Program . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.3 Declaration . . . . . . . . . . . . . . . . . . . . . . . 5
3 Statement . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.1 IF_statement . . . . . . . . . . . . . . . . . . . . . . 6
3.1.1 expression . . . . . . . . . . . . . . . . . . . . 6
3.1.2 term . . . . . . . . . . . . . . . . . . . . . . . 6
3.1.3 factor . . . . . . . . . . . . . . . . . . . . . . 6
3.1.4 operand_list . . . . . . . . . . . . . . . . . . . 6
3.1.5 operand . . . . . . . . . . . . . . . . . . . . . . 6
3.1.6 Test Part . . . . . . . . . . . . . . . . . . . . . 7
3.1.7 Action Part . . . . . . . . . . . . . . . . . . . . 8
3.1.8 ELSE Clause . . . . . . . . . . . . . . . . . . . . 8
3.2 Compound_statement . . . . . . . . . . . . . . . . . . . 8
3.3 Imperative_statement . . . . . . . . . . . . . . . . . . 9
3.3.1 SAVE Statement . . . . . . . . . . . . . . . . . . 9
3.3.2 COUNT Statement . . . . . . . . . . . . . . . . . . 10



Brownlee Informational [Page 1]

RFC 2723 SRL: A Traffic Flow Language October 1999


3.3.3 EXIT Statement . . . . . . . . . . . . . . . . . . 10
3.3.4 IGNORE Statement . . . . . . . . . . . . . . . . . 10
3.3.5 NOMATCH Statement . . . . . . . . . . . . . . . . . 10
3.3.6 STORE Statement . . . . . . . . . . . . . . . . . . 11
3.3.7 RETURN Statement . . . . . . . . . . . . . . . . . 11
3.4 Subroutine_declaration . . . . . . . . . . . . . . . . . 11
3.5 CALL_statement . . . . . . . . . . . . . . . . . . . . . 12
4 Example Programs . . . . . . . . . . . . . . . . . . . . . . 13
4.1 Classify IP Port Numbers . . . . . . . . . . . . . . . . 13
4.2 Classify Traffic into Groups of Networks . . . . . . . . 14
5 Security Considerations . . . . . . . . . . . . . . . . . . . 15
6 IANA Considerations . . . . . . . . . . . . . . . . . . . . . 15
7 APPENDICES . . . . . . . . . . . . . . . . . . . . . . . . . 16
7.1 Appendix A: SRL Syntax in BNF . . . . . . . . . . . . . . 16
7.2 Appendix B: Syntax for Values and Masks . . . . . . . . . 18
7.3 Appendix C: RTFM Attribute Information . . . . . . . . . 19
8 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 20
9 References . . . . . . . . . . . . . . . . . . . . . . . . . 20
10 Author's Address . . . . . . . . . . . . . . . . . . . . . . 21
11 Full Copyright Statement . . . . . . . . . . . . . . . . . . 22

1 Purpose and

A ruleset for an RTFM Meter is a sequence of instructions to
executed by the meter's Pattern Matching Engine (PME). The form
these instructions is described in detail in the 'RTFM Architecture
and 'RTFM Meter MIB' documents [RTFM-ARC, RTFM-MIB], but most users -
at least initially - find them confusing and difficult to write
mainly because the effect of each instruction is strongly
on the state of the meter's Packet Matching Engine at the moment
its execution

SRL (the Simple Ruleset Language) is a procedural language
creating RTFM rulesets. It has been designed to be simple for
to understand, using statements which help to clarify the
context in which they operate. SRL programs will be compiled
rulesets which can then be downloaded to RTFM meters

An SRL compiler is available as part of NeTraMet (a free-
implementation of the RTFM meter and manager), version 4.2
[NETRAMET].

1.1 RTFM Meters and Traffic

The RTFM Architecture [RTFM-ARC] defines a set of 'attributes'
apply to network traffic. Among the attributes are '
attributes,' such as PeerType, PeerAddress, TransType
TransAddress, which have meaning for many protocols, e.g. for IPv



Brownlee Informational [Page 2]

RFC 2723 SRL: A Traffic Flow Language October 1999


traffic (PeerType == 1) PeerAddress is an IP address, TransType
TCP(6), UDP(17), ICMP(1), etc., and TransAddress is usually an
port number

An 'RTFM Traffic Flow' is simply a stream of packets observed by
meter as they pass across a network between two end points (
to/from a single end point). Each 'end point' of a flow is
by the set of values of its address attributes

An 'RTFM Meter' is a measuring device - e.g. a program running on
Unix or PC host - which observes passing packets and builds '
Data Records' for the flows of interest

RTFM traffic flows have another important property - they are bi
directional. This means that each flow data record in the meter
two sets of counters, one for packets travelling from source
destination, the other for returning packets. Within the
architecture such counters appear as further attributes of the flow

An RTFM meter must be configured by the user, which means creating
'Ruleset' so as to specify which flows are to be measured, and
much information (i.e. which attributes) should be stored for each
them. A ruleset is effectively a program for a minimal
machine, the 'Packet Matching Engine (PME),' which is described
detail in [RTFM-ARC]. An RTFM meter may run multiple rule sets,
every passing packet being processed by each of the rulesets.
rule 'actions' in this document are described as though only a
ruleset were running

In the past creating a ruleset has meant writing machine code for
PME, which has proved rather difficult to do. SRL provides a high
level language which should enable users to create effective
without having to understand the details of the PME

The language may be useful in other applications, being suitable
any application area which involves selecting traffic flows from
stream of packets

1.2 SRL

An SRL program is executed from the beginning for each new
arriving at the meter. It has two essential goals

(a) Decide whether the current packet is part of a flow which is
interest and, if necessary, determine its direction (i.e.
which of its end-points is considered to be its source).
packets will be ignored




Brownlee Informational [Page 3]

RFC 2723 SRL: A Traffic Flow Language October 1999


(b) SAVE whatever information is required to identify the flow
accumulate (COUNT) quantitative information for that flow

At execution, the meter's Packet Matching Engine (PME) begins
using source and destination attributes as they appear 'on the wire.'
If the attributes do not match those of a flow to be recorded,
PME will normally execute the program again, this time with
source and destination addresses interchanged. Because of this bi
directional matching, an RTFM meter is able to build up tables
flows with two sets of counters - one for forward packets, the
for backward packets. The programmer can, if required, suppress
reverse-direction matching and assign 'forward' and 'backward
directions which conform to the conventions of the external context

Goal (a) is achieved using IF statements which perform comparisons
information from the packet or from SRL variables. Goal (b)
achieved using one or more SAVE statements to store the flow'
identification attributes; a COUNT statement then increments
statistical data accumulating for it

2 SRL Language

The SRL language is explained below using 'railway diagrams'
describe the syntax. Flow through a diagram is from left to right
The only exception to this is that lines carrying a left arrow
only be traversed right to left. In the diagrams, keywords
written in capital letters; in practice an SRL compiler must
insensitive to case. Lower-case identifiers are explained in
text, or they refer to another diagram

The tokens of an SRL program obey the following rules

- Comments may appear on any line of an SRL program, following a #
- White space is used to separate
- Semicolon is used as the terminator for most
- Identifiers (e.g. for defines and labels) must start with a
- Identifiers may contain letters, digits and
- The case of letters is not
- Reserved words (shown in upper case in this document) may not
used as

2.1 Define

--- DEFINE -- defname ---- = ---- defined_text ------------------ ;

Simple parameterless defines are supported via the syntax above.
define name, defname, is an identifier. The defined text
after the equal sign, and continues up to (but not including)



Brownlee Informational [Page 4]

RFC 2723 SRL: A Traffic Flow Language October 1999


closing semicolon. If a semicolon is required within the
text it must be preceded by a backslash, i.e. \; in an SRL
produces ; in the text

Wherever defname appears elsewhere in the program, it will
replaced by the defined text

For example

DEFINE ftp = (20, 21); # Well-known Port numbers from [ASG-NBR
DEFINE telnet = 23;
DEFINE www = 80;

2.2

------------+-------+-------- Statement -------+-------+-----------
| | | |
| +------- Declaration ------+ |
| |
+---------------------<--------------------+

An SRL program is a sequence of statements or declarations. It
not have any special enclosing symbols. Statements and
terminate with a semicolon, except for compound statements,
terminate with a right brace

2.3

---------------------- Subroutine_declaration ---------------------

SRL's only explicit declaration is the subroutine declaration.
implicit declarations are labels (declared where they appear in
of a statement) and subroutine parameters (declared in the
header).

3

----------------+---- IF_statement ----------------+---------------
| |
+---- Compound_statement ----------+
| |
+---- Imperative_statement --------+
| |
+---- CALL_statement --------------+

An SRL program is a sequence of SRL statements. There are four
of statements, as follows




Brownlee Informational [Page 5]

RFC 2723 SRL: A Traffic Flow Language October 1999


3.1 IF_

Test Part Action
............. ...............

--- IF --- expression ---+------------+---- Statement ----+--->
| | |
+-- SAVE , --+ |
| |
+-- SAVE ; ----------------------+

>-----------+-----------------------------+-----------------
| |
+-----ELSE --- Statement -----+

3.1.1

-------- term --------+------------------------+-------------------
| |
+--<-- term ----- || ----+ logical

3.1.2

------- factor -------+------------------------+-------------------
| |
+--<-- factor --- && ----+ logical

3.1.3

------------+-------- attrib == operand_list --------+-----------
| |
+------------ ( expression ) --------------+

3.1.4 operand_

----------+------------------ operand -----------------+-----------
| |
+-- ( operand ---+-------------------+-- ) --+
| |
+-<-- operand , ---+

3.1.5

------------- value ---------+----------------------+--------------
| |
+------- / width ------+
| |
+------- & mask -------+



Brownlee Informational [Page 6]

RFC 2723 SRL: A Traffic Flow Language October 1999


3.1.6 Test

The IF statement evaluates a logical expression. If the
value is TRUE, the action indicated in the 'Action Part' of
diagram is executed. If the value is FALSE and the IF has an
clause, that ELSE clause is executed (see below).

The simplest form of expression is a test for equality (== operator);
in this an RTFM attribute value (from the packet or from an
variable) is ANDed with a mask and compared with a value. A list
RTFM attributes is given in Appendix C. More complicated
may be built up using parentheses and the && (logical AND) and ||
(logical OR) operators

Operand values may be specified as dotted decimal, hexadecimal or
a character constant (enclosed in apostrophes). The syntax
operand values is given in Appendix B

Masks may be specified as numbers
dotted decimal e.g. &255.255
or hexadecimal e.g. &FF-
or as a width in bits e.g. /16

If a mask is not specified, an all-ones mask is used

In SRL a value is always combined with a mask; this combination
referred to as an operand. For example, if we were interested
flows originating from IP network 130.216, we might write

IF SourcePeerAddress == 130.216.0.0 & 255.255.0.0 SAVE

or

IF SourcePeerAddress == 130.216/16 SAVE

A list of values enclosed in parentheses may also be specified;
test succeeds if the masked attribute equals any of the values in
list. For example

IF SourcePeerAddress == ( 130.216.7/24, 130.216.34/24 ) SAVE

As this last example indicates, values are right-padded with zeroes
i.e. the given numbers specify the leading bytes of masks and values

The operand values and masks used in an IF statement must
consistent with the attribute being tested. For example, a four-
value is acceptable as a peer address, but would not be accepted as
transport address (which may not be longer than two bytes).



Brownlee Informational [Page 7]

RFC 2723 SRL: A Traffic Flow Language October 1999


3.1.7 Action

A SAVE action (i.e. SAVE , or SAVE ;) saves attribute(s), mask(s)
value(s) as given in the statement. If the IF expression tests
than one attribute, the masks and values are saved for all
matched attributes. For each value_list in the statement the
saved is the one which the packet actually matched. See below
further description of SAVE statements

Other actions are described in detail under "Imperative statements
below. Note that the RETURN action is valid only within subroutines

3.1.8 ELSE

An ELSE Clause provides a statement which will be executed if
IF's test fails. The statement following ELSE will often be
IF statement, providing SRL's version of a 'select' statement.
that an ELSE clause always matches the immediately preceding IF

3.2 Compound_

-------+-------------+----- { ---+---- Statement ----+--- } -------
| | | |
+-- label : --+ +--------<----------+

A compound statement is a sequence of statements enclosed in braces
Each statement will terminate with a semicolon, unless it is
compound statement (which terminates with a right brace).

A compound statement may be labelled, i.e. preceded by an
followed by a semi-colon. Each statement inside the braces
executed in sequence unless an EXIT statement is performed,
explained below

Labels have a well-defined scope, within which they must be unique
Labels within a subroutine (i.e. between a SUBROUTINE and
matching ENDSUB) are local to that subroutine and are not
outside it. Labels outside subroutines are part of a program's
block












Brownlee Informational [Page 8]

RFC 2723 SRL: A Traffic Flow Language October 1999


3.3 Imperative_

------+---------------------------------------------------+------ ;
| |
+-- SAVE attrib --+--+-----------+--+---------------+
| | | | | |
| | +- / width -+ | |
| | | | | |
| | +- & mask --+ | |
| | | |
| +--- = operand ---+ |
| |
+-- COUNT ------------------------------------------+
| |
+-- EXIT label ------------------------------------+
| |
+-- IGNORE -----------------------------------------+
| |
+-- NOMATCH ----------------------------------------+
| |
+-- RETURN --+-------+------------------------------+
| | | |
| +-- n --+ |
| |
+-- STORE variable := value ------------------------+

3.3.1 SAVE

The SAVE statement saves information which will (later) identify
flow in the meter's flow table. It does not actually record
in the table; this is done when a subsequent COUNT
executes

SAVE has two possible forms

SAVE attrib = operand ; saves the attribute, mask and value as
in the statement. This form of the SAVE statement is similar
that allowed in an IF statement, except that - since
statements do not perform a test - you may save an
value

SAVE attrib ;
SAVE attrib / width ;
SAVE attrib & mask ; saves the attribute and mask from the statement
and the value resulting from their application to the
packet. This is most useful when used to save a value with
wider mask than than was used to select the packet.
example



Brownlee Informational [Page 9]

RFC 2723 SRL: A Traffic Flow Language October 1999


IF DestPeerAddress == 130.216/16
NOMATCH
ELSE IF SourcePeerAddress == 130.216/16 {
SAVE SourcePeerAddress /24;
COUNT
}
ELSE IGNORE

3.3.2 COUNT

The COUNT statement appears after all testing and saving is complete
it instructs the PME to build the flow identifier from the
which have been SAVEd, find it in the meter's flow table (creating
new entry if this is the first packet observed for the flow),
increment its counters. The meter then moves on to examine the
incoming packet

3.3.3 EXIT

The EXIT statement exits a labelled compound statement. The
statement to be executed will be the one following that
statement. This provides a well-defined way to jump to a
identified point in a program. For example

outer: {
...
if SourcePeerAddress == 192.168/16
exit outer; # exits the statement labelled 'outer
...
}
# execution resumes

In practice the language provides sufficient logical structure
one seldom - if ever - needs to use the EXIT statement

3.3.4 IGNORE

The IGNORE statement terminates examination of the current
without saving any information from it. The meter then moves on
examine the next incoming packet, beginning again at the
statement of its program

3.3.5 NOMATCH

The NOMATCH statement indicates that matching has failed for
execution of the program. If it is executed when a packet is
processed with its addresses in 'on the wire' order, the PME




Brownlee Informational [Page 10]

RFC 2723 SRL: A Traffic Flow Language October 1999


perform the program again from the beginning with source
destination addresses interchanged. If it is executed following
an interchange, the packet will be IGNOREd

NOMATCH is illustrated in the SAVE example (section 3.3.1), where
is used to ensure that flows having 130.216/16 as an end-point
counted as though 130.216 had been those flows' source peer (IP
address

3.3.6 STORE

The STORE statement assigns a value to an SRL variable and SAVEs it
There are six SRL variables

SourceClass
DestClass
FlowClass

Their names have no particular significance; they were
chosen as likely RTFM attributes but can be used to store
single-byte integer values. Their values are set to zero each
examination of a new packet begins. For example

STORE SourceClass := 3;
STORE FlowKind := 'W

3.3.7 RETURN

The RETURN statement is used to return from subroutines and can
used only within the context of a subroutine. It is described
detail below (CALL statement).

3.4 Subroutine_

-- SUBROUTINE subname ( --+-----------------------------+-- ) -->
| |
+--+-- ADDRESS --- pname --+--+
| |
+-- VARIABLE -- pname --+
| |
+------<------- , ------+

>------+-------- Statement ---------+----- ENDSUB -------- ;
| |
+-------------<--------------+






Brownlee Informational [Page 11]

RFC 2723 SRL: A Traffic Flow Language October 1999


A Subroutine declaration has three parts

the subname is an identifier, used to name the subroutine

the parameter list specifies the subroutine's parameters.
parameter is preceded with a keyword indicating its type -
VARIABLE indicates an SRL variable (see the STORE
above), ADDRESS indicates any other RTFM attribute.
parameter name may be any identifier, and its scope is
to the subroutine's body

the body specifies what processing the subroutine will perform
This is simply a sequence of Statements, terminated by
ENDSUB keyword

Note that EXITs in a subroutine may not refer to labels outside it
The only way to leave a subroutine is via a RETURN statement

3.5 CALL_

---- CALL subname ( --+---------------------+-- ) ---->
| |
+--+-- parameter --+--+
| |
+----<--- , ----+

>---+-------------------------------------+--- ENDCALL ---- ;
| |
+---+--+-- n : --+--- Statement --+---+
| | | |
| +----<----+ |
| |
+--------------<--------------+

The CALL statement invokes an SRL subroutine. The parameters are
variables or other RTFM attributes, and their types must match
in the subroutine declaration. Following the parameters is
sequence of statements, each preceded by an integer label.
labels will normally be 1:, 2:, 3:, etc, but they do not have to
contiguous, nor in any particular order. They are referred to
RETURN statements within the subroutine body

e.g. RETURN 2; would return to the statement labelled 2:
within in the CALL statement

Execution of the labelled statement completes the CALL





Brownlee Informational [Page 12]

RFC 2723 SRL: A Traffic Flow Language October 1999


If the return statement does not specify a return label, the
statement executed after RETURN will be the statement
following ENDCALL

4 Example

4.1 Classify IP Port

#
# Classify IP port
#
define IPv4 = 1; # Address Family number from [ASG-NBR
#
define ftp = (20, 21); # Well-Known Port numbers from [ASG-NBR
define telnet = 23;
define www = 80;
#
define tcp = 6; # Protocol numbers from [ASG-NBR
define udp = 17;
#
if SourcePeerType == IPv4 save
else ignore; # Not an IPv4
#
if (SourceTransType == tcp || SourceTransType == udp) save, {
if SourceTransAddress == (www, ftp, telnet) nomatch
# We want the well-known port as
#
if DestTransAddress ==
save, store FlowKind := 'T';
else if DestTransAddress ==
save, store FlowKind := 'W';
else if DestTransAddress ==
save, store FlowKind := 'F';
else {
save DestTransAddress
store FlowKind := '?';
}
}
else save SourceTransType = 0;
#
save SourcePeerAddress /32;
save DestPeerAddress /32;
count
#







Brownlee Informational [Page 13]

RFC 2723 SRL: A Traffic Flow Language October 1999


This program counts only IP packets, saving SourceTransType (tcp,
or 0), Source- and DestPeerAddress (32-bit IP addresses) and
('W' for www, 'F' for ftp, 'T' for telnet, '?' for unclassified).
The program uses a NOMATCH action to specify the packet direction -
its resulting flows will have the well-known ports as
destination

4.2 Classify Traffic into Groups of

#
# SRL program to classify traffic into network
#
define my_net = 130.216/16;
define k_nets = ( 130.217/16, 130.123/16, 130.195/16,
132.181/16, 138.75/16, 139.80/16 );
#
call net_kind (SourcePeerAddress, SourceKind
endcall
call net_kind (DestPeerAddress, DestKind
endcall
count
#
subroutine net_kind (address addr, variable net
if addr == my_net save, {
store net := 10; return 1;
}
else if addr == k_nets save, {
store net := 20; return 2;
}
save addr/24; # Not my_net or in k_
store net := 30; return 3;
endsub
#

The net_kind subroutine determines whether addr is my
(130.216), one of the Kawaihiko networks (in the k_nets list),
some other network. It saves the network address from addr (16
for my_net and the k_net networks, 24 bits for others), stores
value of 10, 20 or 30 in net, and returns to 1:, 2: or 3:.
that the network numbers used are contained within the two DEFINEs
making them easy to change

net_kind is called twice, saving Source- and DestPeerAddress
Source- and DestKind; the COUNT statement produces flows
by these four RTFM attributes, with no particular source-
ordering





Brownlee Informational [Page 14]

RFC 2723 SRL: A Traffic Flow Language October 1999


In the program no use is made of return numbers and they could
been omitted. However, we might wish to re-use the subroutine
another program doing different things for different return numbers
as in the version below

call net_kind (DestPeerAddress, DestKind
1: nomatch; # We want my_net as
endcall
call net_kind (SourcePeerAddress, SourceKind
1: count; # my_net -> other
endcall
save SourcePeerAddress /24;
save DestPeerAddress /24;
count

This version uses a NOMATCH statement to ensure that its
flows have my_net as their source. The NOMATCH also rejects my_
-> my_net traffic. Traffic which doesn't have my_net as source
destination saves 24 bits of its peer addresses (the subroutine
only have saved 16) before counting such an unusual flow

5 Security

SRL is a language for creating rulesets (i.e. configuration files
for RTFM Traffic Meters - it does not present any security issues
itself

On the other hand, flow data gathered using such rulesets may well
valuable. It is therefore important to take proper precautions
ensure that access to the meter and its data is secure. Ways
achieve this are discussed in detail in the Architecture and
MIB documents [RTFM-ARC, RTFM-MIB].

6 IANA

Appendix C below lists the RTFM attributes by name. Since SRL
refers to attributes by name, SRL users do not have to know
attribute numbers

The size (in bytes) of the various attribute values is also listed
Appendix C. These sizes reflect the object sizes for the
values as they are stored in the RTFM Meter MIB [RTFM-MIB].

IANA considerations for allocating new attributes are discussed
detail in the RTFM Architecture document [RTFM-ARC].






Brownlee Informational [Page 15]

RFC 2723 SRL: A Traffic Flow Language October 1999


7

7.1 Appendix A: SRL Syntax in

::= |
::= <statement> | <declaration

<declaration> ::= <Subroutine declaration

<statement> ::= statement> |
statement> |
statement> |
statement

statement> ::= IF <expression>
::= SAVE ; |
SAVE , <statement> |
<statement

::= |
ELSE <statement

<expression> ::= | ||
::= | &&
::= <attribute> == |
( <expression> )

::= | ( )

::= |
,
::= |
/ |
&
statement> ::= { <statement seq> }

::= |
<identifier> :

<statement seq> ::= <statement> | <statement seq> <statement

statement> ::= ; |



Brownlee Informational [Page 16]

RFC 2723 SRL: A Traffic Flow Language October 1999


SAVE <attribute> ; |
COUNT ; |
EXIT




if you see any problems within the linking, don't worry be happy,
this is version 0.1 of the Relevance System and you gotta expect some crappy subroutines sometimes,
just be content we did not write this in Java, which would have made this "bigger and better" HAHAHHA.




RFC documents can be found at I.E.T.F.



Relevance System Copyright © 2002 Spectrum WorldResearch
other technical nosh by ServerMasters Corporation
collaboration of BobX







Spectrum