blob: 22d1a244f5cdec1efbf2e5d380b8a5e539a4405f [file] [log] [blame]
Carmelo Cascone1022a4e2017-05-25 00:16:18 -04001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2017-present Open Networking Foundation
Carmelo Cascone1022a4e2017-05-25 00:16:18 -04003 *
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 {
Carmelo Cascone2cad9ef2017-08-01 21:52:07 +020026
27 /**
28 * Returns the name of this header instance.
29 *
30 * @return a string value
31 */
32 String name();
33
Carmelo Cascone1022a4e2017-05-25 00:16:18 -040034 /**
35 * Returns the type of this header instance.
36 *
37 * @return a header type value
38 */
39 PiHeaderTypeModel type();
40
41 /**
42 * Returns true if this header instance is a metadata, false elsewhere.
43 *
44 * @return a boolean value
45 */
46 boolean isMetadata();
47
48 /**
49 * Returns the index of this header w.r.t. to other headers of the same type.
50 * Index 0 points to the first instance of the header, 1 the second one, etc.
51 * Helpful when dealing with stacked headers. e.g. to match on the second MPLS label.
52 *
53 * @return a non-negative integer value
54 */
55 default int index() {
56 return 0;
57 }
58}