blob: 99ec7b9e05b5a71e3d584dd4b2a8247e35c7dbd5 [file] [log] [blame]
Jian Li47671902016-08-11 01:18:18 +09001/*
Jian Li672ebda2017-02-06 20:21:04 +09002 * Copyright 2017-present Open Networking Laboratory
Jian Li47671902016-08-11 01:18:18 +09003 *
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 */
16package org.onosproject.lisp.msg.protocols;
17
18import io.netty.buffer.ByteBuf;
Jian Li5e505c62016-12-05 02:44:24 +090019import org.onosproject.lisp.msg.exceptions.LispWriterException;
Jian Li672ebda2017-02-06 20:21:04 +090020import org.onosproject.lisp.msg.types.LispAfiAddress;
Jian Li47671902016-08-11 01:18:18 +090021
22/**
Jian Li672ebda2017-02-06 20:21:04 +090023 * A generic LISP locator used for both location and referral purposes.
Jian Li47671902016-08-11 01:18:18 +090024 */
Jian Li672ebda2017-02-06 20:21:04 +090025public interface LispGenericLocator {
Jian Li47671902016-08-11 01:18:18 +090026
27 /**
28 * Obtains priority value.
29 *
30 * @return priority value
31 */
32 byte getPriority();
33
34 /**
35 * Obtains weight value.
36 *
37 * @return weight value
38 */
39 byte getWeight();
40
41 /**
42 * Obtains multi-cast priority value.
43 *
44 * @return multi-cast priority value
45 */
46 byte getMulticastPriority();
47
48 /**
49 * Obtains multi-cast weight value.
50 *
51 * @return multi-cast weight value
52 */
53 byte getMulticastWeight();
54
55 /**
56 * Obtains local locator flag.
57 *
58 * @return local locator flag
59 */
60 boolean isLocalLocator();
61
62 /**
63 * Obtains RLOC probed flag.
64 *
65 * @return RLOC probed flag
66 */
67 boolean isRlocProbed();
68
69 /**
70 * Obtains routed flag.
71 *
72 * @return routed flag
73 */
74 boolean isRouted();
75
76 /**
77 * Obtains locator AFI.
78 *
79 * @return locator AFI
80 */
81 LispAfiAddress getLocatorAfi();
82
83 /**
84 * Writes LISP message object into communication channel.
85 *
86 * @param byteBuf byte buffer
Ray Milkey0bb1e102016-11-10 14:51:27 -080087 * @throws LispWriterException on error
Jian Li47671902016-08-11 01:18:18 +090088 */
Yoonseon Hanca814bf2016-09-12 11:37:48 -070089 void writeTo(ByteBuf byteBuf) throws LispWriterException;
Jian Li47671902016-08-11 01:18:18 +090090
91 /**
Jian Li672ebda2017-02-06 20:21:04 +090092 * A builder of LISP generic locator.
93 *
94 * @param <T> sub-builder type
Jian Li47671902016-08-11 01:18:18 +090095 */
Jian Li672ebda2017-02-06 20:21:04 +090096 interface GenericLocatorBuilder<T> {
Jian Li47671902016-08-11 01:18:18 +090097
98 /**
99 * Sets priority value.
100 *
101 * @param priority priority
Jian Li672ebda2017-02-06 20:21:04 +0900102 * @return parameterized object
Jian Li47671902016-08-11 01:18:18 +0900103 */
Jian Li672ebda2017-02-06 20:21:04 +0900104 T withPriority(byte priority);
Jian Li47671902016-08-11 01:18:18 +0900105
106 /**
107 * Sets weight value.
108 *
109 * @param weight weight
Jian Li672ebda2017-02-06 20:21:04 +0900110 * @return parameterized object
Jian Li47671902016-08-11 01:18:18 +0900111 */
Jian Li672ebda2017-02-06 20:21:04 +0900112 T withWeight(byte weight);
Jian Li47671902016-08-11 01:18:18 +0900113
114 /**
115 * Sets multi-cast priority value.
116 *
117 * @param priority priority
Jian Li672ebda2017-02-06 20:21:04 +0900118 * @return parameterized object
Jian Li47671902016-08-11 01:18:18 +0900119 */
Jian Li672ebda2017-02-06 20:21:04 +0900120 T withMulticastPriority(byte priority);
Jian Li47671902016-08-11 01:18:18 +0900121
122 /**
123 * Sets multi-cast weight value.
124 *
125 * @param weight weight
Jian Li672ebda2017-02-06 20:21:04 +0900126 * @return parameterized object
Jian Li47671902016-08-11 01:18:18 +0900127 */
Jian Li672ebda2017-02-06 20:21:04 +0900128 T withMulticastWeight(byte weight);
Jian Li47671902016-08-11 01:18:18 +0900129
130 /**
131 * Sets local locator flag.
132 *
133 * @param localLocator local locator flag
Jian Li672ebda2017-02-06 20:21:04 +0900134 * @return parameterized object
Jian Li47671902016-08-11 01:18:18 +0900135 */
Jian Li672ebda2017-02-06 20:21:04 +0900136 T withLocalLocator(boolean localLocator);
Jian Li47671902016-08-11 01:18:18 +0900137
138 /**
139 * Sets RLOC probed flag.
140 *
141 * @param rlocProbed RLOC probed flag
Jian Li672ebda2017-02-06 20:21:04 +0900142 * @return parameterized object
Jian Li47671902016-08-11 01:18:18 +0900143 */
Jian Li672ebda2017-02-06 20:21:04 +0900144 T withRlocProbed(boolean rlocProbed);
Jian Li47671902016-08-11 01:18:18 +0900145
146 /**
147 * Sets routed flag.
148 *
149 * @param routed routed flag
Jian Li672ebda2017-02-06 20:21:04 +0900150 * @return parameterized object
Jian Li47671902016-08-11 01:18:18 +0900151 */
Jian Li672ebda2017-02-06 20:21:04 +0900152 T withRouted(boolean routed);
Jian Li47671902016-08-11 01:18:18 +0900153
154 /**
155 * Sets locator AFI.
156 *
157 * @param locatorAfi locator AFI
Jian Li672ebda2017-02-06 20:21:04 +0900158 * @return parameterized object
Jian Li47671902016-08-11 01:18:18 +0900159 */
Jian Li672ebda2017-02-06 20:21:04 +0900160 T withLocatorAfi(LispAfiAddress locatorAfi);
Jian Li47671902016-08-11 01:18:18 +0900161 }
162}