ooasn1.h
来自「一个非常美妙的proxy。功能强大。基于sip的协议。如果还要的话」· C头文件 代码 · 共 1,600 行 · 第 1/5 页
H
1,600 行
(void** ppvMemHeap, ASN1UINT propId, void* pProp);/** * This function sets the pointers to standard allocation functions. These * functions are used to allocate/reallocate/free the memory blocks. By * default, standard C functions - 'malloc', 'realloc' and 'free' - are used. * But if some platforms do not support these functions (or some other reasons * exist) they can be overloaded. The functions being overloaded should have * the same prototypes as standard ones. * * @param malloc_func Pointer to the memory allocation function ('malloc' by * default). * @param realloc_func Pointer to the memory reallocation function ('realloc' * by default). * @param free_func Pointer to the memory deallocation function ('free' by * default). */EXTERN void memSetAllocFuncs (OSMallocFunc malloc_func, OSReallocFunc realloc_func, OSFreeFunc free_func);EXTERN void memFreeOpenSeqExt (OOCTXT* pctxt, DList *pElemList);/* * This function sets flags to a heap. May be used to control the heap's * behavior. * * @param pctxt Pointer to a memory block structure that contains the * list of dynamic memory block maintained by these * functions. * @param flags The flags. */EXTERN void memHeapSetFlags (OOCTXT* pctxt, ASN1UINT flags);/* * This function clears memory heap flags. * * @param pctxt Pointer to a memory block structure that contains the * list of dynamic memory block maintained by these * functions. * @param flags The flags */EXTERN void memHeapClearFlags (OOCTXT* pctxt, ASN1UINT flags);/** * This function sets the pointer to standard allocation functions. These * functions are used to allocate/reallocate/free the memory blocks. By * default, standard C functions - malloc, realloc, and free - are used. But if * some platforms do not support these functions or some other reasons exist) * they can be overloaded. The functions being overloaded should have the same * prototypes as standard ones. * * @param pctxt Pointer to a context block. * @param blkSize The currently used minimum size and the granularity of * memory blocks. */EXTERN void memHeapSetDefBlkSize (OOCTXT* pctxt, ASN1UINT blkSize);/** * This function returns the actual granularity of memory blocks. * * @param pctxt Pointer to a context block. */EXTERN ASN1UINT memHeapGetDefBlkSize (OOCTXT* pctxt);#ifdef _STATIC_HEAPEXTERN void memSetStaticBuf (void* memHeapBuf, ASN1UINT blkSize);#endif/* PER encode/decode related items */#define INCRBITIDX(pctxt) \((--(pctxt)->buffer.bitOffset < 0) ? \((++(pctxt)->buffer.byteIndex >= (pctxt)->buffer.size) ? ASN_E_ENDOFBUF : \((pctxt)->buffer.bitOffset = 7, ASN_OK)) : ASN_OK)#define DECODEBIT(pctxt,pvalue) \((INCRBITIDX (pctxt) != ASN_OK) ? ASN_E_ENDOFBUF : ((pvalue) ? \((*(pvalue) = (((pctxt)->buffer.data[(pctxt)->buffer.byteIndex]) & \(1 << (pctxt)->buffer.bitOffset)) != 0), ASN_OK) : ASN_OK ))/*#define SETCHARSET(csetvar, canset, abits, ubits) \csetvar.charSet.nchars = 0; \csetvar.canonicalSet = canset; \csetvar.canonicalSetSize = sizeof(canset)-1; \csetvar.canonicalSetBits = getUIntBitCount(csetvar.canonicalSetSize); \csetvar.charSetUnalignedBits = ubits; \csetvar.charSetAlignedBits = abits;*//** * This function will decode a series of multiple bits and place the results in * an unsigned integer variable. * * @param pctxt A pointer to a context structure. This provides a * storage area for the function to store all working * variables that must be maintained between function * calls. * @param pvalue A pointer to an unsigned integer variable to receive the * decoded result. * @param nbits The number of bits to decode. * @return Completion status of operation: * - 0 (ASN_OK) = success, * - negative return value is error. */EXTERN int decodeBits (OOCTXT* pctxt, ASN1UINT* pvalue, ASN1UINT nbits);/** * This function will decode a value of the ASN.1 bit string type whose maximum * size is is known in advance. The ASN1C complier generates a call to this * function to decode bit string productions or elements that contain a size * constraint. * * @param pctxt A pointer to a context structure. This provides a * storage area for the function to store all working * variables that must be maintained between function * calls. * @param numbits_p Pointer to an unsigned integer variable to receive * decoded number of bits. * @param buffer Pointer to a fixed-size or pre-allocated array of bufsiz * octets to receive a decoded bit string. * @param bufsiz Length (in octets) of the buffer to receive the decoded * bit string. * @return Completion status of operation: * - 0 (ASN_OK) = success, * - negative return value is error. */EXTERN int decodeBitString (OOCTXT* pctxt, ASN1UINT* numbits_p, ASN1OCTET* buffer, ASN1UINT bufsiz);/** * This function will decode a variable of the ASN.1 BMP character string. This * differs from the decode routines for the character strings previously * described in that the BMP string type is based on 16-bit characters. A * 16-bit character string is modeled using an array of unsigned short * integers. * * @param pctxt A pointer to a context structure. This provides a * storage area for the function to store all working * variables that must be maintained between function * calls. * @param pvalue Pointer to character string structure to receive the * decoded result The structure includes a count field * containing the number of characters and an array of * unsigned short integers to hold the 16-bit character * values. * @param permCharSet A pointer to the constraining character set. This * contains an array containing all valid characters in * the set as well as the aligned and unaligned bit * counts required to encode the characters. * @return Completion status of operation: * - 0 (ASN_OK) = success, * - negative return value is error. */EXTERN int decodeBMPString (OOCTXT* pctxt, ASN1BMPString* pvalue, Asn116BitCharSet* permCharSet);/** * This function will position the decode bit cursor on the next byte boundary. * * @param pctxt A pointer to a context structure. This provides a * storage area for the function to store all working * variables that must be maintained between function * calls. * @return Completion status of operation: * - 0 (ASN_OK) = success, * - negative return value is error. */EXTERN int decodeByteAlign (OOCTXT* pctxt);/** * This function will decode an integer constrained either by a value or value * range constraint. * * @param pctxt Pointer to context block structure. * @param pvalue Pointer to integer variable to receive decoded value. * @param lower Lower range value. * @param upper Upper range value. * @return Completion status of operation: * - 0 (ASN_OK) = success, * - negative return value is error. */EXTERN int decodeConsInteger (OOCTXT* pctxt, ASN1INT* pvalue, ASN1INT lower, ASN1INT upper);/** * This function will decode an unsigned integer constrained either by a value * or value range constraint. * * @param pctxt Pointer to context block structure. * @param pvalue Pointer to unsigned integer variable to receive decoded * value. * @param lower Lower range value. * @param upper Upper range value. * @return Completion status of operation: * - 0 (ASN_OK) = success, * - negative return value is error. */EXTERN int decodeConsUnsigned (OOCTXT* pctxt, ASN1UINT* pvalue, ASN1UINT lower, ASN1UINT upper);/** * This function will decode an 8-bit unsigned integer constrained either by a * value or value range constraint. * * @param pctxt Pointer to context block structure. * @param pvalue Pointer to 8-bit unsigned integer variable to receive * decoded value. * @param lower Lower range value. * @param upper Upper range value. * @return Completion status of operation: * - 0 (ASN_OK) = success, * - negative return value is error. */EXTERN int decodeConsUInt8 (OOCTXT* pctxt, ASN1UINT8* pvalue, ASN1UINT lower, ASN1UINT upper);/** * This function will decode a 16-bit unsigned integer constrained either by a * value or value range constraint. * * @param pctxt Pointer to context block structure. * @param pvalue Pointer to 16-bit unsigned integer variable to receive * decoded value. * @param lower Lower range value. * @param upper Upper range value. * @return Completion status of operation: * - 0 (ASN_OK) = success, * - negative return value is error. */EXTERN int decodeConsUInt16 (OOCTXT* pctxt, ASN1USINT* pvalue, ASN1UINT lower, ASN1UINT upper);/** * This function decodes a constrained whole number as specified in Section * 10.5 of the X.691 standard. * * @param pctxt Pointer to context block structure. * @param padjusted_value Pointer to unsigned adjusted integer value to * receive decoded result. To get the final value, * this value is added to the lower boundary of the * range. * @param range_value Unsigned integer value specifying the total size * of the range. This is obtained by subtracting * the lower range value from the upper range * value. * @return Completion status of operation: * - 0 (ASN_OK) = success, * - negative return value is error. */EXTERN int decodeConsWholeNumber (OOCTXT* pctxt, ASN1UINT* padjusted_value, ASN1UINT range_value);/** * This function decodes a constrained string value. This version of the * function allows all of the required permitted alphabet constraint parameters * to be passed in as arguments. * * @param pctxt Pointer to context block structure. * @param string Pointer to const char* to receive decoded string. Memory * will be allocated for this variable using internal * memory management functions. * @param charSet String containing permitted alphabet character set. Can * be null if no character set was specified. * @param abits Number of bits in a character set character (aligned). * @param ubits Number of bits in a character set character (unaligned). * @param canSetBits Number of bits in a character from the canonical set * representing this string. * @return Completion status of operation: * - 0 (ASN_OK) = success, * - negative return value is error. */EXTERN int decodeConstrainedStringEx (OOCTXT* pctxt, const char** string, const char* charSet, ASN1UINT abits, ASN1UINT ubits, ASN1UINT canSetBits);/** * This function will decode a variable of thr ASN.1 BIT STRING type. This * function allocates dynamic memory t store the decoded result. The ASN1C * complier generates a call to this function to decode an unconstrained bit * string production or element. * * @param pctxt A pointer to a context structure. This provides a * storage area for the function to store all working * variables that must be maintained between function * calls. * @param pBitStr Pointer to a dynamic bit string structure to receive the * decoded result. This structure contains a field to * hold the number of decoded bits and a pointer to an * octet string to hold the decoded data. Memory is * allocated by the decoder using the memAlloc * function. This memory is tracked within the context * and released when the freeContext function is * invoked. * @return Completion status of operation: * - 0 (ASN_OK) = success, * - negative return value is error. */EXTERN int decodeDynBitString (OOCTXT* pctxt, ASN1DynBitStr* pBitStr);/** * This function will decode a value of the ASN.1 octet string type whose * maximum size is known in advance. The ASN1C complier generates a call to * this function to decode octet string productions or elements that contain a * size constraint. * * @param pctxt A pointer to a context structure. This provides a * storage area for the function to store all working * variables that must be maintained between function * calls. * @param pOctStr A pointer to a dynamic octet string to receive the * decoded result. * @return Completion status of operation: * - 0 (ASN_OK) = success, * - negative return value is error.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?