blob: 460457fe64fb458923cba268e80931407756d897 [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;
Ray Milkey019fba42018-01-31 14:07:47 -080020import org.onosproject.ospf.exceptions.OspfParseException;
Chidambar babu86b3b1a2016-02-16 17:39:52 +053021
22/**
23 * Representation of an OSPF message.
24 */
25public interface OspfMessage {
26
27 /**
sunishvkf7c56552016-07-18 16:02:39 +053028 * Returns the interface index on which the message received.
29 *
30 * @return interface index on which the message received
31 */
32 int interfaceIndex();
33
34 /**
35 * Sets the interface index on which the message received.
36 *
37 * @param interfaceIndex interface index on which the message received
38 */
39 void setInterfaceIndex(int interfaceIndex);
40
41 /**
Chidambar babu86b3b1a2016-02-16 17:39:52 +053042 * Returns the type of OSPF message.
43 *
44 * @return OSPF message type
45 */
46 public OspfPacketType ospfMessageType();
47
48 /**
49 * Reads from ChannelBuffer and initializes the type of LSA.
50 *
51 * @param channelBuffer channel buffer instance
Ray Milkey019fba42018-01-31 14:07:47 -080052 * @throws OspfParseException might throws exception while parsing buffer
Chidambar babu86b3b1a2016-02-16 17:39:52 +053053 */
Ray Milkey019fba42018-01-31 14:07:47 -080054 void readFrom(ChannelBuffer channelBuffer) throws OspfParseException;
Chidambar babu86b3b1a2016-02-16 17:39:52 +053055
56 /**
57 * Returns OSPFMessage as byte array.
58 *
59 * @return OSPF message as bytes
60 */
61 byte[] asBytes();
62
63 /**
64 * Sets the source IP address.
65 *
66 * @param sourceIp IP address
67 */
68 public void setSourceIp(Ip4Address sourceIp);
69
70 /**
71 * Gets the destination IP address.
72 *
73 * @return destination IP address
74 */
75 public Ip4Address destinationIp();
76
77 /**
78 * Sets destination IP.
79 *
80 * @param destinationIp destination IP address
81 */
82 public void setDestinationIp(Ip4Address destinationIp);
83}