aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2013-07-01 02:51:48 +0000
committerGuy Harris <guy@alum.mit.edu>2013-07-01 02:51:48 +0000
commitf426c3cd45fe1aa1c1f52ea21d34d2273a6ea33c (patch)
treea0a9e7d10c256c7df7e3edb11c14dc1e5dea94bf /epan
parent3e0168d1c548d1734a733ff81fff7e42fde0e955 (diff)
Consistently maintain the callState member of an iax2_info_t structure
as a voip_call_state value; don't have it sometimes a voip_call_state and sometimes a frame subtype. This should squelch some complaints from newer versions of Clang about unnecessary array-bounds checks - the array-bounds checks are done on frame subtypes, where they *are* necessary (nothing prevents an untrustworthy IAX2 implementation or an untrustworthy capture file writer from putting an arbitrary value in the packets), not on voip_call_state values (where it was only necessary because the value wasn't, in that case, a voip_call_state value, it was a frame subtype cast to a voip_call_state). svn path=/trunk/; revision=50277
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-iax2.c48
1 files changed, 46 insertions, 2 deletions
diff --git a/epan/dissectors/packet-iax2.c b/epan/dissectors/packet-iax2.c
index 16f0ffb928..e1ad8494ee 100644
--- a/epan/dissectors/packet-iax2.c
+++ b/epan/dissectors/packet-iax2.c
@@ -292,7 +292,7 @@ static const value_string iax_cmd_subclasses[] = {
};
static value_string_ext iax_cmd_subclasses_ext = VALUE_STRING_EXT_INIT(iax_cmd_subclasses);
-/* IAX2 to tap-voip call state mapping */
+/* IAX2 to tap-voip call state mapping for command frames */
static const voip_call_state tap_cmd_voip_state[] = {
VOIP_NO_STATE,
VOIP_COMPLETED, /*HANGUP*/
@@ -305,6 +305,50 @@ static const voip_call_state tap_cmd_voip_state[] = {
};
#define NUM_TAP_CMD_VOIP_STATES array_length(tap_cmd_voip_state)
+/* IAX2 to tap-voip call state mapping for IAX frames */
+static const voip_call_state tap_iax_voip_state[] = {
+ VOIP_NO_STATE,
+ VOIP_CALL_SETUP, /*NEW*/
+ VOIP_NO_STATE,
+ VOIP_NO_STATE,
+ VOIP_COMPLETED, /*HANGUP*/
+ VOIP_REJECTED, /*REJECT*/
+ VOIP_RINGING, /*ACCEPT*/
+ VOIP_NO_STATE,
+ VOIP_NO_STATE,
+ VOIP_NO_STATE,
+ VOIP_NO_STATE,
+ VOIP_NO_STATE,
+ VOIP_NO_STATE,
+ VOIP_NO_STATE,
+ VOIP_NO_STATE,
+ VOIP_NO_STATE,
+ VOIP_NO_STATE,
+ VOIP_NO_STATE,
+ VOIP_NO_STATE,
+ VOIP_NO_STATE,
+ VOIP_NO_STATE,
+ VOIP_CALL_SETUP, /*DIAL*/
+ VOIP_NO_STATE,
+ VOIP_NO_STATE,
+ VOIP_NO_STATE,
+ VOIP_NO_STATE,
+ VOIP_NO_STATE,
+ VOIP_NO_STATE,
+ VOIP_NO_STATE,
+ VOIP_NO_STATE,
+ VOIP_NO_STATE,
+ VOIP_NO_STATE,
+ VOIP_NO_STATE,
+ VOIP_NO_STATE,
+ VOIP_NO_STATE,
+ VOIP_NO_STATE,
+ VOIP_NO_STATE,
+ VOIP_NO_STATE
+};
+
+#define NUM_TAP_IAX_VOIP_STATES array_length(tap_iax_voip_state)
+
/* Subclasses for Modem packets */
static const value_string iax_modem_subclasses[] = {
{0, "(0?)"},
@@ -1654,7 +1698,7 @@ dissect_fullpacket(tvbuff_t *tvb, guint32 offset,
case AST_FRAME_IAX:
offset=dissect_iax2_command(tvb, offset+9, pinfo, packet_type_tree, iax_packet);
iax2_info->messageName = val_to_str_ext(csub, &iax_iax_subclasses_ext, "unknown (0x%02x)");
- iax2_info->callState = (voip_call_state)csub;
+ if (csub < NUM_TAP_IAX_VOIP_STATES) iax2_info->callState = tap_iax_voip_state[csub];
break;
case AST_FRAME_DTMF_BEGIN: