Last sync 2016.04.01
[deliverable/titan.core.git] / core / Addfunc.hh
CommitLineData
d44e3c4f 1/******************************************************************************
2 * Copyright (c) 2000-2016 Ericsson Telecom AB
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Baji, Laszlo
10 * Balasko, Jeno
11 * Baranyi, Botond
12 * Delic, Adam
13 * Forstner, Matyas
14 * Kovacs, Ferenc
15 * Raduly, Csaba
16 * Szabo, Janos Zoltan – initial implementation
17 * Zalanyi, Balazs Andor
18 *
19 ******************************************************************************/
970ed795
EL
20#ifndef ADDFUNC_HH
21#define ADDFUNC_HH
22
23#include "Types.h"
24
25class INTEGER;
26class FLOAT;
27class BITSTRING;
28class BITSTRING_ELEMENT;
29class HEXSTRING;
30class HEXSTRING_ELEMENT;
31class OCTETSTRING;
32class OCTETSTRING_ELEMENT;
33class CHARSTRING;
34class CHARSTRING_ELEMENT;
35class UNIVERSAL_CHARSTRING;
36class UNIVERSAL_CHARSTRING_ELEMENT;
37class BITSTRING_template;
38class HEXSTRING_template;
39class OCTETSTRING_template;
40class CHARSTRING_template;
41class UNIVERSAL_CHARSTRING_template;
42
43extern char hexdigit_to_char(unsigned char hexdigit);
44
45// Additional predefined functions defined in Annex C of ES 101 873-1
46
47// C.1 - int2char
48extern CHARSTRING int2char(int value);
49extern CHARSTRING int2char(const INTEGER& value);
50
51// C.2 - int2unichar
52extern UNIVERSAL_CHARSTRING int2unichar(int value);
53extern UNIVERSAL_CHARSTRING int2unichar(const INTEGER& value);
54
55// C.3 - int2bit
56extern BITSTRING int2bit(int value, int length);
57extern BITSTRING int2bit(int value, const INTEGER& length);
58extern BITSTRING int2bit(const INTEGER& value, int length);
59extern BITSTRING int2bit(const INTEGER& value, const INTEGER& length);
60
61// C.4 - int2hex
62extern HEXSTRING int2hex(int value, int length);
63extern HEXSTRING int2hex(int value, const INTEGER& length);
64extern HEXSTRING int2hex(const INTEGER& value, int length);
65extern HEXSTRING int2hex(const INTEGER& value, const INTEGER& length);
66
67// C.5 - int2oct
68extern OCTETSTRING int2oct(int value, int length);
69extern OCTETSTRING int2oct(int value, const INTEGER& length);
70extern OCTETSTRING int2oct(const INTEGER& value, int length);
71extern OCTETSTRING int2oct(const INTEGER& value, const INTEGER& length);
72
73// C.6 - int2str
74extern CHARSTRING int2str(int value);
75extern CHARSTRING int2str(const INTEGER& value);
76
77// C.7 - int2float
78extern double int2float(int value);
79extern double int2float(const INTEGER& value);
80
81// C.8 - float2int
82extern INTEGER float2int(double value);
83extern INTEGER float2int(const FLOAT& value);
84
85// C.9 - char2int
86extern int char2int(char value);
87extern int char2int(const char *value);
88extern int char2int(const CHARSTRING& value);
89extern int char2int(const CHARSTRING_ELEMENT& value);
90
91// C.10 - char2oct
92extern OCTETSTRING char2oct(const char *value);
93extern OCTETSTRING char2oct(const CHARSTRING& value);
94extern OCTETSTRING char2oct(const CHARSTRING_ELEMENT& value);
95
96// C.11 - unichar2int
97extern int unichar2int(const universal_char& value);
98extern int unichar2int(const UNIVERSAL_CHARSTRING& value);
99extern int unichar2int(const UNIVERSAL_CHARSTRING_ELEMENT& value);
100
101// C.12 - bit2int
102extern INTEGER bit2int(const BITSTRING& value);
103extern INTEGER bit2int(const BITSTRING_ELEMENT& value);
104
105// C.13 - bit2hex
106extern HEXSTRING bit2hex(const BITSTRING& value);
107extern HEXSTRING bit2hex(const BITSTRING_ELEMENT& value);
108
109// C.14 - bit2oct
110extern OCTETSTRING bit2oct(const BITSTRING& value);
111extern OCTETSTRING bit2oct(const BITSTRING_ELEMENT& value);
112
113// C.15 - bit2str
114extern CHARSTRING bit2str(const BITSTRING& value);
115extern CHARSTRING bit2str(const BITSTRING_ELEMENT& value);
116
117// C.16 - hex2int
118extern INTEGER hex2int(const HEXSTRING& value);
119extern INTEGER hex2int(const HEXSTRING_ELEMENT& value);
120
121// C.17 - hex2bit
122extern BITSTRING hex2bit(const HEXSTRING& value);
123extern BITSTRING hex2bit(const HEXSTRING_ELEMENT& value);
124
125// C.18 - hex2oct
126extern OCTETSTRING hex2oct(const HEXSTRING& value);
127extern OCTETSTRING hex2oct(const HEXSTRING_ELEMENT& value);
128
129// C.19 - hex2str
130extern CHARSTRING hex2str(const HEXSTRING& value);
131extern CHARSTRING hex2str(const HEXSTRING_ELEMENT& value);
132
133// C.20 - oct2int
134extern INTEGER oct2int(const OCTETSTRING& value);
135extern INTEGER oct2int(const OCTETSTRING_ELEMENT& value);
136
137// C.21 - oct2bit
138extern BITSTRING oct2bit(const OCTETSTRING& value);
139extern BITSTRING oct2bit(const OCTETSTRING_ELEMENT& value);
140
141// C.22 - oct2hex
142extern HEXSTRING oct2hex(const OCTETSTRING& value);
143extern HEXSTRING oct2hex(const OCTETSTRING_ELEMENT& value);
144
145// C.23 - oct2str
146extern CHARSTRING oct2str(const OCTETSTRING& value);
147extern CHARSTRING oct2str(const OCTETSTRING_ELEMENT& value);
148
149// C.24 - oct2char
150extern CHARSTRING oct2char(const OCTETSTRING& value);
151extern CHARSTRING oct2char(const OCTETSTRING_ELEMENT& value);
152
153// C.25 - str2int
154extern INTEGER str2int(const char *value);
155extern INTEGER str2int(const CHARSTRING& value);
156extern INTEGER str2int(const CHARSTRING_ELEMENT& value);
157
158// C.26 - str2oct
159extern OCTETSTRING str2oct(const char *value);
160extern OCTETSTRING str2oct(const CHARSTRING& value);
161
162// C.27 - str2float
163extern double str2float(const char *value);
164extern double str2float(const CHARSTRING& value);
165
166// C.28 - lengthof: built-in
167
168// C.29 - sizeof: built-in
169
170// C.31 - ispresent: built-in
171
172// C.32 - ischosen: built-in
173
174// C.33 - regexp
175extern CHARSTRING regexp(const CHARSTRING& instr, const CHARSTRING& expression,
176 int groupno);
177extern CHARSTRING regexp(const CHARSTRING& instr, const CHARSTRING& expression,
178 const INTEGER& groupno);
179extern UNIVERSAL_CHARSTRING regexp(const UNIVERSAL_CHARSTRING& instr,
180 const UNIVERSAL_CHARSTRING* expression_val,
181 const UNIVERSAL_CHARSTRING_template* expression_tmpl,
182 int groupno);
183extern UNIVERSAL_CHARSTRING regexp(const UNIVERSAL_CHARSTRING& instr,
184 const UNIVERSAL_CHARSTRING& expression, int groupno);
185extern UNIVERSAL_CHARSTRING regexp(const UNIVERSAL_CHARSTRING& instr,
186 const UNIVERSAL_CHARSTRING& expression, const INTEGER& groupno);
187// regexp on templates
188extern CHARSTRING regexp(const CHARSTRING_template& instr,
189 const CHARSTRING_template& expression, int groupno);
190extern CHARSTRING regexp(const CHARSTRING_template& instr,
191 const CHARSTRING_template& expression, const INTEGER& groupno);
192extern UNIVERSAL_CHARSTRING regexp(const UNIVERSAL_CHARSTRING_template& instr,
193 const UNIVERSAL_CHARSTRING_template& expression, int groupno);
194extern UNIVERSAL_CHARSTRING regexp(const UNIVERSAL_CHARSTRING_template& instr,
195 const UNIVERSAL_CHARSTRING_template& expression, const INTEGER& groupno);
196
197// C.34 - substr
198extern void check_substr_arguments(int value_length, int index,
199 int returncount, const char *string_type, const char *element_name);
200extern BITSTRING substr(const BITSTRING& value, int index, int returncount);
201extern BITSTRING substr(const BITSTRING& value, int index,
202 const INTEGER& returncount);
203extern BITSTRING substr(const BITSTRING& value, const INTEGER& index,
204 int returncount);
205extern BITSTRING substr(const BITSTRING& value, const INTEGER& index,
206 const INTEGER& returncount);
207extern BITSTRING substr(const BITSTRING_ELEMENT& value, int index,
208 int returncount);
209extern BITSTRING substr(const BITSTRING_ELEMENT& value, int index,
210 const INTEGER& returncount);
211extern BITSTRING substr(const BITSTRING_ELEMENT& value, const INTEGER& index,
212 int returncount);
213extern BITSTRING substr(const BITSTRING_ELEMENT& value, const INTEGER& index,
214 const INTEGER& returncount);
215
216extern HEXSTRING substr(const HEXSTRING& value, int index, int returncount);
217extern HEXSTRING substr(const HEXSTRING& value, int index,
218 const INTEGER& returncount);
219extern HEXSTRING substr(const HEXSTRING& value, const INTEGER& index,
220 int returncount);
221extern HEXSTRING substr(const HEXSTRING& value, const INTEGER& index,
222 const INTEGER& returncount);
223extern HEXSTRING substr(const HEXSTRING_ELEMENT& value, int index,
224 int returncount);
225extern HEXSTRING substr(const HEXSTRING_ELEMENT& value, int index,
226 const INTEGER& returncount);
227extern HEXSTRING substr(const HEXSTRING_ELEMENT& value, const INTEGER& index,
228 int returncount);
229extern HEXSTRING substr(const HEXSTRING_ELEMENT& value, const INTEGER& index,
230 const INTEGER& returncount);
231
232extern OCTETSTRING substr(const OCTETSTRING& value, int index,
233 int returncount);
234extern OCTETSTRING substr(const OCTETSTRING& value, int index,
235 const INTEGER& returncount);
236extern OCTETSTRING substr(const OCTETSTRING& value, const INTEGER& index,
237 int returncount);
238extern OCTETSTRING substr(const OCTETSTRING& value, const INTEGER& index,
239 const INTEGER& returncount);
240extern OCTETSTRING substr(const OCTETSTRING_ELEMENT& value, int index,
241 int returncount);
242extern OCTETSTRING substr(const OCTETSTRING_ELEMENT& value, int index,
243 const INTEGER& returncount);
244extern OCTETSTRING substr(const OCTETSTRING_ELEMENT& value,
245 const INTEGER& index, int returncount);
246extern OCTETSTRING substr(const OCTETSTRING_ELEMENT& value,
247 const INTEGER& index, const INTEGER& returncount);
248
249extern CHARSTRING substr(const CHARSTRING& value, int index,
250 int returncount);
251extern CHARSTRING substr(const CHARSTRING& value, int index,
252 const INTEGER& returncount);
253extern CHARSTRING substr(const CHARSTRING& value, const INTEGER& index,
254 int returncount);
255extern CHARSTRING substr(const CHARSTRING& value, const INTEGER& index,
256 const INTEGER& returncount);
257extern CHARSTRING substr(const CHARSTRING_ELEMENT& value, int index,
258 int returncount);
259extern CHARSTRING substr(const CHARSTRING_ELEMENT& value, int index,
260 const INTEGER& returncount);
261extern CHARSTRING substr(const CHARSTRING_ELEMENT& value,
262 const INTEGER& index, int returncount);
263extern CHARSTRING substr(const CHARSTRING_ELEMENT& value,
264 const INTEGER& index, const INTEGER& returncount);
265
266extern UNIVERSAL_CHARSTRING substr(const UNIVERSAL_CHARSTRING& value,
267 int index, int returncount);
268extern UNIVERSAL_CHARSTRING substr(const UNIVERSAL_CHARSTRING& value,
269 int index, const INTEGER& returncount);
270extern UNIVERSAL_CHARSTRING substr(const UNIVERSAL_CHARSTRING& value,
271 const INTEGER& index, int returncount);
272extern UNIVERSAL_CHARSTRING substr(const UNIVERSAL_CHARSTRING& value,
273 const INTEGER& index, const INTEGER& returncount);
274extern UNIVERSAL_CHARSTRING substr(const UNIVERSAL_CHARSTRING_ELEMENT& value,
275 int index, int returncount);
276extern UNIVERSAL_CHARSTRING substr(const UNIVERSAL_CHARSTRING_ELEMENT& value,
277 int index, const INTEGER& returncount);
278extern UNIVERSAL_CHARSTRING substr(const UNIVERSAL_CHARSTRING_ELEMENT& value,
279 const INTEGER& index, int returncount);
280extern UNIVERSAL_CHARSTRING substr(const UNIVERSAL_CHARSTRING_ELEMENT& value,
281 const INTEGER& index, const INTEGER& returncount);
282
283// substr for templates
284extern BITSTRING substr(const BITSTRING_template& value, int index,
285 int returncount);
286extern BITSTRING substr(const BITSTRING_template& value, int index,
287 const INTEGER& returncount);
288extern BITSTRING substr(const BITSTRING_template& value, const INTEGER& index,
289 int returncount);
290extern BITSTRING substr(const BITSTRING_template& value, const INTEGER& index,
291 const INTEGER& returncount);
292
293extern HEXSTRING substr(const HEXSTRING_template& value, int index,
294 int returncount);
295extern HEXSTRING substr(const HEXSTRING_template& value, int index,
296 const INTEGER& returncount);
297extern HEXSTRING substr(const HEXSTRING_template& value, const INTEGER& index,
298 int returncount);
299extern HEXSTRING substr(const HEXSTRING_template& value, const INTEGER& index,
300 const INTEGER& returncount);
301
302extern OCTETSTRING substr(const OCTETSTRING_template& value, int index,
303 int returncount);
304extern OCTETSTRING substr(const OCTETSTRING_template& value, int index,
305 const INTEGER& returncount);
306extern OCTETSTRING substr(const OCTETSTRING_template& value, const INTEGER& index,
307 int returncount);
308extern OCTETSTRING substr(const OCTETSTRING_template& value, const INTEGER& index,
309 const INTEGER& returncount);
310
311extern CHARSTRING substr(const CHARSTRING_template& value, int index,
312 int returncount);
313extern CHARSTRING substr(const CHARSTRING_template& value, int index,
314 const INTEGER& returncount);
315extern CHARSTRING substr(const CHARSTRING_template& value, const INTEGER& index,
316 int returncount);
317extern CHARSTRING substr(const CHARSTRING_template& value, const INTEGER& index,
318 const INTEGER& returncount);
319
320extern UNIVERSAL_CHARSTRING substr(const UNIVERSAL_CHARSTRING_template& value,
321 int index, int returncount);
322extern UNIVERSAL_CHARSTRING substr(const UNIVERSAL_CHARSTRING_template& value,
323 int index, const INTEGER& returncount);
324extern UNIVERSAL_CHARSTRING substr(const UNIVERSAL_CHARSTRING_template& value,
325 const INTEGER& index, int returncount);
326extern UNIVERSAL_CHARSTRING substr(const UNIVERSAL_CHARSTRING_template& value,
327 const INTEGER& index, const INTEGER& returncount);
328
329// C.35 - replace
330extern void check_replace_arguments(int value_length, int index, int len,
331 const char *string_type, const char *element_name);
332extern BITSTRING replace(const BITSTRING& value, int index, int len,
333 const BITSTRING& repl);
334extern BITSTRING replace(const BITSTRING& value, int index,
335 const INTEGER& len, const BITSTRING& repl);
336extern BITSTRING replace(const BITSTRING& value, const INTEGER& index,
337 int len, const BITSTRING& repl);
338extern BITSTRING replace(const BITSTRING& value, const INTEGER& index,
339 const INTEGER& len, const BITSTRING& repl);
340
341extern HEXSTRING replace(const HEXSTRING& value, int index, int len,
342 const HEXSTRING& repl);
343extern HEXSTRING replace(const HEXSTRING& value, int index,
344 const INTEGER& len, const HEXSTRING& repl);
345extern HEXSTRING replace(const HEXSTRING& value, const INTEGER& index,
346 int len, const HEXSTRING& repl);
347extern HEXSTRING replace(const HEXSTRING& value, const INTEGER& index,
348 const INTEGER& len, const HEXSTRING& repl);
349
350extern OCTETSTRING replace(const OCTETSTRING& value, int index, int len,
351 const OCTETSTRING& repl);
352extern OCTETSTRING replace(const OCTETSTRING& value, int index,
353 const INTEGER& len, const OCTETSTRING& repl);
354extern OCTETSTRING replace(const OCTETSTRING& value, const INTEGER& index,
355 int len, const OCTETSTRING& repl);
356extern OCTETSTRING replace(const OCTETSTRING& value, const INTEGER& index,
357 const INTEGER& len, const OCTETSTRING& repl);
358
359extern CHARSTRING replace(const CHARSTRING& value, int index, int len,
360 const CHARSTRING& repl);
361extern CHARSTRING replace(const CHARSTRING& value, int index,
362 const INTEGER& len, const CHARSTRING& repl);
363extern CHARSTRING replace(const CHARSTRING& value, const INTEGER& index,
364 int len, const CHARSTRING& repl);
365extern CHARSTRING replace(const CHARSTRING& value, const INTEGER& index,
366 const INTEGER& len, const CHARSTRING& repl);
367
368extern UNIVERSAL_CHARSTRING replace(const UNIVERSAL_CHARSTRING& value,
369 int index, int len, const UNIVERSAL_CHARSTRING& repl);
370extern UNIVERSAL_CHARSTRING replace(const UNIVERSAL_CHARSTRING& value,
371 int index, const INTEGER& len, const UNIVERSAL_CHARSTRING& repl);
372extern UNIVERSAL_CHARSTRING replace(const UNIVERSAL_CHARSTRING& value,
373 const INTEGER& index, int len, const UNIVERSAL_CHARSTRING& repl);
374extern UNIVERSAL_CHARSTRING replace(const UNIVERSAL_CHARSTRING& value,
375 const INTEGER& index, const INTEGER& len,
376 const UNIVERSAL_CHARSTRING& repl);
377// replace - template parameters
378extern BITSTRING replace(const BITSTRING_template& value, int index, int len,
379 const BITSTRING_template& repl);
380extern BITSTRING replace(const BITSTRING_template& value, int index,
381 const INTEGER& len, const BITSTRING_template& repl);
382extern BITSTRING replace(const BITSTRING_template& value, const INTEGER& index,
383 int len, const BITSTRING_template& repl);
384extern BITSTRING replace(const BITSTRING_template& value, const INTEGER& index,
385 const INTEGER& len, const BITSTRING_template& repl);
386
387extern HEXSTRING replace(const HEXSTRING_template& value, int index, int len,
388 const HEXSTRING_template& repl);
389extern HEXSTRING replace(const HEXSTRING_template& value, int index,
390 const INTEGER& len, const HEXSTRING_template& repl);
391extern HEXSTRING replace(const HEXSTRING_template& value, const INTEGER& index,
392 int len, const HEXSTRING_template& repl);
393extern HEXSTRING replace(const HEXSTRING_template& value, const INTEGER& index,
394 const INTEGER& len, const HEXSTRING_template& repl);
395
396extern OCTETSTRING replace(const OCTETSTRING_template& value, int index, int len,
397 const OCTETSTRING& repl);
398extern OCTETSTRING replace(const OCTETSTRING_template& value, int index,
399 const INTEGER& len, const OCTETSTRING& repl);
400extern OCTETSTRING replace(const OCTETSTRING_template& value, const INTEGER& index,
401 int len, const OCTETSTRING_template& repl);
402extern OCTETSTRING replace(const OCTETSTRING_template& value, const INTEGER& index,
403 const INTEGER& len, const OCTETSTRING_template& repl);
404
405extern CHARSTRING replace(const CHARSTRING_template& value, int index, int len,
406 const CHARSTRING_template& repl);
407extern CHARSTRING replace(const CHARSTRING_template& value, int index,
408 const INTEGER& len, const CHARSTRING_template& repl);
409extern CHARSTRING replace(const CHARSTRING_template& value, const INTEGER& index,
410 int len, const CHARSTRING_template& repl);
411extern CHARSTRING replace(const CHARSTRING_template& value, const INTEGER& index,
412 const INTEGER& len, const CHARSTRING_template& repl);
413
414extern UNIVERSAL_CHARSTRING replace(const UNIVERSAL_CHARSTRING_template& value,
415 int index, int len, const UNIVERSAL_CHARSTRING_template& repl);
416extern UNIVERSAL_CHARSTRING replace(const UNIVERSAL_CHARSTRING_template& value,
417 int index, const INTEGER& len, const UNIVERSAL_CHARSTRING_template& repl);
418extern UNIVERSAL_CHARSTRING replace(const UNIVERSAL_CHARSTRING_template& value,
419 const INTEGER& index, int len, const UNIVERSAL_CHARSTRING_template& repl);
420extern UNIVERSAL_CHARSTRING replace(const UNIVERSAL_CHARSTRING_template& value,
421 const INTEGER& index, const INTEGER& len,
422 const UNIVERSAL_CHARSTRING_template& repl);
423
424
425// C.36 - rnd
426extern double rnd();
427extern double rnd(double seed);
428extern double rnd(const FLOAT& seed);
429
430
431// Additional predefined functions defined in Annex B of ES 101 873-7
432
433// B.1 decomp - not implemented yet
434
435
436// Non-standard functions
437
438// str2bit
439extern BITSTRING str2bit(const char *value);
440extern BITSTRING str2bit(const CHARSTRING& value);
441extern BITSTRING str2bit(const CHARSTRING_ELEMENT& value);
442
443// str2hex
444extern HEXSTRING str2hex(const char *value);
445extern HEXSTRING str2hex(const CHARSTRING& value);
446extern HEXSTRING str2hex(const CHARSTRING_ELEMENT& value);
447
448// float2str
449extern CHARSTRING float2str(double value);
450extern CHARSTRING float2str(const FLOAT& value);
451
452// unichar2char
453extern CHARSTRING unichar2char(const UNIVERSAL_CHARSTRING& value);
454extern CHARSTRING unichar2char(const UNIVERSAL_CHARSTRING_ELEMENT& value);
455
456// only for internal purposes
457extern CHARSTRING get_port_name(const char *port_name, int array_index);
458extern CHARSTRING get_port_name(const char *port_name,
459 const INTEGER& array_index);
460extern CHARSTRING get_port_name(const CHARSTRING& port_name, int array_index);
461extern CHARSTRING get_port_name(const CHARSTRING& port_name,
462 const INTEGER& array_index);
463
464unsigned char char_to_hexdigit(char c);
465
466// unichar2oct
467extern OCTETSTRING unichar2oct(const UNIVERSAL_CHARSTRING& invalue); // default string_encoding UTF-8
468extern OCTETSTRING unichar2oct(const UNIVERSAL_CHARSTRING& invalue,
469 const CHARSTRING& string_encoding);
470//oct2unichar
471extern UNIVERSAL_CHARSTRING oct2unichar(const OCTETSTRING& invalue ); // default string_encoding UTF-8
472extern UNIVERSAL_CHARSTRING oct2unichar(const OCTETSTRING& invalue,
473 const CHARSTRING& string_encoding);
474
475extern CHARSTRING get_stringencoding(const OCTETSTRING& encoded__value);
476extern OCTETSTRING remove_bom(const OCTETSTRING& encoded__value);
477extern CHARSTRING encode_base64(const OCTETSTRING& msg, bool use_linebreaks);
478extern CHARSTRING encode_base64(const OCTETSTRING& msg);
479extern OCTETSTRING decode_base64(const CHARSTRING& b64);
480
481#endif
This page took 0.040262 seconds and 5 git commands to generate.