Debian Codegraph @

addons/ooh323c/src/eventHandler.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2004-2005 by Objective Systems, Inc.
3 *
4 * This software is furnished under an open source license and may be
5 * used and copied only in accordance with the terms of this license.
6 * The text of the license may generally be found in the root
7 * directory of this installation in the COPYING file. It
8 * can also be viewed online at the following URL:
9 *
10 * http://www.obj-sys.com/open/license.html
11 *
12 * Any redistributions of this file including modified versions must
13 * maintain this copyright notice.
14 *
15 *****************************************************************************/
16 /**
17 * @file eventHandler.h
18 * C event handler structure. This structure holds event handler function
19 * callbacks for use by the generated code.
20 */
21 /**
22 * @defgroup EventHandler event handler
23 * Event handler structures and callback function definitions.
24 * @{
25 */
26 #ifndef _EVENTHANDLER_H_
27 #define _EVENTHANDLER_H_
28
29 #include <stdio.h>
30 #include "ooasn1.h"
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36
37 #ifndef EXTERN
38 #if define (MAKE_DLL)
39 #define EXTERN __declspec(dllexport)
40 #else
41 #define EXTERN
42 #endif /* MAKE_DLL */
43 #endif /* EXTERN */
44
45
46 /**
47 * This is a function pointer for a callback function which is invoked
48 * from within a decode function when an element of a SEQUENCE, SET,
49 * SEQUENCE OF, SET OF, or CHOICE construct is parsed.
50 *
51 * @param name For SEQUENCE, SET, or CHOICE, this is the name of the
52 * element as defined in the ASN.1 definition. For
53 * SEQUENCE OF or SET OF, this is set to the name
54 * "element".
55 * @param index For SEQUENCE, SET, or CHOICE, this is not used and is
56 * set to the value
57 * -1. For SEQUENCE OF or SET OF, this contains the
58 * zero-based index of the element in the conceptual
59 * array associated with the construct.
60 * @return - none
61 */
62 typedef void (*StartElement) (const char* name, int index) ;
63
64
65 /**
66 * This is a function pointer for a callback function which is invoked from
67 * within a decode function when parsing is complete on an element of a
68 * SEQUENCE, SET, SEQUENCE OF, SET OF, or CHOICE construct.
69 *
70 * @param name For SEQUENCE, SET, or CHOICE, this is the name of the
71 * element as defined in the ASN.1 definition. For
72 * SEQUENCE OF or SET OF, this is set to the name
73 * "element".
74 * @param index For SEQUENCE, SET, or CHOICE, this is not used and is
75 * set to the value
76 * -1. For SEQUENCE OF or SET OF, this contains the
77 * zero-based index of the element in the conceptual
78 * array associated with the construct.
79 * @return - none
80 */
81 typedef void (*EndElement) (const char* name, int index) ;
82
83
84 /**
85 * This is a function pointer for a callback function which is invoked from
86 * within a decode function when a value of the BOOLEAN ASN.1 type is parsed.
87 *
88 * @param value Parsed value.
89 * @return - none
90 */
91 typedef void (*BoolValue) (ASN1BOOL value);
92
93 /**
94 * This is a function pointer for a callback function which is invoked from
95 * within a decode function when a value of the INTERGER ASN.1 type is parsed.
96 *
97 * @param value Parsed value.
98 * @return - none
99 */
100 typedef void (*IntValue) (ASN1INT value);
101
102 /**
103 * This is a function pointer for a callback function which is invoked
104 * from within a decode function when a value of the INTEGER ASN.1 type
105 * is parsed. In this case, constraints on the integer value forced the
106 * use of unsigned integer C type to represent the value.
107 *
108 * @param value Parsed value.
109 * @return - none
110 */
111 typedef void (*UIntValue) (ASN1UINT value);
112
113 /**
114 * This is a function pointer for a callback function which is invoked from
115 * within a decode function when a value of the BIT STRING ASN.1 type is
116 * parsed.
117 *
118 * @param numbits - Number of bits in the parsed value.
119 * @param data - Pointer to a byte array that contains the bit
120 * string data.
121 * @return - none
122 */
123 typedef void (*BitStrValue) (ASN1UINT numbits, const ASN1OCTET* data);
124
125 /**
126 * This is a function pointer for a callback function which is invoked from
127 * within a decode function when a value of one of the OCTET STRING ASN.1 type
128 * is parsed.
129 *
130 * @param numocts Number of octets in the parsed value.
131 * @param data Pointer to byte array containing the octet string
132 * data.
133 * @return - none
134 */
135 typedef void (*OctStrValue) (ASN1UINT numocts, const ASN1OCTET* data) ;
136
137 /**
138 * This is a function pointer for a callback function which is invoked from
139 * within a decode function when a value of one of the 8-bit ASN.1 character
140 * string types is parsed.
141 *
142 * @param value Null terminated character string value.
143 * @return - none
144 */
145 typedef void (*CharStrValue) (const char* value) ;
146
147 /**
148 * This is a function pointer for a callback function which is invoked from
149 * within a decode function when a value of one of the 16-bit ASN.1 character
150 * string types is parsed.
151 *
152 * This is used for the ASN.1 BmpString type.
153 *
154 * @param nchars Number of characters in the parsed value.
155 * @param data Pointer to an array containing 16-bit values.
156 * These are represented using unsigned short integer
157 * values.
158 * @return - none
159 */
160 typedef void (*CharStrValue16Bit) (ASN1UINT nchars, ASN116BITCHAR* data) ;
161
162 /**
163 * This is a function pointer for a callback function which is invoked from
164 * within a decode function when a value of the NULL ASN.1 type is parsed.
165 *
166 * @param - none
167 * @return - none
168 */
169 typedef void (*NullValue) (void) ;
170
171 /**
172 * This is a function pointer for a callback function which is invoked from
173 * within a decode function whn a value the OBJECT IDENTIFIER ASN.1 type is
174 * parsed.
175 *
176 * @param numSubIds Number of subidentifiers in the object identifier.
177 * @param pSubIds Pointer to array containing the subidentifier values.
178 * @return -none
179 */
180 typedef void (*OidValue) (ASN1UINT numSubIds, ASN1UINT* pSubIds) ;
181
182 /**
183 * This is a function pointer for a callback function which is invoked from
184 * within a decode function when a value of the ENUMERATED ASN.1 type is
185 * parsed.
186 *
187 * @param value - Parsed enumerated value
188 * @return - none
189 */
190 typedef void (*EnumValue) (ASN1UINT value) ;
191
192 /**
193 * This is a function pointer for a callback function which is invoked from
194 * within a decode function when an ASN.1 open type is parsed.
195 *
196 * @param numocts Number of octets in the parsed value.
197 * @param data Pointer to byte array contain in tencoded ASN.1
198 * value.
199 * @return - none
200 */
201 typedef void (*OpenTypeValue) (ASN1UINT numocts, const ASN1OCTET* data) ;
202
203
204 /**
205 * This is a basic C based event handler structure, which can be used
206 * to define user-defined event handlers.
207 */
208 typedef struct EventHandler {
209 StartElement startElement;
210 EndElement endElement;
211 BoolValue boolValue;
212 IntValue intValue;
213 UIntValue uIntValue;
214 BitStrValue bitStrValue;
215 OctStrValue octStrValue;
216 CharStrValue charStrValue;
217 CharStrValue16Bit charStr16BitValue;
218 NullValue nullValue;
219 OidValue oidValue;
220 EnumValue enumValue;
221 OpenTypeValue openTypeValue;
222 } EventHandler;
223
224
225 /**
226 * This function sets the event handler object within the context. It
227 * will overwrite the definition of any handler that was set previously.
228 *
229 * @param pctxt Context to which event handler has to be added.
230 * @param pHandler Pointer to the event handler structure.
231 * @return none
232 */
233 EXTERN void setEventHandler (OOCTXT* pctxt, EventHandler* pHandler);
234
235 /**
236 * This function is called to remove the event handler current defined
237 * in the context. This is done by setting the event handler object
238 * pointer to NULL.
239 *
240 * @param pctxt Context from which event handler has to be removed.
241 * @return none
242 */
243 EXTERN void removeEventHandler (OOCTXT* pctxt);
244
245 /**
246 * The following functions are invoked from within the generated
247 * code to call the various user-defined event handler methods ..
248 */
249 EXTERN void invokeStartElement (OOCTXT* pctxt, const char* name, int index);
250 EXTERN void invokeEndElement (OOCTXT* pctxt, const char* name, int index);
251 EXTERN void invokeBoolValue (OOCTXT* pctxt, ASN1BOOL value);
252 EXTERN void invokeIntValue (OOCTXT* pctxt, ASN1INT value);
253 EXTERN void invokeUIntValue (OOCTXT* pctxt, ASN1UINT value);
254
255 EXTERN void invokeBitStrValue
256 (OOCTXT* pctxt, ASN1UINT numbits, const ASN1OCTET* data);
257
258 EXTERN void invokeOctStrValue
259 (OOCTXT* pctxt, ASN1UINT numocts, const ASN1OCTET* data);
260
261 EXTERN void invokeCharStrValue (OOCTXT* pctxt, const char* value);
262
263 EXTERN void invokeCharStr16BitValue
264 (OOCTXT* pctxt, ASN1UINT nchars, ASN116BITCHAR* data);
265
266 EXTERN void invokeNullValue (OOCTXT* pctxt);
267
268 EXTERN void invokeOidValue
269 (OOCTXT* pctxt, ASN1UINT numSubIds, ASN1UINT* pSubIds);
270
271 EXTERN void invokeEnumValue (OOCTXT* pctxt, ASN1UINT value);
272
273 EXTERN void invokeOpenTypeValue
274 (OOCTXT* pctxt, ASN1UINT numocts, const ASN1OCTET* data);
275
276 /**
277 * @}
278 */
279
280 #ifdef __cplusplus
281 }
282 #endif
283
284 #endif