aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/Criterion.java
blob: 10cb629f64b305a679b4ae38a25cdba851307406 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
/*
 * Copyright 2014-2015 Open Networking Laboratory
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.onosproject.net.flow.criteria;


/**
 * Representation of a single header field selection.
 */
public interface Criterion {

    /**
     * Types of fields to which the selection criterion may apply.
     */
    // From page 75 of OpenFlow 1.5.0 spec
    enum Type {
        /** Switch input port. */
        IN_PORT,
        /** Switch physical input port. */
        IN_PHY_PORT,
        /** Metadata passed between tables. */
        METADATA,
        /** Ethernet destination address. */
        ETH_DST,
        /** Ethernet source address. */
        ETH_SRC,
        /** Ethernet frame type. */
        ETH_TYPE,
        /** VLAN id. */
        VLAN_VID,
        /** VLAN priority. */
        VLAN_PCP,
        /** IP DSCP (6 bits in ToS field). */
        IP_DSCP,
        /** IP ECN (2 bits in ToS field). */
        IP_ECN,
        /** IP protocol. */
        IP_PROTO,
        /** IPv4 source address. */
        IPV4_SRC,
        /** IPv4 destination address. */
        IPV4_DST,
        /** TCP source port. */
        TCP_SRC,
        /** TCP destination port. */
        TCP_DST,
        /** UDP source port. */
        UDP_SRC,
        /** UDP destination port. */
        UDP_DST,
        /** SCTP source port. */
        SCTP_SRC,
        /** SCTP destination port. */
        SCTP_DST,
        /** ICMP type. */
        ICMPV4_TYPE,
        /** ICMP code. */
        ICMPV4_CODE,
        /** ARP opcode. */
        ARP_OP,
        /** ARP source IPv4 address. */
        ARP_SPA,
        /** ARP target IPv4 address. */
        ARP_TPA,
        /** ARP source hardware address. */
        ARP_SHA,
        /** ARP target hardware address. */
        ARP_THA,
        /** IPv6 source address. */
        IPV6_SRC,
        /** IPv6 destination address. */
        IPV6_DST,
        /** IPv6 Flow Label. */
        IPV6_FLABEL,
        /** ICMPv6 type. */
        ICMPV6_TYPE,
        /** ICMPv6 code. */
        ICMPV6_CODE,
        /** Target address for ND. */
        IPV6_ND_TARGET,
        /** Source link-layer for ND. */
        IPV6_ND_SLL,
        /** Target link-layer for ND. */
        IPV6_ND_TLL,
        /** MPLS label. */
        MPLS_LABEL,
        /** MPLS TC. */
        MPLS_TC,
        /** MPLS BoS bit. */
        MPLS_BOS,
        /** PBB I-SID. */
        PBB_ISID,
        /** Logical Port Metadata. */
        TUNNEL_ID,
        /** IPv6 Extension Header pseudo-field. */
        IPV6_EXTHDR,
        /** Unassigned value: 40. */
        UNASSIGNED_40,
        /** PBB UCA header field. */
        PBB_UCA,
        /** TCP flags. */
        TCP_FLAGS,
        /** Output port from action set metadata. */
        ACTSET_OUTPUT,
        /** Packet type value. */
        PACKET_TYPE,

        //
        // NOTE: Everything below is defined elsewhere: ONOS-specific,
        // extensions, etc.
        //
        /** Optical channel signal ID (lambda). */
        OCH_SIGID,
        /** Optical channel signal type (fixed or flexible). */
        OCH_SIGTYPE,
        /** ODU (Optical channel Data Unit) signal ID. */
        ODU_SIGID,
        /** ODU (Optical channel Data Unit) signal type. */
        ODU_SIGTYPE,

        /**
         * An empty criterion.
         */
        DUMMY
    }

    /**
     * Returns the type of criterion.
     *
     * @return type of criterion
     */
    Type type();

    /**
     * Bit definitions for IPv6 Extension Header pseudo-field.
     * From page 79 of OpenFlow 1.5.0 spec.
     */
    enum IPv6ExthdrFlags {
        /** "No next header" encountered. */
        NONEXT((short) (1 << 0)),
        /** Encrypted Sec Payload header present. */
        ESP((short) (1 << 1)),
        /** Authentication header present. */
        AUTH((short) (1 << 2)),
        /** 1 or 2 dest headers present. */
        DEST((short) (1 << 3)),
        /** Fragment header present. */
        FRAG((short) (1 << 4)),
        /** Router header present. */
        ROUTER((short) (1 << 5)),
        /** Hop-by-hop header present. */
        HOP((short) (1 << 6)),
        /** Unexpected repeats encountered. */
        UNREP((short) (1 << 7)),
        /** Unexpected sequencing encountered. */
        UNSEQ((short) (1 << 8));

        private short value;

        IPv6ExthdrFlags(short value) {
            this.value = value;
        }

        /**
         * Gets the value as an integer.
         *
         * @return the value as an integer
         */
        public short getValue() {
            return this.value;
        }
    }
}