]> www.average.org Git - loctrkd.git/blobdiff - loctrkd/common.py
rectifier: lookaside based on rectified objects
[loctrkd.git] / loctrkd / common.py
index 02b520f620d7d82582df949361b572327de283ac..f112fbd53a51176e279b77c01cc05e6f32529bd2 100644 (file)
@@ -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()]