Beispiel #1
0
 def pfstring_to_pfdict(self, pfstring):
     """Return a dictionary from the 'string' field of a status packet which
     contains a parameter file."""
     # TODO Should this be a method on DLSource since that's the only place
     # it's used?
     pfstring = pfstring.strip('\0')
     pfptr = _stock._pfnew()
     try:
         r = _stock._pfcompile(pfstring, pfptr)
         if r != 0: raise Exception("pfcompile failed")
         pfdict = _stock._pfget(pfptr, None)
         return pfdict
     finally:
         _stock._pffree(pfptr)
Beispiel #2
0
 def unstuff(self, srcname, time, raw_packet):
     pkt = None
     try:
         type, pkt = _pkt._unstuffPkt(srcname, time, raw_packet)
         check_error(type, UnstuffError)
         self.string = _pkt._Pkt_string_get(pkt)
         self.pkttype.update(dict(zip(self._pkttypefields,
             _pkt._Pkt_pkttype_get(pkt))))
         if _pkt._Pkt_type_get(pkt) == _pkt.Pkt_pf:
             pfptr = _pkt._Pkt_pfptr_get(pkt)
             if pfptr != None:
                 try:
                     self.pfdict = _stock._pfget(pfptr, None)
                 finally:
                     _stock._pffree(pfptr)
         self.time = time
     finally:
         if pkt is not None:
             _pkt._freePkt(pkt)