X-Git-Url: http://www.average.org/gitweb/?a=blobdiff_plain;f=loctrkd%2Fcommon.py;h=f112fbd53a51176e279b77c01cc05e6f32529bd2;hb=be1de0bb68c5c4acf2edd6f04c5ea8e40d9f31fb;hp=02b520f620d7d82582df949361b572327de283ac;hpb=023da3cd78841eb34d8286cf289995be658f0fa2;p=loctrkd.git diff --git a/loctrkd/common.py b/loctrkd/common.py index 02b520f..f112fbd 100644 --- a/loctrkd/common.py +++ b/loctrkd/common.py @@ -67,3 +67,12 @@ def pmod_for_proto(proto: str) -> Optional[ProtoModule]: if pmod.proto_handled(proto): return pmod return None + + +def parse_message(proto: str, packet: bytes, is_incoming: bool = True) -> Any: + pmod = pmod_for_proto(proto) + return pmod.parse_message(packet, is_incoming) if pmod else None + + +def exposed_protos() -> List[Tuple[str, bool]]: + return [item for pmod in pmods for item in pmod.exposed_protos()]