Acknowledge Data TLVs
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
parent
e1f0d54ac8
commit
901d4aad05
|
@ -212,6 +212,9 @@ class DataTLV(TLV):
|
||||||
# The message was already received
|
# The message was already received
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Acknowledge the packet
|
||||||
|
squirrel.send_packet(sender, Packet.construct(AckTLV.construct(sender.id, self.nonce)))
|
||||||
|
|
||||||
nickname_match = re.match("(.*): (.*)", msg)
|
nickname_match = re.match("(.*): (.*)", msg)
|
||||||
if nickname_match is None:
|
if nickname_match is None:
|
||||||
squirrel.send_packet(sender, Packet.construct(WarningTLV.construct(
|
squirrel.send_packet(sender, Packet.construct(WarningTLV.construct(
|
||||||
|
@ -263,6 +266,15 @@ class AckTLV(TLV):
|
||||||
# TODO Implement AckTLV
|
# TODO Implement AckTLV
|
||||||
squirrel.add_system_message("I received an AckTLV. I don't know what to do with it. Please implement me!")
|
squirrel.add_system_message("I received an AckTLV. I don't know what to do with it. Please implement me!")
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def construct(sender_id: int, nonce: int) -> "AckTLV":
|
||||||
|
tlv = AckTLV()
|
||||||
|
tlv.type = 5
|
||||||
|
tlv.length = 12
|
||||||
|
tlv.sender_id = sender_id
|
||||||
|
tlv.nonce = nonce
|
||||||
|
return tlv
|
||||||
|
|
||||||
|
|
||||||
class GoAwayTLV(TLV):
|
class GoAwayTLV(TLV):
|
||||||
class GoAwayType(Enum):
|
class GoAwayType(Enum):
|
||||||
|
|
Loading…
Reference in New Issue