Chidambar babu | 86b3b1a | 2016-02-16 17:39:52 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Foundation |
Chidambar babu | 86b3b1a | 2016-02-16 17:39:52 +0530 | [diff] [blame] | 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 | */ |
sunishvk | f7c5655 | 2016-07-18 16:02:39 +0530 | [diff] [blame] | 16 | package org.onosproject.ospf.controller; |
Chidambar babu | 86b3b1a | 2016-02-16 17:39:52 +0530 | [diff] [blame] | 17 | |
| 18 | import org.jboss.netty.buffer.ChannelBuffer; |
| 19 | import org.onlab.packet.Ip4Address; |
Ray Milkey | 019fba4 | 2018-01-31 14:07:47 -0800 | [diff] [blame^] | 20 | import org.onosproject.ospf.exceptions.OspfParseException; |
Chidambar babu | 86b3b1a | 2016-02-16 17:39:52 +0530 | [diff] [blame] | 21 | |
| 22 | /** |
| 23 | * Representation of an OSPF message. |
| 24 | */ |
| 25 | public interface OspfMessage { |
| 26 | |
| 27 | /** |
sunishvk | f7c5655 | 2016-07-18 16:02:39 +0530 | [diff] [blame] | 28 | * 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 babu | 86b3b1a | 2016-02-16 17:39:52 +0530 | [diff] [blame] | 42 | * 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 Milkey | 019fba4 | 2018-01-31 14:07:47 -0800 | [diff] [blame^] | 52 | * @throws OspfParseException might throws exception while parsing buffer |
Chidambar babu | 86b3b1a | 2016-02-16 17:39:52 +0530 | [diff] [blame] | 53 | */ |
Ray Milkey | 019fba4 | 2018-01-31 14:07:47 -0800 | [diff] [blame^] | 54 | void readFrom(ChannelBuffer channelBuffer) throws OspfParseException; |
Chidambar babu | 86b3b1a | 2016-02-16 17:39:52 +0530 | [diff] [blame] | 55 | |
| 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 | } |