forked from KNEMC/KLALB
feat(srv6)!: add node-info update invalidation
Publish node metadata through Tiny and Full queries, synchronize Swing and web topology details, and document the updated protocol workflow. BREAKING CHANGE: RouterInfo no longer carries device names; peers must use Tiny node-info queries.
This commit is contained in:
@@ -95,8 +95,12 @@ public abstract class KLALBRoutingProtocolPacket extends NetworkPacket {
|
||||
return readKLALBPacketFromChannel(Channels.newChannel(in));
|
||||
}
|
||||
|
||||
public static KLALBRoutingProtocolPacket readKLALBPacketFromChannel(ReadableByteChannel in) throws IOException {
|
||||
while(true) {
|
||||
public static KLALBRoutingProtocolPacket readKLALBPacketFromChannel(ReadableByteChannel in) throws IOException {
|
||||
return readKLALBPacketFromChannel(in, -1);
|
||||
}
|
||||
|
||||
public static KLALBRoutingProtocolPacket readKLALBPacketFromChannel(ReadableByteChannel in, long packetLength) throws IOException {
|
||||
while(true) {
|
||||
ByteBuffer bb=NetworkPacket.bufferAllocator.allocate(40);
|
||||
bb.limit(1);
|
||||
while(bb.hasRemaining()){
|
||||
@@ -109,18 +113,20 @@ public abstract class KLALBRoutingProtocolPacket extends NetworkPacket {
|
||||
|
||||
KLALBRoutingProtocolPacket klp;
|
||||
switch(type) {
|
||||
case RINFO_REQ:
|
||||
klp=new RouterInfoRequestPacket(bb);
|
||||
klp.readFromChannel(in);
|
||||
return klp;
|
||||
case RINFO:
|
||||
klp=new RouterInfoPacket(bb);
|
||||
klp.readFromChannel(in);
|
||||
return klp;
|
||||
case JSON_DATA:
|
||||
klp=new JsonDataPacket(bb);
|
||||
klp.readFromChannel(in);
|
||||
return klp;
|
||||
case RINFO_REQ:
|
||||
klp=new RouterInfoRequestPacket(bb);
|
||||
if(packetLength < 0) klp.readFromChannel(in);
|
||||
else klp.readFromChannel(in, packetLength);
|
||||
return klp;
|
||||
case RINFO:
|
||||
klp=new RouterInfoPacket(bb);
|
||||
if(packetLength < 0) klp.readFromChannel(in);
|
||||
else klp.readFromChannel(in, packetLength);
|
||||
return klp;
|
||||
case JSON_DATA:
|
||||
klp=new JsonDataPacket(bb);
|
||||
klp.readFromChannel(in);
|
||||
return klp;
|
||||
}
|
||||
//throw new StreamCorruptedException("unknown package type:"+type);
|
||||
System.err.println("ignore unknown KLALBRoutingProtocolPacket type:"+type);
|
||||
|
||||
Reference in New Issue
Block a user