def __init__(self, cmd_code = (), avp_code = 0x00, avp_data = "", decode_buf = None, dcc_instance = None): AVP.__init__(self, cmd_code, avp_code, avp_data, decode_buf, dcc_instance)
def __init__(self, avp_code=0, avp_data=None, vendor_id=0, mandatory=0, private=0, level=0, decode_buf=None, cmd_etc_instance=None): AVP.__init__(self, avp_code, avp_data, vendor_id, mandatory, private, level, decode_buf, cmd_etc_instance) if (self.cmd_etc == None and self.avp['AVP_CODE_STATE'] == "10"): raise self.err.AvpE_InvalidInitParam, \ "编码Grouped类型必须传入cmd_etc_instance!" self.avp['AVP_DATA_TYPE'] = "Grouped" self.avp['GROUPED_SUBS_BUF'] = "" # 用来保存Grouped内部子AVP_BUF self.avp['GROUPED_SUBS_AVP'] = [] # 保存解码或者加密后的avp实例 self.print_template_group = self.make_template("\ ${L}AVP_CODE = [${AVP_CODE}] - ${AVP_NAME} - ${AVP_DATA_TYPE}(\"${AVP_CODE_OPERATOR}\") \n\ ${L}AVP_FLAG = [${AVP_FLAG}] (VENDOR_ID(${AVP_VENDOR_ID})|MANDATORY(${AVP_MANDATORY})|PRIVATE(${AVP_PRIVATE}) \n\ ${L}AVP_LENGTH = [${AVP_LENGTH}] \n\ ${L}AVP_VENDOR_ID = [${AVP_VENDOR_ID}] \n\ ${L}~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~") self.print_detail_template_group = self.make_template("\ ${L}${AVP_CODE_HEX}\n${L}\tAVP_CODE = [${AVP_CODE}] - ${AVP_NAME} - ${AVP_DATA_TYPE}(\"${AVP_CODE_OPERATOR}\") \n\ ${L}${AVP_FLAGS_HEX}\n${L}\tAVP_FLAG = [${AVP_FLAG}] (VENDOR_ID(${AVP_VENDOR_ID})|MANDATORY(${AVP_MANDATORY})|PRIVATE(${AVP_PRIVATE}) \n\ ${L}${AVP_LENGTH_HEX}\n${L}\tAVP_LENGTH = [${AVP_LENGTH}] \n\ ${L}${AVP_VONDER_HEX}\n${L}\tAVP_VENDOR_ID = [${AVP_VENDOR_ID}] \n\ ${L}~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
def __init__(self, avp_code=0, avp_data=None, vendor_id=0, mandatory=0, private=0, level=0, decode_buf=None, cmd_etc_instance=None): AVP.__init__(self, avp_code, avp_data, vendor_id, mandatory, private, level, decode_buf, cmd_etc_instance) self.avp['AVP_CODE_OPERATOR'] = "!Q" self.avp['AVP_DATA_TYPE'] = "Unsigned64"
def __init__(self, avp_code=0, avp_data=None, vendor_id=0, mandatory=0, private=0, level=0, decode_buf=None, cmd_etc_instance=None): AVP.__init__(self, avp_code, avp_data, vendor_id, mandatory, private, level, decode_buf, cmd_etc_instance) self.avp['AVP_DATA_TYPE'] = "OctetString" if self.avp['AVP_CODE_STATE'] == "00": if self.avp['AVP_DATA'] is None: raise self.err.AvpE_InvalidInitParam, \ "初始化OctetString类型错误,AVP编码时必须在初始化时传入 AVP_DATA" data_length = len(self.avp['AVP_DATA']) data_length = (data_length + 3) // 4 * 4 self.avp['AVP_CODE_OPERATOR'] = "!" + str(data_length) + "s"