blob: 9a2727276b0cd3722b35244ac4e1774222b8b73a [file] [log] [blame]
Rich Lane4d9f0f62013-05-09 15:50:57 -07001# Copyright 2013, Big Switch Networks, Inc.
2#
3# LoxiGen is licensed under the Eclipse Public License, version 1.0 (EPL), with
4# the following special exception:
5#
6# LOXI Exception
7#
8# As a special exception to the terms of the EPL, you may distribute libraries
9# generated by LoxiGen (LoxiGen Libraries) under the terms of your choice, provided
10# that copyright and licensing notices generated by LoxiGen are not altered or removed
11# from the LoxiGen Libraries and the notice provided below is (i) included in
12# the LoxiGen Libraries, if distributed in source code form and (ii) included in any
13# documentation for the LoxiGen Libraries, if distributed in binary form.
14#
15# Notice: "Copyright 2013, Big Switch Networks, Inc. This library was generated by the LoxiGen Compiler."
16#
17# You may not use this file except in compliance with the EPL or LOXI Exception. You may obtain
18# a copy of the EPL at:
19#
20# http://www.eclipse.org/legal/epl-v10.html
21#
22# Unless required by applicable law or agreed to in writing, software
23# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
24# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
25# EPL for the specific language governing permissions and limitations
26# under the EPL.
27
28from collections import namedtuple
29
30# This module is intended to be imported like this: from loxi_ir import *
31# All public names are prefixed with 'OF'.
32__all__ = [
33 'OFInput',
34 'OFProtocol',
35 'OFClass',
36 'OFDataMember',
37 'OFTypeMember',
38 'OFLengthMember',
39 'OFFieldLengthMember',
40 'OFPadMember',
41 'OFEnum',
42]
43
44"""
45One input file
46
47@param wire_versions Set of integer wire versions this file applies to
48@param classes List of OFClass objects in the same order as in the file
49@param enums List of Enum objects in the same order as in the file
50"""
51OFInput = namedtuple('OFInput', ['wire_versions', 'classes', 'enums'])
52
53"""
54One version of the OpenFlow protocol
55
56Combination of multiple OFInput objects.
57
58@param wire_version
59@param classes List of OFClass objects
60@param enums List of Enum objects
61"""
62OFProtocol = namedtuple('OFProtocol', ['wire_version', 'classes', 'enums'])
63
64"""
65An OpenFlow class
66
67All compound objects like messages, actions, instructions, etc are
68uniformly represented by this class.
69
70The members are in the same order as on the wire.
71
72@param name
73@param members List of *Member objects
74"""
75OFClass = namedtuple('OFClass', ['name', 'members'])
76
77"""
78Normal field
79
80@param name
81@param oftype C-like type string
82
83Example: packet_in.buffer_id
84"""
85OFDataMember = namedtuple('OFDataMember', ['name', 'oftype'])
86
87"""
88Field used to determine the type of an OpenFlow object
89
90@param name
91@param oftype C-like type string
92@param value Fixed type value
93
94Example: packet_in.type, flow_add._command
95"""
96OFTypeMember = namedtuple('OFTypeMember', ['name', 'oftype', 'value'])
97
98"""
99Field with the length of the containing object
100
101@param name
102@param oftype C-like type string
103
104Example: packet_in.length, action_output.len
105"""
106OFLengthMember = namedtuple('OFLengthMember', ['name', 'oftype'])
107
108"""
109Field with the length of another field in the containing object
110
111@param name
112@param oftype C-like type string
113@param field_name Peer field whose length this field contains
114
115Example: packet_out.actions_len (only usage)
116"""
117OFFieldLengthMember = namedtuple('OFFieldLengthMember', ['name', 'oftype', 'field_name'])
118
119"""
120Zero-filled padding
121
122@param length Length in bytes
123
124Example: packet_in.pad
125"""
126OFPadMember = namedtuple('OFPadMember', ['length'])
127
128"""
129An OpenFlow enumeration
130
131All values are Python ints.
132
133@param name
134@param values List of (name, value) tuples in input order
135"""
136OFEnum = namedtuple('OFEnum', ['name', 'values'])