⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 asner.cxx

📁 mgcp协议源代码。支持多种编码:g711
💻 CXX
📖 第 1 页 / 共 5 页
字号:
  if (names.Contains(tag))    return names[tag];  if (choice != NULL && choice->IsDescendant(PASN_Choice::Class()) &&      choice->GetTag() == tag && choice->GetTagClass() == tagClass)    return PString(choice->GetClass()) + "->" + ((PASN_Choice *)choice)->GetTagName();  return psprintf("<%u>", tag);}PASN_Object & PASN_Choice::GetObject() const{  PAssert(choice != NULL, "NULL Choice");  return *choice;}#if defined(__GNUC__) && __GNUC__ <= 2 && __GNUC_MINOR__ < 9PASN_Choice::operator PASN_Null &() const{  PAssert(PAssertNULL(choice)->IsDescendant(PASN_Null::Class()), PInvalidCast);  return *(PASN_Null *)choice;}PASN_Choice::operator PASN_Boolean &() const{  PAssert(PAssertNULL(choice)->IsDescendant(PASN_Boolean::Class()), PInvalidCast);  return *(PASN_Boolean *)choice;}PASN_Choice::operator PASN_Integer &() const{  PAssert(PAssertNULL(choice)->IsDescendant(PASN_Integer::Class()), PInvalidCast);  return *(PASN_Integer *)choice;}PASN_Choice::operator PASN_Enumeration &() const{  PAssert(PAssertNULL(choice)->IsDescendant(PASN_Enumeration::Class()), PInvalidCast);  return *(PASN_Enumeration *)choice;}PASN_Choice::operator PASN_Real &() const{  PAssert(PAssertNULL(choice)->IsDescendant(PASN_Real::Class()), PInvalidCast);  return *(PASN_Real *)choice;}PASN_Choice::operator PASN_ObjectId &() const{  PAssert(PAssertNULL(choice)->IsDescendant(PASN_ObjectId::Class()), PInvalidCast);  return *(PASN_ObjectId *)choice;}PASN_Choice::operator PASN_BitString &() const{  PAssert(PAssertNULL(choice)->IsDescendant(PASN_BitString::Class()), PInvalidCast);  return *(PASN_BitString *)choice;}PASN_Choice::operator PASN_OctetString &() const{  PAssert(PAssertNULL(choice)->IsDescendant(PASN_OctetString::Class()), PInvalidCast);  return *(PASN_OctetString *)choice;}PASN_Choice::operator PASN_NumericString &() const{  PAssert(PAssertNULL(choice)->IsDescendant(PASN_NumericString::Class()), PInvalidCast);  return *(PASN_NumericString *)choice;}PASN_Choice::operator PASN_PrintableString &() const{  PAssert(PAssertNULL(choice)->IsDescendant(PASN_PrintableString::Class()), PInvalidCast);  return *(PASN_PrintableString *)choice;}PASN_Choice::operator PASN_VisibleString &() const{  PAssert(PAssertNULL(choice)->IsDescendant(PASN_VisibleString::Class()), PInvalidCast);  return *(PASN_VisibleString *)choice;}PASN_Choice::operator PASN_IA5String &() const{  PAssert(PAssertNULL(choice)->IsDescendant(PASN_IA5String::Class()), PInvalidCast);  return *(PASN_IA5String *)choice;}PASN_Choice::operator PASN_GeneralString &() const{  PAssert(PAssertNULL(choice)->IsDescendant(PASN_GeneralString::Class()), PInvalidCast);  return *(PASN_GeneralString *)choice;}PASN_Choice::operator PASN_BMPString &() const{  PAssert(PAssertNULL(choice)->IsDescendant(PASN_BMPString::Class()), PInvalidCast);  return *(PASN_BMPString *)choice;}PASN_Choice::operator PASN_Sequence &() const{  PAssert(PAssertNULL(choice)->IsDescendant(PASN_Sequence::Class()), PInvalidCast);  return *(PASN_Sequence *)choice;}#elsePASN_Choice::operator PASN_Null &(){  PAssert(PAssertNULL(choice)->IsDescendant(PASN_Null::Class()), PInvalidCast);  return *(PASN_Null *)choice;}PASN_Choice::operator PASN_Boolean &(){  PAssert(PAssertNULL(choice)->IsDescendant(PASN_Boolean::Class()), PInvalidCast);  return *(PASN_Boolean *)choice;}PASN_Choice::operator PASN_Integer &(){  PAssert(PAssertNULL(choice)->IsDescendant(PASN_Integer::Class()), PInvalidCast);  return *(PASN_Integer *)choice;}PASN_Choice::operator PASN_Enumeration &(){  PAssert(PAssertNULL(choice)->IsDescendant(PASN_Enumeration::Class()), PInvalidCast);  return *(PASN_Enumeration *)choice;}PASN_Choice::operator PASN_Real &(){  PAssert(PAssertNULL(choice)->IsDescendant(PASN_Real::Class()), PInvalidCast);  return *(PASN_Real *)choice;}PASN_Choice::operator PASN_ObjectId &(){  PAssert(PAssertNULL(choice)->IsDescendant(PASN_ObjectId::Class()), PInvalidCast);  return *(PASN_ObjectId *)choice;}PASN_Choice::operator PASN_BitString &(){  PAssert(PAssertNULL(choice)->IsDescendant(PASN_BitString::Class()), PInvalidCast);  return *(PASN_BitString *)choice;}PASN_Choice::operator PASN_OctetString &(){  PAssert(PAssertNULL(choice)->IsDescendant(PASN_OctetString::Class()), PInvalidCast);  return *(PASN_OctetString *)choice;}PASN_Choice::operator PASN_NumericString &(){  PAssert(PAssertNULL(choice)->IsDescendant(PASN_NumericString::Class()), PInvalidCast);  return *(PASN_NumericString *)choice;}PASN_Choice::operator PASN_PrintableString &(){  PAssert(PAssertNULL(choice)->IsDescendant(PASN_PrintableString::Class()), PInvalidCast);  return *(PASN_PrintableString *)choice;}PASN_Choice::operator PASN_VisibleString &(){  PAssert(PAssertNULL(choice)->IsDescendant(PASN_VisibleString::Class()), PInvalidCast);  return *(PASN_VisibleString *)choice;}PASN_Choice::operator PASN_IA5String &(){  PAssert(PAssertNULL(choice)->IsDescendant(PASN_IA5String::Class()), PInvalidCast);  return *(PASN_IA5String *)choice;}PASN_Choice::operator PASN_GeneralString &(){  PAssert(PAssertNULL(choice)->IsDescendant(PASN_GeneralString::Class()), PInvalidCast);  return *(PASN_GeneralString *)choice;}PASN_Choice::operator PASN_BMPString &(){  PAssert(PAssertNULL(choice)->IsDescendant(PASN_BMPString::Class()), PInvalidCast);  return *(PASN_BMPString *)choice;}PASN_Choice::operator PASN_Sequence &(){  PAssert(PAssertNULL(choice)->IsDescendant(PASN_Sequence::Class()), PInvalidCast);  return *(PASN_Sequence *)choice;}PASN_Choice::operator const PASN_Null &() const{  PAssert(PAssertNULL(choice)->IsDescendant(PASN_Null::Class()), PInvalidCast);  return *(const PASN_Null *)choice;}PASN_Choice::operator const PASN_Boolean &() const{  PAssert(PAssertNULL(choice)->IsDescendant(PASN_Boolean::Class()), PInvalidCast);  return *(const PASN_Boolean *)choice;}PASN_Choice::operator const PASN_Integer &() const{  PAssert(PAssertNULL(choice)->IsDescendant(PASN_Integer::Class()), PInvalidCast);  return *(const PASN_Integer *)choice;}PASN_Choice::operator const PASN_Enumeration &() const{  PAssert(PAssertNULL(choice)->IsDescendant(PASN_Enumeration::Class()), PInvalidCast);  return *(const PASN_Enumeration *)choice;}PASN_Choice::operator const PASN_Real &() const{  PAssert(PAssertNULL(choice)->IsDescendant(PASN_Real::Class()), PInvalidCast);  return *(const PASN_Real *)choice;}PASN_Choice::operator const PASN_ObjectId &() const{  PAssert(PAssertNULL(choice)->IsDescendant(PASN_ObjectId::Class()), PInvalidCast);  return *(const PASN_ObjectId *)choice;}PASN_Choice::operator const PASN_BitString &() const{  PAssert(PAssertNULL(choice)->IsDescendant(PASN_BitString::Class()), PInvalidCast);  return *(const PASN_BitString *)choice;}PASN_Choice::operator const PASN_OctetString &() const{  PAssert(PAssertNULL(choice)->IsDescendant(PASN_OctetString::Class()), PInvalidCast);  return *(const PASN_OctetString *)choice;}PASN_Choice::operator const PASN_NumericString &() const{  PAssert(PAssertNULL(choice)->IsDescendant(PASN_NumericString::Class()), PInvalidCast);  return *(const PASN_NumericString *)choice;}PASN_Choice::operator const PASN_PrintableString &() const{  PAssert(PAssertNULL(choice)->IsDescendant(PASN_PrintableString::Class()), PInvalidCast);  return *(const PASN_PrintableString *)choice;}PASN_Choice::operator const PASN_VisibleString &() const{  PAssert(PAssertNULL(choice)->IsDescendant(PASN_VisibleString::Class()), PInvalidCast);  return *(const PASN_VisibleString *)choice;}PASN_Choice::operator const PASN_IA5String &() const{  PAssert(PAssertNULL(choice)->IsDescendant(PASN_IA5String::Class()), PInvalidCast);  return *(const PASN_IA5String *)choice;}PASN_Choice::operator const PASN_GeneralString &() const{  PAssert(PAssertNULL(choice)->IsDescendant(PASN_GeneralString::Class()), PInvalidCast);  return *(const PASN_GeneralString *)choice;}PASN_Choice::operator const PASN_BMPString &() const{  PAssert(PAssertNULL(choice)->IsDescendant(PASN_BMPString::Class()), PInvalidCast);  return *(const PASN_BMPString *)choice;}PASN_Choice::operator const PASN_Sequence &() const{  PAssert(PAssertNULL(choice)->IsDescendant(PASN_Sequence::Class()), PInvalidCast);  return *(const PASN_Sequence *)choice;}#endifPObject::Comparison PASN_Choice::Compare(const PObject & obj) const{  PAssert(obj.IsDescendant(PASN_Choice::Class()), PInvalidCast);  const PASN_Choice & other = (const PASN_Choice &)obj;  if (choice == other.choice)    return EqualTo;  if (choice == NULL)    return LessThan;  if (other.choice == NULL)    return GreaterThan;  if (tag < other.tag)    return LessThan;  if (tag > other.tag)    return GreaterThan;  return choice->Compare(*other.choice);}void PASN_Choice::PrintOn(ostream & strm) const{  strm << GetTagName();  if (choice != NULL)    strm << ' ' << *choice;  else    strm << " (NULL)";}PString PASN_Choice::GetTypeAsString() const{  return "Choice";}PINDEX PASN_Choice::GetDataLength() const{  if (choice != NULL)    return choice->GetDataLength();  return 0;}BOOL PASN_Choice::IsPrimitive() const{  if (choice != NULL)    return choice->IsPrimitive();  return FALSE;}BOOL PASN_Choice::Decode(PASN_Stream & strm){  return strm.ChoiceDecode(*this);}void PASN_Choice::Encode(PASN_Stream & strm) const{  strm.ChoiceEncode(*this);}BOOL PASN_Choice::DecodePER(PPER_Stream & strm){  // X.691 Section 22  delete choice;  if (strm.IsAtEnd()) {    choice = NULL;    return FALSE;  }  BOOL ok = TRUE;  if (extendable) {    if (strm.SingleBitDecode()) {      tag = strm.SmallUnsignedDecode() + numChoices;      unsigned len;      if (strm.LengthDecode(0, INT_MAX, len) != 0)        return FALSE;      if (CreateObject()) {        PINDEX nextPos = strm.GetPosition() + len;        ok = choice->Decode(strm);        strm.SetPosition(nextPos);      }      else {        PASN_OctetString * open_type = new PASN_OctetString;        open_type->SetConstraints(PASN_ConstrainedObject::FixedConstraint, len, len);        open_type->Decode(strm);        if (open_type->GetSize() > 0)          choice = open_type;        else {          delete open_type;          ok = FALSE;        }      }      return ok;    }  }  if (numChoices < 2)    tag = 0;  else {    if (strm.UnsignedDecode(0, numChoices-1, tag) < 0)      return FALSE;  }  if (CreateObject())    ok = choice->Decode(strm);  return ok;}void PASN_Choice::EncodePER(PPER_Stream & strm) const{  PAssert(tag != UINT_MAX, PLogicError);  if (extendable) {    BOOL extended = tag >= numChoices;    strm.SingleBitEncode(extended);    if (extended) {      strm.SmallUnsignedEncode(tag - numChoices);      strm.AnyTypeEncode(choice);      return;    }  }  if (numChoices > 1)    strm.UnsignedEncode(tag, 0, numChoices-1);  if (choice != NULL)    choice->Encode(strm);}BOOL PBER_Stream::ChoiceDecode(PASN_Choice & value){  PINDEX savedPosition = GetPosition();  unsigned tag;  PASN_Object::TagClass tagClass;  BOOL primitive;  unsigned entryLen;  if (!HeaderDecode(tag, tagClass, primitive, entryLen))    return FALSE;  SetPosition(savedPosition);  value.SetTag(tag, tagClass);  if (value.IsValid())    return value.GetObject().Decode(*this);  return TRUE;}void PBER_Stream::ChoiceEncode(const PASN_Choice & value){  if (value.IsValid())    value.GetObject().Encode(*this);}BOOL PPER_Stream::ChoiceDecode(PASN_Choice & value){  return value.DecodePER(*this);}void PPER_Stream::ChoiceEncode(const PASN_Choice & value){  value.EncodePER(*this);}///////////////////////////////////////////////////////////////////////PASN_Sequence::PASN_Sequence(unsigned tag, TagClass tagClass,                             unsigned nOpts, BOOL extend, unsigned nExtend)  : PASN_Object(tag, tagClass, extend){  optionMap.SetConstraints(PASN_ConstrainedObject::FixedConstraint, nOpts, nOpts);  knownExtensions = nExtend;  totalExtensions = 0;  endBasicEncoding = 0;}PASN_Sequence::PASN_Sequence(const PASN_Sequence & other)  : PASN_Object(other),    fields(other.fields.GetSize()),    optionMap(other.optionMap),    extensionMap(other.extensionMap){  for (PINDEX i = 0; i < other.fields.GetSize(); i++)    fields.SetAt(i, other.fields[i].Clone());  knownExtensions = other.knownExtensions;  totalExtensions = other.totalExtensions;  endBasicEncoding = 0;}PASN_Sequence & PASN_Sequence::operator=(const PASN_Sequence & other){  PASN_Object::operator=(other);  fields.SetSize(other.fields.GetSize());  for (PINDEX i = 0; i < other.fields.GetSize(); i++)    fields.SetAt(i, other.fields[i].Clone());  optionMap = other.optionMap;  knownExtensions = other.knownExtensions;  totalExtensions = other.totalExtensions;  extensionMap = other.extensionMap;  return *this;}BOOL PASN_Sequence::HasOptionalField(PINDEX opt) const{  if (opt < (PINDEX)optionMap.GetSize())    return optionMap[opt];  else    return extensionMap[opt - optionMap.GetSize()];}void PASN_Sequence::IncludeOptionalField(PINDEX opt){  if (opt < (PINDEX)optionMap.GetSize())    option

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -