blob: 77ebfb61e2c5ae685d0615bae6f4fdecbb031de2 [file] [log] [blame]
Jian Licb1fca22016-07-19 18:34:25 +09001/*
2 * Copyright 2016-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 */
16package org.onosproject.lisp.msg.protocols;
17
18import io.netty.buffer.ByteBuf;
Yoonseon Hanca814bf2016-09-12 11:37:48 -070019import org.onosproject.lisp.msg.exceptions.LispWriterException;
Jian Licb1fca22016-07-19 18:34:25 +090020
Jian Liafe2d3f2016-11-01 02:49:07 +090021import java.net.InetSocketAddress;
22
Jian Licb1fca22016-07-19 18:34:25 +090023/**
24 * LISP message interface.
25 */
26public interface LispMessage {
27
28 /**
29 * Obtains LISP message type.
30 *
31 * @return LISP message type
32 */
33 LispType getType();
34
35 /**
Jian Liafe2d3f2016-11-01 02:49:07 +090036 * Configures the sender's IP address with port number.
37 * Note that this information is used to make the UDP datagram packet.
38 *
39 * @param sender LISP message sender
40 */
41 void configSender(InetSocketAddress sender);
42
43 /**
44 * Obtains the sender's IP address with port number.
45 * Note that this information is used to make the UDP datagram packet.
46 *
47 * @return send's IP address with port number
48 */
49 InetSocketAddress getSender();
50
51 /**
Jian Licb1fca22016-07-19 18:34:25 +090052 * Writes LISP message object into communication channel.
53 *
54 * @param byteBuf byte buffer
Yoonseon Hanca814bf2016-09-12 11:37:48 -070055 * @throws LispWriterException if the writing request is failed due to
56 * the lisp object cannot be written to the buffer.
Jian Licb1fca22016-07-19 18:34:25 +090057 */
Yoonseon Hanca814bf2016-09-12 11:37:48 -070058 void writeTo(ByteBuf byteBuf) throws LispWriterException;
Jian Licb1fca22016-07-19 18:34:25 +090059
60 /**
61 * Generates LISP message builder.
62 *
63 * @return builder object
64 */
65 Builder createBuilder();
66
67 /**
68 * LISP message builder interface.
69 */
Jian Li719b3bf2016-07-22 00:38:29 +090070 interface Builder {
Jian Licb1fca22016-07-19 18:34:25 +090071
72 /**
Jian Licb1fca22016-07-19 18:34:25 +090073 * Obtains LISP message type.
74 *
75 * @return LISP message type
76 */
77 LispType getType();
78 }
79}