コード例 #1
0
 def handle_sibra_pkt(self, pkt):
     """
     Handle SIBRA packets. First determine which interface they came from,
     then pass them to the appropriate Link.
     """
     ext = find_ext_hdr(pkt, ExtensionClass.HOP_BY_HOP,
                        SibraExtSteady.EXT_TYPE)
     if not ext:
         logging.error("Packet contains no SIBRA extension header")
         return
     if not ext.steady:
         logging.error("Received non-steady SIBRA packet:\n%s", pkt)
         return
     if not ext.req_block:
         logging.error("Received non-request SIBRA packet:\n%s", pkt)
         return
     with self.lock:
         if ext.fwd:
             self._process_req(pkt, ext)
         else:
             self._process_reply(pkt, ext)
コード例 #2
0
 def get_ext(self, spkt):
     return find_ext_hdr(spkt, ExtensionClass.HOP_BY_HOP,
                         SibraExtEphemeral.EXT_TYPE)