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; |
Chidambar babu | 86b3b1a | 2016-02-16 17:39:52 +0530 | [diff] [blame] | 20 | |
| 21 | /** |
| 22 | * Representation of an OSPF message. |
| 23 | */ |
| 24 | public interface OspfMessage { |
| 25 | |
| 26 | /** |
sunishvk | f7c5655 | 2016-07-18 16:02:39 +0530 | [diff] [blame] | 27 | * 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 babu | 86b3b1a | 2016-02-16 17:39:52 +0530 | [diff] [blame] | 41 | * 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 |
sunishvk | f7c5655 | 2016-07-18 16:02:39 +0530 | [diff] [blame] | 51 | * @throws Exception might throws exception while parsing buffer |
Chidambar babu | 86b3b1a | 2016-02-16 17:39:52 +0530 | [diff] [blame] | 52 | */ |
sunishvk | f7c5655 | 2016-07-18 16:02:39 +0530 | [diff] [blame] | 53 | void readFrom(ChannelBuffer channelBuffer) throws Exception; |
Chidambar babu | 86b3b1a | 2016-02-16 17:39:52 +0530 | [diff] [blame] | 54 | |
| 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 | } |