2 * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 *---------------------------------------------------------------------------
27 * facility.c - decode Q.932 facilities
28 * ------------------------------------
30 * $Id: facility.c,v 1.5 2000/02/21 15:17:17 hm Exp $
32 * $FreeBSD: src/usr.sbin/i4b/isdndecode/facility.c,v 1.6.2.1 2001/08/01 17:45:05 obrien Exp $
34 * last edit-date: [Mon Feb 21 16:15:43 2000]
36 *---------------------------------------------------------------------------
38 * - Q.932 (03/93) Generic Procedures for the Control of
39 * ISDN Supplementaty Services
40 * - Q.950 (03/93) Supplementary Services Protocols, Structure and
42 * - ETS 300 179 (10/92) Advice Of Charge: charging information during
43 * the call (AOC-D) supplementary service Service description
44 * - ETS 300 180 (10/92) Advice Of Charge: charging information at the
45 * end of call (AOC-E) supplementary service Service description
46 * - ETS 300 181 (04/93) Advice Of Charge (AOC) supplementary service
47 * Functional capabilities and information flows
48 * - ETS 300 182 (04/93) Advice Of Charge (AOC) supplementary service
49 * Digital Subscriber Signalling System No. one (DSS1) protocol
50 * - X.208 Specification of Abstract Syntax Notation One (ASN.1)
51 * - X.209 Specification of Basic Encoding Rules for
52 * Abstract Syntax Notation One (ASN.1)
53 * - "ASN.1 Abstract Syntax Notation One", Walter Gora, DATACOM-Verlag
54 * 1992, 3rd Edition (ISBN 3-89238-062-7) (german !)
56 *---------------------------------------------------------------------------*/
61 static int do_component(int length, char *pbuf);
62 static char *uni_str(int code);
63 static char *opval_str(int val);
64 static char *bid_str(int val);
65 static void next_state(char *pbuf, int class, int form, int code, int val);
68 static unsigned char *byte_buf;
71 /*---------------------------------------------------------------------------*
72 * decode Q.931/Q.932 facility info element
73 *---------------------------------------------------------------------------*/
75 q932_facility(char *pbuf, unsigned char *buf)
79 sprintf((pbuf+strlen(pbuf)), "[facility (Q.932): ");
85 buf++; /* protocol profile */
87 sprintf((pbuf+strlen(pbuf)), "Protocol=");
92 sprintf((pbuf+strlen(pbuf)), "Remote Operations Protocol\n");
96 sprintf((pbuf+strlen(pbuf)), "CMIP Protocol (Q.941), UNSUPPORTED!\n");
101 sprintf((pbuf+strlen(pbuf)), "ACSE Protocol (X.217/X.227), UNSUPPORTED!\n");
106 sprintf((pbuf+strlen(pbuf)), "Unknown Protocol (val = 0x%x), UNSUPPORTED!\n", *buf & 0x1f);
116 /* initialize variables for do_component */
120 state = ST_EXP_COMP_TYP;
122 /* decode facility */
124 do_component(len, pbuf);
126 sprintf((pbuf+(strlen(pbuf)-1)), "]"); /* XXX replace last newline */
131 /*---------------------------------------------------------------------------*
132 * handle a component recursively
133 *---------------------------------------------------------------------------*/
135 do_component(int length, char *pbuf)
137 int comp_tag_class; /* component tag class */
138 int comp_tag_form; /* component form: constructor or primitive */
139 int comp_tag_code; /* component code depending on class */
140 int comp_length = 0; /* component length */
143 sprintf((pbuf+strlen(pbuf)), "ENTER - comp_length = %d, byte_len = %d, length =%d\n", comp_length, byte_len, length);
149 sprintf((pbuf+strlen(pbuf)), "AGAIN - comp_length = %d, byte_len = %d, length =%d\n", comp_length, byte_len, length);
152 /*----------------------------------------*/
153 /* first component element: component tag */
154 /*----------------------------------------*/
158 sprintf((pbuf+strlen(pbuf)), "\t0x%02x Tag: ", *byte_buf);
160 comp_tag_class = (*byte_buf & 0xc0) >> 6;
162 switch(comp_tag_class)
164 case FAC_TAGCLASS_UNI:
165 sprintf((pbuf+strlen(pbuf)), "Universal");
167 case FAC_TAGCLASS_APW:
168 sprintf((pbuf+strlen(pbuf)), "Applic-wide");
170 case FAC_TAGCLASS_COS:
171 sprintf((pbuf+strlen(pbuf)), "Context-spec");
173 case FAC_TAGCLASS_PRU:
174 sprintf((pbuf+strlen(pbuf)), "Private");
180 comp_tag_form = (*byte_buf & 0x20) > 5;
182 sprintf((pbuf+strlen(pbuf)), ", ");
184 if(comp_tag_form == FAC_TAGFORM_CON)
186 sprintf((pbuf+strlen(pbuf)), "Constructor");
190 sprintf((pbuf+strlen(pbuf)), "Primitive");
195 comp_tag_code = *byte_buf & 0x1f;
197 sprintf((pbuf+strlen(pbuf)), ", ");
199 if(comp_tag_code == 0x1f)
206 while(*byte_buf & 0x80)
208 comp_tag_code += (*byte_buf & 0x7f);
212 comp_tag_code += (*byte_buf & 0x7f);
213 sprintf((pbuf+strlen(pbuf)), "%d (ext)\n", comp_tag_code);
217 comp_tag_code = (*byte_buf & 0x1f);
219 if(comp_tag_class == FAC_TAGCLASS_UNI)
221 sprintf((pbuf+strlen(pbuf)), "%s (%d)\n", uni_str(comp_tag_code), comp_tag_code);
225 sprintf((pbuf+strlen(pbuf)), "code = %d\n", comp_tag_code);
232 /*--------------------------------------------*/
233 /* second component element: component length */
234 /*--------------------------------------------*/
236 sprintf((pbuf+strlen(pbuf)), "\t0x%02x Len: ", *byte_buf);
242 int i = *byte_buf & 0x7f;
249 comp_length += (*byte_buf * (i*256));
251 sprintf((pbuf+strlen(pbuf)), "%d (long form)\n", comp_length);
255 comp_length = *byte_buf & 0x7f;
256 sprintf((pbuf+strlen(pbuf)), "%d (short form)\n", comp_length);
259 next_state(pbuf, comp_tag_class, comp_tag_form, comp_tag_code, -1);
267 /*---------------------------------------------*/
268 /* third component element: component contents */
269 /*---------------------------------------------*/
271 if(comp_tag_form) /* == constructor */
273 do_component(comp_length, pbuf);
278 if(comp_tag_class == FAC_TAGCLASS_UNI)
280 switch(comp_tag_code)
282 case FAC_CODEUNI_INT:
283 case FAC_CODEUNI_ENUM:
284 case FAC_CODEUNI_BOOL:
289 sprintf((pbuf+strlen(pbuf)), "\t");
291 for(i = comp_length-1; i >= 0; i--)
293 sprintf((pbuf+strlen(pbuf)), "0x%02x ", *byte_buf);
294 val += (*byte_buf + (i*255));
298 sprintf((pbuf+strlen(pbuf)), "\n\t");
300 sprintf((pbuf+strlen(pbuf)), "Val: %d\n", val);
308 sprintf((pbuf+strlen(pbuf)), "\t");
310 for(i = comp_length-1; i >= 0; i--)
312 sprintf((pbuf+strlen(pbuf)), "0x%02x = %d", *byte_buf, *byte_buf);
313 if(isprint(*byte_buf))
314 sprintf((pbuf+strlen(pbuf)), " = '%c'", *byte_buf);
318 sprintf((pbuf+strlen(pbuf)), "\n\t");
325 else /* comp_tag_class != FAC_TAGCLASS_UNI */
331 sprintf((pbuf+strlen(pbuf)), "\t");
333 for(i = comp_length-1; i >= 0; i--)
335 sprintf((pbuf+strlen(pbuf)), "0x%02x", *byte_buf);
336 val += (*byte_buf + (i*255));
340 sprintf((pbuf+strlen(pbuf)), "\n\t");
342 sprintf((pbuf+strlen(pbuf)), "\n");
345 next_state(pbuf, comp_tag_class, comp_tag_form, comp_tag_code, val);
350 sprintf((pbuf+strlen(pbuf)), "PREGOTO - comp_length = %d, byte_len = %d, length =%d\n", comp_length, byte_len, length);
352 if(byte_len < length)
355 sprintf((pbuf+strlen(pbuf)), "RETURN - comp_length = %d, byte_len = %d, length =%d\n", comp_length, byte_len, length);
360 /*---------------------------------------------------------------------------*
361 * print universal id type
362 *---------------------------------------------------------------------------*/
363 static char *uni_str(int code)
365 static char *tbl[] = {
392 if(code >= 1 && code <= FAC_CODEUNI_GNSTR)
395 return("ERROR, Value out of Range!");
398 /*---------------------------------------------------------------------------*
399 * print operation value
400 *---------------------------------------------------------------------------*/
401 static char *opval_str(int val)
403 static char buffer[80];
426 case FAC_OPVAL_DIV_ACT:
427 r = "activationDiversion";
429 case FAC_OPVAL_DIV_DEACT:
430 r = "deactivationDiversion";
432 case FAC_OPVAL_DIV_ACTSN:
433 r = "activationStatusNotificationDiv";
435 case FAC_OPVAL_DIV_DEACTSN:
436 r = "deactivationStatusNotificationDiv";
438 case FAC_OPVAL_DIV_INTER:
439 r = "interrogationDiversion";
441 case FAC_OPVAL_DIV_INFO:
442 r = "diversionInformation";
444 case FAC_OPVAL_DIV_CALLDEF:
445 r = "callDeflection";
447 case FAC_OPVAL_DIV_CALLRER:
450 case FAC_OPVAL_DIV_LINF2:
451 r = "divertingLegInformation2";
453 case FAC_OPVAL_DIV_INVS:
456 case FAC_OPVAL_DIV_INTER1:
457 r = "interrogationDiversion1";
459 case FAC_OPVAL_DIV_LINF1:
460 r = "divertingLegInformation1";
462 case FAC_OPVAL_DIV_LINF3:
463 r = "divertingLegInformation3";
465 case FAC_OPVAL_ER_CRCO:
466 r = "explicitReservationCreationControl";
468 case FAC_OPVAL_ER_MGMT:
469 r = "explicitReservationManagement";
471 case FAC_OPVAL_ER_CANC:
472 r = "explicitReservationCancel";
474 case FAC_OPVAL_MLPP_QUERY:
475 r = "mLPP lfb Query";
477 case FAC_OPVAL_MLPP_CALLR:
478 r = "mLPP Call Request";
480 case FAC_OPVAL_MLPP_CALLP:
481 r = "mLPP Call Preemption";
483 case FAC_OPVAL_AOC_REQ:
484 r = "chargingRequest";
486 case FAC_OPVAL_AOC_S_CUR:
489 case FAC_OPVAL_AOC_S_SPC:
490 r = "aOCSSpecialArrangement";
492 case FAC_OPVAL_AOC_D_CUR:
495 case FAC_OPVAL_AOC_D_UNIT:
496 r = "aOCDChargingUnit";
498 case FAC_OPVAL_AOC_E_CUR:
501 case FAC_OPVAL_AOC_E_UNIT:
502 r = "aOCEChargingUnit";
504 case FAC_OPVAL_AOC_IDOFCRG:
505 r = "identificationOfCharge";
507 case FAC_OPVAL_CONF_BEG:
510 case FAC_OPVAL_CONF_ADD:
513 case FAC_OPVAL_CONF_SPLIT:
516 case FAC_OPVAL_CONF_DROP:
519 case FAC_OPVAL_CONF_ISOLATE:
522 case FAC_OPVAL_CONF_REATT:
525 case FAC_OPVAL_CONF_PDISC:
528 case FAC_OPVAL_CONF_FCONF:
531 case FAC_OPVAL_CONF_END:
534 case FAC_OPVAL_CONF_IDCFE:
535 r = "indentifyConferee";
537 case FAC_OPVAL_REVC_REQ:
541 sprintf(buffer, "unknown operation value %d!", val);
547 /*---------------------------------------------------------------------------*
549 *---------------------------------------------------------------------------*/
550 static char *bid_str(int val)
552 static char buffer[80];
558 r = "normalCharging";
561 r = "reverseCharging";
564 r = "creditCardCharging";
567 r = "callForwardingUnconditional";
570 r = "callForwardingBusy";
573 r = "callForwardingNoReply";
576 r = "callDeflection";
582 sprintf(buffer, "unknown billing-id value %d!", val);
588 /*---------------------------------------------------------------------------*
590 *---------------------------------------------------------------------------*/
592 F_1_1(char *pbuf, int val)
595 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_1_1, val = %d\n", val);
599 sprintf((pbuf+strlen(pbuf)), "\t invokeComponent\n");
600 state = ST_EXP_INV_ID;
604 /*---------------------------------------------------------------------------*
606 *---------------------------------------------------------------------------*/
608 F_1_2(char *pbuf, int val)
611 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_1_2, val = %d\n", val);
615 sprintf((pbuf+strlen(pbuf)), "\t returnResult\n");
616 state = ST_EXP_RR_INV_ID;
619 /*---------------------------------------------------------------------------*
621 *---------------------------------------------------------------------------*/
623 F_1_3(char *pbuf, int val)
626 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_1_3, val = %d\n", val);
630 sprintf((pbuf+strlen(pbuf)), "\t returnError\n");
634 /*---------------------------------------------------------------------------*
636 *---------------------------------------------------------------------------*/
638 F_1_4(char *pbuf, int val)
641 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_1_4, val = %d\n", val);
645 sprintf((pbuf+strlen(pbuf)), "\t reject\n");
646 state = ST_EXP_REJ_INV_ID;
650 /*---------------------------------------------------------------------------*
651 * return result: invoke id
652 *---------------------------------------------------------------------------*/
654 F_RJ2(char *pbuf, int val)
657 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RJ2, val = %d\n", val);
661 sprintf((pbuf+strlen(pbuf)), "\t InvokeIdentifier = %d\n", val);
662 state = ST_EXP_REJ_OP_VAL;
666 /*---------------------------------------------------------------------------*
667 * reject, general problem
668 *---------------------------------------------------------------------------*/
670 F_RJ30(char *pbuf, int val)
673 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RJ30, val = %d\n", val);
677 sprintf((pbuf+strlen(pbuf)), "\t General problem\n");
684 sprintf((pbuf+strlen(pbuf)), "\t problem = unrecognized component\n");
687 sprintf((pbuf+strlen(pbuf)), "\t problem = mistyped component\n");
690 sprintf((pbuf+strlen(pbuf)), "\t problem = badly structured component\n");
693 sprintf((pbuf+strlen(pbuf)), "\t problem = unknown problem code 0x%x\n", val);
700 /*---------------------------------------------------------------------------*
701 * reject, invoke problem
702 *---------------------------------------------------------------------------*/
704 F_RJ31(char *pbuf, int val)
707 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RJ31, val = %d\n", val);
711 sprintf((pbuf+strlen(pbuf)), "\t Invoke problem\n");
718 sprintf((pbuf+strlen(pbuf)), "\t problem = duplicate invocation\n");
721 sprintf((pbuf+strlen(pbuf)), "\t problem = unrecognized operation\n");
724 sprintf((pbuf+strlen(pbuf)), "\t problem = mistyped argument\n");
727 sprintf((pbuf+strlen(pbuf)), "\t problem = resource limitation\n");
730 sprintf((pbuf+strlen(pbuf)), "\t problem = initiator releasing\n");
733 sprintf((pbuf+strlen(pbuf)), "\t problem = unrecognized linked identifier\n");
736 sprintf((pbuf+strlen(pbuf)), "\t problem = linked resonse unexpected\n");
739 sprintf((pbuf+strlen(pbuf)), "\t problem = unexpected child operation\n");
742 sprintf((pbuf+strlen(pbuf)), "\t problem = unknown problem code 0x%x\n", val);
749 /*---------------------------------------------------------------------------*
750 * reject, return result problem
751 *---------------------------------------------------------------------------*/
753 F_RJ32(char *pbuf, int val)
756 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RJ32, val = %d\n", val);
760 sprintf((pbuf+strlen(pbuf)), "\t Return result problem\n");
767 sprintf((pbuf+strlen(pbuf)), "\t problem = unrecognized invocation\n");
770 sprintf((pbuf+strlen(pbuf)), "\t problem = return response unexpected\n");
773 sprintf((pbuf+strlen(pbuf)), "\t problem = mistyped result\n");
776 sprintf((pbuf+strlen(pbuf)), "\t problem = unknown problem code 0x%x\n", val);
783 /*---------------------------------------------------------------------------*
784 * reject, return error problem
785 *---------------------------------------------------------------------------*/
787 F_RJ33(char *pbuf, int val)
790 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RJ33, val = %d\n", val);
794 sprintf((pbuf+strlen(pbuf)), "\t Return error problem\n");
801 sprintf((pbuf+strlen(pbuf)), "\t problem = unrecognized invocation\n");
804 sprintf((pbuf+strlen(pbuf)), "\t problem = error response unexpected\n");
807 sprintf((pbuf+strlen(pbuf)), "\t problem = unrecognized error\n");
810 sprintf((pbuf+strlen(pbuf)), "\t problem = unexpected error\n");
813 sprintf((pbuf+strlen(pbuf)), "\t problem = mistyped parameter\n");
816 sprintf((pbuf+strlen(pbuf)), "\t problem = unknown problem code 0x%x\n", val);
823 /*---------------------------------------------------------------------------*
824 * invoke component: invoke id
825 *---------------------------------------------------------------------------*/
827 F_2(char *pbuf, int val)
830 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_2, val = %d\n", val);
834 sprintf((pbuf+strlen(pbuf)), "\t InvokeIdentifier = %d\n", val);
835 state = ST_EXP_OP_VAL;
839 /*---------------------------------------------------------------------------*
840 * return result: invoke id
841 *---------------------------------------------------------------------------*/
843 F_RR2(char *pbuf, int val)
846 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RR2, val = %d\n", val);
850 sprintf((pbuf+strlen(pbuf)), "\t InvokeIdentifier = %d\n", val);
851 state = ST_EXP_RR_OP_VAL;
855 /*---------------------------------------------------------------------------*
856 * invoke component: operation value
857 *---------------------------------------------------------------------------*/
859 F_3(char *pbuf, int val)
862 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_3, val = %d\n", val);
866 sprintf((pbuf+strlen(pbuf)), "\t Operation Value = %s (%d)\n", opval_str(val), val);
871 /*---------------------------------------------------------------------------*
872 * return result: operation value
873 *---------------------------------------------------------------------------*/
875 F_RR3(char *pbuf, int val)
878 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RR3, val = %d\n", val);
882 sprintf((pbuf+strlen(pbuf)), "\t Operation Value = %s (%d)\n", opval_str(val), val);
883 state = ST_EXP_RR_RESULT;
887 /*---------------------------------------------------------------------------*
888 * return result: RESULT
889 *---------------------------------------------------------------------------*/
891 F_RRR(char *pbuf, int val)
894 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RRR, val = %d\n", val);
899 /*---------------------------------------------------------------------------*
901 *---------------------------------------------------------------------------*/
903 F_4(char *pbuf, int val)
906 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_4, val = %d\n", val);
910 sprintf((pbuf+strlen(pbuf)), "\t specificChargingUnits\n");
915 /*---------------------------------------------------------------------------*
917 *---------------------------------------------------------------------------*/
919 F_4_1(char *pbuf, int val)
922 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_4_1, val = %d\n", val);
926 sprintf((pbuf+strlen(pbuf)), "\t freeOfCharge\n");
931 /*---------------------------------------------------------------------------*
933 *---------------------------------------------------------------------------*/
935 F_4_2(char *pbuf, int val)
938 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_4_2, val = %d\n", val);
942 sprintf((pbuf+strlen(pbuf)), "\t chargeNotAvailable\n");
947 /*---------------------------------------------------------------------------*
949 *---------------------------------------------------------------------------*/
951 F_5(char *pbuf, int val)
954 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_5, val = %d\n", val);
958 sprintf((pbuf+strlen(pbuf)), "\t recordedUnitsList [1]\n");
963 /*---------------------------------------------------------------------------*
965 *---------------------------------------------------------------------------*/
967 F_6(char *pbuf, int val)
970 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_6, val = %d\n", val);
974 sprintf((pbuf+strlen(pbuf)), "\t RecordedUnits\n");
979 /*---------------------------------------------------------------------------*
981 *---------------------------------------------------------------------------*/
983 F_7(char *pbuf, int val)
986 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_7, val = %d\n", val);
990 sprintf((pbuf+strlen(pbuf)), "\t NumberOfUnits = %d\n", val);
995 /*---------------------------------------------------------------------------*
997 *---------------------------------------------------------------------------*/
999 F_8(char *pbuf, int val)
1002 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_8, val = %d\n", val);
1006 sprintf((pbuf+strlen(pbuf)), "\t typeOfChargingInfo = %s\n", val == 0 ? "subTotal" : "total");
1007 state = ST_EXP_DBID;
1011 /*---------------------------------------------------------------------------*
1013 *---------------------------------------------------------------------------*/
1015 F_9(char *pbuf, int val)
1018 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_9, val = %d\n", val);
1022 sprintf((pbuf+strlen(pbuf)), "\t AOCDBillingId = %s (%d)\n", bid_str(val), val);
1027 /*---------------------------------------------------------------------------*
1029 *---------------------------------------------------------------------------*/
1030 static struct statetab {
1031 int currstate; /* input: current state we are in */
1032 int form; /* input: current tag form */
1033 int class; /* input: current tag class */
1034 int code; /* input: current tag code */
1035 void (*func)(char *,int); /* output: func to exec */
1038 /* current state tag form tag class tag code function */
1039 /* --------------------- ---------------------- ---------------------- ---------------------- ----------------*/
1043 {ST_EXP_COMP_TYP, FAC_TAGFORM_CON, FAC_TAGCLASS_COS, 1, F_1_1 },
1044 {ST_EXP_COMP_TYP, FAC_TAGFORM_CON, FAC_TAGCLASS_COS, 2, F_1_2 },
1045 {ST_EXP_COMP_TYP, FAC_TAGFORM_CON, FAC_TAGCLASS_COS, 3, F_1_3 },
1046 {ST_EXP_COMP_TYP, FAC_TAGFORM_CON, FAC_TAGCLASS_COS, 4, F_1_4 },
1047 {ST_EXP_INV_ID, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_INT, F_2 },
1048 {ST_EXP_OP_VAL, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_INT, F_3 },
1049 {ST_EXP_INFO, FAC_TAGFORM_CON, FAC_TAGCLASS_UNI, FAC_CODEUNI_SEQ, F_4 },
1050 {ST_EXP_INFO, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_NULL, F_4_1 },
1051 {ST_EXP_INFO, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 1, F_4_2 },
1052 {ST_EXP_RUL, FAC_TAGFORM_CON, FAC_TAGCLASS_COS, 1, F_5 },
1053 {ST_EXP_RU, FAC_TAGFORM_CON, FAC_TAGCLASS_UNI, FAC_CODEUNI_SEQ, F_6 },
1054 {ST_EXP_RNOU, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_INT, F_7 },
1055 {ST_EXP_TOCI, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 2, F_8 },
1056 {ST_EXP_DBID, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 3, F_9 },
1060 {ST_EXP_RR_INV_ID, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_INT, F_RR2 },
1061 {ST_EXP_RR_OP_VAL, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_INT, F_RR3 },
1062 {ST_EXP_RR_RESULT, FAC_TAGFORM_CON, FAC_TAGCLASS_UNI, FAC_CODEUNI_SET, F_RRR },
1064 /* current state tag form tag class tag code function */
1065 /* --------------------- ---------------------- ---------------------- ---------------------- ----------------*/
1068 {ST_EXP_REJ_INV_ID, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_INT, F_RJ2 },
1069 {ST_EXP_REJ_OP_VAL, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 0, F_RJ30 },
1070 {ST_EXP_REJ_OP_VAL, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 1, F_RJ31 },
1071 {ST_EXP_REJ_OP_VAL, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 2, F_RJ32 },
1072 {ST_EXP_REJ_OP_VAL, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 3, F_RJ33 },
1076 {-1, -1, -1, -1, NULL }
1079 /*---------------------------------------------------------------------------*
1080 * state decode for do_component
1081 *---------------------------------------------------------------------------*/
1083 next_state(char *pbuf, int class, int form, int code, int val)
1088 sprintf((pbuf+strlen(pbuf)), "next_state: class=%d, form=%d, code=%d, val=%d\n", class, form, code, val);
1093 if((statetab[i].currstate > state) ||
1094 (statetab[i].currstate == -1))
1099 if((statetab[i].currstate == state) &&
1100 (statetab[i].form == form) &&
1101 (statetab[i].class == class) &&
1102 (statetab[i].code == code))
1104 (*statetab[i].func)(pbuf, val);