diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-06-30 16:40:38 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-06-30 16:40:38 +0000 |
commit | e9d15cbea7a98184521c851500176da7aa424012 (patch) | |
tree | d3d6aa7ea86d11ecaa6e88efbc46a5dde1c63ea5 /addons/ooh323c/src/eventHandler.h | |
parent | b85bdd32a783a8f07004d41db8a696645685a331 (diff) |
Move Asterisk-addons modules into the main Asterisk source tree.
Someone asked yesterday, "is there a good reason why we can't just put these
modules in Asterisk?". After a brief discussion, as long as the modules are
clearly set aside in their own directory and not enabled by default, it is
perfectly fine.
For more information about why a module goes in addons, see README-addons.txt.
chan_ooh323 does not currently compile as it is behind some trunk API updates.
However, it will not build by default, so it should be okay for now.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@204413 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'addons/ooh323c/src/eventHandler.h')
-rw-r--r-- | addons/ooh323c/src/eventHandler.h | 284 |
1 files changed, 284 insertions, 0 deletions
diff --git a/addons/ooh323c/src/eventHandler.h b/addons/ooh323c/src/eventHandler.h new file mode 100644 index 000000000..320a55b99 --- /dev/null +++ b/addons/ooh323c/src/eventHandler.h @@ -0,0 +1,284 @@ +/* + * Copyright (C) 2004-2005 by Objective Systems, Inc. + * + * This software is furnished under an open source license and may be + * used and copied only in accordance with the terms of this license. + * The text of the license may generally be found in the root + * directory of this installation in the COPYING file. It + * can also be viewed online at the following URL: + * + * http://www.obj-sys.com/open/license.html + * + * Any redistributions of this file including modified versions must + * maintain this copyright notice. + * + *****************************************************************************/ +/** + * @file eventHandler.h + * C event handler structure. This structure holds event handler function + * callbacks for use by the generated code. + */ +/** + * @defgroup EventHandler event handler + * Event handler structures and callback function definitions. + * @{ + */ +#ifndef _EVENTHANDLER_H_ +#define _EVENTHANDLER_H_ + +#include <stdio.h> +#include "ooasn1.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifndef EXTERN +#if define (MAKE_DLL) +#define EXTERN __declspec(dllexport) +#else +#define EXTERN +#endif /* MAKE_DLL */ +#endif /* EXTERN */ + + +/** + * This is a function pointer for a callback function which is invoked + * from within a decode function when an element of a SEQUENCE, SET, + * SEQUENCE OF, SET OF, or CHOICE construct is parsed. + * + * @param name For SEQUENCE, SET, or CHOICE, this is the name of the + * element as defined in the ASN.1 defination. For + * SEQUENCE OF or SET OF, this is set to the name + * "element". + * @param index For SEQUENCE, SET, or CHOICE, this is not used and is + * set to the value + * -1. For SEQUENCE OF or SET OF, this contains the + * zero-based index of the element in the conceptual + * array associated with the construct. + * @return - none + */ +typedef void (*StartElement) (const char* name, int index) ; + + +/** + * This is a function pointer for a callback function which is invoked from + * within a decode function when parsing is complete on an element of a + * SEQUENCE, SET, SEQUENCE OF, SET OF, or CHOICE construct. + * + * @param name For SEQUENCE, SET, or CHOICE, this is the name of the + * element as defined in the ASN.1 defination. For + * SEQUENCE OF or SET OF, this is set to the name + * "element". + * @param index For SEQUENCE, SET, or CHOICE, this is not used and is + * set to the value + * -1. For SEQUENCE OF or SET OF, this contains the + * zero-based index of the element in the conceptual + * array associated with the construct. + * @return - none + */ +typedef void (*EndElement) (const char* name, int index) ; + + +/** + * This is a function pointer for a callback function which is invoked from + * within a decode function when a value of the BOOLEAN ASN.1 type is parsed. + * + * @param value Parsed value. + * @return - none + */ +typedef void (*BoolValue) (ASN1BOOL value); + +/** + * This is a function pointer for a callback function which is invoked from + * within a decode function when a value of the INTERGER ASN.1 type is parsed. + * + * @param value Parsed value. + * @return - none + */ +typedef void (*IntValue) (ASN1INT value); + +/** + * This is a function pointer for a callback function which is invoked + * from within a decode function when a value of the INTEGER ASN.1 type + * is parsed. In this case, constraints on the integer value forced the + * use of unsigned integer C type to represent the value. + * + * @param value Parsed value. + * @return - none + */ +typedef void (*UIntValue) (ASN1UINT value); + +/** + * This is a function pointer for a callback function which is invoked from + * within a decode function when a value of the BIT STRING ASN.1 type is + * parsed. + * + * @param numbits - Number of bits in the parsed value. + * @param data - Pointer to a byte array that contains the bit + * string data. + * @return - none + */ +typedef void (*BitStrValue) (ASN1UINT numbits, const ASN1OCTET* data); + +/** + * This is a function pointer for a callback function which is invoked from + * within a decode function when a value of one of the OCTET STRING ASN.1 type + * is parsed. + * + * @param numocts Number of octets in the parsed value. + * @param data Pointer to byte array containing the octet string + * data. + * @return - none + */ +typedef void (*OctStrValue) (ASN1UINT numocts, const ASN1OCTET* data) ; + +/** + * This is a function pointer for a callback function which is invoked from + * within a decode function when a value of one of the 8-bit ASN.1 character + * string types is parsed. + * + * @param value Null terminated character string value. + * @return - none + */ +typedef void (*CharStrValue) (const char* value) ; + +/** + * This is a function pointer for a callback function which is invoked from + * within a decode function when a value of one of the 16-bit ASN.1 character + * string types is parsed. + * + * This is used for the ASN.1 BmpString type. + * + * @param nchars Number of characters in the parsed value. + * @param data Pointer to an array containing 16-bit values. + * These are represented using unsigned short integer + * values. + * @return - none + */ +typedef void (*CharStrValue16Bit) (ASN1UINT nchars, ASN116BITCHAR* data) ; + +/** + * This is a function pointer for a callback function which is invoked from + * within a decode function when a value of the NULL ASN.1 type is parsed. + * + * @param - none + * @return - none + */ +typedef void (*NullValue) () ; + +/** + * This is a function pointer for a callback function which is invoked from + * within a decode function whn a value the OBJECT IDENTIFIER ASN.1 type is + * parsed. + * + * @param numSubIds Number of subidentifiers in the object identifier. + * @param pSubIds Pointer to array containing the subidentifier values. + * @return -none + */ +typedef void (*OidValue) (ASN1UINT numSubIds, ASN1UINT* pSubIds) ; + +/** + * This is a function pointer for a callback function which is invoked from + * within a decode function when a value of the ENUMERATED ASN.1 type is + * parsed. + * + * @param value - Parsed enumerated value + * @return - none + */ +typedef void (*EnumValue) (ASN1UINT value) ; + +/** + * This is a function pointer for a callback function which is invoked from + * within a decode function when an ASN.1 open type is parsed. + * + * @param numocts Number of octets in the parsed value. + * @param data Pointer to byet array contain in tencoded ASN.1 + * value. + * @return - none + */ +typedef void (*OpenTypeValue) (ASN1UINT numocts, const ASN1OCTET* data) ; + + +/** + * This is a basic C based event handler structure, which can be used + * to define user-defined event handlers. + */ +typedef struct EventHandler { + StartElement startElement; + EndElement endElement; + BoolValue boolValue; + IntValue intValue; + UIntValue uIntValue; + BitStrValue bitStrValue; + OctStrValue octStrValue; + CharStrValue charStrValue; + CharStrValue16Bit charStr16BitValue; + NullValue nullValue; + OidValue oidValue; + EnumValue enumValue; + OpenTypeValue openTypeValue; +} EventHandler; + + +/** + * This function sets the event handler object within the context. It + * will overwrite the definition of any handler that was set previously. + * + * @param pctxt Context to which event handler has to be added. + * @param pHandler Pointer to the event handler structure. + * @return none + */ +EXTERN void setEventHandler (OOCTXT* pctxt, EventHandler* pHandler); + +/** + * This function is called to remove the event handler current defined + * in the context. This is done by setting the event handler object + * pointer to NULL. + * + * @param pctxt Context from which event handler has to be removed. + * @return none + */ +EXTERN void removeEventHandler (OOCTXT* pctxt); + +/** + * The following functions are invoked from within the generated + * code to call the various user-defined event handler methods .. + */ +EXTERN void invokeStartElement (OOCTXT* pctxt, const char* name, int index); +EXTERN void invokeEndElement (OOCTXT* pctxt, const char* name, int index); +EXTERN void invokeBoolValue (OOCTXT* pctxt, ASN1BOOL value); +EXTERN void invokeIntValue (OOCTXT* pctxt, ASN1INT value); +EXTERN void invokeUIntValue (OOCTXT* pctxt, ASN1UINT value); + +EXTERN void invokeBitStrValue +(OOCTXT* pctxt, ASN1UINT numbits, const ASN1OCTET* data); + +EXTERN void invokeOctStrValue +(OOCTXT* pctxt, ASN1UINT numocts, const ASN1OCTET* data); + +EXTERN void invokeCharStrValue (OOCTXT* pctxt, const char* value); + +EXTERN void invokeCharStr16BitValue +(OOCTXT* pctxt, ASN1UINT nchars, ASN116BITCHAR* data); + +EXTERN void invokeNullValue (OOCTXT* pctxt); + +EXTERN void invokeOidValue +(OOCTXT* pctxt, ASN1UINT numSubIds, ASN1UINT* pSubIds); + +EXTERN void invokeEnumValue (OOCTXT* pctxt, ASN1UINT value); + +EXTERN void invokeOpenTypeValue +(OOCTXT* pctxt, ASN1UINT numocts, const ASN1OCTET* data); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif |