Fix raw type warnings in bgp/bmp
[bgpcep.git] / bgp / parser-spi / src / main / java / org / opendaylight / protocol / bgp / parser / spi / MessageRegistry.java
index d4dd27d62a042edea7b831260b2ffa45e3b0cb5e..84088ce2388e04139b9032ff747a761b1b3abb55 100644 (file)
@@ -7,11 +7,31 @@
  */
 package org.opendaylight.protocol.bgp.parser.spi;
 
+import io.netty.buffer.ByteBuf;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
 import org.opendaylight.protocol.bgp.parser.BGPParsingException;
 import org.opendaylight.yangtools.yang.binding.Notification;
 
+/**
+ * BGP Message codec registry, provides services to encode/decode messages.
+ */
+@NonNullByDefault
 public interface MessageRegistry {
-       public Notification parseMessage(final byte[] bytes) throws BGPDocumentedException, BGPParsingException;
-       public byte[] serializeMessage(Notification message);
+    /**
+     * Decode input buffer to BGP Message.
+     * @param bytes Input buffer with encoded message.
+     * @param constraint Peer specific constraint.
+     * @return Parsed BGP message.
+     */
+    Notification<?> parseMessage(ByteBuf bytes, @Nullable PeerSpecificParserConstraint constraint)
+            throws BGPDocumentedException, BGPParsingException;
+
+    /**
+     * Encode input BGP Message to output buffer.
+     * @param message Input BGP Message to be serialized.
+     * @param buffer Output buffer where message is to be written.
+     */
+    void serializeMessage(Notification<?> message, ByteBuf buffer);
 }