Thomas Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2014-present Open Networking Foundation |
Thomas Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 3 | * |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 4 | * 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 Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 7 | * |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 8 | * 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 Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 15 | */ |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.net.flow.criteria; |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 17 | |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 18 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 19 | /** |
| 20 | * Representation of a single header field selection. |
| 21 | */ |
| 22 | public interface Criterion { |
| 23 | |
Carmelo Cascone | 1022a4e | 2017-05-25 00:16:18 -0400 | [diff] [blame] | 24 | String SEPARATOR = ":"; |
Jonathan Hart | c7840bd | 2016-01-21 23:26:29 -0800 | [diff] [blame] | 25 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 26 | /** |
| 27 | * Types of fields to which the selection criterion may apply. |
| 28 | */ |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 29 | // From page 75 of OpenFlow 1.5.0 spec |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 30 | enum Type { |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 31 | /** Switch input port. */ |
| 32 | IN_PORT, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 33 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 34 | /** Switch physical input port. */ |
| 35 | IN_PHY_PORT, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 36 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 37 | /** Metadata passed between tables. */ |
| 38 | METADATA, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 39 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 40 | /** Ethernet destination address. */ |
| 41 | ETH_DST, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 42 | |
Saurav Das | 9d6c86b | 2016-02-19 09:01:07 -0800 | [diff] [blame] | 43 | /** Ethernet destination address with masking. */ |
| 44 | ETH_DST_MASKED, |
| 45 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 46 | /** Ethernet source address. */ |
| 47 | ETH_SRC, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 48 | |
Saurav Das | 9d6c86b | 2016-02-19 09:01:07 -0800 | [diff] [blame] | 49 | /** Ethernet source address with masking. */ |
| 50 | ETH_SRC_MASKED, |
| 51 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 52 | /** Ethernet frame type. */ |
| 53 | ETH_TYPE, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 54 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 55 | /** VLAN id. */ |
| 56 | VLAN_VID, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 57 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 58 | /** VLAN priority. */ |
| 59 | VLAN_PCP, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 60 | |
alshabib | fa0dc66 | 2016-01-13 11:23:53 -0800 | [diff] [blame] | 61 | /** |
| 62 | * Inner VLAN id. |
| 63 | * |
| 64 | * Note: Some drivers may not support this. |
| 65 | */ |
| 66 | INNER_VLAN_VID, |
| 67 | |
| 68 | /** |
| 69 | * Inner VLAN pcp. |
| 70 | * |
| 71 | * Note: Some drivers may not support this. |
| 72 | */ |
| 73 | INNER_VLAN_PCP, |
| 74 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 75 | /** IP DSCP (6 bits in ToS field). */ |
| 76 | IP_DSCP, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 77 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 78 | /** IP ECN (2 bits in ToS field). */ |
| 79 | IP_ECN, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 80 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 81 | /** IP protocol. */ |
| 82 | IP_PROTO, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 83 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 84 | /** IPv4 source address. */ |
| 85 | IPV4_SRC, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 86 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 87 | /** IPv4 destination address. */ |
| 88 | IPV4_DST, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 89 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 90 | /** TCP source port. */ |
| 91 | TCP_SRC, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 92 | |
Andreas Gilbert | 75b882f7 | 2017-02-03 09:58:07 +0100 | [diff] [blame] | 93 | /** TCP source port with masking. */ |
| 94 | TCP_SRC_MASKED, |
| 95 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 96 | /** TCP destination port. */ |
| 97 | TCP_DST, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 98 | |
Andreas Gilbert | 75b882f7 | 2017-02-03 09:58:07 +0100 | [diff] [blame] | 99 | /** TCP destination port with masking. */ |
| 100 | TCP_DST_MASKED, |
| 101 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 102 | /** UDP source port. */ |
| 103 | UDP_SRC, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 104 | |
Andreas Gilbert | 75b882f7 | 2017-02-03 09:58:07 +0100 | [diff] [blame] | 105 | /** UDP source port with masking. */ |
| 106 | UDP_SRC_MASKED, |
| 107 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 108 | /** UDP destination port. */ |
| 109 | UDP_DST, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 110 | |
Andreas Gilbert | 75b882f7 | 2017-02-03 09:58:07 +0100 | [diff] [blame] | 111 | /** UDP destination port with masking. */ |
| 112 | UDP_DST_MASKED, |
| 113 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 114 | /** SCTP source port. */ |
| 115 | SCTP_SRC, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 116 | |
Andreas Gilbert | 75b882f7 | 2017-02-03 09:58:07 +0100 | [diff] [blame] | 117 | /** SCTP source port with masking. */ |
| 118 | SCTP_SRC_MASKED, |
| 119 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 120 | /** SCTP destination port. */ |
| 121 | SCTP_DST, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 122 | |
Andreas Gilbert | 75b882f7 | 2017-02-03 09:58:07 +0100 | [diff] [blame] | 123 | /** SCTP destination port with masking. */ |
| 124 | SCTP_DST_MASKED, |
| 125 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 126 | /** ICMP type. */ |
| 127 | ICMPV4_TYPE, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 128 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 129 | /** ICMP code. */ |
| 130 | ICMPV4_CODE, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 131 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 132 | /** ARP opcode. */ |
| 133 | ARP_OP, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 134 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 135 | /** ARP source IPv4 address. */ |
| 136 | ARP_SPA, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 137 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 138 | /** ARP target IPv4 address. */ |
| 139 | ARP_TPA, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 140 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 141 | /** ARP source hardware address. */ |
| 142 | ARP_SHA, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 143 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 144 | /** ARP target hardware address. */ |
| 145 | ARP_THA, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 146 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 147 | /** IPv6 source address. */ |
| 148 | IPV6_SRC, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 149 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 150 | /** IPv6 destination address. */ |
| 151 | IPV6_DST, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 152 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 153 | /** IPv6 Flow Label. */ |
| 154 | IPV6_FLABEL, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 155 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 156 | /** ICMPv6 type. */ |
| 157 | ICMPV6_TYPE, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 158 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 159 | /** ICMPv6 code. */ |
| 160 | ICMPV6_CODE, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 161 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 162 | /** Target address for ND. */ |
| 163 | IPV6_ND_TARGET, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 164 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 165 | /** Source link-layer for ND. */ |
| 166 | IPV6_ND_SLL, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 167 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 168 | /** Target link-layer for ND. */ |
| 169 | IPV6_ND_TLL, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 170 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 171 | /** MPLS label. */ |
| 172 | MPLS_LABEL, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 173 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 174 | /** MPLS TC. */ |
| 175 | MPLS_TC, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 176 | |
| 177 | /** MPLS BoS bit. */ |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 178 | MPLS_BOS, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 179 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 180 | /** PBB I-SID. */ |
| 181 | PBB_ISID, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 182 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 183 | /** Logical Port Metadata. */ |
| 184 | TUNNEL_ID, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 185 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 186 | /** IPv6 Extension Header pseudo-field. */ |
Marc De Leenheer | 4908775 | 2014-10-23 13:54:09 -0700 | [diff] [blame] | 187 | IPV6_EXTHDR, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 188 | |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 189 | /** Unassigned value: 40. */ |
| 190 | UNASSIGNED_40, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 191 | |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 192 | /** PBB UCA header field. */ |
| 193 | PBB_UCA, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 194 | |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 195 | /** TCP flags. */ |
| 196 | TCP_FLAGS, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 197 | |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 198 | /** Output port from action set metadata. */ |
| 199 | ACTSET_OUTPUT, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 200 | |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 201 | /** Packet type value. */ |
| 202 | PACKET_TYPE, |
| 203 | |
| 204 | // |
| 205 | // NOTE: Everything below is defined elsewhere: ONOS-specific, |
| 206 | // extensions, etc. |
| 207 | // |
Marc De Leenheer | 4908775 | 2014-10-23 13:54:09 -0700 | [diff] [blame] | 208 | /** Optical channel signal ID (lambda). */ |
| 209 | OCH_SIGID, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 210 | |
Marc De Leenheer | 4908775 | 2014-10-23 13:54:09 -0700 | [diff] [blame] | 211 | /** Optical channel signal type (fixed or flexible). */ |
alshabib | a3a476d | 2015-04-10 14:35:38 -0700 | [diff] [blame] | 212 | OCH_SIGTYPE, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 213 | |
Yafit Hadar | 52d8155 | 2015-10-07 12:26:52 +0300 | [diff] [blame] | 214 | /** ODU (Optical channel Data Unit) signal ID. */ |
| 215 | ODU_SIGID, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 216 | |
Yafit Hadar | 52d8155 | 2015-10-07 12:26:52 +0300 | [diff] [blame] | 217 | /** ODU (Optical channel Data Unit) signal type. */ |
| 218 | ODU_SIGTYPE, |
alshabib | a3a476d | 2015-04-10 14:35:38 -0700 | [diff] [blame] | 219 | |
Carmelo Cascone | 1022a4e | 2017-05-25 00:16:18 -0400 | [diff] [blame] | 220 | /** Protocol-independent. */ |
| 221 | PROTOCOL_INDEPENDENT, |
| 222 | |
Jonathan Hart | 26a8d95 | 2015-12-02 15:16:35 -0800 | [diff] [blame] | 223 | /** Extension criterion. */ |
| 224 | EXTENSION, |
| 225 | |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 226 | /** An empty criterion. */ |
alshabib | a3a476d | 2015-04-10 14:35:38 -0700 | [diff] [blame] | 227 | DUMMY |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 228 | } |
| 229 | |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 230 | /** |
| 231 | * Returns the type of criterion. |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 232 | * |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 233 | * @return type of criterion |
| 234 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 235 | Type type(); |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 236 | |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 237 | /** |
| 238 | * Bit definitions for IPv6 Extension Header pseudo-field. |
| 239 | * From page 79 of OpenFlow 1.5.0 spec. |
| 240 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 241 | enum IPv6ExthdrFlags { |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 242 | /** "No next header" encountered. */ |
Charles M.C. Chan | 2184de1 | 2015-04-26 02:24:53 +0800 | [diff] [blame] | 243 | NONEXT((short) (1 << 0)), |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 244 | /** Encrypted Sec Payload header present. */ |
Charles M.C. Chan | 2184de1 | 2015-04-26 02:24:53 +0800 | [diff] [blame] | 245 | ESP((short) (1 << 1)), |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 246 | /** Authentication header present. */ |
Charles M.C. Chan | 2184de1 | 2015-04-26 02:24:53 +0800 | [diff] [blame] | 247 | AUTH((short) (1 << 2)), |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 248 | /** 1 or 2 dest headers present. */ |
Charles M.C. Chan | 2184de1 | 2015-04-26 02:24:53 +0800 | [diff] [blame] | 249 | DEST((short) (1 << 3)), |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 250 | /** Fragment header present. */ |
Charles M.C. Chan | 2184de1 | 2015-04-26 02:24:53 +0800 | [diff] [blame] | 251 | FRAG((short) (1 << 4)), |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 252 | /** Router header present. */ |
Charles M.C. Chan | 2184de1 | 2015-04-26 02:24:53 +0800 | [diff] [blame] | 253 | ROUTER((short) (1 << 5)), |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 254 | /** Hop-by-hop header present. */ |
Charles M.C. Chan | 2184de1 | 2015-04-26 02:24:53 +0800 | [diff] [blame] | 255 | HOP((short) (1 << 6)), |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 256 | /** Unexpected repeats encountered. */ |
Charles M.C. Chan | 2184de1 | 2015-04-26 02:24:53 +0800 | [diff] [blame] | 257 | UNREP((short) (1 << 7)), |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 258 | /** Unexpected sequencing encountered. */ |
Charles M.C. Chan | 2184de1 | 2015-04-26 02:24:53 +0800 | [diff] [blame] | 259 | UNSEQ((short) (1 << 8)); |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 260 | |
Charles M.C. Chan | 2184de1 | 2015-04-26 02:24:53 +0800 | [diff] [blame] | 261 | private short value; |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 262 | |
Charles M.C. Chan | 2184de1 | 2015-04-26 02:24:53 +0800 | [diff] [blame] | 263 | IPv6ExthdrFlags(short value) { |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 264 | this.value = value; |
| 265 | } |
| 266 | |
| 267 | /** |
| 268 | * Gets the value as an integer. |
| 269 | * |
| 270 | * @return the value as an integer |
| 271 | */ |
Charles M.C. Chan | 2184de1 | 2015-04-26 02:24:53 +0800 | [diff] [blame] | 272 | public short getValue() { |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 273 | return this.value; |
| 274 | } |
| 275 | } |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 276 | |
Jonathan Hart | 51539b8 | 2015-10-29 09:53:04 -0700 | [diff] [blame] | 277 | enum TcpFlags { |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 278 | |
| 279 | /** ECN-nonce concealment protection. */ |
| 280 | NS((short) (1 << 0)), |
| 281 | /** Congestion Window Reduced. */ |
| 282 | CWR((short) (1 << 1)), |
| 283 | /** ECN-Echo. **/ |
| 284 | ECE((short) (1 << 2)), |
| 285 | /** Urgent pointer field is significant. */ |
| 286 | URG((short) (1 << 3)), |
| 287 | /** Acknowledgment field is significant. */ |
| 288 | ACK((short) (1 << 4)), |
| 289 | /** Push the buffered data to the receiving application. */ |
| 290 | PSH((short) (1 << 5)), |
| 291 | /** Reset the connection. */ |
| 292 | RST((short) (1 << 6)), |
| 293 | /** Synchronize sequence numbers. */ |
| 294 | SYN((short) (1 << 7)), |
| 295 | /** No more data from sender. */ |
| 296 | FIN((short) (1 << 8)); |
| 297 | |
| 298 | private short value; |
| 299 | |
Jonathan Hart | 51539b8 | 2015-10-29 09:53:04 -0700 | [diff] [blame] | 300 | TcpFlags(short value) { |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 301 | this.value = value; |
| 302 | } |
| 303 | |
| 304 | /** |
| 305 | * Gets the value as an integer. |
| 306 | * |
| 307 | * @return the value as an integer |
| 308 | */ |
| 309 | public short getValue() { |
| 310 | return this.value; |
| 311 | } |
| 312 | } |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 313 | } |