From dedea6ba117851f701b259e3cfdfc5fda3daf962 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Mon, 16 Apr 2018 22:09:23 +0200 Subject: [PATCH] Refactored packet type naming --- Notes/Header format | 2 +- RNS/Destination.py | 2 +- RNS/Packet.py | 6 +++--- RNS/Transport.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Notes/Header format b/Notes/Header format index 41e3409..f32409c 100644 --- a/Notes/Header format +++ b/Notes/Header format @@ -24,7 +24,7 @@ link 11 packet types ----------------- -resource 00 +data 00 announce 01 link request 10 proof 11 diff --git a/RNS/Destination.py b/RNS/Destination.py index 402c3fc..9d6e252 100755 --- a/RNS/Destination.py +++ b/RNS/Destination.py @@ -116,7 +116,7 @@ class Destination: if packet.packet_type == RNS.Packet.LINKREQUEST: self.incomingLinkRequest(plaintext, packet) - if packet.packet_type == RNS.Packet.RESOURCE: + if packet.packet_type == RNS.Packet.DATA: if self.callbacks.packet != None: self.callbacks.packet(plaintext, packet) diff --git a/RNS/Packet.py b/RNS/Packet.py index 05e030e..e94e731 100755 --- a/RNS/Packet.py +++ b/RNS/Packet.py @@ -4,11 +4,11 @@ import RNS class Packet: # Constants - RESOURCE = 0x00; + DATA = 0x00; ANNOUNCE = 0x01; LINKREQUEST = 0x02; PROOF = 0x03; - types = [RESOURCE, ANNOUNCE, LINKREQUEST, PROOF] + types = [DATA, ANNOUNCE, LINKREQUEST, PROOF] HEADER_1 = 0x00; # Normal header format HEADER_2 = 0x01; # Header format used for link packets in transport @@ -16,7 +16,7 @@ class Packet: HEADER_4 = 0x03; # Reserved header_types = [HEADER_1, HEADER_2, HEADER_3, HEADER_4] - def __init__(self, destination, data, packet_type = RESOURCE, transport_type = RNS.Transport.BROADCAST, header_type = HEADER_1, transport_id = None): + def __init__(self, destination, data, packet_type = DATA, transport_type = RNS.Transport.BROADCAST, header_type = HEADER_1, transport_id = None): if destination != None: if transport_type == None: transport_type = RNS.Transport.BROADCAST diff --git a/RNS/Transport.py b/RNS/Transport.py index a5a649f..e56fd84 100755 --- a/RNS/Transport.py +++ b/RNS/Transport.py @@ -51,7 +51,7 @@ class Transport: destination.receive(packet) Transport.cache(packet) - if packet.packet_type == RNS.Packet.RESOURCE: + if packet.packet_type == RNS.Packet.DATA: if packet.destination_type == RNS.Destination.LINK: for link in Transport.active_links: if link.link_id == packet.destination_hash: