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.2 2003/06/17 04:29:55 dillon 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 *---------------------------------------------------------------------------*/
364 static char *uni_str(int code)
366 static char *tbl[] = {
393 if(code >= 1 && code <= FAC_CODEUNI_GNSTR)
396 return("ERROR, Value out of Range!");
399 /*---------------------------------------------------------------------------*
400 * print operation value
401 *---------------------------------------------------------------------------*/
402 static char *opval_str(int val)
404 static char buffer[80];
427 case FAC_OPVAL_DIV_ACT:
428 r = "activationDiversion";
430 case FAC_OPVAL_DIV_DEACT:
431 r = "deactivationDiversion";
433 case FAC_OPVAL_DIV_ACTSN:
434 r = "activationStatusNotificationDiv";
436 case FAC_OPVAL_DIV_DEACTSN:
437 r = "deactivationStatusNotificationDiv";
439 case FAC_OPVAL_DIV_INTER:
440 r = "interrogationDiversion";
442 case FAC_OPVAL_DIV_INFO:
443 r = "diversionInformation";
445 case FAC_OPVAL_DIV_CALLDEF:
446 r = "callDeflection";
448 case FAC_OPVAL_DIV_CALLRER:
451 case FAC_OPVAL_DIV_LINF2:
452 r = "divertingLegInformation2";
454 case FAC_OPVAL_DIV_INVS:
457 case FAC_OPVAL_DIV_INTER1:
458 r = "interrogationDiversion1";
460 case FAC_OPVAL_DIV_LINF1:
461 r = "divertingLegInformation1";
463 case FAC_OPVAL_DIV_LINF3:
464 r = "divertingLegInformation3";
466 case FAC_OPVAL_ER_CRCO:
467 r = "explicitReservationCreationControl";
469 case FAC_OPVAL_ER_MGMT:
470 r = "explicitReservationManagement";
472 case FAC_OPVAL_ER_CANC:
473 r = "explicitReservationCancel";
475 case FAC_OPVAL_MLPP_QUERY:
476 r = "mLPP lfb Query";
478 case FAC_OPVAL_MLPP_CALLR:
479 r = "mLPP Call Request";
481 case FAC_OPVAL_MLPP_CALLP:
482 r = "mLPP Call Preemption";
484 case FAC_OPVAL_AOC_REQ:
485 r = "chargingRequest";
487 case FAC_OPVAL_AOC_S_CUR:
490 case FAC_OPVAL_AOC_S_SPC:
491 r = "aOCSSpecialArrangement";
493 case FAC_OPVAL_AOC_D_CUR:
496 case FAC_OPVAL_AOC_D_UNIT:
497 r = "aOCDChargingUnit";
499 case FAC_OPVAL_AOC_E_CUR:
502 case FAC_OPVAL_AOC_E_UNIT:
503 r = "aOCEChargingUnit";
505 case FAC_OPVAL_AOC_IDOFCRG:
506 r = "identificationOfCharge";
508 case FAC_OPVAL_CONF_BEG:
511 case FAC_OPVAL_CONF_ADD:
514 case FAC_OPVAL_CONF_SPLIT:
517 case FAC_OPVAL_CONF_DROP:
520 case FAC_OPVAL_CONF_ISOLATE:
523 case FAC_OPVAL_CONF_REATT:
526 case FAC_OPVAL_CONF_PDISC:
529 case FAC_OPVAL_CONF_FCONF:
532 case FAC_OPVAL_CONF_END:
535 case FAC_OPVAL_CONF_IDCFE:
536 r = "indentifyConferee";
538 case FAC_OPVAL_REVC_REQ:
542 sprintf(buffer, "unknown operation value %d!", val);
548 /*---------------------------------------------------------------------------*
550 *---------------------------------------------------------------------------*/
551 static char *bid_str(int val)
553 static char buffer[80];
559 r = "normalCharging";
562 r = "reverseCharging";
565 r = "creditCardCharging";
568 r = "callForwardingUnconditional";
571 r = "callForwardingBusy";
574 r = "callForwardingNoReply";
577 r = "callDeflection";
583 sprintf(buffer, "unknown billing-id value %d!", val);
589 /*---------------------------------------------------------------------------*
591 *---------------------------------------------------------------------------*/
593 F_1_1(char *pbuf, int val)
596 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_1_1, val = %d\n", val);
600 sprintf((pbuf+strlen(pbuf)), "\t invokeComponent\n");
601 state = ST_EXP_INV_ID;
605 /*---------------------------------------------------------------------------*
607 *---------------------------------------------------------------------------*/
609 F_1_2(char *pbuf, int val)
612 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_1_2, val = %d\n", val);
616 sprintf((pbuf+strlen(pbuf)), "\t returnResult\n");
617 state = ST_EXP_RR_INV_ID;
620 /*---------------------------------------------------------------------------*
622 *---------------------------------------------------------------------------*/
624 F_1_3(char *pbuf, int val)
627 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_1_3, val = %d\n", val);
631 sprintf((pbuf+strlen(pbuf)), "\t returnError\n");
635 /*---------------------------------------------------------------------------*
637 *---------------------------------------------------------------------------*/
639 F_1_4(char *pbuf, int val)
642 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_1_4, val = %d\n", val);
646 sprintf((pbuf+strlen(pbuf)), "\t reject\n");
647 state = ST_EXP_REJ_INV_ID;
651 /*---------------------------------------------------------------------------*
652 * return result: invoke id
653 *---------------------------------------------------------------------------*/
655 F_RJ2(char *pbuf, int val)
658 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RJ2, val = %d\n", val);
662 sprintf((pbuf+strlen(pbuf)), "\t InvokeIdentifier = %d\n", val);
663 state = ST_EXP_REJ_OP_VAL;
667 /*---------------------------------------------------------------------------*
668 * reject, general problem
669 *---------------------------------------------------------------------------*/
671 F_RJ30(char *pbuf, int val)
674 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RJ30, val = %d\n", val);
678 sprintf((pbuf+strlen(pbuf)), "\t General problem\n");
685 sprintf((pbuf+strlen(pbuf)), "\t problem = unrecognized component\n");
688 sprintf((pbuf+strlen(pbuf)), "\t problem = mistyped component\n");
691 sprintf((pbuf+strlen(pbuf)), "\t problem = badly structured component\n");
694 sprintf((pbuf+strlen(pbuf)), "\t problem = unknown problem code 0x%x\n", val);
701 /*---------------------------------------------------------------------------*
702 * reject, invoke problem
703 *---------------------------------------------------------------------------*/
705 F_RJ31(char *pbuf, int val)
708 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RJ31, val = %d\n", val);
712 sprintf((pbuf+strlen(pbuf)), "\t Invoke problem\n");
719 sprintf((pbuf+strlen(pbuf)), "\t problem = duplicate invocation\n");
722 sprintf((pbuf+strlen(pbuf)), "\t problem = unrecognized operation\n");
725 sprintf((pbuf+strlen(pbuf)), "\t problem = mistyped argument\n");
728 sprintf((pbuf+strlen(pbuf)), "\t problem = resource limitation\n");
731 sprintf((pbuf+strlen(pbuf)), "\t problem = initiator releasing\n");
734 sprintf((pbuf+strlen(pbuf)), "\t problem = unrecognized linked identifier\n");
737 sprintf((pbuf+strlen(pbuf)), "\t problem = linked resonse unexpected\n");
740 sprintf((pbuf+strlen(pbuf)), "\t problem = unexpected child operation\n");
743 sprintf((pbuf+strlen(pbuf)), "\t problem = unknown problem code 0x%x\n", val);
750 /*---------------------------------------------------------------------------*
751 * reject, return result problem
752 *---------------------------------------------------------------------------*/
754 F_RJ32(char *pbuf, int val)
757 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RJ32, val = %d\n", val);
761 sprintf((pbuf+strlen(pbuf)), "\t Return result problem\n");
768 sprintf((pbuf+strlen(pbuf)), "\t problem = unrecognized invocation\n");
771 sprintf((pbuf+strlen(pbuf)), "\t problem = return response unexpected\n");
774 sprintf((pbuf+strlen(pbuf)), "\t problem = mistyped result\n");
777 sprintf((pbuf+strlen(pbuf)), "\t problem = unknown problem code 0x%x\n", val);
784 /*---------------------------------------------------------------------------*
785 * reject, return error problem
786 *---------------------------------------------------------------------------*/
788 F_RJ33(char *pbuf, int val)
791 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RJ33, val = %d\n", val);
795 sprintf((pbuf+strlen(pbuf)), "\t Return error problem\n");
802 sprintf((pbuf+strlen(pbuf)), "\t problem = unrecognized invocation\n");
805 sprintf((pbuf+strlen(pbuf)), "\t problem = error response unexpected\n");
808 sprintf((pbuf+strlen(pbuf)), "\t problem = unrecognized error\n");
811 sprintf((pbuf+strlen(pbuf)), "\t problem = unexpected error\n");
814 sprintf((pbuf+strlen(pbuf)), "\t problem = mistyped parameter\n");
817 sprintf((pbuf+strlen(pbuf)), "\t problem = unknown problem code 0x%x\n", val);
824 /*---------------------------------------------------------------------------*
825 * invoke component: invoke id
826 *---------------------------------------------------------------------------*/
828 F_2(char *pbuf, int val)
831 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_2, val = %d\n", val);
835 sprintf((pbuf+strlen(pbuf)), "\t InvokeIdentifier = %d\n", val);
836 state = ST_EXP_OP_VAL;
840 /*---------------------------------------------------------------------------*
841 * return result: invoke id
842 *---------------------------------------------------------------------------*/
844 F_RR2(char *pbuf, int val)
847 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RR2, val = %d\n", val);
851 sprintf((pbuf+strlen(pbuf)), "\t InvokeIdentifier = %d\n", val);
852 state = ST_EXP_RR_OP_VAL;
856 /*---------------------------------------------------------------------------*
857 * invoke component: operation value
858 *---------------------------------------------------------------------------*/
860 F_3(char *pbuf, int val)
863 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_3, val = %d\n", val);
867 sprintf((pbuf+strlen(pbuf)), "\t Operation Value = %s (%d)\n", opval_str(val), val);
872 /*---------------------------------------------------------------------------*
873 * return result: operation value
874 *---------------------------------------------------------------------------*/
876 F_RR3(char *pbuf, int val)
879 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RR3, val = %d\n", val);
883 sprintf((pbuf+strlen(pbuf)), "\t Operation Value = %s (%d)\n", opval_str(val), val);
884 state = ST_EXP_RR_RESULT;
888 /*---------------------------------------------------------------------------*
889 * return result: RESULT
890 *---------------------------------------------------------------------------*/
892 F_RRR(char *pbuf, int val)
895 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RRR, val = %d\n", val);
900 /*---------------------------------------------------------------------------*
902 *---------------------------------------------------------------------------*/
904 F_4(char *pbuf, int val)
907 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_4, val = %d\n", val);
911 sprintf((pbuf+strlen(pbuf)), "\t specificChargingUnits\n");
916 /*---------------------------------------------------------------------------*
918 *---------------------------------------------------------------------------*/
920 F_4_1(char *pbuf, int val)
923 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_4_1, val = %d\n", val);
927 sprintf((pbuf+strlen(pbuf)), "\t freeOfCharge\n");
932 /*---------------------------------------------------------------------------*
934 *---------------------------------------------------------------------------*/
936 F_4_2(char *pbuf, int val)
939 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_4_2, val = %d\n", val);
943 sprintf((pbuf+strlen(pbuf)), "\t chargeNotAvailable\n");
948 /*---------------------------------------------------------------------------*
950 *---------------------------------------------------------------------------*/
952 F_5(char *pbuf, int val)
955 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_5, val = %d\n", val);
959 sprintf((pbuf+strlen(pbuf)), "\t recordedUnitsList [1]\n");
964 /*---------------------------------------------------------------------------*
966 *---------------------------------------------------------------------------*/
968 F_6(char *pbuf, int val)
971 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_6, val = %d\n", val);
975 sprintf((pbuf+strlen(pbuf)), "\t RecordedUnits\n");
980 /*---------------------------------------------------------------------------*
982 *---------------------------------------------------------------------------*/
984 F_7(char *pbuf, int val)
987 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_7, val = %d\n", val);
991 sprintf((pbuf+strlen(pbuf)), "\t NumberOfUnits = %d\n", val);
996 /*---------------------------------------------------------------------------*
998 *---------------------------------------------------------------------------*/
1000 F_8(char *pbuf, int val)
1003 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_8, val = %d\n", val);
1007 sprintf((pbuf+strlen(pbuf)), "\t typeOfChargingInfo = %s\n", val == 0 ? "subTotal" : "total");
1008 state = ST_EXP_DBID;
1012 /*---------------------------------------------------------------------------*
1014 *---------------------------------------------------------------------------*/
1016 F_9(char *pbuf, int val)
1019 sprintf((pbuf+strlen(pbuf)), "next_state: exec F_9, val = %d\n", val);
1023 sprintf((pbuf+strlen(pbuf)), "\t AOCDBillingId = %s (%d)\n", bid_str(val), val);
1028 /*---------------------------------------------------------------------------*
1030 *---------------------------------------------------------------------------*/
1031 static struct statetab {
1032 int currstate; /* input: current state we are in */
1033 int form; /* input: current tag form */
1034 int class; /* input: current tag class */
1035 int code; /* input: current tag code */
1036 void (*func)(char *,int); /* output: func to exec */
1039 /* current state tag form tag class tag code function */
1040 /* --------------------- ---------------------- ---------------------- ---------------------- ----------------*/
1044 {ST_EXP_COMP_TYP, FAC_TAGFORM_CON, FAC_TAGCLASS_COS, 1, F_1_1 },
1045 {ST_EXP_COMP_TYP, FAC_TAGFORM_CON, FAC_TAGCLASS_COS, 2, F_1_2 },
1046 {ST_EXP_COMP_TYP, FAC_TAGFORM_CON, FAC_TAGCLASS_COS, 3, F_1_3 },
1047 {ST_EXP_COMP_TYP, FAC_TAGFORM_CON, FAC_TAGCLASS_COS, 4, F_1_4 },
1048 {ST_EXP_INV_ID, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_INT, F_2 },
1049 {ST_EXP_OP_VAL, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_INT, F_3 },
1050 {ST_EXP_INFO, FAC_TAGFORM_CON, FAC_TAGCLASS_UNI, FAC_CODEUNI_SEQ, F_4 },
1051 {ST_EXP_INFO, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_NULL, F_4_1 },
1052 {ST_EXP_INFO, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 1, F_4_2 },
1053 {ST_EXP_RUL, FAC_TAGFORM_CON, FAC_TAGCLASS_COS, 1, F_5 },
1054 {ST_EXP_RU, FAC_TAGFORM_CON, FAC_TAGCLASS_UNI, FAC_CODEUNI_SEQ, F_6 },
1055 {ST_EXP_RNOU, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_INT, F_7 },
1056 {ST_EXP_TOCI, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 2, F_8 },
1057 {ST_EXP_DBID, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 3, F_9 },
1061 {ST_EXP_RR_INV_ID, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_INT, F_RR2 },
1062 {ST_EXP_RR_OP_VAL, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_INT, F_RR3 },
1063 {ST_EXP_RR_RESULT, FAC_TAGFORM_CON, FAC_TAGCLASS_UNI, FAC_CODEUNI_SET, F_RRR },
1065 /* current state tag form tag class tag code function */
1066 /* --------------------- ---------------------- ---------------------- ---------------------- ----------------*/
1069 {ST_EXP_REJ_INV_ID, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_INT, F_RJ2 },
1070 {ST_EXP_REJ_OP_VAL, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 0, F_RJ30 },
1071 {ST_EXP_REJ_OP_VAL, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 1, F_RJ31 },
1072 {ST_EXP_REJ_OP_VAL, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 2, F_RJ32 },
1073 {ST_EXP_REJ_OP_VAL, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 3, F_RJ33 },
1077 {-1, -1, -1, -1, NULL }
1080 /*---------------------------------------------------------------------------*
1081 * state decode for do_component
1082 *---------------------------------------------------------------------------*/
1084 next_state(char *pbuf, int class, int form, int code, int val)
1089 sprintf((pbuf+strlen(pbuf)), "next_state: class=%d, form=%d, code=%d, val=%d\n", class, form, code, val);
1094 if((statetab[i].currstate > state) ||
1095 (statetab[i].currstate == -1))
1100 if((statetab[i].currstate == state) &&
1101 (statetab[i].form == form) &&
1102 (statetab[i].class == class) &&
1103 (statetab[i].code == code))
1105 (*statetab[i].func)(pbuf, val);