feat: implement list cast on packet flags
This commit is contained in:
parent
76b0a89375
commit
22f7b437bd
|
@ -45,6 +45,21 @@ class PacketFlags7(PrettyPrint):
|
||||||
self.compression: Optional[bool] = None
|
self.compression: Optional[bool] = None
|
||||||
self.connless: Optional[bool] = None
|
self.connless: Optional[bool] = None
|
||||||
|
|
||||||
|
def __iter__(self):
|
||||||
|
flags = []
|
||||||
|
if self.control:
|
||||||
|
flags.append('control')
|
||||||
|
if self.resend:
|
||||||
|
flags.append('resend')
|
||||||
|
if self.compression:
|
||||||
|
flags.append('compression')
|
||||||
|
if self.connless:
|
||||||
|
flags.append('connless')
|
||||||
|
return iter(flags)
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "<class: '" + str(self.__class__.__name__) + "'>: " + str(list(self))
|
||||||
|
|
||||||
class PacketFlags6(PrettyPrint):
|
class PacketFlags6(PrettyPrint):
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
self.token: Optional[bool] = None
|
self.token: Optional[bool] = None
|
||||||
|
@ -53,6 +68,23 @@ class PacketFlags6(PrettyPrint):
|
||||||
self.compression: Optional[bool] = None
|
self.compression: Optional[bool] = None
|
||||||
self.connless: Optional[bool] = None
|
self.connless: Optional[bool] = None
|
||||||
|
|
||||||
|
def __iter__(self):
|
||||||
|
flags = []
|
||||||
|
if self.token:
|
||||||
|
flags.append('token')
|
||||||
|
if self.control:
|
||||||
|
flags.append('control')
|
||||||
|
if self.resend:
|
||||||
|
flags.append('resend')
|
||||||
|
if self.compression:
|
||||||
|
flags.append('compression')
|
||||||
|
if self.connless:
|
||||||
|
flags.append('connless')
|
||||||
|
return iter(flags)
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "<class: '" + str(self.__class__.__name__) + "'>: " + str(list(self))
|
||||||
|
|
||||||
class PacketHeader6(PrettyPrint):
|
class PacketHeader6(PrettyPrint):
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
|
|
Loading…
Reference in a new issue