draft-ietf-rtfm-ruleset-language-02.txt   draft-ietf-rtfm-ruleset-language-03.txt 
Internet Engineering Task Force Nevil Brownlee Internet Engineering Task Force Nevil Brownlee
INTERNET-DRAFT The University of Auckland INTERNET-DRAFT The University of Auckland
Expires January 1999 September 1998
SRL: A Language for Describing Traffic Flows SRL: A Language for Describing Traffic Flows
and Specifying Actions for Flow Groups and Specifying Actions for Flow Groups
<draft-ietf-rtfm-ruleset-language-02.txt> <draft-ietf-rtfm-ruleset-language-03.txt>
Status of this Memo Status of this Memo
This document is an Internet-Draft. Internet-Drafts are working This document is an Internet-Draft. Internet-Drafts are working
documents of the Internet Engineering Task Force (IETF), its Areas, and documents of the Internet Engineering Task Force (IETF), its Areas, and
its Working Groups. Note that other groups may also distribute working its Working Groups. Note that other groups may also distribute working
documents as Internet-Drafts. This Internet Draft is a product of the documents as Internet-Drafts. This Internet Draft is a product of the
Realtime Traffic Flow Measurement Working Group of the IETF. Realtime Traffic Flow Measurement Working Group of the IETF.
Internet Drafts are draft documents valid for a maximum of six months. Internet Drafts are draft documents valid for a maximum of six months.
skipping to change at page 2, line ? skipping to change at page 2, line ?
2 SRL Language Description 5 2 SRL Language Description 5
2.1 Define Directive . . . . . . . . . . . . . . . . . . . . . . . 5 2.1 Define Directive . . . . . . . . . . . . . . . . . . . . . . . 5
2.2 Program . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.2 Program . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.3 Declaration . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.3 Declaration . . . . . . . . . . . . . . . . . . . . . . . . . 6
3 Statement 6 3 Statement 6
3.1 IF_statement . . . . . . . . . . . . . . . . . . . . . . . . . 7 3.1 IF_statement . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.1.1 expression . . . . . . . . . . . . . . . . . . . . . . . . 7 3.1.1 expression . . . . . . . . . . . . . . . . . . . . . . . . 7
3.1.2 term . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3.1.2 term . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.1.3 factor . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3.1.3 factor . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.1.4 operand_list . . . . . . . . . . . . . . . . . . . . . . . 8 3.1.4operand_list . . . . . . . . . . . . . . . . . . . . . . . 7
3.1.5 operand . . . . . . . . . . . . . . . . . . . . . . . . . 8 3.1.5operand . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.1.6 Test Part . . . . . . . . . . . . . . . . . . . . . . . . 8 3.1.6Test Part . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.1.7 Action Part . . . . . . . . . . . . . . . . . . . . . . . 9 3.1.7Action Part . . . . . . . . . . . . . . . . . . . . . . . . 9
3.1.8 Else Clause . . . . . . . . . . . . . . . . . . . . . . . 9 3.1.8ELSE Clause . . . . . . . . . . . . . . . . . . . . . . . . 9
3.2 Compound_statement . . . . . . . . . . . . . . . . . . . . . . 9
3.2 Compound_statement . . . . . . . . . . . . . . . . . . . . . . 10
3.3 Imperative_statement . . . . . . . . . . . . . . . . . . . . . 10 3.3 Imperative_statement . . . . . . . . . . . . . . . . . . . . . 10
3.3.1 SAVE Statement . . . . . . . . . . . . . . . . . . . . . . 11 3.3.1SAVE Statement . . . . . . . . . . . . . . . . . . . . . . 10
3.3.2 COUNT Statement . . . . . . . . . . . . . . . . . . . . . 11 3.3.2COUNT Statement . . . . . . . . . . . . . . . . . . . . . . 11
3.3.3 EXIT Statement . . . . . . . . . . . . . . . . . . . . . . 11 3.3.3 EXIT Statement . . . . . . . . . . . . . . . . . . . . . . 11
3.3.4 IGNORE Statement . . . . . . . . . . . . . . . . . . . . . 12 3.3.4IGNORE Statement . . . . . . . . . . . . . . . . . . . . . 11
3.3.5 NOMATCH Statement . . . . . . . . . . . . . . . . . . . . 12 3.3.5NOMATCH Statement . . . . . . . . . . . . . . . . . . . . . 12
3.3.6 STORE Statement . . . . . . . . . . . . . . . . . . . . . 12 3.3.6STORE Statement . . . . . . . . . . . . . . . . . . . . . . 12
3.3.7 RETURN Statement . . . . . . . . . . . . . . . . . . . . . 12 3.3.7 RETURN Statement . . . . . . . . . . . . . . . . . . . . . 12
3.4 Subroutine_declaration . . . . . . . . . . . . . . . . . . . . 12
3.4 Subroutine_declaration . . . . . . . . . . . . . . . . . . . . 13
3.5 CALL_statement . . . . . . . . . . . . . . . . . . . . . . . . 13 3.5 CALL_statement . . . . . . . . . . . . . . . . . . . . . . . . 13
4 Example Programs 14 4 Example Programs 14
4.1 Classify IP Port Numbers . . . . . . . . . . . . . . . . . . . 14 4.1 Classify IP Port Numbers . . . . . . . . . . . . . . . . . . . 14
4.2 Classify Traffic into Groups of Networks . . . . . . . . . . . 15 4.2 Classify Traffic into Groups of Networks . . . . . . . . . . . 15
5 APPENDICES 16 5 APPENDICES 16
5.1 Appendix A: SRL Syntax in BNF . . . . . . . . . . . . . . . . 16 5.1 Appendix A: SRL Syntax in BNF . . . . . . . . . . . . . . . . 16
5.2 Appendix B: Syntax for Values and Masks . . . . . . . . . . . 18 5.2 Appendix B: Syntax for Values and Masks . . . . . . . . . . . 18
5.3 Appendix C: RTFM Attribute Information . . . . . . . . . . . . 18 5.3 Appendix C: RTFM Attribute Information . . . . . . . . . . . . 19
6 Acknowledgments 20 6 Acknowledgments 20
7 References 20 7 References 20
8 Author's Addresses 20 8 Author's Address 20
1 Purpose and Scope 1 Purpose and Scope
A ruleset for an RTFM Meter is a sequence of instructions to be executed A ruleset for an RTFM Meter is a sequence of instructions to be executed
by the meter's Pattern Matching Engine (PME). The form of these by the meter's Pattern Matching Engine (PME). The form of these
instructions is described in detail in RFCs 2063 and 2064 [1], [2], but instructions is described in detail in the 'RTFM Architecture' and 'RTFM
most users - at least inititially - find them confusing and difficult to Meter MIB' documents [1], [2], but most users - at least inititially -
write, mainly because the effect of each instruction is strongly find them confusing and difficult to write, mainly because the effect of
dependent on the state of the meter's Packet Matching Engine at the each instruction is strongly dependent on the state of the meter's
moment of its execution. Packet Matching Engine at the moment of its execution.
SRL is a procedural language for creating RTFM rulesets. It has been SRL is a procedural language for creating RTFM rulesets. It has been
designed to be simple for people to understand, using statements which designed to be simple for people to understand, using statements which
help to clarify the execution context in which they operate. SRL help to clarify the execution context in which they operate. SRL
programs will be compiled into rulesets, which can then be downloaded to programs will be compiled into rulesets which can then be downloaded to
RTFM meters. RTFM meters.
An SRL compiler is available as part of NeTraMet (a free-software An SRL compiler is available as part of NeTraMet (a free-software
implementation of the RTFM meter and manager), version 4.2 [3]. implementation of the RTFM meter and manager), version 4.2 [3].
1.1 RTFM Meters and Traffic Flows 1.1 RTFM Meters and Traffic Flows
The RTFM Architecture [1] defines a set of 'attributes' which apply to The RTFM Architecture [1] defines a set of 'attributes' which apply to
network traffic. Among the attributes are 'address attributes,' such as network traffic. Among the attributes are 'address attributes,' such as
PeerType, PeerAddress, TransType and TransAddress, which have meaning PeerType, PeerAddress, TransType and TransAddress, which have meaning
for many protocols, e.g. for IP traffic (PeerType == IP) PeerAddress is for many protocols, e.g. for IP traffic (PeerType == IP) PeerAddress is
an IP address, TransType is TCP, UDP, ICMP, etc., and TransAddress is an IP address, TransType is TCP, UDP, ICMP, etc., and TransAddress is
usually an IP port number. usually an IP port number.
An 'RTFM Traffic Flow' is simply a stream of packets observed by a meter An 'RTFM Traffic Flow' is simply a stream of packets observed by a meter
as they pass across a network between two end points (or from a single as they pass across a network between two end points (or to/from a
end point). Each 'end point' of a flow is determined by the set of single end point). Each 'end point' of a flow is specified by the set
values of its address attributes. of values of its address attributes.
An 'RTFM Meter' is a measuring device - e.g. a program running on a An 'RTFM Meter' is a measuring device - e.g. a program running on a
Unix or PC host - which observes passing packets and builds 'Flow Data Unix or PC host - which observes passing packets and builds 'Flow Data
Records' for the flows of interest. Records' for the flows of interest.
RTFM traffic flows have another important property - they are RTFM traffic flows have another important property - they are
bi-directional. This means that each flow data record in the meter has bi-directional. This means that each flow data record in the meter has
two sets of counters, one for packets travelling from source to two sets of counters, one for packets travelling from source to
destination, the other for returning packets. Within the RTFM destination, the other for returning packets. Within the RTFM
architecture such counters appear as further attributes of the flow. architecture such counters appear as further attributes of the flow.
An RTFM meter must be configured by the user, which means creating a An RTFM meter must be configured by the user, which means creating a
'Ruleset' so as to specify which flows are to be measured, and how much 'Ruleset' so as to specify which flows are to be measured, and how much
information (i.e. which attributes) should be stored for each of them.
information (i.e. which attributes) should be stored for each of them.
A ruleset is effectively a program for a minimal virtual machine, the A ruleset is effectively a program for a minimal virtual machine, the
'Packet Matching Engine (PME),' which is described in detail in [1]. An 'Packet Matching Engine (PME),' which is described in detail in [1]. An
RTFM meter may run multiple rule sets, with every passing packet being RTFM meter may run multiple rule sets, with every passing packet being
processed by each of the rulesets. The rule 'actions' in this document processed by each of the rulesets. The rule 'actions' in this document
are described as though only a single ruleset were running. are described as though only a single ruleset were running.
In the past creating a ruleset has meant writing machine code for the In the past creating a ruleset has meant writing machine code for the
PME, which has proved rather difficult to do. SRL provides a high-level PME, which has proved rather difficult to do. SRL provides a high-level
language which should enable users to create effective rulesets without language which should enable users to create effective rulesets without
having to understand the details of the PME. having to understand the details of the PME.
skipping to change at page 5, line 23 skipping to change at page 5, line 23
to another diagram. to another diagram.
The tokens of an SRL program obey the following rules: The tokens of an SRL program obey the following rules:
- Comments may appear on any line of an SRL program, following a # - Comments may appear on any line of an SRL program, following a #
- White space is used to separate tokens - White space is used to separate tokens
- Semicolon is used as the terminator for most statements - Semicolon is used as the terminator for most statements
- Identifiers (e.g. for defines and labels) must start with a letter - Identifiers (e.g. for defines and labels) must start with a letter
- Identifiers may contain letters, digits and underscores - Identifiers may contain letters, digits and underscores
- The case of letters is not significant - The case of letters is not significant
- Reserved words (shown in upper case in this documents)
may not be used as identifiers
2.1 Define Directive 2.1 Define Directive
--- DEFINE -- defname ---- = ---- defined_text ------------------ ; --- DEFINE -- defname ---- = ---- defined_text ------------------ ;
Simple parameterless defines are supported via the syntax above. The Simple parameterless defines are supported via the syntax above. The
define name, defname, is an identifier made up of letters, digits and define name, defname, is an identifier. The defined text starts after
underscores. The defined text starts after the equal sign, and the equal sign, and continues up to (but not including) the closing
continues up to (but not including) the closing semicolon. (If a semicolon. If a semicolon is required within the defined text it must
semicolon is required within define text, it must be preceded by a be preceded by a backslash, i.e. \; in an SRL define produces ; in the
backslash). Wherever defname appears elsewhere in the program, it will text.
be replaced by the defined text.
Wherever defname appears elsewhere in the program, it will be replaced
by the defined text.
For example, For example,
DEFINE ftp = (20, 21);
DEFINE telnet = 23; DEFINE telnet = 23;
DEFINE smtp = 25; DEFINE www = 80;
DEFINE http = (80, 8080);
2.2 Program 2.2 Program
------------+-------+-------- Statement -------+-------+----------- ------------+-------+-------- Statement -------+-------+-----------
| | | | | | | |
| +------- Declaration ------+ | | +------- Declaration ------+ |
| | | |
+---------------------<--------------------+ +---------------------<--------------------+
An SRL program is a sequence of statements or declarations. It does not An SRL program is a sequence of statements or declarations. It does not
have any special enclosing symbols. Statements and declarations have any special enclosing symbols. Statements and declarations
terminate with a semicolon, except for Compound statements, which terminate with a semicolon, except for compound statements, which
terminate with a right brace. terminate with a right brace.
2.3 Declaration 2.3 Declaration
---------------------- Subroutine_declaration --------------------- ---------------------- Subroutine_declaration ---------------------
SRL's only explicit declaration is the subroutine declaration. Other SRL's only explicit declaration is the subroutine declaration. Other
implicit declarations are labels (declared where they appear in front of implicit declarations are labels (declared where they appear in front of
a statement) and subroutine parameters (declared in the subroutine a statement) and subroutine parameters (declared in the subroutine
header). header).
skipping to change at page 6, line 37 skipping to change at page 6, line 37
3 Statement 3 Statement
----------------+---- IF_statement ----------------+--------------- ----------------+---- IF_statement ----------------+---------------
| | | |
+---- Compound_statement ----------+ +---- Compound_statement ----------+
| | | |
+---- Imperative_statement --------+ +---- Imperative_statement --------+
| | | |
+---- CALL_statement --------------+ +---- CALL_statement --------------+
An SRL program is a sequence of SRL statements, generally terminated by An SRL program is a sequence of SRL statements. There are four kinds of
a semicolon. There are four kinds of statements, as follows. statements, as follows.
3.1 IF_statement 3.1 IF_statement
Test Part Action Part Test Part Action Part
............. ............... ............. ...............
--- IF --- expression ---+------------+---- Statement ----+---> --- IF --- expression ---+------------+---- Statement ----+--->
| | | | | |
+-- SAVE , --+ | +-- SAVE , --+ |
| | | |
skipping to change at page 8, line 7 skipping to change at page 7, line 40
+--<-- factor --- && ----+ logical AND +--<-- factor --- && ----+ logical AND
3.1.3 factor 3.1.3 factor
------------+-------- attrib == operand_list --------+----------- ------------+-------- attrib == operand_list --------+-----------
| | | |
+------------ ( expression ) --------------+ +------------ ( expression ) --------------+
3.1.4 operand_list 3.1.4 operand_list
------------+-------------- operand -----------------+------------- ----------+------------------ operand -----------------+-----------
| |
+--- ( operand--+---------------+-- ) ---+
| | | |
+-- , operand --+ +-- ( operand ---+-------------------+-- ) --+
| | | |
+-------<-------+ +-<-- operand , ---+
3.1.5 operand 3.1.5 operand
------------- value ---------+----------------------+-------------- ------------- value ---------+----------------------+--------------
| | | |
+------- / width ------+ +------- / width ------+
| | | |
+------- & mask -------+ +------- & mask -------+
3.1.6 Test Part 3.1.6 Test Part
The IF statement evaluates a logical expression. If the expression The IF statement evaluates a logical expression. If the expression
value is TRUE, the action indicated in the 'Action Part' of the diagram value is TRUE, the action indicated in the 'Action Part' of the diagram
is executed. If the value is FALSE, the statement after the IF is is executed. If the value is FALSE and the IF has an ELSE clause, that
executed. ELSE clause is executed (see below).
The simplest form of expression is a test for equality (== operator); in The simplest form of expression is a test for equality (== operator); in
this an RTFM attribute value (from the packet or from an SRL variable) this an RTFM attribute value (from the packet or from an SRL variable)
is ANDed with a mask and compared with a value. A list of RTFM is ANDed with a mask and compared with a value. A list of RTFM
attributes is given in Appendix C. More complicated expressions may be attributes is given in Appendix C. More complicated expressions may be
built up using parentheses and the && (logical AND) and || (logical OR) built up using parentheses and the && (logical AND) and || (logical OR)
operators. operators.
Operand values may be specified as dotted decimal,hexadecimal or as a Operand values may be specified as dotted decimal,hexadecimal or as a
character constant (enclosed in apostrophes). The syntax for operand character constant (enclosed in apostrophes). The syntax for operand
skipping to change at page 9, line 9 skipping to change at page 8, line 42
dotted decimal e.g. &255.255 dotted decimal e.g. &255.255
or hexadecimal e.g. &FF-FF or hexadecimal e.g. &FF-FF
or as a width in bits e.g. /16 or as a width in bits e.g. /16
If a mask is not specified, an all-ones mask is used. If a mask is not specified, an all-ones mask is used.
In SRL a value is always combined with a mask; this combination is In SRL a value is always combined with a mask; this combination is
referred to as an operand. For example, if we were interested in flows referred to as an operand. For example, if we were interested in flows
originating from IP network 130.216, we might write: originating from IP network 130.216, we might write:
IF SourcePeerAddress == 130.216.0.0 & 255.255.0.0 IGNORE; IF SourcePeerAddress == 130.216.0.0 & 255.255.0.0 SAVE;
or equivalently or equivalently
IF SourcePeerAddress == 130.216/16 IGNORE; IF SourcePeerAddress == 130.216/16 SAVE;
A list of values enclosed in parentheses may also be specified; the test A list of values enclosed in parentheses may also be specified; the test
succeeds if the masked attribute equals any of the values in the list. succeeds if the masked attribute equals any of the values in the list.
For example For example
IF SourcePeerAddress == ( 130.216.7/24, 130.216.34/24 ) SAVE; IF SourcePeerAddress == ( 130.216.7/24, 130.216.34/24 ) SAVE;
As this last example indicates, values are right-padded with zeroes, As this last example indicates, values are right-padded with zeroes,
i.e. the given numbers specify the leading bytes of masks and values. i.e. the given numbers specify the leading bytes of masks and values.
The operand values and masks used in an IF statement must be consistent The operand values and masks used in an IF statement must be consistent
with the attribute being tested. For example, a four-byte value is with the attribute being tested. For example, a four-byte value is
acceptable as a peer address, but would not be accepted as a transport acceptable as a peer address, but would not be accepted as a transport
address (which may not be longer than two bytes). address (which may not be longer than two bytes).
3.1.7 Action Part 3.1.7 Action Part
A SAVE action (i.e. SAVE , or SAVE ;) saves attribute(s), mask(s) and A SAVE action (i.e. SAVE , or SAVE ;) saves attribute(s), mask(s) and
value(s) as given in the statement. If the IF expression tests more value(s) as given in the statement. If the IF expression tests more
than one attribute, the masks and values are saved for all the than one attribute, the masks and values are saved for all the matched
attributes. For each value_list in the statement the value saved is the attributes. For each value_list in the statement the value saved is the
one which the packet actually matched. See below for further one which the packet actually matched. See below for further
description of SAVE statements. description of SAVE statements.
Other actions are described in detail under "Imperative statements" Other actions are described in detail under "Imperative statements"
below. Note that the RETURN action is valid only within subroutines. below. Note that the RETURN action is valid only within subroutines.
3.1.8 Else Clause 3.1.8 ELSE Clause
An Else Clause provides a statement which will be executed if the IF's An Else Clause provides a statement which will be executed if the IF's
test fails. The statement following ELSE will often be another IF test fails. The statement following ELSE will often be another IF
statement, providing SRL's version of a 'select' statement. Note that statement, providing SRL's version of a 'select' statement. Note that
an ELSE clause always matches the immediately preceding IF. an ELSE clause always matches the immediately preceding IF.
3.2 Compound_statement 3.2 Compound_statement
-------+-------------+----- { ---+---- Statement ----+--- } ------- -------+-------------+----- { ---+---- Statement ----+--- } -------
| | | | | | | |
skipping to change at page 12, line 8 skipping to change at page 11, line 43
3.3.3 EXIT Statement 3.3.3 EXIT Statement
The EXIT statement exits a labelled compound statement. The next The EXIT statement exits a labelled compound statement. The next
statement to be executed will be the one following that compound statement to be executed will be the one following that compound
statement. This provides a well-defined way to jump to a clearly statement. This provides a well-defined way to jump to a clearly
identified point in a program. identified point in a program.
3.3.4 IGNORE Statement 3.3.4 IGNORE Statement
The IGNORE statement terminates examination of the current packet The IGNORE statement terminates examination of the current packet
without saving any information from it; the meter moves on to examine without saving any information from it. The meter then moves on to
the next incoming packet, beginning again at the first statement of its examine the next incoming packet, beginning again at the first statement
program. of its program.
3.3.5 NOMATCH Statement 3.3.5 NOMATCH Statement
The NOMATCH statement indicates that matching has failed for this The NOMATCH statement indicates that matching has failed for this
execution of the program. If it is executed when a packet is being execution of the program. If it is executed when a packet is being
processed with its addresses in 'on the wire' order, the PME will processed with its addresses in 'on the wire' order, the PME will
perform the program again from the beginning with source and destination perform the program again from the beginning with source and destination
addresses interchanged. If it is executed following such an addresses interchanged. If it is executed following such an
interchange, the packet will be IGNOREd. NOMATCH is illustrated in the interchange, the packet will be IGNOREd. NOMATCH is illustrated in the
above example, where it is used to ensure that flows having 130.216/16 above example, where it is used to ensure that flows having 130.216/16
skipping to change at page 13, line 7 skipping to change at page 12, line 39
examination of a new packet begins. examination of a new packet begins.
3.3.7 RETURN Statement 3.3.7 RETURN Statement
The RETURN statement is used to return from subroutines and can be used The RETURN statement is used to return from subroutines and can be used
only within the context of a subroutine. It is described in detail only within the context of a subroutine. It is described in detail
below (CALL statement). below (CALL statement).
3.4 Subroutine_declaration 3.4 Subroutine_declaration
--- SUBROUTINE subname ( ---+---ADDRESS ----pname---+--- ) ---> -- SUBROUTINE subname ( --+-----------------------------+-- ) -->
| |
+--+-- ADDRESS --- pname --+--+
| | | |
+-- VARIABLE -- pname --+ +-- VARIABLE -- pname --+
| | | |
+------<------- , ------+ +------<------- , ------+
>------+-------- Statement ---------+----- ENDSUB -------- ; >------+-------- Statement ---------+----- ENDSUB -------- ;
| | | |
+-------------<--------------+ +-------------<--------------+
A Subroutine declaration has three parts: A Subroutine declaration has three parts:
the subname is an indentifier, used to name the subroutine. the subname is an indentifier, used to name the subroutine.
the parameter list specifies the subroutine's parameters. the parameter list specifies the subroutine's parameters.
Each parameter is preceded with a keyword indicating its Each parameter is preceded with a keyword indicating its
skipping to change at page 13, line 37 skipping to change at page 13, line 28
the body specifies what processing the subroutine will perform. the body specifies what processing the subroutine will perform.
This is simply a sequence of Statements, terminated by the This is simply a sequence of Statements, terminated by the
ENDSUB keyword. ENDSUB keyword.
Note that EXITs in a subroutine may not refer to labels outside it. The 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. only way to leave a subroutine is via a RETURN statement.
3.5 CALL_statement 3.5 CALL_statement
---- CALL subname ( ---+-- parameter --+--- ) ----> ---- CALL subname ( --+---------------------+-- ) ---->
| | | |
+---<---- , ----+ +--+-- parameter --+--+
| |
+----<--- , ----+
>-----+---+-- n : --+---- Statement ----+---- ENDCALL ----- ; >---+-------------------------------------+--- ENDCALL ---- ;
| |
+---+--+-- n : --+--- Statement --+---+
| | | | | | | |
| +----<----+ | | +----<----+ |
| | | |
+----------------<----------------+ +--------------<--------------+
The CALL statement invokes an SRL subroutine. The parameters are SRL The CALL statement invokes an SRL subroutine. The parameters are SRL
variables or other RTFM attributes, and their types must match those in variables or other RTFM attributes, and their types must match those in
the subroutine declaration. Following the parameters is a sequence of the subroutine declaration. Following the parameters is a sequence of
statements, each preceded by an integer label. These labels will statements, each preceded by an integer label. These labels will
normally be 1:, 2:, 3:, etc, but they do not have to be contiguous, nor normally be 1:, 2:, 3:, etc, but they do not have to be contiguous, nor
in any particular order. They are referred to in RETURN statements. in any particular order. They are referred to in RETURN statements
within the subroutine body.
e.g. RETURN 2; would return to the statement labelled 2: e.g. RETURN 2; would return to the statement labelled 2:
in the subroutine call. within in the CALL statement.
Execution of the labelled statement completes the CALL.
If the return statement does not specify a return label, the first If the return statement does not specify a return label, the first
statement executed after RETURN will be the statement immediately statement executed after RETURN will be the statement immediately
following ENDCALL. following ENDCALL.
4 Example Programs 4 Example Programs
4.1 Classify IP Port Numbers 4.1 Classify IP Port Numbers
# #
skipping to change at page 16, line 11 skipping to change at page 16, line 11
omitted. However, we might wish to re-use the subroutine in another omitted. However, we might wish to re-use the subroutine in another
program doing different things for different return numbers, as in the program doing different things for different return numbers, as in the
version below. version below.
call net_kind (DestPeerAddress, DestKind) call net_kind (DestPeerAddress, DestKind)
1: nomatch; # We want my_net as source 1: nomatch; # We want my_net as source
endcall; endcall;
call net_kind (SourcePeerAddress, SourceKind) call net_kind (SourcePeerAddress, SourceKind)
1: count; # my_net -> other networks 1: count; # my_net -> other networks
endcall; endcall;
save SourcePeerAddress /24; # save SourcePeerAddress /24;
save DestPeerAddress /24; save DestPeerAddress /24;
count; count;
This version uses a NOMATCH statement to ensure that its resulting flows This version uses a NOMATCH statement to ensure that its resulting flows
have my_net as their source. The NOMATCH also rejects my_net -> my_ have my_net as their source. The NOMATCH also rejects my_net -> my_net
traffic. Traffic which doesn't have my_net as source or destination traffic. Traffic which doesn't have my_net as source or destination
saves 24 bits of its peer addresses (the subroutine might only have saves 24 bits of its peer addresses (the subroutine might only have
saved 16) before counting such an unusual flow. saved 16) before counting such an unusual flow.
5 APPENDICES 5 APPENDICES
5.1 Appendix A: SRL Syntax in BNF 5.1 Appendix A: SRL Syntax in BNF
<SRL program> ::= <S or D> | <SRL program> <S or D> <SRL program> ::= <S or D> | <SRL program> <S or D>
skipping to change at page 17, line 43 skipping to change at page 17, line 43
<opt operand> ::= <null> | <opt operand> ::= <null> |
<width or mask> | <width or mask> |
= <operand> = <operand>
<width or mask> ::= / <width> | & <mask> <width or mask> ::= / <width> | & <mask>
<Subroutine declaration> ::= <Subroutine declaration> ::=
SUBROUTINE <sub header> <sub body> ENDSUB ; SUBROUTINE <sub header> <sub body> ENDSUB ;
<sub header> ::= <subname> ( <sub param list> ) <sub header> ::= <subname> ( ) |
<subname> ( <sub param list> )
<sub param list> ::= <sub param> | <sub param list> , <sub param> <sub param list> ::= <sub param> | <sub param list> , <sub param>
<sub param> ::= ADDRESS <pname> | VARIABLE <pname> <sub param> ::= ADDRESS <pname> | VARIABLE <pname>
<pname> ::= <identifier> <pname> ::= <identifier>
<sub body> ::= <statement sequence> <sub body> ::= <statement sequence>
<CALL statement> ::= CALL <call header> <call body> ENDCALL ; <CALL statement> ::= CALL <call header> <opt call body> ENDCALL ;
<call header> ::= <subname> ( <call param list> ) <call header> ::= <subname> ( ) |
<subname> ( <call param list> )
<call param list> ::= <call param> | <call param list> ::= <call param> |
<call param list> , <call param> <call param list> , <call param>
<call param> ::= <attribute> | <variable> <call param> ::= <attribute> | <variable>
<call body> ::= <call statement> | <call body> <call statement> <opt call body> ::= <null> |
<actual call body>
<call statement> ::= <int label seq> : <statement> <actual call body> ::= <numbered statement> |
<actual call body> <numbered statement>
<numbered statement> ::= <int label seq> <statement>
<int label seq> ::= <integer> : | <int label seq> <integer> : <int label seq> ::= <integer> : | <int label seq> <integer> :
5.2 Appendix B: Syntax for Values and Masks 5.2 Appendix B: Syntax for Values and Masks
Values and masks consist of sequences of numeric fields, each of one or Values and masks consist of sequences of numeric fields, each of one or
more bytes. The non-blank character following a field indicates the more bytes. The non-blank character following a field indicates the
field width, and whether the number is decimal or hexadecimal. These field width, and whether the number is decimal or hexadecimal. These
'field type' characters may be: 'field type' characters may be:
skipping to change at page 20, line 24 skipping to change at page 20, line 32
with John White and Russell Fulton. Discussion has continued on the with John White and Russell Fulton. Discussion has continued on the
RTFM mailing list. RTFM mailing list.
7 References 7 References
[1] Brownlee, N., Mills, C., and G. Ruth, "Traffic Flow [1] Brownlee, N., Mills, C., and G. Ruth, "Traffic Flow
Measurement: Architecture", RFC 2063, The University of Measurement: Architecture", RFC 2063, The University of
Auckland, Bolt Beranek and Newman Inc., GTE Laboratories, Inc, Auckland, Bolt Beranek and Newman Inc., GTE Laboratories, Inc,
January 1997. January 1997.
[2] Brownlee, N., "Traffic Flow Measurement: Meter MIB", RFC [2] Brownlee, N., "Traffic Flow Measurement: Meter MIB",
2064, The University of Auckland, January 1997. RFC 2064, The University of Auckland, January 1997.
[3] Brownlee, N., NeTraMet home page, [3] Brownlee, N., NeTraMet home page,
http://www.auckland.ac.nz/net/NeTraMet http://www.auckland.ac.nz/net/NeTraMet
8 Author's Addresses 8 Author's Address
Nevil Brownlee Nevil Brownlee
Information Technology Systems & Services Information Technology Systems & Services
The University of Auckland The University of Auckland
Phone: +64 9 373 7599 x8941 Phone: +64 9 373 7599 x8941
E-mail: n.brownlee@auckland.ac.nz E-mail: n.brownlee@auckland.ac.nz
Expires January 1999
 End of changes. 47 change blocks. 
73 lines changed or deleted 87 lines changed or added

This html diff was produced by rfcdiff 1.34. The latest version is available from http://tools.ietf.org/tools/rfcdiff/