/******************************************************************************/ /* asn1api.h */ /* */ /* Definition of functions for */ /* Abstract Syntax Notation One - Application Programming Interface. */ /* The application designers interface to Talura ASN.1 run-time engine (TARE) */ /* */ /* Copyright: Talura 2002, All rights reserved */ /* */ /******************************************************************************/ /* prevent multiple definition */ #ifndef _ASN1API_H #define _ASN1API_H /* standard header files */ #include #include /* proprietary header files */ #include /* constant definitions */ /* type definitions */ typedef struct {void * reference;} encode_t; typedef struct {void * reference;} decode_t; /* macro definitions */ /* (none) */ /* enumerator definitions */ typedef enum { Err_Base = 1<<0, /* Invalid base (RealType only) */ Err_BufferSize = 1<<1, /* Buffer size too small */ Err_ComponentSequence = 1<<2, /* Invalid sequence of components */ Err_EndOfContents = 1<<3, /* Invalid use of EndOfContents */ Err_Extension = 1<<4, /* Invalid Extension */ Err_FormBit = 1<<5, /* Invalid formbit */ Err_Identifier = 1<<6, /* Invalid identifier */ Err_Initialization = 1<<7, /* Initialization not finished */ Err_Internal = 1<<8, /* Internal error */ Err_Length = 1<<9, /* Invalid length */ Err_Limitation = 1<<10,/* Implemenation / system limitation exceeded */ Err_Mandatory = 1<<11,/* Invalid mandatory components */ Err_Multiple = 1<<12,/* Multiple occurences of same component in Set */ Err_Protocol = 1<<13,/* Invalid protocol specified */ Err_Resource = 1<<14,/* Resource limitation */ Err_Size = 1<<15,/* Invalid size */ Err_TransferSyntax = 1<<16,/* Invalid/unsupported transfer syntax specified */ Err_Type = 1<<17,/* Invalid/unknown type specified */ Err_UnusedBits = 1<<18,/* Invalid use of unused bits in bitstring */ Err_UserDefinedConstraint = 1<<19,/* Error detected by UserDefined constraint */ Err_Value = 1<<20,/* Error detected in value */ Err_Detected = 1<<21 /* Error detected */ } ASN1_ErrorCode_t; /* variable declarations */ /* (none) */ /* structure definitions */ /* (none) */ /* function definitions */ /* Encoding */ /* transfer_syntax can be "ber" or "xerBasic" */ size_t EncExec(void * const PDU_buf, const size_t size, const ASN1_Type_t type, const void * const value, const char * transfer_syntax, encode_t * scope); ASN1_ErrorCode_t EncError(FILE * stream, encode_t scope); void EncFree(encode_t scope); /* Decoding */ /* transfer_syntax can be "ber" or "xerBasic" */ void * DecExec(const void * const PDU, const size_t LengthOfPDU, const ASN1_Type_t type, const char * transfer_syntax, decode_t * scope); ASN1_ErrorCode_t DecError(FILE * stream, decode_t scope); void DecFree(decode_t scope); /* Compare */ int Compare(const ASN1_Type_t type, const void * const value1, const void * const value2); /* Support functions */ size_t ObjectFromObjectSet(void * const ObjectSet, size_t from_instance, const size_t offset, const ASN1_Type_t type, void * const value); size_t Unique_ObjectFromObjectSet(void * const ObjectSet, const size_t offset, const ASN1_Type_t type, void * const value); const ASN1_ObjectIdentifier_t reg_ObjectIdentifier(const unsigned int * const ObjIdComponentsList, const size_t NumberOfObjIdComponents); const ASN1_ObjectIdentifier_t regno_ObjectIdentifier(const unsigned int * const ObjIdComponentsList, const size_t NumberOfObjIdComponents); unsigned int numreg_ObjectIdentifiers(void); unsigned int reg_OctetString(ASN1_OctetString_t OctetStringValue); unsigned int regno_OctetString(ASN1_OctetString_t OctetStringValue); unsigned int numreg_OctetStrings(void); const ASN1_RelativeOID_t reg_RelativeOID(const unsigned int * const RelativeOIDComponentsList, const size_t NumberOfRelativeOIDComponents); const ASN1_RelativeOID_t regno_RelativeOID(const unsigned int * const RelativeOIDComponentsList, const size_t NumberOfRelativeOIDComponents); unsigned int numreg_RelativeOIDs(void); size_t UTF8String_len(const ASN1_UTF8String_t * UTF8String_ptr); #endif /* _ASN1API_H */