blob: 6c13f734660edd0a36f57fcd2b46d9ab0fdb4bd7 [file] [log] [blame]
Lev Walkinf15320b2004-06-03 03:38:44 +00001/*-
Lev Walkin4902f052006-10-16 12:18:10 +00002 * Copyright (c) 2003, 2006 Lev Walkin <vlm@lionet.info>. All rights reserved.
Lev Walkinf15320b2004-06-03 03:38:44 +00003 * Redistribution and modifications are permitted subject to BSD license.
4 */
Lev Walkina9cc46e2004-09-22 16:06:28 +00005#include <asn_internal.h>
Lev Walkinf15320b2004-06-03 03:38:44 +00006#include <TeletexString.h>
7
8/*
9 * TeletexString basic type description.
10 */
Wim Lewis18c2ec92014-07-29 11:30:10 -070011static const ber_tlv_tag_t asn_DEF_TeletexString_tags[] = {
Lev Walkin188ed2c2004-09-13 08:31:01 +000012 (ASN_TAG_CLASS_UNIVERSAL | (20 << 2)), /* [UNIVERSAL 20] IMPLICIT ...*/
13 (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), /* ... OCTET STRING */
Lev Walkinf15320b2004-06-03 03:38:44 +000014};
Bi-Ruei, Chiu1f87ac02017-08-20 01:25:45 +080015asn_TYPE_operation_t asn_OP_TeletexString = {
Lev Walkina9cc46e2004-09-22 16:06:28 +000016 OCTET_STRING_free,
17 OCTET_STRING_print, /* non-ascii string */
Lev Walkincd2f48e2017-08-10 02:14:59 -070018 OCTET_STRING_compare,
Lev Walkinf15320b2004-06-03 03:38:44 +000019 OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */
Lev Walkindc06f6b2004-10-20 15:50:55 +000020 OCTET_STRING_encode_der,
21 OCTET_STRING_decode_xer_hex,
22 OCTET_STRING_encode_xer,
Lev Walkincc159472017-07-06 08:26:36 -070023#ifdef ASN_DISABLE_OER_SUPPORT
24 0,
25 0,
26#else
Lev Walkin1d76f3c2017-07-25 07:58:05 -070027 OCTET_STRING_decode_oer,
28 OCTET_STRING_encode_oer,
Lev Walkincc159472017-07-06 08:26:36 -070029#endif /* ASN_DISABLE_OER_SUPPORT */
Lev Walkinb33425f2017-07-14 14:59:52 +040030#ifdef ASN_DISABLE_PER_SUPPORT
31 0,
32 0,
33#else
34 OCTET_STRING_decode_uper,
35 OCTET_STRING_encode_uper,
36#endif /* ASN_DISABLE_PER_SUPPORT */
Lev Walkina5972be2017-09-29 23:15:58 -070037 OCTET_STRING_random_fill,
Bi-Ruei, Chiu1f87ac02017-08-20 01:25:45 +080038 0 /* Use generic outmost tag fetcher */
39};
40asn_TYPE_descriptor_t asn_DEF_TeletexString = {
41 "TeletexString",
42 "TeletexString",
43 &asn_OP_TeletexString,
Lev Walkin5e033762004-09-29 13:26:15 +000044 asn_DEF_TeletexString_tags,
45 sizeof(asn_DEF_TeletexString_tags)
46 / sizeof(asn_DEF_TeletexString_tags[0]) - 1,
47 asn_DEF_TeletexString_tags,
48 sizeof(asn_DEF_TeletexString_tags)
49 / sizeof(asn_DEF_TeletexString_tags[0]),
Lev Walkina5972be2017-09-29 23:15:58 -070050 { 0, 0, asn_generic_unknown_constraint },
Lev Walkin449f8322004-08-20 13:23:42 +000051 0, 0, /* No members */
Lev Walkind9bd7752004-06-05 08:17:50 +000052 0 /* No specifics */
Lev Walkinf15320b2004-06-03 03:38:44 +000053};
54
Lev Walkin4902f052006-10-16 12:18:10 +000055/*
56 * Here is a formal attempt at creating a mapping from TeletexString
57 * (T61String) of the latest ASN.1 standard (X.680:2002) into the Unicode
58 * character set. -- Lev Walkin <vlm@lionet.info>
59 *
60 * The first thing to keep in mind is that TeletexString (T61String)
61 * is defined in ASN.1, and is not really a T.61 string.
62 * The T.61 standard is withdrawn by ITU-T and is no longer an authoritative
63 * reference. See http://www.itu.int/rec/T-REC-T.61
64 *
65 * The X.680 specifies TeletexString (T61String) as a combination of the
66 * character sets specified by the registration numbers listed in
67 * ISO International Register of Coded Character Sets to be used with
68 * Escape Sequences (ISO-2375):
69 * 6, 87, 102, 103, 106, 107, 126, 144, 150, 153, 156, 164, 165, 168,
70 * plus SPACE and DELETE characters.
71 * In addition to that, the X.680 Table 6 NOTE 2 allows using register entries
72 * 6 and 156 instead of 102 and 103.
73 *
74 * The ISO Register itself is available at http://www.itscj.ipsj.or.jp/ISO-IR/
75 *
76 * #6 is ASCII. http://www.itscj.ipsj.or.jp/ISO-IR/006.pdf
77 * Escapes into:
78 * G0: ESC 2/8 4/2 ("(B")
79 * G1: ESC 2/9 4/2 (")B")
80 * The range is [0x21 .. 0x7e]. Conversion into Unicode
81 * is simple, because it has one-to-one correspondence.
82 * #87 is a "Japanese Graphic Character Set for Information Interchange".
83 * Is a multiple-byte set of 6877 characters.
84 * The character set is JIS X 0208-1983 (originally JIS C 6226-1983).
85 * Escapes into:
86 * G0: ESC 2/4 4/2 ("$B")
87 * G1: ESC 2/4 2/9 4/2 ("$)B")
88 * G2: ESC 2/4 2/10 4/2 ("$*B")
89 * G3: ESC 2/4 2/11 4/2 ("$+B")
90 * #102 is "Teletex Primary Set of Graphic Characters" and is almost ASCII.
91 * Escapes into:
92 * G0: ESC 2/8 7/5 ("(u")
93 * G1: ESC 2/9 7/5 (")u")
94 * G2: ESC 2/10 7/5 ("*u")
95 * G3: ESC 2/11 7/5 ("+u")
96 * It is almost identical to ASCII, except for ASCII position for '$'
97 * (DOLLAR SIGN) is filled with 'ยค' (CURRENCY SIGN), which is U+00A4.
98 * Also, ASCII positions for '`', '\', '^', '{', '}', '~' are marked
99 * as "should not be used".
100 * #103 is a supplementary set of characters used in combination with #102.
101 * Escapes into:
102 * G0: ESC 2/8 7/6 ("(v")
103 * G1: ESC 2/9 7/6 (")v")
104 * G2: ESC 2/10 7/6 ("*v")
105 * G3: ESC 2/11 7/6 ("+v")
106 * Some characters in that character set are combining characters,
107 * which can only be restrictively used with certain basic Latin letters.
108 * It can be thought of as a subset of #156 with the exception of 4/12
109 * which is UNDERLINE in #103 and absent in #156.
110 * #106 is a primary set of control functions, used in combination with #107.
111 * Escapes into:
112 * C0: ESC 2/1 4/5 ("!E")
113 * This set is so short I can list it here:
114 * 0x08 BS BACKSPACE -- same as Unicode
115 * 0x0a LF LINE FEED -- same as Unicode
116 * 0x0c FF FORM FEED -- same as Unicode
117 * 0x0d CR CARRIAGE RETURN -- same as Unicode
118 * 0x0e LS1 LOCKING SHIFT ONE
119 * 0x0f LS0 LOCKING SHIFT ZERO
120 * 0x19 SS2 SINGLE SHIFT TWO
121 * 0x1a SUB SUBSTITUTE CHARACTER
122 * 0x1b ESC ESCAPE -- same as Unicode
123 * 0x1d SS3 SINGLE SHIFT THREE
124 * The LS1 and LS0 are two magical functions which, respectively, invoke
125 * the currently designated G1 or G0 set into positions 2/1 to 7/14
126 * The SS2 and SS3, respectively, invoke one character of the
127 * currently designated set G2 and G3.
128 * The SUB is wholly equivalent to U+001a (SUBSTITUTE)
129 * #107 is a supplementary set of control functions, used with #106.
130 * Escapes into:
131 * C1: ESC 2/2 4/8 ('"H')
132 * This set contains three special control codes:
133 * 0x8b PLD PARTIAL LINE DOWN -- similar to <SUB>
134 * 0x8c PLU PARTIAL LINE UP -- sumilar to <SUP>
135 * 0x9b CSI CONTROL SEQUENCE INTRODUCER
136 * This set is so out of world we can probably safely ignore it.
137 * #126 is a "Right-hand Part of the Latin/Greek Alphabet".
138 * Comprises of 90 characters, including accented letters.
139 * Escapes into:
140 * G1: ESC 2/13 4/6 ("-F")
141 * G2: ESC 2/14 4/6 (".F")
142 * G3: ESC 2/15 4/6 ("/F")
143 * Note: This Registration is a subset of ISO-IR 227.
144 * #144 is a "Cyrillic part of the Latin/Cyrillic Alphabet".
145 * Comprises of 95 characters.
146 * Escapes into:
147 * G1: ESC 2/13 4/12 ("-L")
148 * G2: ESC 2/14 4/12 (".L")
149 * G3: ESC 2/15 4/12 ("/L")
150 * #150 is a "Greek Primary Set of Graphic Characters".
151 * Comprises of 94 characters.
152 * Escapes into:
153 * G0: ESC 2/8 2/1 4/0 ("(!@")
154 * G1: ESC 2/9 2/1 4/0 (")!@")
155 * G2: ESC 2/10 2/1 4/0 ("*!@")
156 * G3: ESC 2/11 2/1 4/0 ("+!@")
157 * #153 is a "Basic Cyrillic Character Set for 8-bit codes".
158 * Comprises of 68 characters.
159 * Escapes into:
160 * G1: ESC 2/13 4/15 ("-O")
161 * G2: ESC 2/14 4/15 (".O")
162 * G3: ESC 2/15 4/15 ("/O")
163 * #156 is a "Supplementary Set of ISO/IEC 6937:1992" for use with #6
164 * Comprises of 87 characters.
165 * Escapes into:
166 * G1: ESC 2/13 5/2 ("-R")
167 * G2: ESC 2/14 5/2 (".R")
168 * G3: ESC 2/15 5/2 ("/R")
169 * #164 is a "Hebrew Supplementary Set of Graphic Characters"
170 * Comprises of 27 characters.
171 * Escapes into:
172 * G1: ESC 2/13 5/3 ("-S")
173 * G2: ESC 2/14 5/3 (".S")
174 * G3: ESC 2/15 5/3 ("/S")
175 * #165 is a set of "Codes of the Chinese graphic character set"
176 * Is a multiple-byte set of 8446 characters.
177 * Escapes into:
178 * G0: ESC 2/4 2/8 4/5 ("$(E")
179 * G1: ESC 2/4 2/9 4/5 ("$)E")
180 * G2: ESC 2/4 2/10 4/5 ("$*E")
181 * G3: ESC 2/4 2/11 4/5 ("$+E")
182 * #168 is a "Japanese Graphic Character Set for Information Interchange"
183 * A multiple-byte set of 6879 characters updated from #87.
184 * Escapes into:
185 * G0: ESC 2/6 4/0 ESC 2/4 4/2 ("&@" "$B")
186 * G1: ESC 2/6 4/0 ESC 2/4 2/9 4/2 ("&@" "$)B")
187 * G2: ESC 2/6 4/0 ESC 2/4 2/10 4/2 ("&@" "$*B")
188 * G3: ESC 2/6 4/0 ESC 2/4 2/11 4/2 ("&@" "$+B")
189 */
190