blob: f8113ab7f0fa881947577519461267cd9c122afd [file] [log] [blame]
Yoonseon Hanca814bf2016-09-12 11:37:48 -07001/*
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 */
16
17package org.onosproject.lisp.msg.protocols;
18
19import org.onlab.packet.IP;
20import org.onlab.packet.UDP;
21
22/**
23 * LISP Encapsulated Control Message (ECM) interface.
24 * <p>
25 * LISP ECM format is defined in RFC6830.
26 * https://tools.ietf.org/html/rfc6830#section-6.1.8
27 *
28 * <pre>
29 * {@literal
30 * 0 1 2 3
31 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
32 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
33 * / | IPv4 or IPv6 Header |
34 * OH | (uses RLOC addresses) |
35 * \ | |
36 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
37 * / | Source Port = xxxx | Dest Port = 4342 |
38 * UDP +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
39 * \ | UDP Length | UDP Checksum |
40 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
41 * LH |Type=8 |S| Reserved |
42 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
43 * / | IPv4 or IPv6 Header |
44 * IH | (uses RLOC or EID addresses) |
45 * \ | |
46 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
47 * / | Source Port = xxxx | Dest Port = yyyy |
48 * UDP +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
49 * \ | UDP Length | UDP Checksum |
50 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
51 * LCM | LISP Control Message |
52 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
53 * }</pre>
54 */
55public interface LispEncapsulatedControl extends LispMessage {
56
57 /**
58 * Obtains security flag.
59 * If this bit is set, the 'Reserved' field will have the authentication data.
60 *
61 * @return security flag
62 */
63 boolean isSecurity();
64
65 /**
66 * Obtains inner IP header.
67 *
68 * @return inner IP header
69 */
70 IP innerIpHeader();
71
72 /**
73 * Obtains inner LISP UDP header.
74 *
75 * @return inner LISP UDP header
76 */
77 UDP innerUdp();
78
79 /**
80 * Obtains inner LISP control message.
81 * The format can be one of other LISP messages.
82 *
83 * @return Inner lisp control messages
84 */
85
86 LispMessage getControlMessage();
87
88 /**
89 * A builder of LISP map request message.
90 */
91 interface EcmBuilder extends Builder {
92
93 /**
94 * Sets security flag.
95 *
96 * @param security security flag
97 * @return ECMBuilder object
98 */
99 EcmBuilder isSecurity(boolean security);
100
101 /**
102 * Sets inner IP header.
103 *
104 * @param innerIpHeader inner IP header in IPv4 or IPv6
105 * @return ECMBuilder object
106 */
107 EcmBuilder innerIpHeader(IP innerIpHeader);
108
109 /**
110 * Sets inner UDP header.
111 *
112 * @param innerUdpHeader inner UDP packet
113 * @return ECMBuilder object
114 */
115 EcmBuilder innerUdpHeader(UDP innerUdpHeader);
116
117 /**
118 * Sets inner LISP control message.
119 *
120 * @param msg the inner lisp message
121 * @return ECMBuilder object
122 */
123 EcmBuilder innerLispMessage(LispMessage msg);
124
125 /**
126 * Builds LISP ECM message.
127 *
128 * @return LISP ECM message
129 */
130 LispEncapsulatedControl build();
131 }
132}