blob: 99491467e9f2b60414485af1f0daaaf79fd8f785 [file] [log] [blame]
Chidambar babu86b3b1a2016-02-16 17:39:52 +05301/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
Chidambar babu86b3b1a2016-02-16 17:39:52 +05303 *
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 */
sunishvkf7c56552016-07-18 16:02:39 +053016package org.onosproject.ospf.controller;
Chidambar babu86b3b1a2016-02-16 17:39:52 +053017
18import org.jboss.netty.buffer.ChannelBuffer;
19import org.onlab.packet.Ip4Address;
Chidambar babu86b3b1a2016-02-16 17:39:52 +053020
21/**
22 * Representation of an OSPF message.
23 */
24public interface OspfMessage {
25
26 /**
sunishvkf7c56552016-07-18 16:02:39 +053027 * Returns the interface index on which the message received.
28 *
29 * @return interface index on which the message received
30 */
31 int interfaceIndex();
32
33 /**
34 * Sets the interface index on which the message received.
35 *
36 * @param interfaceIndex interface index on which the message received
37 */
38 void setInterfaceIndex(int interfaceIndex);
39
40 /**
Chidambar babu86b3b1a2016-02-16 17:39:52 +053041 * Returns the type of OSPF message.
42 *
43 * @return OSPF message type
44 */
45 public OspfPacketType ospfMessageType();
46
47 /**
48 * Reads from ChannelBuffer and initializes the type of LSA.
49 *
50 * @param channelBuffer channel buffer instance
sunishvkf7c56552016-07-18 16:02:39 +053051 * @throws Exception might throws exception while parsing buffer
Chidambar babu86b3b1a2016-02-16 17:39:52 +053052 */
sunishvkf7c56552016-07-18 16:02:39 +053053 void readFrom(ChannelBuffer channelBuffer) throws Exception;
Chidambar babu86b3b1a2016-02-16 17:39:52 +053054
55 /**
56 * Returns OSPFMessage as byte array.
57 *
58 * @return OSPF message as bytes
59 */
60 byte[] asBytes();
61
62 /**
63 * Sets the source IP address.
64 *
65 * @param sourceIp IP address
66 */
67 public void setSourceIp(Ip4Address sourceIp);
68
69 /**
70 * Gets the destination IP address.
71 *
72 * @return destination IP address
73 */
74 public Ip4Address destinationIp();
75
76 /**
77 * Sets destination IP.
78 *
79 * @param destinationIp destination IP address
80 */
81 public void setDestinationIp(Ip4Address destinationIp);
82}