draft-ietf-rtfm-ruleset-language-07.txt   rfc2723.txt 
Internet Engineering Task Force Nevil Brownlee
INTERNET-DRAFT The University of Auckland
August 1999 Network Working Group N. Brownlee
Expires February 2000 Request for Comments: 2723 The University of Auckland
Category: Informational October 1999
SRL: A Language for Describing Traffic Flows and SRL: A Language for Describing Traffic Flows and
Specifying Actions for Flow Groups Specifying Actions for Flow Groups
<draft-ietf-rtfm-ruleset-language-07.txt>
Status of this Memo Status of this Memo
This document is an Internet-Draft and is in full conformance with all This memo provides information for the Internet community. It does
provisions of Section 10 of RFC 2026. not specify an Internet standard of any kind. Distribution of this
memo is unlimited.
Internet-Drafts are working documents of the Internet Engineering Task
Force (IETF), its areas, and its working groups. Note that other groups
may also distribute working documents as Internet-Drafts.
Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference material
or to cite them other than as "work in progress."
The list of current Internet-Drafts can be accessed at
http://www.ietf.org/ietf/1id-abstracts.txt
The list of Internet-Draft Shadow Directories can be accessed at Copyright Notice
http://www.ietf.org/shadow.html.
This Internet Draft is a product of the Realtime Traffic Flow Copyright (C) The Internet Society (1999). All Rights Reserved.
Measurement Working Group of the IETF.
Abstract Abstract
This document describes a language for specifying rulesets, i.e. This document describes a language for specifying rulesets, i.e.
configuration files which may be loaded into a traffic flow meter so configuration files which may be loaded into a traffic flow meter so
as to specify which traffic flows are measured by the meter, and the as to specify which traffic flows are measured by the meter, and the
information it will store for each flow. information it will store for each flow.
Contents
1 Purpose and Scope 3
1.1 RTFM Meters and Traffic Flows . . . . . . . . . . . . . . . . 3
1.2 SRL Overview . . . . . . . . . . . . . . . . . . . . . . . . 4
2 SRL Language Description 5
2.1 Define Directive . . . . . . . . . . . . . . . . . . . . . . 5
2.2 Program . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.3 Declaration . . . . . . . . . . . . . . . . . . . . . . . . . 6
3 Statement 6
3.1 IF_statement . . . . . . . . . . . . . . . . . . . . . . . . 7
3.1.1 expression . . . . . . . . . . . . . . . . . . . . . . 7
3.1.2 term . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.1.3 factor . . . . . . . . . . . . . . . . . . . . . . . . 7
3.1.4 operand_list . . . . . . . . . . . . . . . . . . . . . 8
3.1.5 operand . . . . . . . . . . . . . . . . . . . . . . . . 8
3.1.6 Test Part . . . . . . . . . . . . . . . . . . . . . . . 8
3.1.7 Action Part . . . . . . . . . . . . . . . . . . . . . . 9
3.1.8 ELSE Clause . . . . . . . . . . . . . . . . . . . . . . 9
3.2 Compound_statement . . . . . . . . . . . . . . . . . . . . . 10
3.3 Imperative_statement . . . . . . . . . . . . . . . . . . . . 10
3.3.1 SAVE Statement . . . . . . . . . . . . . . . . . . . . 11
3.3.2 COUNT Statement . . . . . . . . . . . . . . . . . . . . 11
3.3.3 EXIT Statement . . . . . . . . . . . . . . . . . . . . 11
3.3.4 IGNORE Statement . . . . . . . . . . . . . . . . . . . 12
3.3.5 NOMATCH Statement . . . . . . . . . . . . . . . . . . . 12
3.3.6 STORE Statement . . . . . . . . . . . . . . . . . . . . 12
3.3.7 RETURN Statement . . . . . . . . . . . . . . . . . . . 13
3.4 Subroutine_declaration . . . . . . . . . . . . . . . . . . . 13
3.5 CALL_statement . . . . . . . . . . . . . . . . . . . . . . . 14
4 Example Programs 15
4.1 Classify IP Port Numbers . . . . . . . . . . . . . . . . . . 15
4.2 Classify Traffic into Groups of Networks . . . . . . . . . . 16
5 Security Considerations 17
6 IANA Considerations 17
7 APPENDICES 18
7.1 Appendix A: SRL Syntax in BNF . . . . . . . . . . . . . . . . 18
7.2 Appendix B: Syntax for Values and Masks . . . . . . . . . . . 20
7.3 Appendix C: RTFM Attribute Information . . . . . . . . . . . 21
8 Acknowledgments 22 Table of Contents
9 References 22 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
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
10 Author's Address 23
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
by the meter's Pattern Matching Engine (PME). The form of these executed by the meter's Pattern Matching Engine (PME). The form of
instructions is described in detail in the 'RTFM Architecture' and 'RTFM these instructions is described in detail in the 'RTFM Architecture'
Meter MIB' documents [RTFM-ARC, RTFM-MIB], but most users - at least and 'RTFM Meter MIB' documents [RTFM-ARC, RTFM-MIB], but most users -
initially - find them confusing and difficult to write, mainly because at least initially - find them confusing and difficult to write,
the effect of each instruction is strongly dependent on the state of the mainly because the effect of each instruction is strongly dependent
meter's Packet Matching Engine at the moment of its execution. on the state of the meter's Packet Matching Engine at the moment of
its execution.
SRL (the Simple Ruleset Language) is a procedural language for creating SRL (the Simple Ruleset Language) is a procedural language for
RTFM rulesets. It has been designed to be simple for people to creating RTFM rulesets. It has been designed to be simple for people
understand, using statements which help to clarify the execution context to understand, using statements which help to clarify the execution
in which they operate. SRL programs will be compiled into rulesets context in which they operate. SRL programs will be compiled into
which can then be downloaded to RTFM meters. rulesets which can then be downloaded to 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 [NETRAMET]. implementation of the RTFM meter and manager), version 4.2
[NETRAMET].
1.1 RTFM Meters and Traffic Flows 1.1 RTFM Meters and Traffic Flows
The RTFM Architecture [RTFM-ARC] defines a set of 'attributes' which The RTFM Architecture [RTFM-ARC] defines a set of 'attributes' which
apply to network traffic. Among the attributes are 'address apply to network traffic. Among the attributes are 'address
attributes,' such as PeerType, PeerAddress, TransType and TransAddress, attributes,' such as PeerType, PeerAddress, TransType and
which have meaning for many protocols, e.g. for IPv4 traffic (PeerType TransAddress, which have meaning for many protocols, e.g. for IPv4
== 1) PeerAddress is an IP address, TransType is TCP(6), UDP(17), traffic (PeerType == 1) PeerAddress is an IP address, TransType is
ICMP(1), etc., and TransAddress is usually an IP port number. TCP(6), UDP(17), ICMP(1), etc., and TransAddress is 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
as they pass across a network between two end points (or to/from a meter as they pass across a network between two end points (or
single end point). Each 'end point' of a flow is specified by the set to/from a single end point). Each 'end point' of a flow is specified
of values of its address attributes. by the set of values of its address attributes.
An 'RTFM Meter' is a measuring device - e.g. a program running on a Unix An 'RTFM Meter' is a measuring device - e.g. a program running on a
or PC host - which observes passing packets and builds 'Flow Data Unix or PC host - which observes passing packets and builds 'Flow
Records' for the flows of interest. Data 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-
bi-directional. This means that each flow data record in the meter has 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
information (i.e. which attributes) should be stored for each of them. much information (i.e. which attributes) should be stored for each of
A ruleset is effectively a program for a minimal virtual machine, the them. A ruleset is effectively a program for a minimal virtual
'Packet Matching Engine (PME),' which is described in detail in machine, the 'Packet Matching Engine (PME),' which is described in
[RTFM-ARC]. An RTFM meter may run multiple rule sets, with every passing detail in [RTFM-ARC]. An RTFM meter may run multiple rule sets, with
packet being processed by each of the rulesets. The rule 'actions' in every passing packet being processed by each of the rulesets. The
this document are described as though only a single ruleset were rule 'actions' in this document are described as though only a single
running. 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-
language which should enable users to create effective rulesets without level language which should enable users to create effective rulesets
having to understand the details of the PME. without having to understand the details of the PME.
The language may be useful in other applications, being suitable for any The language may be useful in other applications, being suitable for
application area which involves selecting traffic flows from a stream of any application area which involves selecting traffic flows from a
packets. stream of packets.
1.2 SRL Overview 1.2 SRL Overview
An SRL program is executed from the beginning for each new packet An SRL program is executed from the beginning for each new packet
arriving at the meter. It has two essential goals. arriving at the meter. It has two essential goals.
(a) Decide whether the current packet is part of a flow which is of (a) Decide whether the current packet is part of a flow which is of
interest and, if necessary, determine its direction (i.e. decide interest and, if necessary, determine its direction (i.e. decide
which of its end-points is considered to be its source). Other which of its end-points is considered to be its source). Other
packets will be ignored. packets will be ignored.
(b) SAVE whatever information is required to identify the flow and (b) SAVE whatever information is required to identify the flow and
accumulate (COUNT) quantitative information for that flow. accumulate (COUNT) quantitative information for that flow.
At execution, the meter's Packet Matching Engine (PME) begins by using At execution, the meter's Packet Matching Engine (PME) begins by
source and destination attributes as they appear 'on the wire.' If the using source and destination attributes as they appear 'on the wire.'
attributes do not match those of a flow to be recorded, the PME will If the attributes do not match those of a flow to be recorded, the
normally execute the program again, this time with the source and PME will normally execute the program again, this time with the
destination addresses interchanged. Because of this bi-directional source and destination addresses interchanged. Because of this bi-
matching, an RTFM meter is able to build up tables of flows with two directional matching, an RTFM meter is able to build up tables of
sets of counters - one for forward packets, the other for backward flows with two sets of counters - one for forward packets, the other
packets. The programmer can, if required, suppress the for backward packets. The programmer can, if required, suppress the
reverse-direction matching and assign 'forward' and 'backward' reverse-direction matching and assign 'forward' and 'backward'
directions which conform to the conventions of the external context. directions which conform to the conventions of the external context.
Goal (a) is achieved using IF statements which perform comparisons on Goal (a) is achieved using IF statements which perform comparisons on
information from the packet or from SRL variables. Goal (b) is achieved information from the packet or from SRL variables. Goal (b) is
using one or more SAVE statements to store the flow's identification achieved using one or more SAVE statements to store the flow's
attributes; a COUNT statement then increments the statistical data identification attributes; a COUNT statement then increments the
accumulating for it. statistical data accumulating for it.
2 SRL Language Description 2 SRL Language Description
The SRL language is explained below using 'railway diagrams' to describe The SRL language is explained below using 'railway diagrams' to
the syntax. Flow through a diagram is from left to right. The only describe the syntax. Flow through a diagram is from left to right.
exception to this is that lines carrying a left arrow may only be The only exception to this is that lines carrying a left arrow may
traversed right to left. In the diagrams, keywords are written in only be traversed right to left. In the diagrams, keywords are
capital letters; in practice an SRL compiler must be insensitive to written in capital letters; in practice an SRL compiler must be
case. Lower-case identifiers are explained in the text, or they refer insensitive to case. Lower-case identifiers are explained in the
to another diagram. text, or they refer 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) - Reserved words (shown in upper case in this document) may not be
may not be used as identifiers 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. The defined text starts after define name, defname, is an identifier. The defined text starts
the equal sign, and continues up to (but not including) the closing after the equal sign, and continues up to (but not including) the
semicolon. If a semicolon is required within the defined text it must closing semicolon. If a semicolon is required within the defined
be preceded by a backslash, i.e. \x; in an SRL define produces ; in the text it must be preceded by a backslash, i.e. \; in an SRL define
text. produces ; in the text.
Wherever defname appears elsewhere in the program, it will be replaced Wherever defname appears elsewhere in the program, it will be
by the defined text. replaced by the defined text.
For example, For example,
DEFINE ftp = (20, 21); # Well-known Port numbers from [ASG-NBR] DEFINE ftp = (20, 21); # Well-known Port numbers from [ASG-NBR]
DEFINE telnet = 23; DEFINE telnet = 23;
DEFINE www = 80; DEFINE www = 80;
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
have any special enclosing symbols. Statements and declarations not 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
a statement) and subroutine parameters (declared in the subroutine of a statement) and subroutine parameters (declared in the subroutine
header). header).
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. There are four kinds of An SRL program is a sequence of SRL statements. There are four kinds
statements, as follows. of 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 , --+ |
| | | |
+-- SAVE ; ----------------------+ +-- SAVE ; ----------------------+
>-----------+-----------------------------+----------------- >-----------+-----------------------------+-----------------
| | | |
+-----ELSE --- Statement -----+ +-----ELSE --- Statement -----+
3.1.1 expression 3.1.1 expression
-------- term --------+------------------------+------------------- -------- term --------+------------------------+-------------------
| | | |
+--<-- term ----- || ----+ logical OR +--<-- term ----- || ----+ logical OR
3.1.2 term 3.1.2 term
------- factor -------+------------------------+------------------- ------- factor -------+------------------------+-------------------
| | | |
+--<-- 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
is executed. If the value is FALSE and the IF has an ELSE clause, that diagram is executed. If the value is FALSE and the IF has an ELSE
ELSE clause is executed (see below). clause, that 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);
this an RTFM attribute value (from the packet or from an SRL variable) in this an RTFM attribute value (from the packet or from an SRL
is ANDed with a mask and compared with a value. A list of RTFM variable) is ANDed with a mask and compared with a value. A list of
attributes is given in Appendix C. More complicated expressions may be RTFM attributes is given in Appendix C. More complicated expressions
built up using parentheses and the && (logical AND) and || (logical OR) may be built up using parentheses and the && (logical AND) and ||
operators. (logical OR) operators.
Operand values may be specified as dotted decimal, hexadecimal or as a Operand values may be specified as dotted decimal, hexadecimal or as
character constant (enclosed in apostrophes). The syntax for operand a character constant (enclosed in apostrophes). The syntax for
values is given in Appendix B. operand values is given in Appendix B.
Masks may be specified as numbers, Masks may be specified as numbers,
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
originating from IP network 130.216, we might write: flows originating from IP network 130.216, we might write:
IF SourcePeerAddress == 130.216.0.0 & 255.255.0.0 SAVE; IF SourcePeerAddress == 130.216.0.0 & 255.255.0.0 SAVE;
or equivalently or equivalently
IF SourcePeerAddress == 130.216/16 SAVE; 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
succeeds if the masked attribute equals any of the values in the list. test succeeds if the masked attribute equals any of the values in the
For example list. 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
with the attribute being tested. For example, a four-byte value is consistent with the attribute being tested. For example, a four-byte
acceptable as a peer address, but would not be accepted as a transport value is acceptable as a peer address, but would not be accepted as a
address (which may not be longer than two bytes). transport 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 matched than one attribute, the masks and values are saved for all the
attributes. For each value_list in the statement the value saved is the matched attributes. For each value_list in the statement the value
one which the packet actually matched. See below for further saved is the one which the packet actually matched. See below for
description of SAVE statements. further 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
test fails. The statement following ELSE will often be another IF IF's test fails. The statement following ELSE will often be another
statement, providing SRL's version of a 'select' statement. Note that IF statement, providing SRL's version of a 'select' statement. Note
an ELSE clause always matches the immediately preceding IF. that an ELSE clause always matches the immediately preceding IF.
3.2 Compound_statement 3.2 Compound_statement
-------+-------------+----- { ---+---- Statement ----+--- } ------- -------+-------------+----- { ---+---- Statement ----+--- } -------
| | | | | | | |
+-- label : --+ +--------<----------+ +-- label : --+ +--------<----------+
A compound statement is a sequence of statements enclosed in braces. A compound statement is a sequence of statements enclosed in braces.
Each statement will terminate with a semicolon, unless it is another Each statement will terminate with a semicolon, unless it is another
compound statement (which terminates with a right brace). compound statement (which terminates with a right brace).
A compound statement may be labelled, i.e. preceded by an identifier A compound statement may be labelled, i.e. preceded by an identifier
followed by a semi-colon. Each statement inside the braces is executed followed by a semi-colon. Each statement inside the braces is
in sequence unless an EXIT statement is performed, as explained below. executed in sequence unless an EXIT statement is performed, as
explained below.
Labels have a well-defined scope, within which they must be unique. Labels have a well-defined scope, within which they must be unique.
Labels within a subroutine (i.e. between a SUBROUTINE and its matching Labels within a subroutine (i.e. between a SUBROUTINE and its
ENDSUB) are local to that subroutine and are not visible outside it. matching ENDSUB) are local to that subroutine and are not visible
Labels outside subroutines are part of a program's outer block. outside it. Labels outside subroutines are part of a program's outer
block.
3.3 Imperative_statement 3.3 Imperative_statement
------+---------------------------------------------------+------ ; ------+---------------------------------------------------+------ ;
| | | |
+-- SAVE attrib --+--+-----------+--+---------------+ +-- SAVE attrib --+--+-----------+--+---------------+
| | | | | | | | | | | |
| | +- / width -+ | | | | +- / width -+ | |
| | | | | | | | | | | |
| | +- & mask --+ | | | | +- & mask --+ | |
| | | | | | | |
| +--- = operand ---+ | | +--- = operand ---+ |
| | | |
+-- COUNT ------------------------------------------+ +-- COUNT ------------------------------------------+
| | | |
+-- EXIT label ------------------------------------+ +-- EXIT label ------------------------------------+
| | | |
+-- IGNORE -----------------------------------------+ +-- IGNORE -----------------------------------------+
| | | |
+-- NOMATCH ----------------------------------------+ +-- NOMATCH ----------------------------------------+
| | | |
+-- RETURN --+-------+------------------------------+ +-- RETURN --+-------+------------------------------+
| | | | | | | |
| +-- n --+ | | +-- n --+ |
| | | |
+-- STORE variable := value ------------------------+ +-- STORE variable := value ------------------------+
3.3.1 SAVE Statement 3.3.1 SAVE Statement
The SAVE statement saves information which will (later) identify the The SAVE statement saves information which will (later) identify the
flow in the meter's flow table. It does not actually record anything in flow in the meter's flow table. It does not actually record anything
the table; this is done when a subsequent COUNT statement executes. in the table; this is done when a subsequent COUNT statement
executes.
SAVE has two possible forms: SAVE has two possible forms:
SAVE attrib = operand ; SAVE attrib = operand ; saves the attribute, mask and value as given
saves the attribute, mask and value as given in the statement. in the statement. This form of the SAVE statement is similar to
This form of the SAVE statement is similar to that allowed that allowed in an IF statement, except that - since imperative
in an IF statement, except that - since imperative statements statements do not perform a test - you may save an arbitrary
do not perform a test - you may save an arbitrary value. value.
SAVE attrib ; SAVE attrib ;
SAVE attrib / width ; SAVE attrib / width ;
SAVE attrib & mask ; SAVE attrib & mask ; saves the attribute and mask from the statement,
saves the attribute and mask from the statement, and the and the value resulting from their application to the current
value resulting from their application to the current packet. packet. This is most useful when used to save a value with a
This is most useful when used to save a value with a wider wider mask than than was used to select the packet. For
mask than than was used to select the packet. For example example:
IF DestPeerAddress == 130.216/16 IF DestPeerAddress == 130.216/16
NOMATCH; NOMATCH;
ELSE IF SourcePeerAddress == 130.216/16 { ELSE IF SourcePeerAddress == 130.216/16 {
SAVE SourcePeerAddress /24; SAVE SourcePeerAddress /24;
COUNT; COUNT;
} }
ELSE IGNORE; ELSE IGNORE;
3.3.2 COUNT Statement 3.3.2 COUNT Statement
The COUNT statement appears after all testing and saving is complete; it The COUNT statement appears after all testing and saving is complete;
instructs the PME to build the flow identifier from the attributes which it instructs the PME to build the flow identifier from the attributes
have been SAVEd, find it in the meter's flow table (creating a new entry which have been SAVEd, find it in the meter's flow table (creating a
if this is the first packet observed for the flow), and increment its new entry if this is the first packet observed for the flow), and
counters. The meter then moves on to examine the next incoming packet. increment its counters. The meter then moves on to examine the next
incoming packet.
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. For example identified point in a program. For example:
outer: { outer: {
... ...
if SourcePeerAddress == 192.168/16 if SourcePeerAddress == 192.168/16
exit outer; # exits the statement labelled 'outer' exit outer; # exits the statement labelled 'outer'
... ...
} }
# execution resumes here # execution resumes here
In practice the language provides sufficient logical structure that one In practice the language provides sufficient logical structure that
seldom - if ever - needs to use the EXIT statement. one seldom - if ever - needs to use the EXIT statement.
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 then moves on to without saving any information from it. The meter then moves on to
examine the next incoming packet, beginning again at the first statement examine the next incoming packet, beginning again at the first
of its program. statement 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
addresses interchanged. If it is executed following such an destination addresses interchanged. If it is executed following such
interchange, the packet will be IGNOREd. an interchange, the packet will be IGNOREd.
NOMATCH is illustrated in the SAVE example (section 3.3.1), where it is NOMATCH is illustrated in the SAVE example (section 3.3.1), where it
used to ensure that flows having 130.216/16 as an end-point are counted is used to ensure that flows having 130.216/16 as an end-point are
as though 130.216 had been those flows' source peer (IP) address. counted as though 130.216 had been those flows' source peer (IP)
address.
3.3.6 STORE Statement 3.3.6 STORE Statement
The STORE statement assigns a value to an SRL variable and SAVEs it. The STORE statement assigns a value to an SRL variable and SAVEs it.
There are six SRL variables: There are six SRL variables:
SourceClass SourceKind SourceClass SourceKind
DestClass DestKind DestClass DestKind
FlowClass FlowKind FlowClass FlowKind
Their names have no particular significance; they were arbitrarily Their names have no particular significance; they were arbitrarily
chosen as likely RTFM attributes but can be used to store any chosen as likely RTFM attributes but can be used to store any
single-byte integer values. Their values are set to zero each time single-byte integer values. Their values are set to zero each time
examination of a new packet begins. For example examination of a new packet begins. For example:
STORE SourceClass := 3; STORE SourceClass := 3;
STORE FlowKind := 'W' STORE FlowKind := 'W'
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
only within the context of a subroutine. It is described in detail used only within the context of a subroutine. It is described in
below (CALL statement). detail below (CALL statement).
3.4 Subroutine_declaration 3.4 Subroutine_declaration
-- SUBROUTINE subname ( --+-----------------------------+-- ) --> -- SUBROUTINE subname ( --+-----------------------------+-- ) -->
| | | |
+--+-- ADDRESS --- pname --+--+ +--+-- 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 identifier, used to name the subroutine. the subname is an identifier, used to name the subroutine.
the parameter list specifies the subroutine's parameters. the parameter list specifies the subroutine's parameters. Each
Each parameter is preceded with a keyword indicating its parameter is preceded with a keyword indicating its type -
type - VARIABLE indicates an SRL variable (see the STORE VARIABLE indicates an SRL variable (see the STORE statement
statement above), ADDRESS indicates any other RTFM attribute. above), ADDRESS indicates any other RTFM attribute. A
A parameter name may be any identifier, and its scope is parameter name may be any identifier, and its scope is limited
limited to the subroutine's body. to the subroutine's body.
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.
only way to leave a subroutine is via a RETURN statement. The only way to leave a subroutine is via a RETURN statement.
3.5 CALL_statement 3.5 CALL_statement
---- CALL subname ( --+---------------------+-- ) ----> ---- CALL subname ( --+---------------------+-- ) ---->
| | | |
+--+-- parameter --+--+ +--+-- parameter --+--+
| | | |
+----<--- , ----+ +----<--- , ----+
>---+-------------------------------------+--- ENDCALL ---- ; >---+-------------------------------------+--- ENDCALL ---- ;
| | | |
+---+--+-- n : --+--- Statement --+---+ +---+--+-- 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
the subroutine declaration. Following the parameters is a sequence of in the subroutine declaration. Following the parameters is a
statements, each preceded by an integer label. These labels will sequence of statements, each preceded by an integer label. These
normally be 1:, 2:, 3:, etc, but they do not have to be contiguous, nor labels will normally be 1:, 2:, 3:, etc, but they do not have to be
in any particular order. They are referred to in RETURN statements contiguous, nor in any particular order. They are referred to in
within the subroutine body. 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:
within in the CALL statement. within in the CALL statement.
Execution of the labelled statement completes the CALL. 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
# #
# Classify IP port numbers # Classify IP port numbers
# #
define IPv4 = 1; # Address Family number from [ASG-NBR] define IPv4 = 1; # Address Family number from [ASG-NBR]
# #
define ftp = (20, 21); # Well-Known Port numbers from [ASG-NBR] define ftp = (20, 21); # Well-Known Port numbers from [ASG-NBR]
define telnet = 23; define telnet = 23;
define www = 80; define www = 80;
# #
define tcp = 6; # Protocol numbers from [ASG-NBR] define tcp = 6; # Protocol numbers from [ASG-NBR]
define udp = 17; define udp = 17;
# #
if SourcePeerType == IPv4 save; if SourcePeerType == IPv4 save;
else ignore; # Not an IPv4 packet else ignore; # Not an IPv4 packet
# #
if (SourceTransType == tcp || SourceTransType == udp) save, { if (SourceTransType == tcp || SourceTransType == udp) save, {
if SourceTransAddress == (www, ftp, telnet) nomatch; if SourceTransAddress == (www, ftp, telnet) nomatch;
# We want the well-known port as Dest # We want the well-known port as Dest
# #
if DestTransAddress == telnet if DestTransAddress == telnet
save, store FlowKind := 'T'; save, store FlowKind := 'T';
else if DestTransAddress == www else if DestTransAddress == www
save, store FlowKind := 'W'; save, store FlowKind := 'W';
else if DestTransAddress == ftp else if DestTransAddress == ftp
save, store FlowKind := 'F'; save, store FlowKind := 'F';
else { else {
save DestTransAddress; save DestTransAddress;
store FlowKind := '?'; store FlowKind := '?';
}
} }
} else save SourceTransType = 0;
else save SourceTransType = 0; #
# save SourcePeerAddress /32;
save SourcePeerAddress /32; save DestPeerAddress /32;
save DestPeerAddress /32; count;
count; #
# This program counts only IP packets, saving SourceTransType (tcp, udp
or 0), Source- and DestPeerAddress (32-bit IP addresses) and FlowKind
This program counts only IP packets, saving SourceTransType (tcp, udp or ('W' for www, 'F' for ftp, 'T' for telnet, '?' for unclassified).
0), Source- and DestPeerAddress (32-bit IP addresses) and FlowKind ('W' The program uses a NOMATCH action to specify the packet direction -
for www, 'F' for ftp, 'T' for telnet, '?' for unclassified). The its resulting flows will have the well-known ports as their
program uses a NOMATCH action to specify the packet direction - its destination.
resulting flows will have the well-known ports as their destination.
4.2 Classify Traffic into Groups of Networks 4.2 Classify Traffic into Groups of Networks
# #
# SRL program to classify traffic into network groups # SRL program to classify traffic into network groups
# #
define my_net = 130.216/16; define my_net = 130.216/16;
define k_nets = ( 130.217/16, 130.123/16, 130.195/16, define k_nets = ( 130.217/16, 130.123/16, 130.195/16,
132.181/16, 138.75/16, 139.80/16 ); 132.181/16, 138.75/16, 139.80/16 );
# #
call net_kind (SourcePeerAddress, SourceKind) call net_kind (SourcePeerAddress, SourceKind)
endcall; endcall;
call net_kind (DestPeerAddress, DestKind) call net_kind (DestPeerAddress, DestKind)
endcall; endcall;
count; count;
# #
subroutine net_kind (address addr, variable net) subroutine net_kind (address addr, variable net)
if addr == my_net save, { if addr == my_net save, {
store net := 10; return 1; store net := 10; return 1;
} }
else if addr == k_nets save, { else if addr == k_nets save, {
store net := 20; return 2; store net := 20; return 2;
} }
save addr/24; # Not my_net or in k_nets save addr/24; # Not my_net or in k_nets
store net := 30; return 3; store net := 30; return 3;
endsub; endsub;
# #
The net_kind subroutine determines whether addr is my network (130.216), The net_kind subroutine determines whether addr is my network
one of the Kawaihiko networks (in the k_nets list), or some other (130.216), one of the Kawaihiko networks (in the k_nets list), or
network. It saves the network address from addr (16 bits for my_net and some other network. It saves the network address from addr (16 bits
the k_net networks, 24 bits for others), stores a value of 10, 20 or 30 for my_net and the k_net networks, 24 bits for others), stores a
in net, and returns to 1:, 2: or 3:. Note that the network numbers value of 10, 20 or 30 in net, and returns to 1:, 2: or 3:. Note
used are contained within the two DEFINEs, making them easy to change. 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 and Source- net_kind is called twice, saving Source- and DestPeerAddress and
and DestKind; the COUNT statement produces flows identified by these Source- and DestKind; the COUNT statement produces flows identified
four RTFM attributes, with no particular source-dest ordering. by these four RTFM attributes, with no particular source-dest
ordering.
In the program no use is made of return numbers and they could have been In the program no use is made of return numbers and they could have
omitted. However, we might wish to re-use the subroutine in another been omitted. However, we might wish to re-use the subroutine in
program doing different things for different return numbers, as in the another program doing different things for different return numbers,
version below. as in the 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
have my_net as their source. The NOMATCH also rejects my_net -> my_net flows have my_net as their source. The NOMATCH also rejects my_net
traffic. Traffic which doesn't have my_net as source or destination -> my_net traffic. Traffic which doesn't have my_net as source or
saves 24 bits of its peer addresses (the subroutine might only have destination saves 24 bits of its peer addresses (the subroutine might
saved 16) before counting such an unusual flow. only have saved 16) before counting such an unusual flow.
5 Security Considerations 5 Security Considerations
SRL is a language for creating rulesets (i.e. configuration files) for SRL is a language for creating rulesets (i.e. configuration files)
RTFM Traffic Meters - it does not present any security issues in itself. for RTFM Traffic Meters - it does not present any security issues in
itself.
On the other hand, flow data gathered using such rulesets may well be On the other hand, flow data gathered using such rulesets may well be
valuable. It is therefore important to take proper precautions to valuable. It is therefore important to take proper precautions to
ensure that access to the meter and its data is secure. Ways to achieve ensure that access to the meter and its data is secure. Ways to
this are discussed in detail in the Architecture and Meter MIB documents achieve this are discussed in detail in the Architecture and Meter
[RTFM-ARC, RTFM-MIB]. MIB documents [RTFM-ARC, RTFM-MIB].
6 IANA Considerations 6 IANA Considerations
Appendix C below lists the RTFM attributes by name. Since SRL only Appendix C below lists the RTFM attributes by name. Since SRL only
refers to attributes by name, SRL users do not have to know the refers to attributes by name, SRL users do not have to know the
attribute numbers. attribute numbers.
The size (in bytes) of the various attribute values is also listed in The size (in bytes) of the various attribute values is also listed in
Appendix C. These sizes reflect the object sizes for the attribute Appendix C. These sizes reflect the object sizes for the attribute
values as they are stored in the RTFM Meter MIB [RTFM-MIB]. values as they are stored in the RTFM Meter MIB [RTFM-MIB].
IANA considerations for allocating new attributes are discussed in IANA considerations for allocating new attributes are discussed in
detail in the RTFM Architecture document [RTFM-ARC]. detail in the RTFM Architecture document [RTFM-ARC].
7 APPENDICES 7 APPENDICES
7.1 Appendix A: SRL Syntax in BNF 7.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>
<S or D> ::= <statement> | <declaration> <S or D> ::= <statement> | <declaration>
<declaration> ::= <Subroutine declaration> <declaration> ::= <Subroutine declaration>
<statement> ::= <IF statement> | <statement> ::= <IF statement> |
<Compound statement> | <Compound statement> |
<Imperative statement> | <Imperative statement> |
<CALL statement> <CALL statement>
<IF statement> ::= IF <expression> <if action> <opt else> <IF statement> ::= IF <expression> <if action> <opt else>
<if action> ::= SAVE ; | <if action> ::= SAVE ; |
SAVE , <statement> | SAVE , <statement> |
<statement> <statement>
<opt else> ::= <null> | <opt else> ::= <null> |
ELSE <statement> ELSE <statement>
<expression> ::= <term> | <term> || <term> <expression> ::= <term> | <term> || <term>
<term> ::= <factor> | <factor> && <factor> <term> ::= <factor> | <factor> && <factor>
<factor> ::= <attribute> == <operand list> | <factor> ::= <attribute> == <operand list> |
( <expression> ) ( <expression> )
<operand list> ::= <operand> | ( <actual operand list> ) <operand list> ::= <operand> | ( <actual operand list> )
<actual operand list> ::= <operand> | <actual operand list> ::= <operand> |
<actual operand list> , <operand> <actual operand list> , <operand>
<operand> ::= <value> | <operand> ::= <value> |
<value> / <width> | <value> / <width> |
<value> & <mask> <value> & <mask>
<Compound statement> ::= <opt label> { <statement seq> } <Compound statement> ::= <opt label> { <statement seq> }
<opt label> ::= <null> | <opt label> ::= <null> |
<identifier> : <identifier> :
<statement seq> ::= <statement> | <statement seq> <statement> <statement seq> ::= <statement> | <statement seq> <statement>
<Imperative statement> ::= ; |
SAVE <attribute> <opt operand> ; |
COUNT ; |
EXIT <label> ; |
IGNORE ; |
NOMATCH ; |
RETURN <integer> ; |
RETURN ; |
STORE <variable> := <value> ;
<opt operand> ::= <null> | <Imperative statement> ::= ; |
<width or mask> | SAVE <attribute> <opt operand> ; |
= <operand> COUNT ; |
EXIT <label> ; |
IGNORE ; |
NOMATCH ; |
RETURN <integer> ; |
RETURN ; |
STORE <variable> := <value> ;
<width or mask> ::= / <width> | & <mask> <opt operand> ::= <null> |
<width or mask> |
= <operand>
<Subroutine declaration> ::= <width or mask> ::= / <width> | & <mask>
SUBROUTINE <sub header> <sub body> ENDSUB ;
<sub header> ::= <subname> ( ) | <Subroutine declaration> ::=
<subname> ( <sub param list> ) SUBROUTINE <sub header> <sub body> ENDSUB ;
<sub param list> ::= <sub param> | <sub param list> , <sub param> <sub header> ::= <subname> ( ) |
<subname> ( <sub param list> )
<sub param> ::= ADDRESS <pname> | VARIABLE <pname> <sub param list> ::= <sub param> | <sub param list> , <sub param>
<pname> ::= <identifier> <sub param> ::= ADDRESS <pname> | VARIABLE <pname>
<sub body> ::= <statement sequence> <pname> ::= <identifier>
<CALL statement> ::= CALL <call header> <opt call body> ENDCALL ; <sub body> ::= <statement sequence>;
<call header> ::= <subname> ( ) | <CALL statement> ::= CALL <call header> <opt call body> ENDCALL ;
<subname> ( <call param list> )
<call param list> ::= <call param> | <call header> ::= <subname> ( ) |
<call param list> , <call param> <subname> ( <call param list> )
<call param> ::= <attribute> | <variable> <call param list> ::= <call param> |
<call param list> , <call param>
<opt call body> ::= <null> | <call param> ::= <attribute> | <variable>
<actual call body>
<actual call body> ::= <numbered statement> | <opt call body> ::= <null> |
<actual call body> <numbered statement> <actual call body>
<numbered statement> ::= <int label seq> <statement> <actual call body> ::= <numbered statement> |
<actual call body> <numbered statement>
<int label seq> ::= <integer> : | <int label seq> <integer> : <numbered statement> ::= <int label seq> <statement>
The following are terminals, recognised by the scanner: <int label seq> ::= <integer> : | <int label seq> <integer> :
<identifier> Described in section 2 The following are terminals, recognised by the scanner:
<integer> A decimal integer
<attribute> Attribute name, as listed in Appendix C <identifier> Described in section 2
<integer> A decimal integer
<value>, <mask> Described in section 5.2 <attribute> Attribute name, as listed in Appendix C
<width> ::= <integer> <value>, <mask> Described in section 5.2
<label> ::= <identifier>
<variable> ::= SourceClass | DestClass | FlowClass | <width> ::= <integer>
SourceKind | DestKind | FlowKind <label> ::= <identifier>
<variable> ::= SourceClass | DestClass | FlowClass |
SourceKind | DestKind | FlowKind
7.2 Appendix B: Syntax for Values and Masks 7.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
more bytes. The non-blank character following a field indicates the or more bytes. The non-blank character following a field indicates
field width, and whether the number is decimal or hexadecimal. These the field width, and whether the number is decimal or hexadecimal.
'field type' characters may be: These 'field type' characters may be:
. period decimal, single byte . period decimal, single byte
- minus hex, single byte - minus hex, single byte
! exclaim decimal, two bytes ! exclaim decimal, two bytes
For example, 130.216.0.0 is an IP address (in dotted decimal), and For example, 130.216.0.0 is an IP address (in dotted decimal), and
FF-FF-00-00 is an IP address in hexadecimal. FF-FF-00-00 is an IP address in hexadecimal.
The last field of a value or mask has no field width character. Instead The last field of a value or mask has no field width character.
it takes the same width as the preceding field. For example, 1.3.10!50 Instead it takes the same width as the preceding field. For example,
and 1.3.0.10.0.50 are two different ways to specify the same value. 1.3.10!50 and 1.3.0.10.0.50 are two different ways to specify the
same value.
Unspecified fields (at the right-hand side of a value or mask) are set Unspecified fields (at the right-hand side of a value or mask) are
to zero, i.e. 130.216 is the same as 130.216.0.0. set to zero, i.e. 130.216 is the same as 130.216.0.0.
If only a single field is specified (no field width character), the If only a single field is specified (no field width character), the
value given fills the whole field. For example, 23 and 0.23 specify the value given fills the whole field. For example, 23 and 0.23 specify
same value for a SourceTransAddress operand. For variables (which have the same value for a SourceTransAddress operand. For variables
one-byte values) a C-style character constant may also be used. (which have one-byte values) a C-style character constant may also be
used.
IPv6 addresses and masks may also be used, following the conventions set IPv6 addresses and masks may also be used, following the conventions
out in the IP Version 6 Addressing Architecture RFC [V6-ADR]. set out in the IP Version 6 Addressing Architecture RFC [V6-ADR].
7.3 Appendix C: RTFM Attribute Information 7.3 Appendix C: RTFM Attribute Information
The following attributes may be tested in an IF statement, and their The following attributes may be tested in an IF statement, and their
values may be SAVEd (except for MatchingStoD). Their maximum size (in values may be SAVEd (except for MatchingStoD). Their maximum size (in
bytes) is shown to the left, and a brief description is given for each. bytes) is shown to the left, and a brief description is given for
The names given here are reserved words in SRL (they are <attribute> each. The names given here are reserved words in SRL (they are
terminals in the grammar given in Appendix A). <attribute> terminals in the grammar given in Appendix A).
Note that this table gives only a very brief summary. The Meter MIB Note that this table gives only a very brief summary. The Meter MIB
[RTFM-MIB] provides the definitive specification of attributes and their [RTFM-MIB] provides the definitive specification of attributes and
allowed values. The MIB variables which represent flow attributes have their allowed values. The MIB variables which represent flow
'flowData' prepended to their names to indicate that they belong to the attributes have 'flowData' prepended to their names to indicate that
MIB's flowData table. they belong to the MIB's flowData table.
1 SourceInterface, DestInterface 1 SourceInterface, DestInterface
Interface(s) on which the flow was observed Interface(s) on which the flow was observed
1 SourceAdjacentType, DestAdjacentType 1 SourceAdjacentType, DestAdjacentType
Indicates the interface type(s), i.e. an ifType from [ASG-NBR], Indicates the interface type(s), i.e. an ifType from [ASG-NBR],
or an Address Family Number (if metering within a tunnel) or an Address Family Number (if metering within a tunnel)
20 SourceAdjacentAddress, DestAdjacentAddress 0 SourceAdjacentAddress, DestAdjacentAddress
For IEEE 802.x interfaces, the MAC addresses for the flow For IEEE 802.x interfaces, the MAC addresses for the flow
1 SourcePeerType, DestPeerType 1 SourcePeerType, DestPeerType
Peer protocol types, i.e. Address Family Number from [ASG-NBR], Peer protocol types, i.e. Address Family Number from [ASG-NBR],
such as IPv4, Novell, Ethertalk, .. such as IPv4, Novell, Ethertalk, ..
20 SourcePeerAddress, DestPeerAddress 0 SourcePeerAddress, DestPeerAddress
Peer Addresses (size varies, e.g. 4 for IPv4, 3 for Ethertalk)) Peer Addresses (size varies, e.g. 4 for IPv4, 3 for Ethertalk))
1 SourceTransType, DestTransType 1 SourceTransType, DestTransType
Transport layer type, i.e. Protocol Number from [ASG-NBR] Transport layer type, i.e. Protocol Number from [ASG-NBR]
such as tcp(6), udp(17), ospf(89), .. such as tcp(6), udp(17), ospf(89), ..
2 SourceTransAddress, DestTransAddress 2 SourceTransAddress, DestTransAddress
Transport layer addresses (e.g. port numbers for TCP and UDP) Transport layer addresses (e.g. port numbers for TCP and UDP)
1 FlowRuleset 1 FlowRuleset
Rule set number for the flow Rule set number for the flow
1 MatchingStoD 1 MatchingStoD
Indicates whether the packet is being matched with its Indicates whether the packet is being matched with its
addresses in 'wire order.' See [RTFM-ARC] for details. addresses in 'wire order.' See [RTFM-ARC] for details.
The following variables may be tested in an IF, and their values may be The following variables may be tested in an IF, and their values may
set by a STORE. They all have one-byte values. be set by a STORE. They all have one-byte values.
SourceClass, DestClass, FlowClass, SourceClass, DestClass, FlowClass,
SourceKind, DestKind, FlowKind SourceKind, DestKind, FlowKind
The following RTFM attributes are not address attributes - they are The following RTFM attributes are not address attributes - they are
measured attributes of a flow. Their values may be read from an RTFM measured attributes of a flow. Their values may be read from an RTFM
meter. (For example, NeTraMet uses a FORMAT statement to specify which meter. (For example, NeTraMet uses a FORMAT statement to specify
attribute values are to be read from the meter.) which attribute values are to be read from the meter.)
8 ToOctets, FromOctets 8 ToOctets, FromOctets
Total number of octets seen for each direction of the flow Total number of octets seen for each direction of the flow
8 ToPDUs, FromPDUs 8 ToPDUs, FromPDUs
Total number of PDUs seen for each direction of the flow Total number of PDUs seen for each direction of the flow
4 FirstTime, LastActiveTime 4 FirstTime, LastActiveTime
Time (in centiseconds) that first and last PDUs were seen Time (in centiseconds) that first and last PDUs were seen
for the flow for the flow
Other attributes will be defined by the RTFM working group from time to Other attributes will be defined by the RTFM working group from time
time. to time.
8 Acknowledgments 8 Acknowledgments
The SRL language is part of the RTFM Working Group's efforts to make the The SRL language is part of the RTFM Working Group's efforts to make
RTFM traffic measurement system easier to use. Initial work on the the RTFM traffic measurement system easier to use. Initial work on
language was done by Cyndi Mills and Brad Frazee in Boston. SRL was the language was done by Cyndi Mills and Brad Frazee in Boston. SRL
developed in Auckland; it was greatly assisted by detailed discussion was developed in Auckland; it was greatly assisted by detailed
with John White and Russell Fulton. Discussion has continued on the discussion with John White and Russell Fulton. Discussion has
RTFM and NeTraMet mailing lists. continued on the RTFM and NeTraMet mailing lists.
9 References 9 References
[ASG-NBR] Reynolds, J., Postel, J., "Assigned Numbers," [ASG-NBR] Reynolds, J. and J. Postel, "Assigned Numbers",
RFC 1700, ISI, October 1994. STD 2, RFC 1700, October 1994.
[NETRAMET] Brownlee, N., NeTraMet home page, [NETRAMET] Brownlee, N., NeTraMet home page,
http://www.auckland.ac.nz/net/NeTraMet http://www.auckland.ac.nz/net/NeTraMet
[RTFM-ARC] Brownlee, N., Mills, C. and G. Ruth, "Traffic Flow [RTFM-ARC] Brownlee, N., Mills, C. and G. Ruth, "Traffic Flow
Measurement: Architecture", RFC 2063, January 1997. Measurement: Architecture", RFC 2722, October 1999.
[RTFM-MIB] Brownlee, N., "Traffic Flow Measurement: Meter MIB", [RTFM-MIB] Brownlee, N., "Traffic Flow Measurement: Meter MIB",
RFC 2064, January 1997. RFC 2720, October 1999.
[V6-ADDR] Hinden, R.and Deering, S., "IP Version 6 Addressing [V6-ADDR] Hinden, R. and S. Deering, "IP Version 6 Addressing
Architecture," RFC 2373, July 1998. Architecture," RFC 2373, July 1998.
10 Author's Address 10 Author's Address
Nevil Brownlee Nevil Brownlee
Information Technology Systems & Services Information Technology Systems & Services
The University of Auckland The University of Auckland
Private Bag 92-019 Private Bag 92-019
Auckland, New Zealand Auckland, New Zealand
Phone: +64 9 373 7599 x8941 Phone: +64 9 373 7599 x8941
E-mail: n.brownlee@auckland.ac.nz EMail: n.brownlee@auckland.ac.nz
Expires February 2000 11 Full Copyright Statement
Copyright (C) The Internet Society (1999). All Rights Reserved.
This document and translations of it may be copied and furnished to
others, and derivative works that comment on or otherwise explain it
or assist in its implementation may be prepared, copied, published
and distributed, in whole or in part, without restriction of any
kind, provided that the above copyright notice and this paragraph are
included on all such copies and derivative works. However, this
document itself may not be modified in any way, such as by removing
the copyright notice or references to the Internet Society or other
Internet organizations, except as needed for the purpose of
developing Internet standards in which case the procedures for
copyrights defined in the Internet Standards process must be
followed, or as required to translate it into languages other than
English.
The limited permissions granted above are perpetual and will not be
revoked by the Internet Society or its successors or assigns.
This document and the information contained herein is provided on an
"AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
Acknowledgement
Funding for the RFC Editor function is currently provided by the
Internet Society.
 End of changes. 178 change blocks. 
669 lines changed or deleted 661 lines changed or added

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