aboutsummaryrefslogtreecommitdiffstats
path: root/epan/strutil.c
diff options
context:
space:
mode:
authoretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>2009-10-23 01:56:09 +0000
committeretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>2009-10-23 01:56:09 +0000
commitffede2ce180539325655ff3f82e0fb46835ef2bb (patch)
tree0d4922ee451cbc2d2be151a04b5df83b347de7e3 /epan/strutil.c
parentecd477f9eeb3744a7d20c86ad95c87e7b1efaf57 (diff)
Move IA5_7BIT_decode to strutil.c
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@30669 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/strutil.c')
-rw-r--r--epan/strutil.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/epan/strutil.c b/epan/strutil.c
index d3e2d19522..b2a77f54c7 100644
--- a/epan/strutil.c
+++ b/epan/strutil.c
@@ -1023,3 +1023,57 @@ escape_string(char *buf, const char *string)
*bufp = '\0';
return buf;
}
+
+#define GN_CHAR_ALPHABET_SIZE 128
+
+static gunichar IA5_default_alphabet[GN_CHAR_ALPHABET_SIZE] = {
+
+ /*ITU-T recommendation T.50 specifies International Reference Alphabet 5 (IA5) */
+
+ '?', '?', '?', '?', '?', '?', '?', '?',
+ '?', '?', '?', '?', '?', '?', '?', '?',
+ '?', '?', '?', '?', '?', '?', '?', '?',
+ '?', '?', '?', '?', '?', '?', '?', '?',
+ ' ', '!', '\"','#', '$', '%', '&', '\'',
+ '(', ')', '*', '+', ',', '-', '.', '/',
+ '0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', ':', ';', '<', '=', '>', '?',
+ '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
+ 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
+ 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
+ 'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
+ '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
+ 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
+ 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
+ 'x', 'y', 'z', '{', '|', '}', '~', '?'
+};
+
+static gunichar
+char_def_ia5_alphabet_decode(unsigned char value)
+{
+ if (value < GN_CHAR_ALPHABET_SIZE)
+ {
+ return IA5_default_alphabet[value];
+ }
+ else
+ {
+ return '?';
+ }
+}
+
+void
+IA5_7BIT_decode(unsigned char * dest, const unsigned char* src, int len)
+{
+ int i, j;
+ gunichar buf;
+
+
+ for (i = 0, j = 0; j < len; j++)
+ {
+ buf = char_def_ia5_alphabet_decode(src[j]);
+ i += g_unichar_to_utf8(buf,&(dest[i]));
+ }
+ dest[i]=0;
+ return;
+}
+