blob: 28148c1e0b25bc09b04622e39a49238a5c812f16 [file] [log] [blame]
Carmelo Cascone1022a4e2017-05-25 00:16:18 -04001/*
2 * Copyright 2017-present Open Networking Laboratory
3 *
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
7 *
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.
15 */
16
17package org.onosproject.net.pi.model;
18
19import com.google.common.annotations.Beta;
20
21/**
22 * Model of a header instance in a protocol-independent pipeline.
23 */
24@Beta
25public interface PiHeaderModel {
26 /**
27 * Returns the type of this header instance.
28 *
29 * @return a header type value
30 */
31 PiHeaderTypeModel type();
32
33 /**
34 * Returns true if this header instance is a metadata, false elsewhere.
35 *
36 * @return a boolean value
37 */
38 boolean isMetadata();
39
40 /**
41 * Returns the index of this header w.r.t. to other headers of the same type.
42 * Index 0 points to the first instance of the header, 1 the second one, etc.
43 * Helpful when dealing with stacked headers. e.g. to match on the second MPLS label.
44 *
45 * @return a non-negative integer value
46 */
47 default int index() {
48 return 0;
49 }
50}