Chidambar babu | 86b3b1a | 2016-02-16 17:39:52 +0530 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2016 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 | package org.onosproject.ospf.protocol.ospfpacket; |
| 17 | |
| 18 | import org.jboss.netty.buffer.ChannelBuffer; |
| 19 | import org.onlab.packet.Ip4Address; |
| 20 | import org.onosproject.ospf.exceptions.OspfParseException; |
| 21 | import org.onosproject.ospf.protocol.util.OspfPacketType; |
| 22 | |
| 23 | /** |
| 24 | * Representation of an OSPF message. |
| 25 | */ |
| 26 | public interface OspfMessage { |
| 27 | |
| 28 | /** |
| 29 | * Returns the type of OSPF message. |
| 30 | * |
| 31 | * @return OSPF message type |
| 32 | */ |
| 33 | public OspfPacketType ospfMessageType(); |
| 34 | |
| 35 | /** |
| 36 | * Reads from ChannelBuffer and initializes the type of LSA. |
| 37 | * |
| 38 | * @param channelBuffer channel buffer instance |
| 39 | * @throws OspfParseException might throws exception while parsing buffer |
| 40 | */ |
| 41 | void readFrom(ChannelBuffer channelBuffer) throws OspfParseException; |
| 42 | |
| 43 | /** |
| 44 | * Returns OSPFMessage as byte array. |
| 45 | * |
| 46 | * @return OSPF message as bytes |
| 47 | */ |
| 48 | byte[] asBytes(); |
| 49 | |
| 50 | /** |
| 51 | * Sets the source IP address. |
| 52 | * |
| 53 | * @param sourceIp IP address |
| 54 | */ |
| 55 | public void setSourceIp(Ip4Address sourceIp); |
| 56 | |
| 57 | /** |
| 58 | * Gets the destination IP address. |
| 59 | * |
| 60 | * @return destination IP address |
| 61 | */ |
| 62 | public Ip4Address destinationIp(); |
| 63 | |
| 64 | /** |
| 65 | * Sets destination IP. |
| 66 | * |
| 67 | * @param destinationIp destination IP address |
| 68 | */ |
| 69 | public void setDestinationIp(Ip4Address destinationIp); |
| 70 | } |