Thomas Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 1 | /* |
Ray Milkey | 34c9590 | 2015-04-15 09:47:53 -0700 | [diff] [blame] | 2 | * Copyright 2014-2015 Open Networking Laboratory |
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 | |
Jonathan Hart | c7840bd | 2016-01-21 23:26:29 -0800 | [diff] [blame] | 24 | static final String SEPARATOR = ":"; |
| 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 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 43 | /** Ethernet source address. */ |
| 44 | ETH_SRC, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 45 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 46 | /** Ethernet frame type. */ |
| 47 | ETH_TYPE, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 48 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 49 | /** VLAN id. */ |
| 50 | VLAN_VID, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 51 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 52 | /** VLAN priority. */ |
| 53 | VLAN_PCP, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 54 | |
alshabib | fa0dc66 | 2016-01-13 11:23:53 -0800 | [diff] [blame] | 55 | /** |
| 56 | * Inner VLAN id. |
| 57 | * |
| 58 | * Note: Some drivers may not support this. |
| 59 | */ |
| 60 | INNER_VLAN_VID, |
| 61 | |
| 62 | /** |
| 63 | * Inner VLAN pcp. |
| 64 | * |
| 65 | * Note: Some drivers may not support this. |
| 66 | */ |
| 67 | INNER_VLAN_PCP, |
| 68 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 69 | /** IP DSCP (6 bits in ToS field). */ |
| 70 | IP_DSCP, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 71 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 72 | /** IP ECN (2 bits in ToS field). */ |
| 73 | IP_ECN, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 74 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 75 | /** IP protocol. */ |
| 76 | IP_PROTO, |
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 | /** IPv4 source address. */ |
| 79 | IPV4_SRC, |
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 | /** IPv4 destination address. */ |
| 82 | IPV4_DST, |
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 | /** TCP source port. */ |
| 85 | TCP_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 | /** TCP destination port. */ |
| 88 | TCP_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 | /** UDP source port. */ |
| 91 | UDP_SRC, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 92 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 93 | /** UDP destination port. */ |
| 94 | UDP_DST, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 95 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 96 | /** SCTP source port. */ |
| 97 | SCTP_SRC, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 98 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 99 | /** SCTP destination port. */ |
| 100 | SCTP_DST, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 101 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 102 | /** ICMP type. */ |
| 103 | ICMPV4_TYPE, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 104 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 105 | /** ICMP code. */ |
| 106 | ICMPV4_CODE, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 107 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 108 | /** ARP opcode. */ |
| 109 | ARP_OP, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 110 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 111 | /** ARP source IPv4 address. */ |
| 112 | ARP_SPA, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 113 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 114 | /** ARP target IPv4 address. */ |
| 115 | ARP_TPA, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 116 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 117 | /** ARP source hardware address. */ |
| 118 | ARP_SHA, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 119 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 120 | /** ARP target hardware address. */ |
| 121 | ARP_THA, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 122 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 123 | /** IPv6 source address. */ |
| 124 | IPV6_SRC, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 125 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 126 | /** IPv6 destination address. */ |
| 127 | IPV6_DST, |
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 | /** IPv6 Flow Label. */ |
| 130 | IPV6_FLABEL, |
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 | /** ICMPv6 type. */ |
| 133 | ICMPV6_TYPE, |
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 | /** ICMPv6 code. */ |
| 136 | ICMPV6_CODE, |
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 | /** Target address for ND. */ |
| 139 | IPV6_ND_TARGET, |
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 | /** Source link-layer for ND. */ |
| 142 | IPV6_ND_SLL, |
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 | /** Target link-layer for ND. */ |
| 145 | IPV6_ND_TLL, |
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 | /** MPLS label. */ |
| 148 | MPLS_LABEL, |
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 | /** MPLS TC. */ |
| 151 | MPLS_TC, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 152 | |
| 153 | /** MPLS BoS bit. */ |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 154 | MPLS_BOS, |
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 | /** PBB I-SID. */ |
| 157 | PBB_ISID, |
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 | /** Logical Port Metadata. */ |
| 160 | TUNNEL_ID, |
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 | /** IPv6 Extension Header pseudo-field. */ |
Marc De Leenheer | 4908775 | 2014-10-23 13:54:09 -0700 | [diff] [blame] | 163 | IPV6_EXTHDR, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 164 | |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 165 | /** Unassigned value: 40. */ |
| 166 | UNASSIGNED_40, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 167 | |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 168 | /** PBB UCA header field. */ |
| 169 | PBB_UCA, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 170 | |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 171 | /** TCP flags. */ |
| 172 | TCP_FLAGS, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 173 | |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 174 | /** Output port from action set metadata. */ |
| 175 | ACTSET_OUTPUT, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 176 | |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 177 | /** Packet type value. */ |
| 178 | PACKET_TYPE, |
| 179 | |
| 180 | // |
| 181 | // NOTE: Everything below is defined elsewhere: ONOS-specific, |
| 182 | // extensions, etc. |
| 183 | // |
Marc De Leenheer | 4908775 | 2014-10-23 13:54:09 -0700 | [diff] [blame] | 184 | /** Optical channel signal ID (lambda). */ |
| 185 | OCH_SIGID, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 186 | |
Marc De Leenheer | 4908775 | 2014-10-23 13:54:09 -0700 | [diff] [blame] | 187 | /** Optical channel signal type (fixed or flexible). */ |
alshabib | a3a476d | 2015-04-10 14:35:38 -0700 | [diff] [blame] | 188 | OCH_SIGTYPE, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 189 | |
Yafit Hadar | 52d8155 | 2015-10-07 12:26:52 +0300 | [diff] [blame] | 190 | /** ODU (Optical channel Data Unit) signal ID. */ |
| 191 | ODU_SIGID, |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 192 | |
Yafit Hadar | 52d8155 | 2015-10-07 12:26:52 +0300 | [diff] [blame] | 193 | /** ODU (Optical channel Data Unit) signal type. */ |
| 194 | ODU_SIGTYPE, |
alshabib | a3a476d | 2015-04-10 14:35:38 -0700 | [diff] [blame] | 195 | |
Jonathan Hart | 26a8d95 | 2015-12-02 15:16:35 -0800 | [diff] [blame] | 196 | /** Extension criterion. */ |
| 197 | EXTENSION, |
| 198 | |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 199 | /** An empty criterion. */ |
alshabib | a3a476d | 2015-04-10 14:35:38 -0700 | [diff] [blame] | 200 | DUMMY |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 201 | } |
| 202 | |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 203 | /** |
| 204 | * Returns the type of criterion. |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 205 | * |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 206 | * @return type of criterion |
| 207 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 208 | Type type(); |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 209 | |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 210 | /** |
| 211 | * Bit definitions for IPv6 Extension Header pseudo-field. |
| 212 | * From page 79 of OpenFlow 1.5.0 spec. |
| 213 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 214 | enum IPv6ExthdrFlags { |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 215 | /** "No next header" encountered. */ |
Charles M.C. Chan | 2184de1 | 2015-04-26 02:24:53 +0800 | [diff] [blame] | 216 | NONEXT((short) (1 << 0)), |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 217 | /** Encrypted Sec Payload header present. */ |
Charles M.C. Chan | 2184de1 | 2015-04-26 02:24:53 +0800 | [diff] [blame] | 218 | ESP((short) (1 << 1)), |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 219 | /** Authentication header present. */ |
Charles M.C. Chan | 2184de1 | 2015-04-26 02:24:53 +0800 | [diff] [blame] | 220 | AUTH((short) (1 << 2)), |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 221 | /** 1 or 2 dest headers present. */ |
Charles M.C. Chan | 2184de1 | 2015-04-26 02:24:53 +0800 | [diff] [blame] | 222 | DEST((short) (1 << 3)), |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 223 | /** Fragment header present. */ |
Charles M.C. Chan | 2184de1 | 2015-04-26 02:24:53 +0800 | [diff] [blame] | 224 | FRAG((short) (1 << 4)), |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 225 | /** Router header present. */ |
Charles M.C. Chan | 2184de1 | 2015-04-26 02:24:53 +0800 | [diff] [blame] | 226 | ROUTER((short) (1 << 5)), |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 227 | /** Hop-by-hop header present. */ |
Charles M.C. Chan | 2184de1 | 2015-04-26 02:24:53 +0800 | [diff] [blame] | 228 | HOP((short) (1 << 6)), |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 229 | /** Unexpected repeats encountered. */ |
Charles M.C. Chan | 2184de1 | 2015-04-26 02:24:53 +0800 | [diff] [blame] | 230 | UNREP((short) (1 << 7)), |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 231 | /** Unexpected sequencing encountered. */ |
Charles M.C. Chan | 2184de1 | 2015-04-26 02:24:53 +0800 | [diff] [blame] | 232 | UNSEQ((short) (1 << 8)); |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 233 | |
Charles M.C. Chan | 2184de1 | 2015-04-26 02:24:53 +0800 | [diff] [blame] | 234 | private short value; |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 235 | |
Charles M.C. Chan | 2184de1 | 2015-04-26 02:24:53 +0800 | [diff] [blame] | 236 | IPv6ExthdrFlags(short value) { |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 237 | this.value = value; |
| 238 | } |
| 239 | |
| 240 | /** |
| 241 | * Gets the value as an integer. |
| 242 | * |
| 243 | * @return the value as an integer |
| 244 | */ |
Charles M.C. Chan | 2184de1 | 2015-04-26 02:24:53 +0800 | [diff] [blame] | 245 | public short getValue() { |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 246 | return this.value; |
| 247 | } |
| 248 | } |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 249 | |
Jonathan Hart | 51539b8 | 2015-10-29 09:53:04 -0700 | [diff] [blame^] | 250 | enum TcpFlags { |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 251 | |
| 252 | /** ECN-nonce concealment protection. */ |
| 253 | NS((short) (1 << 0)), |
| 254 | /** Congestion Window Reduced. */ |
| 255 | CWR((short) (1 << 1)), |
| 256 | /** ECN-Echo. **/ |
| 257 | ECE((short) (1 << 2)), |
| 258 | /** Urgent pointer field is significant. */ |
| 259 | URG((short) (1 << 3)), |
| 260 | /** Acknowledgment field is significant. */ |
| 261 | ACK((short) (1 << 4)), |
| 262 | /** Push the buffered data to the receiving application. */ |
| 263 | PSH((short) (1 << 5)), |
| 264 | /** Reset the connection. */ |
| 265 | RST((short) (1 << 6)), |
| 266 | /** Synchronize sequence numbers. */ |
| 267 | SYN((short) (1 << 7)), |
| 268 | /** No more data from sender. */ |
| 269 | FIN((short) (1 << 8)); |
| 270 | |
| 271 | private short value; |
| 272 | |
Jonathan Hart | 51539b8 | 2015-10-29 09:53:04 -0700 | [diff] [blame^] | 273 | TcpFlags(short value) { |
Jian Li | 79bdf3c | 2015-11-30 14:54:54 -0800 | [diff] [blame] | 274 | this.value = value; |
| 275 | } |
| 276 | |
| 277 | /** |
| 278 | * Gets the value as an integer. |
| 279 | * |
| 280 | * @return the value as an integer |
| 281 | */ |
| 282 | public short getValue() { |
| 283 | return this.value; |
| 284 | } |
| 285 | } |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 286 | } |