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