aboutsummaryrefslogtreecommitdiffstats
path: root/epan/tvbuff.c
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2016-10-21 10:10:06 +0200
committerMichael Mann <mmann78@netscape.net>2016-10-22 03:16:11 +0000
commit321b756dc41f9bc26cc0eb8b08f90a73158dc75a (patch)
tree5df4f3a53a47dbbf7933106a486143a3cda9fe96 /epan/tvbuff.c
parent53d3e3c25ef7037ba28b93dd684f5de4c015767f (diff)
Add T.61 character set support
Bug: 13032 Change-Id: I6bf2cc2c43a6262d899a304df6576d9831115966 Reviewed-on: https://code.wireshark.org/review/18350 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/tvbuff.c')
-rw-r--r--epan/tvbuff.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/epan/tvbuff.c b/epan/tvbuff.c
index 3358b7ae1f..38ac3e06e6 100644
--- a/epan/tvbuff.c
+++ b/epan/tvbuff.c
@@ -2476,6 +2476,15 @@ tvb_get_ebcdic_string(wmem_allocator_t *scope, tvbuff_t *tvb, gint offset, gint
return get_ebcdic_string(scope, ptr, length);
}
+static guint8 *
+tvb_get_t61_string(wmem_allocator_t *scope, tvbuff_t *tvb, gint offset, gint length)
+{
+ const guint8 *ptr;
+
+ ptr = ensure_contiguous(tvb, offset, length);
+ return get_t61_string(scope, ptr, length);
+}
+
/*
* Given a tvbuff, an offset, a length, and an encoding, allocate a
* buffer big enough to hold a non-null-terminated string of that length
@@ -2636,6 +2645,10 @@ tvb_get_string_enc(wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset,
*/
strptr = tvb_get_ebcdic_string(scope, tvb, offset, length);
break;
+
+ case ENC_T61:
+ strptr = tvb_get_t61_string(scope, tvb, offset, length);
+ break;
}
return strptr;
}
@@ -2812,6 +2825,20 @@ tvb_get_ebcdic_stringz(wmem_allocator_t *scope, tvbuff_t *tvb, gint offset, gint
return get_ebcdic_string(scope, ptr, size);
}
+static guint8 *
+tvb_get_t61_stringz(wmem_allocator_t *scope, tvbuff_t *tvb, gint offset, gint *lengthp)
+{
+ guint size;
+ const guint8 *ptr;
+
+ size = tvb_strsize(tvb, offset);
+ ptr = ensure_contiguous(tvb, offset, size);
+ /* XXX, conversion between signed/unsigned integer */
+ if (lengthp)
+ *lengthp = size;
+ return get_t61_string(scope, ptr, size);
+}
+
guint8 *
tvb_get_stringz_enc(wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset, gint *lengthp, const guint encoding)
{
@@ -2951,6 +2978,10 @@ tvb_get_stringz_enc(wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset, g
*/
strptr = tvb_get_ebcdic_stringz(scope, tvb, offset, lengthp);
break;
+
+ case ENC_T61:
+ strptr = tvb_get_t61_stringz(scope, tvb, offset, lengthp);
+ break;
}
return strptr;