private SimpleMapCache smc;
private AuthenticationKeyDataListener authenticationKeyDataListener;
private DataStoreBackEnd dsbe;
+ private boolean isReadFromChannelEnabled = true;
public LispSouthboundHandler(LispSouthboundPlugin lispSbPlugin) {
this.lispSbPlugin = lispSbPlugin;
final MapRegisterCacheValueBuilder cacheValueBldNew = new MapRegisterCacheValueBuilder();
cacheValueBldNew.setPacketData(artificialEntry.getValue());
- cacheValueBldNew.setAuthKeyValue(mappingAuthkey.getKeyString());
- cacheValueBldNew.setAuthKeyType(mappingAuthkey.getKeyType());
+ cacheValueBldNew.setMappingAuthkey(mappingAuthkey);
cacheValueBldNew.setMapRegisterCacheMetadata(cacheMetadataBldNew.build());
mapRegisterCache.addEntry(cacheKey, cacheValueBldNew.build());
final MapRegisterCacheMetadataBuilder newMapRegisterCacheMetadataBuilder =
new MapRegisterCacheMetadataBuilder(mapRegisterCacheValue.getMapRegisterCacheMetadata());
- newMapRegisterCacheValueBuilder.setAuthKeyValue(mappingAuthkey.getKeyString());
- newMapRegisterCacheValueBuilder.setAuthKeyType(mappingAuthkey.getKeyType());
+ newMapRegisterCacheValueBuilder.setMappingAuthkey(mappingAuthkey);
newMapRegisterCacheValueBuilder.setMapRegisterCacheMetadata(newMapRegisterCacheMetadataBuilder.build());
return newMapRegisterCacheValueBuilder.build();
}
private void sendMapNotifyMsg(final ByteBuffer inBuffer, final InetAddress inetAddress, int portNumber,
MapRegisterCacheValue mapRegisterValue) {
- if (mapRegisterValue.getAuthKeyType() != null) {
+ if (mapRegisterValue.getMappingAuthkey().getKeyType() != null) {
ByteBuffer outBuffer = transformMapRegisterToMapNotify(inBuffer);
- if (mapRegisterValue.getAuthKeyType() != 0) {
- outBuffer = calculateAndSetNewMAC(outBuffer, mapRegisterValue.getAuthKeyValue());
+ if (mapRegisterValue.getMappingAuthkey().getKeyType() != 0) {
+ outBuffer = calculateAndSetNewMAC(outBuffer, mapRegisterValue.getMappingAuthkey().getKeyString());
}
outBuffer.position(0);
lispSbPlugin.handleSerializedLispBuffer(inetAddress, outBuffer, MessageType.MapNotify, portNumber);
@Override
protected void channelRead0(ChannelHandlerContext ctx, DatagramPacket msg) throws Exception {
- if (LOG.isTraceEnabled()) {
- LOG.trace("Received UDP packet from {}:{} with content:\n{}", msg.sender().getHostString(),
- msg.sender().getPort(), ByteBufUtil.prettyHexDump(msg.content()));
+ if (isReadFromChannelEnabled) {
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Received UDP packet from {}:{} with content:\n{}", msg.sender().getHostString(),
+ msg.sender().getPort(), ByteBufUtil.prettyHexDump(msg.content()));
+ }
+ handlePacket(msg);
}
- handlePacket(msg);
}
@Override
this.authenticationKeyDataListener = new AuthenticationKeyDataListener(dataBroker, smc);
dsbe = new DataStoreBackEnd(dataBroker);
}
+
+ public void setIsReadFromChannelEnabled(boolean isReadFromChannelEnabled) {
+ this.isReadFromChannelEnabled = isReadFromChannelEnabled;
+ }
}