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 $
33 * $DragonFly: src/usr.sbin/i4b/isdndecode/facility.c,v 1.3 2005/11/25 00:58:52 swildner Exp $
35 * last edit-date: [Mon Feb 21 16:15:43 2000]
37 *---------------------------------------------------------------------------
39 * - Q.932 (03/93) Generic Procedures for the Control of
40 * ISDN Supplementaty Services
41 * - Q.950 (03/93) Supplementary Services Protocols, Structure and
43 * - ETS 300 179 (10/92) Advice Of Charge: charging information during
44 * the call (AOC-D) supplementary service Service description
45 * - ETS 300 180 (10/92) Advice Of Charge: charging information at the
46 * end of call (AOC-E) supplementary service Service description
47 * - ETS 300 181 (04/93) Advice Of Charge (AOC) supplementary service
48 * Functional capabilities and information flows
49 * - ETS 300 182 (04/93) Advice Of Charge (AOC) supplementary service
50 * Digital Subscriber Signalling System No. one (DSS1) protocol
51 * - X.208 Specification of Abstract Syntax Notation One (ASN.1)
52 * - X.209 Specification of Basic Encoding Rules for
53 * Abstract Syntax Notation One (ASN.1)
54 * - "ASN.1 Abstract Syntax Notation One", Walter Gora, DATACOM-Verlag
55 * 1992, 3rd Edition (ISBN 3-89238-062-7) (german !)
57 *---------------------------------------------------------------------------*/
62 static int do_component(int length, char *pbuf);
63 static char *uni_str(int code);
64 static char *opval_str(int val);
65 static char *bid_str(int val);
66 static void next_state(char *pbuf, int class, int form, int code, int val);
69 static unsigned char *byte_buf;
72 /*---------------------------------------------------------------------------*
73 * decode Q.931/Q.932 facility info element
74 *---------------------------------------------------------------------------*/
76 q932_facility(char *pbuf, unsigned char *buf)
80 sprintf((pbuf+strlen(pbuf)), "[facility (Q.932): ");
86 buf++; /* protocol profile */
88 sprintf((pbuf+strlen(pbuf)), "Protocol=");
93 sprintf((pbuf+strlen(pbuf)), "Remote Operations Protocol\n");
97 sprintf((pbuf+strlen(pbuf)), "CMIP Protocol (Q.941), UNSUPPORTED!\n");
102 sprintf((pbuf+strlen(pbuf)), "ACSE Protocol (X.217/X.227), UNSUPPORTED!\n");
107 sprintf((pbuf+strlen(pbuf)), "Unknown Protocol (val = 0x%x), UNSUPPORTED!\n", *buf & 0x1f);
117 /* initialize variables for do_component */
121 state = ST_EXP_COMP_TYP;
123 /* decode facility */
125 do_component(len, pbuf);
127 sprintf((pbuf+(strlen(pbuf)-1)), "]"); /* XXX replace last newline */
132 /*---------------------------------------------------------------------------*
133 * handle a component recursively
134 *---------------------------------------------------------------------------*/
136 do_component(int length, char *pbuf)
138 int comp_tag_class; /* component tag class */
139 int comp_tag_form; /* component form: constructor or primitive */
140 int comp_tag_code; /* component code depending on class */
141 int comp_length = 0; /* component length */
144 sprintf((pbuf+strlen(pbuf)), "ENTER - comp_length = %d, byte_len = %d, length =%d\n", comp_length, byte_len, length);
150 sprintf((pbuf+strlen(pbuf)), "AGAIN - comp_length = %d, byte_len = %d, length =%d\n", comp_length, byte_len, length);
153 /*----------------------------------------*/
154 /* first component element: component tag */
155 /*----------------------------------------*/
159 sprintf((pbuf+strlen(pbuf)), "\t0x%02x Tag: ", *byte_buf);
161 comp_tag_class = (*byte_buf & 0xc0) >> 6;
163 switch(comp_tag_class)
165 case FAC_TAGCLASS_UNI:
166 sprintf((pbuf+strlen(pbuf)), "Universal");
168 case FAC_TAGCLASS_APW:
169 sprintf((pbuf+strlen(pbuf)), "Applic-wide");
171 case FAC_TAGCLASS_COS:
172 sprintf((pbuf+strlen(pbuf)), "Context-spec");
174 case FAC_TAGCLASS_PRU:
175 sprintf((pbuf+strlen(pbuf)), "Private");
181 comp_tag_form = (*byte_buf & 0x20) > 5;
183 sprintf((pbuf+strlen(pbuf)), ", ");
185 if(comp_tag_form == FAC_TAGFORM_CON)
187 sprintf((pbuf+strlen(pbuf)), "Constructor");
191 sprintf((pbuf+strlen(pbuf)), "Primitive");
196 comp_tag_code = *byte_buf & 0x1f;
198 sprintf((pbuf+strlen(pbuf)), ", ");
200 if(comp_tag_code == 0x1f)
207 while(*byte_buf & 0x80)
209 comp_tag_code += (*byte_buf & 0x7f);
213 comp_tag_code += (*byte_buf & 0x7f);
214 sprintf((pbuf+strlen(pbuf)), "%d (ext)\n", comp_tag_code);
218 comp_tag_code = (*byte_buf & 0x1f);
220 if(comp_tag_class == FAC_TAGCLASS_UNI)
222 sprintf((pbuf+strlen(pbuf)), "%s (%d)\n", uni_str(comp_tag_code), comp_tag_code);
226 sprintf((pbuf+strlen(pbuf)), "code = %d\n", comp_tag_code);
233 /*--------------------------------------------*/
234 /* second component element: component length */
235 /*--------------------------------------------*/
237 sprintf((pbuf+strlen(pbuf)), "\t0x%02x Len: ", *byte_buf);
243 int i = *byte_buf & 0x7f;
250 comp_length += (*byte_buf * (i*256));
252 sprintf((pbuf+strlen(pbuf)), "%d (long form)\n", comp_length);
256 comp_length = *byte_buf & 0x7f;
257 sprintf((pbuf+strlen(pbuf)), "%d (short form)\n", comp_length);
260 next_state(pbuf, comp_tag_class, comp_tag_form, comp_tag_code, -1);
268 /*---------------------------------------------*/
269 /* third component element: component contents */
270 /*---------------------------------------------*/
272 if(comp_tag_form) /* == constructor */
274 do_component(comp_length, pbuf);
279 if(comp_tag_class == FAC_TAGCLASS_UNI)
281 switch(comp_tag_code)
283 case FAC_CODEUNI_INT:
284 case FAC_CODEUNI_ENUM:
285 case FAC_CODEUNI_BOOL:
290 sprintf((pbuf+strlen(pbuf)), "\t");
292 for(i = comp_length-1; i >= 0; i--)
294 sprintf((pbuf+strlen(pbuf)), "0x%02x ", *byte_buf);
295 val += (*byte_buf + (i*255));
299 sprintf((pbuf+strlen(pbuf)), "\n\t");
301 sprintf((pbuf+strlen(pbuf)), "Val: %d\n", val);
309 sprintf((pbuf+strlen(pbuf)), "\t");
311 for(i = comp_length-1; i >= 0; i--)
313 sprintf((pbuf+strlen(pbuf)), "0x%02x = %d", *byte_buf, *byte_buf);
314 if(isprint(*byte_buf))
315 sprintf((pbuf+strlen(pbuf)), " = '%c'", *byte_buf);
319 sprintf((pbuf+strlen(pbuf)), "\n\t");
326 else /* comp_tag_class != FAC_TAGCLASS_UNI */
332 sprintf((pbuf+strlen(pbuf)), "\t");
334 for(i = comp_length-1; i >= 0; i--)
336 sprintf((pbuf+strlen(pbuf)), "0x%02x", *byte_buf);
337 val += (*byte_buf + (i*255));
341 sprintf((pbuf+strlen(pbuf)), "\n\t");
343 sprintf((pbuf+strlen(pbuf)), "\n");
346 next_state(pbuf, comp_tag_class, comp_tag_form, comp_tag_code, val);
351 sprintf((pbuf+strlen(pbuf)), "PREGOTO - comp_length = %d, byte_len = %d, length =%d\n", comp_length, byte_len, length);
353 if(byte_len < length)
356 sprintf((pbuf+strlen(pbuf)), "RETURN - comp_length = %d, byte_len = %d, length =%d\n", comp_length, byte_len, length);
361 /*---------------------------------------------------------------------------*
362 * print universal id type
363 *---------------------------------------------------------------------------*/
367 static char *tbl[] = {
394 if(code >= 1 && code <= FAC_CODEUNI_GNSTR)
397 return("ERROR, Value out of Range!");
400 /*---------------------------------------------------------------------------*
401 * print operation value
402 *---------------------------------------------------------------------------*/
406 static char buffer[80];
429 case FAC_OPVAL_DIV_ACT:
430 r = "activationDiversion";
432 case FAC_OPVAL_DIV_DEACT:
433 r = "deactivationDiversion";
435 case FAC_OPVAL_DIV_ACTSN:
436 r = "activationStatusNotificationDiv";
438 case FAC_OPVAL_DIV_DEACTSN:
439 r = "deactivationStatusNotificationDiv";
441 case FAC_OPVAL_DIV_INTER:
442 r = "interrogationDiversion";
444 case FAC_OPVAL_DIV_INFO:
445 r = "diversionInformation";
447 case FAC_OPVAL_DIV_CALLDEF:
448 r = "callDeflection";
450 case FAC_OPVAL_DIV_CALLRER:
453 case FAC_OPVAL_DIV_LINF2:
454 r = "divertingLegInformation2";
456 case FAC_OPVAL_DIV_INVS:
459 case FAC_OPVAL_DIV_INTER1:
460 r = "interrogationDiversion1";
462 case FAC_OPVAL_DIV_LINF1:
463 r = "divertingLegInformation1";
465 case FAC_OPVAL_DIV_LINF3:
466 r = "divertingLegInformation3";
468 case FAC_OPVAL_ER_CRCO:
469 r = "explicitReservationCreationControl";
471 case FAC_OPVAL_ER_MGMT:
472 r = "explicitReservationManagement";
474 case FAC_OPVAL_ER_CANC:
475 r = "explicitReservationCancel";
477 case FAC_OPVAL_MLPP_QUERY:
478 r = "mLPP lfb Query";
480 case FAC_OPVAL_MLPP_CALLR:
481 r = "mLPP Call Request";
483 case FAC_OPVAL_MLPP_CALLP:
484 r = "mLPP Call Preemption";
486 case FAC_OPVAL_AOC_REQ:
487 r = "chargingRequest";
489 case FAC_OPVAL_AOC_S_CUR:
492 case FAC_OPVAL_AOC_S_SPC:
493 r = "aOCSSpecialArrangement";
495 case FAC_OPVAL_AOC_D_CUR:
498 case FAC_OPVAL_AOC_D_UNIT:
499 r = "aOCDChargingUnit";
501 case FAC_OPVAL_AOC_E_CUR:
504 case FAC_OPVAL_AOC_E_UNIT:
505 r = "aOCEChargingUnit";
507 case FAC_OPVAL_AOC_IDOFCRG:
508 r = "identificationOfCharge";
510 case FAC_OPVAL_CONF_BEG:
513 case FAC_OPVAL_CONF_ADD:
516 case FAC_OPVAL_CONF_SPLIT:
519 case FAC_OPVAL_CONF_DROP:
522 case FAC_OPVAL_CONF_ISOLATE:
525 case FAC_OPVAL_CONF_REATT:
528 case FAC_OPVAL_CONF_PDISC:
531 case FAC_OPVAL_CONF_FCONF:
534 case FAC_OPVAL_CONF_END:
537 case FAC_OPVAL_CONF_IDCFE:
538 r = "indentifyConferee";
540 case FAC_OPVAL_REVC_REQ:
544 sprintf(buffer, "unknown operation value %d!", val);
550 /*---------------------------------------------------------------------------*
552 *---------------------------------------------------------------------------*/
556 static char buffer[80];
562 r = "normalCharging";
565 r = "reverseCharging";
568 r = "creditCardCharging";
571 r = "callForwardingUnconditional";
574 r = "callForwardingBusy";
577 r = "callForwardingNoReply";
580 r = "callDeflection";
586 sprintf(buffer, "unknown billing-id value %d!", val);
592 /*---------------------------------------------------------------------------*
594 *---------------------------------------------------------------------------*/
596 F_1_1(char *pbuf, int val)
599 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_1_1, val = %d\n", val);
603 sprintf((pbuf+strlen(pbuf)), "\t invokeComponent\n");
604 state = ST_EXP_INV_ID;
608 /*---------------------------------------------------------------------------*
610 *---------------------------------------------------------------------------*/
612 F_1_2(char *pbuf, int val)
615 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_1_2, val = %d\n", val);
619 sprintf((pbuf+strlen(pbuf)), "\t returnResult\n");
620 state = ST_EXP_RR_INV_ID;
623 /*---------------------------------------------------------------------------*
625 *---------------------------------------------------------------------------*/
627 F_1_3(char *pbuf, int val)
630 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_1_3, val = %d\n", val);
634 sprintf((pbuf+strlen(pbuf)), "\t returnError\n");
638 /*---------------------------------------------------------------------------*
640 *---------------------------------------------------------------------------*/
642 F_1_4(char *pbuf, int val)
645 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_1_4, val = %d\n", val);
649 sprintf((pbuf+strlen(pbuf)), "\t reject\n");
650 state = ST_EXP_REJ_INV_ID;
654 /*---------------------------------------------------------------------------*
655 * return result: invoke id
656 *---------------------------------------------------------------------------*/
658 F_RJ2(char *pbuf, int val)
661 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RJ2, val = %d\n", val);
665 sprintf((pbuf+strlen(pbuf)), "\t InvokeIdentifier = %d\n", val);
666 state = ST_EXP_REJ_OP_VAL;
670 /*---------------------------------------------------------------------------*
671 * reject, general problem
672 *---------------------------------------------------------------------------*/
674 F_RJ30(char *pbuf, int val)
677 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RJ30, val = %d\n", val);
681 sprintf((pbuf+strlen(pbuf)), "\t General problem\n");
688 sprintf((pbuf+strlen(pbuf)), "\t problem = unrecognized component\n");
691 sprintf((pbuf+strlen(pbuf)), "\t problem = mistyped component\n");
694 sprintf((pbuf+strlen(pbuf)), "\t problem = badly structured component\n");
697 sprintf((pbuf+strlen(pbuf)), "\t problem = unknown problem code 0x%x\n", val);
704 /*---------------------------------------------------------------------------*
705 * reject, invoke problem
706 *---------------------------------------------------------------------------*/
708 F_RJ31(char *pbuf, int val)
711 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RJ31, val = %d\n", val);
715 sprintf((pbuf+strlen(pbuf)), "\t Invoke problem\n");
722 sprintf((pbuf+strlen(pbuf)), "\t problem = duplicate invocation\n");
725 sprintf((pbuf+strlen(pbuf)), "\t problem = unrecognized operation\n");
728 sprintf((pbuf+strlen(pbuf)), "\t problem = mistyped argument\n");
731 sprintf((pbuf+strlen(pbuf)), "\t problem = resource limitation\n");
734 sprintf((pbuf+strlen(pbuf)), "\t problem = initiator releasing\n");
737 sprintf((pbuf+strlen(pbuf)), "\t problem = unrecognized linked identifier\n");
740 sprintf((pbuf+strlen(pbuf)), "\t problem = linked resonse unexpected\n");
743 sprintf((pbuf+strlen(pbuf)), "\t problem = unexpected child operation\n");
746 sprintf((pbuf+strlen(pbuf)), "\t problem = unknown problem code 0x%x\n", val);
753 /*---------------------------------------------------------------------------*
754 * reject, return result problem
755 *---------------------------------------------------------------------------*/
757 F_RJ32(char *pbuf, int val)
760 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RJ32, val = %d\n", val);
764 sprintf((pbuf+strlen(pbuf)), "\t Return result problem\n");
771 sprintf((pbuf+strlen(pbuf)), "\t problem = unrecognized invocation\n");
774 sprintf((pbuf+strlen(pbuf)), "\t problem = return response unexpected\n");
777 sprintf((pbuf+strlen(pbuf)), "\t problem = mistyped result\n");
780 sprintf((pbuf+strlen(pbuf)), "\t problem = unknown problem code 0x%x\n", val);
787 /*---------------------------------------------------------------------------*
788 * reject, return error problem
789 *---------------------------------------------------------------------------*/
791 F_RJ33(char *pbuf, int val)
794 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RJ33, val = %d\n", val);
798 sprintf((pbuf+strlen(pbuf)), "\t Return error problem\n");
805 sprintf((pbuf+strlen(pbuf)), "\t problem = unrecognized invocation\n");
808 sprintf((pbuf+strlen(pbuf)), "\t problem = error response unexpected\n");
811 sprintf((pbuf+strlen(pbuf)), "\t problem = unrecognized error\n");
814 sprintf((pbuf+strlen(pbuf)), "\t problem = unexpected error\n");
817 sprintf((pbuf+strlen(pbuf)), "\t problem = mistyped parameter\n");
820 sprintf((pbuf+strlen(pbuf)), "\t problem = unknown problem code 0x%x\n", val);
827 /*---------------------------------------------------------------------------*
828 * invoke component: invoke id
829 *---------------------------------------------------------------------------*/
831 F_2(char *pbuf, int val)
834 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_2, val = %d\n", val);
838 sprintf((pbuf+strlen(pbuf)), "\t InvokeIdentifier = %d\n", val);
839 state = ST_EXP_OP_VAL;
843 /*---------------------------------------------------------------------------*
844 * return result: invoke id
845 *---------------------------------------------------------------------------*/
847 F_RR2(char *pbuf, int val)
850 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RR2, val = %d\n", val);
854 sprintf((pbuf+strlen(pbuf)), "\t InvokeIdentifier = %d\n", val);
855 state = ST_EXP_RR_OP_VAL;
859 /*---------------------------------------------------------------------------*
860 * invoke component: operation value
861 *---------------------------------------------------------------------------*/
863 F_3(char *pbuf, int val)
866 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_3, val = %d\n", val);
870 sprintf((pbuf+strlen(pbuf)), "\t Operation Value = %s (%d)\n", opval_str(val), val);
875 /*---------------------------------------------------------------------------*
876 * return result: operation value
877 *---------------------------------------------------------------------------*/
879 F_RR3(char *pbuf, int val)
882 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RR3, val = %d\n", val);
886 sprintf((pbuf+strlen(pbuf)), "\t Operation Value = %s (%d)\n", opval_str(val), val);
887 state = ST_EXP_RR_RESULT;
891 /*---------------------------------------------------------------------------*
892 * return result: RESULT
893 *---------------------------------------------------------------------------*/
895 F_RRR(char *pbuf, int val)
898 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RRR, val = %d\n", val);
903 /*---------------------------------------------------------------------------*
905 *---------------------------------------------------------------------------*/
907 F_4(char *pbuf, int val)
910 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_4, val = %d\n", val);
914 sprintf((pbuf+strlen(pbuf)), "\t specificChargingUnits\n");
919 /*---------------------------------------------------------------------------*
921 *---------------------------------------------------------------------------*/
923 F_4_1(char *pbuf, int val)
926 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_4_1, val = %d\n", val);
930 sprintf((pbuf+strlen(pbuf)), "\t freeOfCharge\n");
935 /*---------------------------------------------------------------------------*
937 *---------------------------------------------------------------------------*/
939 F_4_2(char *pbuf, int val)
942 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_4_2, val = %d\n", val);
946 sprintf((pbuf+strlen(pbuf)), "\t chargeNotAvailable\n");
951 /*---------------------------------------------------------------------------*
953 *---------------------------------------------------------------------------*/
955 F_5(char *pbuf, int val)
958 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_5, val = %d\n", val);
962 sprintf((pbuf+strlen(pbuf)), "\t recordedUnitsList [1]\n");
967 /*---------------------------------------------------------------------------*
969 *---------------------------------------------------------------------------*/
971 F_6(char *pbuf, int val)
974 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_6, val = %d\n", val);
978 sprintf((pbuf+strlen(pbuf)), "\t RecordedUnits\n");
983 /*---------------------------------------------------------------------------*
985 *---------------------------------------------------------------------------*/
987 F_7(char *pbuf, int val)
990 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_7, val = %d\n", val);
994 sprintf((pbuf+strlen(pbuf)), "\t NumberOfUnits = %d\n", val);
999 /*---------------------------------------------------------------------------*
1001 *---------------------------------------------------------------------------*/
1003 F_8(char *pbuf, int val)
1006 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_8, val = %d\n", val);
1010 sprintf((pbuf+strlen(pbuf)), "\t typeOfChargingInfo = %s\n", val == 0 ? "subTotal" : "total");
1011 state = ST_EXP_DBID;
1015 /*---------------------------------------------------------------------------*
1017 *---------------------------------------------------------------------------*/
1019 F_9(char *pbuf, int val)
1022 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_9, val = %d\n", val);
1026 sprintf((pbuf+strlen(pbuf)), "\t AOCDBillingId = %s (%d)\n", bid_str(val), val);
1031 /*---------------------------------------------------------------------------*
1033 *---------------------------------------------------------------------------*/
1034 static struct statetab {
1035 int currstate; /* input: current state we are in */
1036 int form; /* input: current tag form */
1037 int class; /* input: current tag class */
1038 int code; /* input: current tag code */
1039 void (*func)(char *,int); /* output: func to exec */
1042 /* current state tag form tag class tag code function */
1043 /* --------------------- ---------------------- ---------------------- ---------------------- ----------------*/
1047 {ST_EXP_COMP_TYP, FAC_TAGFORM_CON, FAC_TAGCLASS_COS, 1, F_1_1 },
1048 {ST_EXP_COMP_TYP, FAC_TAGFORM_CON, FAC_TAGCLASS_COS, 2, F_1_2 },
1049 {ST_EXP_COMP_TYP, FAC_TAGFORM_CON, FAC_TAGCLASS_COS, 3, F_1_3 },
1050 {ST_EXP_COMP_TYP, FAC_TAGFORM_CON, FAC_TAGCLASS_COS, 4, F_1_4 },
1051 {ST_EXP_INV_ID, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_INT, F_2 },
1052 {ST_EXP_OP_VAL, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_INT, F_3 },
1053 {ST_EXP_INFO, FAC_TAGFORM_CON, FAC_TAGCLASS_UNI, FAC_CODEUNI_SEQ, F_4 },
1054 {ST_EXP_INFO, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_NULL, F_4_1 },
1055 {ST_EXP_INFO, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 1, F_4_2 },
1056 {ST_EXP_RUL, FAC_TAGFORM_CON, FAC_TAGCLASS_COS, 1, F_5 },
1057 {ST_EXP_RU, FAC_TAGFORM_CON, FAC_TAGCLASS_UNI, FAC_CODEUNI_SEQ, F_6 },
1058 {ST_EXP_RNOU, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_INT, F_7 },
1059 {ST_EXP_TOCI, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 2, F_8 },
1060 {ST_EXP_DBID, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 3, F_9 },
1064 {ST_EXP_RR_INV_ID, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_INT, F_RR2 },
1065 {ST_EXP_RR_OP_VAL, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_INT, F_RR3 },
1066 {ST_EXP_RR_RESULT, FAC_TAGFORM_CON, FAC_TAGCLASS_UNI, FAC_CODEUNI_SET, F_RRR },
1068 /* current state tag form tag class tag code function */
1069 /* --------------------- ---------------------- ---------------------- ---------------------- ----------------*/
1072 {ST_EXP_REJ_INV_ID, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_INT, F_RJ2 },
1073 {ST_EXP_REJ_OP_VAL, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 0, F_RJ30 },
1074 {ST_EXP_REJ_OP_VAL, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 1, F_RJ31 },
1075 {ST_EXP_REJ_OP_VAL, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 2, F_RJ32 },
1076 {ST_EXP_REJ_OP_VAL, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 3, F_RJ33 },
1080 {-1, -1, -1, -1, NULL }
1083 /*---------------------------------------------------------------------------*
1084 * state decode for do_component
1085 *---------------------------------------------------------------------------*/
1087 next_state(char *pbuf, int class, int form, int code, int val)
1092 sprintf((pbuf+strlen(pbuf)), "next_state: class=%d, form=%d, code=%d, val=%d\n", class, form, code, val);
1097 if((statetab[i].currstate > state) ||
1098 (statetab[i].currstate == -1))
1103 if((statetab[i].currstate == state) &&
1104 (statetab[i].form == form) &&
1105 (statetab[i].class == class) &&
1106 (statetab[i].code == code))
1108 (*statetab[i].func)(pbuf, val);