30#define YASN_API __declspec(dllexport)
33#define YASN_API __declspec(dllimport)
45#define ASN_LONG_LENGTH 0x80
47#define ASN_EXTENSION_ID 31
48#define IS_EXTENSION_ID(byte) (((byte) & ASN_EXTENSION_ID) == ASN_EXTENSION_ID)
78 inline DataBlock& operator=(
const DataBlock& value)
182 : m_type(0), m_data(
"")
190 : m_type(original.m_type), m_data(original.m_data)
199 : m_type(
type), m_data(value)
230 m_type = val->
type();
249 { m_data.clear();m_data = data; }
274 accessibleForNotify = 1,
283 : m_access(
""), m_accessVal(0), m_index(0)
312 {
return m_accessVal;}
342 {
return m_revision; }
378 int pos = m_oid.
rfind(
'.');
379 return m_oid.substr(0,pos);
392 unsigned int m_index;
413 : m_value(original.m_value), m_name(original.m_name)
444 { m_value = original.
toString();
return *
this; }
450 { m_value = val;
return *
this; }
456 { m_value = val;
return *
this; }
523 : m_class(Universal), m_type(Primitive), m_code(0)
533 : m_class(clas), m_type(
type), m_code(
code)
571 return (m_class == tag.
classType() && m_type == tag.
type() && m_code == tag.
code());
579 return !(m_class == tag.
classType() && m_type == tag.
type() && m_code == tag.
code());
588 m_type = value.
type();
589 m_code = value.
code();
626 inline const unsigned int code()
const
672 PRINTABLE_STR = 0x13,
675 GENERALIZED_TIME = 0x18,
678 UNIVERSAL_STR = 0x1c,
679 CHARACTER_STR = 0x1d,
699 InvalidLengthOrTag = -1,
700 ConstraintBreakError = -2,
702 InvalidContentsError = -4,
static int decodeINT8(DataBlock &data, int8_t *intVal, bool tagCheck)
static int decodeGenTime(DataBlock &data, unsigned int *time, unsigned int *fractions, bool *utc, bool tagCheck)
static int decodeUINT16(DataBlock &data, u_int16_t *intVal, bool tagCheck)
static int decodeLength(DataBlock &data)
static DataBlock encodeInteger(u_int64_t intVal, bool tagCheck)
static int decodeOctetString(DataBlock &data, OctetString *strVal, bool tagCheck)
static int decodeAny(DataBlock data, DataBlock *val, bool tagCheck)
static int decodeUTCTime(DataBlock &data, unsigned int *time, bool tagCheck)
static int matchEOC(DataBlock &data)
static int decodeOID(DataBlock &data, ASNObjId *obj, bool tagCheck)
static DataBlock encodeReal(float val, bool tagCheck)
Error
Definition yateasn.h:698
static DataBlock buildLength(DataBlock &data)
static DataBlock encodeBitString(String val, bool tagCheck)
static int decodeUINT32(DataBlock &data, u_int32_t *intVal, bool tagCheck)
static DataBlock encodeAny(DataBlock data, bool tagCheck)
TypeTag
Definition yateasn.h:659
static int decodeNull(DataBlock &data, bool tagCheck)
static int decodeBitString(DataBlock &data, String *val, bool tagCheck)
static int decodeUtf8(DataBlock &data, String *str, bool tagCheck)
static int decodeBoolean(DataBlock &data, bool *val, bool tagCheck)
static int decodeString(DataBlock &data, String *str, int *type, bool tagCheck)
static int decodeReal(DataBlock &data, float *realVal, bool tagCheck)
static DataBlock encodeBoolean(bool val, bool tagCheck)
static int encodeSequence(DataBlock &data, bool tagCheck)
static int decodeInteger(DataBlock &data, u_int64_t &intVal, unsigned int bytes, bool tagCheck)
static int parseUntilEoC(DataBlock &data, int length=0)
static int decodeINT32(DataBlock &data, int32_t *intVal, bool tagCheck)
static int decodeINT16(DataBlock &data, int16_t *intVal, bool tagCheck)
static int decodeINT64(DataBlock &data, int64_t *intVal, bool tagCheck)
static DataBlock encodeNull(bool tagCheck)
static int decodeUINT64(DataBlock &data, u_int64_t *intVal, bool tagCheck)
static DataBlock encodeOctetString(OctetString strVal, bool tagCheck)
static DataBlock encodeOID(ASNObjId obj, bool tagCheck)
static DataBlock encodeString(String str, int type, bool tagCheck)
static DataBlock encodeGenTime(unsigned int time, unsigned int fractions, bool tagCheck)
static DataBlock encodeUTCTime(unsigned int time, bool tagCheck)
static int decodeSequence(DataBlock &data, bool tagCheck)
static int decodeUINT8(DataBlock &data, u_int8_t *intVal, bool tagCheck)
static int encodeSet(DataBlock &data, bool tagCheck)
static DataBlock encodeUtf8(String str, bool tagCheck)
static int decodeSet(DataBlock &data, bool tagCheck)
ASNObjId & operator=(const char *val)
Definition yateasn.h:455
const String & toString() const
Definition yateasn.h:472
ASNObjId(const String &name, const String &val)
ASNObjId & operator=(const ASNObjId &original)
Definition yateasn.h:443
const String & getName() const
Definition yateasn.h:479
ASNObjId(const String &val)
ASNObjId & operator=(const String &val)
Definition yateasn.h:449
void setValue(const String &value)
Definition yateasn.h:486
ASNObjId(const ASNObjId &original)
Definition yateasn.h:412
String & getName()
Definition yateasn.h:318
String getParent()
Definition yateasn.h:376
const String & toString() const
Definition yateasn.h:348
String & getAccess()
Definition yateasn.h:303
String & getType()
Definition yateasn.h:334
void setIndex(unsigned int ind)
Definition yateasn.h:355
int compareTo(AsnMib *mib)
Access
Definition yateasn.h:272
unsigned int index()
Definition yateasn.h:362
String & getRevision()
Definition yateasn.h:341
~AsnMib()
Definition yateasn.h:295
String getOID()
Definition yateasn.h:325
int getAccessValue()
Definition yateasn.h:311
AsnMib(NamedList ¶ms)
AsnMib()
Definition yateasn.h:282
virtual ~AsnObject()
Definition yateasn.h:128
virtual int decode(DataBlock &data)=0
AsnObject()
Definition yateasn.h:115
virtual void setParams(NamedList *params)=0
virtual int encode(DataBlock &data)=0
AsnObject(const AsnObject &original)
Definition yateasn.h:122
virtual void getParams(NamedList *params)=0
static void decode(AsnTag &tag, DataBlock &data)
Type
Definition yateasn.h:514
AsnTag()
Definition yateasn.h:522
bool operator!=(const AsnTag &tag) const
Definition yateasn.h:577
void code(unsigned int code)
Definition yateasn.h:633
AsnTag & operator=(const AsnTag &value)
Definition yateasn.h:585
void classType(Class clas)
Definition yateasn.h:605
const DataBlock & coding() const
Definition yateasn.h:640
bool operator==(const AsnTag &tag) const
Definition yateasn.h:569
~AsnTag()
Definition yateasn.h:541
void encode()
Definition yateasn.h:563
const Class classType() const
Definition yateasn.h:598
void type(Type type)
Definition yateasn.h:619
static void encode(Class clas, Type type, unsigned int code, DataBlock &data)
const Type type() const
Definition yateasn.h:612
const unsigned int code() const
Definition yateasn.h:626
AsnTag(Class clas, Type type, unsigned int code)
Definition yateasn.h:532
Class
Definition yateasn.h:504
const String & getValue()
Definition yateasn.h:212
void setValue(const String &data)
Definition yateasn.h:248
AsnValue()
Definition yateasn.h:181
AsnValue & operator=(AsnValue val)
Definition yateasn.h:237
AsnValue & operator=(AsnValue *val)
Definition yateasn.h:225
virtual ~AsnValue()
Definition yateasn.h:205
AsnValue(const AsnValue &original)
Definition yateasn.h:189
ValType
Definition yateasn.h:166
int type()
Definition yateasn.h:219
AsnValue(const String &value, int type=STRING)
Definition yateasn.h:198
void setType(int type)
Definition yateasn.h:255
A class that holds just a block of raw data.
Definition yateclass.h:4237
void * data() const
Definition yateclass.h:4289
bool unHexify(const char *data, unsigned int len, char sep)
unsigned int length() const
Definition yateclass.h:4321
DataBlock(unsigned int overAlloc=0)
A named string container class.
Definition yateclass.h:5016
Helper class for operations with octet strings.
Definition yateasn.h:61
const String toHexString() const
Definition yateasn.h:88
String getString()
Definition yateasn.h:67
DataBlock & fromHexString(const String &value)
Definition yateasn.h:98
A C-style string handling class.
Definition yateclass.h:2131
String & hexify(void *data, unsigned int len, char sep=0, bool upCase=false)
int rfind(char what) const
Definition yateclass.h:848