def encode(self, pdu): """encode the contents of the BVLCI into the PDU.""" if _debug: BVLCI._debug("encode %s", str(pdu)) # copy the basics PCI.update(pdu, self) pdu.put( self.bvlciType ) # 0x84 pdu.put( self.bvlciFunction ) if (self.bvlciLength != len(self.pduData) + 4): raise EncodingError("invalid BVLCI length") pdu.put_short( self.bvlciLength )
def decode(self, pdu): """decode the contents of the PDU into the BVLCI.""" if _debug: BVLCI._debug("decode %s", str(pdu)) # copy the basics PCI.update(self, pdu) self.bvlciType = pdu.get() if self.bvlciType != 0x84: raise DecodingError("invalid BVLCI type") self.bvlciFunction = pdu.get() self.bvlciLength = pdu.get_short() if (self.bvlciLength != len(pdu.pduData) + 4): raise DecodingError("invalid BVLCI length")
def update(self, bvlci): PCI.update(self, bvlci) self.bvlciType = bvlci.bvlciType self.bvlciFunction = bvlci.bvlciFunction self.bvlciLength = bvlci.bvlciLength