mirror of
https://github.com/markqvist/Reticulum.git
synced 2024-11-22 21:50:18 +00:00
Refactored packet type naming
This commit is contained in:
parent
8772db6736
commit
dedea6ba11
@ -24,7 +24,7 @@ link 11
|
||||
|
||||
packet types
|
||||
-----------------
|
||||
resource 00
|
||||
data 00
|
||||
announce 01
|
||||
link request 10
|
||||
proof 11
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user