Fix the LispMessageEncoder to reply with UDP message sender
- Add AbstractLispMessage to store sender IP address per message
- Fix the LispMacAuthentication class to accept byte array as input
- Rename LispMessageEncoderTest class
- Try to use MessageToMessageEncoder to result in UDP message
Change-Id: I977302cdadf5c96c60c889be291ad5d90e3bc7cf
diff --git a/protocols/lisp/ctl/src/main/java/org/onosproject/lisp/ctl/LispChannelHandler.java b/protocols/lisp/ctl/src/main/java/org/onosproject/lisp/ctl/LispChannelHandler.java
index d628838..6c723a6 100644
--- a/protocols/lisp/ctl/src/main/java/org/onosproject/lisp/ctl/LispChannelHandler.java
+++ b/protocols/lisp/ctl/src/main/java/org/onosproject/lisp/ctl/LispChannelHandler.java
@@ -19,6 +19,7 @@
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.handler.timeout.IdleState;
import io.netty.handler.timeout.IdleStateEvent;
+import io.netty.util.ReferenceCountUtil;
import org.onosproject.lisp.msg.protocols.LispEncapsulatedControl;
import org.onosproject.lisp.msg.protocols.LispMapNotify;
import org.onosproject.lisp.msg.protocols.LispMapRegister;
@@ -46,10 +47,12 @@
if (msg instanceof LispMapRegister) {
LispMapServer mapServer = new LispMapServer();
- LispMapNotify mapNotify =
- (LispMapNotify) mapServer.processMapRegister((LispMapRegister) msg);
+ LispMapNotify mapNotify = mapServer.processMapRegister((LispMapRegister) msg);
- // TODO: deserialize mapNotify message and write to channel
+ // try to remove the received map-register message from buffer
+ ReferenceCountUtil.release(msg);
+
+ ctx.writeAndFlush(mapNotify);
}
if (msg instanceof LispMapRequest) {
@@ -57,7 +60,7 @@
LispMapReply mapReply =
(LispMapReply) mapResolver.processMapRequest((LispMapRequest) msg);
- // TODO: deserialize mapReply message and write to channel
+ // TODO: serialize mapReply message and write to channel
}
}