blob: bbf26741ec91086027747a088aa629ee17928b86 [file] [log] [blame]
Thomas Vachuska83e090e2014-10-22 14:25:35 -07001/*
Ray Milkey34c95902015-04-15 09:47:53 -07002 * Copyright 2014-2015 Open Networking Laboratory
Thomas Vachuska83e090e2014-10-22 14:25:35 -07003 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07004 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
Thomas Vachuska83e090e2014-10-22 14:25:35 -07007 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07008 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
Thomas Vachuska83e090e2014-10-22 14:25:35 -070015 */
Brian O'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.net.flow.criteria;
tom8bb16062014-09-12 14:47:46 -070017
alshabib7b795492014-09-16 14:38:39 -070018
tom8bb16062014-09-12 14:47:46 -070019/**
20 * Representation of a single header field selection.
21 */
22public interface Criterion {
23
24 /**
25 * Types of fields to which the selection criterion may apply.
26 */
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -080027 // From page 75 of OpenFlow 1.5.0 spec
tom8bb16062014-09-12 14:47:46 -070028 public enum Type {
29 /** Switch input port. */
30 IN_PORT,
31 /** Switch physical input port. */
32 IN_PHY_PORT,
33 /** Metadata passed between tables. */
34 METADATA,
35 /** Ethernet destination address. */
36 ETH_DST,
37 /** Ethernet source address. */
38 ETH_SRC,
39 /** Ethernet frame type. */
40 ETH_TYPE,
41 /** VLAN id. */
42 VLAN_VID,
43 /** VLAN priority. */
44 VLAN_PCP,
45 /** IP DSCP (6 bits in ToS field). */
46 IP_DSCP,
47 /** IP ECN (2 bits in ToS field). */
48 IP_ECN,
49 /** IP protocol. */
50 IP_PROTO,
51 /** IPv4 source address. */
52 IPV4_SRC,
53 /** IPv4 destination address. */
54 IPV4_DST,
55 /** TCP source port. */
56 TCP_SRC,
57 /** TCP destination port. */
58 TCP_DST,
59 /** UDP source port. */
60 UDP_SRC,
61 /** UDP destination port. */
62 UDP_DST,
63 /** SCTP source port. */
64 SCTP_SRC,
65 /** SCTP destination port. */
66 SCTP_DST,
67 /** ICMP type. */
68 ICMPV4_TYPE,
69 /** ICMP code. */
70 ICMPV4_CODE,
71 /** ARP opcode. */
72 ARP_OP,
73 /** ARP source IPv4 address. */
74 ARP_SPA,
75 /** ARP target IPv4 address. */
76 ARP_TPA,
77 /** ARP source hardware address. */
78 ARP_SHA,
79 /** ARP target hardware address. */
80 ARP_THA,
81 /** IPv6 source address. */
82 IPV6_SRC,
83 /** IPv6 destination address. */
84 IPV6_DST,
85 /** IPv6 Flow Label. */
86 IPV6_FLABEL,
87 /** ICMPv6 type. */
88 ICMPV6_TYPE,
89 /** ICMPv6 code. */
90 ICMPV6_CODE,
91 /** Target address for ND. */
92 IPV6_ND_TARGET,
93 /** Source link-layer for ND. */
94 IPV6_ND_SLL,
95 /** Target link-layer for ND. */
96 IPV6_ND_TLL,
97 /** MPLS label. */
98 MPLS_LABEL,
99 /** MPLS TC. */
100 MPLS_TC,
101 /** MPLS BoS bit. */
102 MPLS_BOS,
103 /** PBB I-SID. */
104 PBB_ISID,
105 /** Logical Port Metadata. */
106 TUNNEL_ID,
107 /** IPv6 Extension Header pseudo-field. */
Marc De Leenheer49087752014-10-23 13:54:09 -0700108 IPV6_EXTHDR,
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800109 /** Unassigned value: 40. */
110 UNASSIGNED_40,
111 /** PBB UCA header field. */
112 PBB_UCA,
113 /** TCP flags. */
114 TCP_FLAGS,
115 /** Output port from action set metadata. */
116 ACTSET_OUTPUT,
117 /** Packet type value. */
118 PACKET_TYPE,
119
120 //
121 // NOTE: Everything below is defined elsewhere: ONOS-specific,
122 // extensions, etc.
123 //
Marc De Leenheer49087752014-10-23 13:54:09 -0700124 /** Optical channel signal ID (lambda). */
125 OCH_SIGID,
126 /** Optical channel signal type (fixed or flexible). */
alshabiba3a476d2015-04-10 14:35:38 -0700127 OCH_SIGTYPE,
128
129 /**
130 * An empty criterion.
131 */
132 DUMMY
tom8bb16062014-09-12 14:47:46 -0700133 }
134
alshabib7b795492014-09-16 14:38:39 -0700135 /**
136 * Returns the type of criterion.
Pavlin Radoslavov5e4f7542015-02-06 18:18:21 -0800137 *
alshabib7b795492014-09-16 14:38:39 -0700138 * @return type of criterion
139 */
140 public Type type();
141
Pavlin Radoslavov5e4f7542015-02-06 18:18:21 -0800142 /**
143 * Bit definitions for IPv6 Extension Header pseudo-field.
144 * From page 79 of OpenFlow 1.5.0 spec.
145 */
146 public enum IPv6ExthdrFlags {
147 /** "No next header" encountered. */
148 NONEXT(1 << 0),
149 /** Encrypted Sec Payload header present. */
150 ESP(1 << 1),
151 /** Authentication header present. */
152 AUTH(1 << 2),
153 /** 1 or 2 dest headers present. */
154 DEST(1 << 3),
155 /** Fragment header present. */
156 FRAG(1 << 4),
157 /** Router header present. */
158 ROUTER(1 << 5),
159 /** Hop-by-hop header present. */
160 HOP(1 << 6),
161 /** Unexpected repeats encountered. */
162 UNREP(1 << 7),
163 /** Unexpected sequencing encountered. */
164 UNSEQ(1 << 8);
tom8bb16062014-09-12 14:47:46 -0700165
Pavlin Radoslavov5e4f7542015-02-06 18:18:21 -0800166 private int value;
167
168 IPv6ExthdrFlags(int value) {
169 this.value = value;
170 }
171
172 /**
173 * Gets the value as an integer.
174 *
175 * @return the value as an integer
176 */
177 public int getValue() {
178 return this.value;
179 }
180 }
tom8bb16062014-09-12 14:47:46 -0700181}