724 lines
23 KiB
C
724 lines
23 KiB
C
/* packet-ua.c
|
|
* Routines for UA (Universal Alcatel) packet dissection.
|
|
* Copyright 2011
|
|
*
|
|
* $Id$
|
|
*
|
|
* Wireshark - Network traffic analyzer
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
* Copyright 1998 Gerald Combs
|
|
*
|
|
* Copied from WHATEVER_FILE_YOU_USED (where "WHATEVER_FILE_YOU_USED"
|
|
* is a dissector file; if you just copied this from README.developer,
|
|
* don't bother with the "Copied from" - you don't even need to put
|
|
* in a "Copied from" if you copied an existing dissector, especially
|
|
* if the bulk of the code in the new dissector is your code)
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation; either version 2
|
|
* of the License, or (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
*/
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
#include "config.h"
|
|
#endif
|
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
# include <sys/types.h>
|
|
#endif
|
|
|
|
#ifdef HAVE_NETINET_IN_H
|
|
#include <netinet/in.h>
|
|
#endif
|
|
|
|
#include <epan/packet.h>
|
|
#include <epan/prefs.h>
|
|
#include <epan/strutil.h>
|
|
|
|
|
|
static int DissectNOE(tvbuff_t *pTvb, proto_tree *pRootUA);
|
|
static int DissectNOE_type(tvbuff_t *pTvb, proto_tree *pNoeItem, int iOffs);
|
|
static int DissectNOE_callserver(tvbuff_t *pTvb, proto_tree *pNoeItem, int iOffs);
|
|
static int DissectNOE_ip(tvbuff_t *pTvb, proto_tree *pNoeItem, int iOffs);
|
|
static int DissectNOE_ip_startrtp(tvbuff_t *pTvb, proto_tree *pNoeItem, int iOffs);
|
|
static int DissectNOE_ip_startrtp_properties(tvbuff_t *pTvb, proto_tree *pNoeItem);
|
|
|
|
static int DissectTLV(tvbuff_t *pTvb, proto_tree *pNoeItem);
|
|
static int DissectTLV_data(tvbuff_t *pTvb, proto_tree *pTlv, int iOffs, guint8 u8Length, guint8 u8Property);
|
|
|
|
/*
|
|
* Here are the global variables associated with
|
|
* the various user definable characteristics of the dissection
|
|
*/
|
|
|
|
/* Define the UA proto */
|
|
static int proto_ua = -1;
|
|
|
|
/* Define many header fields for UA (Universal Alcatel Protocol) */
|
|
static int hf_noe = -1;
|
|
static int hf_noe_length = -1;
|
|
static int hf_noe_type = -1;
|
|
static int hf_noe_method = -1;
|
|
static int hf_noe_class = -1;
|
|
static int hf_noe_objid = -1;
|
|
static int hf_noe_event = -1;
|
|
static int hf_noe_keychar = -1;
|
|
static int hf_noe_action = -1;
|
|
static int hf_noe_reserved = -1;
|
|
static int hf_noe_property = -1;
|
|
static int hf_noe_id = -1;
|
|
static int hf_noe_size = -1;
|
|
static int hf_noe_local_port = -1;
|
|
static int hf_noe_remote_ip = -1;
|
|
static int hf_noe_remote_port = -1;
|
|
static int hf_noe_data = -1;
|
|
static int hf_noe_compressor = -1;
|
|
static int hf_noe_typeofservice = -1;
|
|
static int hf_noe_payloadconcat = -1;
|
|
|
|
static int hf_tlv = -1;
|
|
static int hf_tlv_property = -1;
|
|
static int hf_tlv_arrindex = -1;
|
|
static int hf_tlv_propsize = -1;
|
|
static int hf_tlv_label = -1;
|
|
static int hf_tlv_data = -1;
|
|
static int hf_tlv_year = -1;
|
|
|
|
/* Define the trees for UA (Universal Alcatel Protocol) */
|
|
static int ett_ua = -1;
|
|
|
|
static int ett_noe = -1;
|
|
static int ett_noe_property = -1;
|
|
|
|
static int ett_tlv = -1;
|
|
static int ett_tlv_sub = -1;
|
|
|
|
|
|
/************************************************************
|
|
* Value Strings
|
|
************************************************************/
|
|
|
|
/**
|
|
* NOE
|
|
*/
|
|
static const value_string szNoeType[] =
|
|
{
|
|
{ 0x00, "Unknown" },
|
|
{ 0x01, "HandsetOffHook" },
|
|
{ 0x02, "HandsetOnHook" },
|
|
{ 0x03, "DigitDialed" },
|
|
{ 0x13, "IP" },
|
|
{ 0x15, "CallServer" },
|
|
{ 0x20, "KeyPushed" },
|
|
{ 0x21, "LedCmd" },
|
|
{ 0x27, "WriteLine1" },
|
|
{ 0x28, "WriteLine2" },
|
|
{ 0x29, "VoiceMode" },
|
|
{ 0x31, "SetClockComd" },
|
|
{ 0x35, "CursorBlink" },
|
|
{ 0x38, "ClockTimerPosition" },
|
|
{ 0x3a, "Error_0x3a" },
|
|
{ 0x3d, "SideTone" },
|
|
{ 0x3f, "Mute" },
|
|
{ 0x46, "AllIconsOff" },
|
|
{ 0x47, "IconsCmd" },
|
|
{ 0x48, "AmplifiedHandset" },
|
|
{ 0x49, "DPIConfiguration" },
|
|
{ 0x4a, "AudioPaddedPath" },
|
|
{ 0x4f, "Error_0x4f" },
|
|
{ 0, NULL }
|
|
};
|
|
|
|
static const value_string szCallServerMethod[] =
|
|
{
|
|
{ 0x00, "Create" },
|
|
{ 0x01, "Delete" },
|
|
{ 0x02, "SetProperty" },
|
|
{ 0x04, "Notify" },
|
|
{ 0, NULL }
|
|
};
|
|
|
|
static const value_string szCallServerClass[] =
|
|
{
|
|
{ 1, "Terminal" },
|
|
{ 5, "Leds" },
|
|
{ 6, "Screen" },
|
|
{ 7, "Date" },
|
|
{ 8, "AOMV" },
|
|
{ 12, "CallState" },
|
|
{ 128, "FrameBox" },
|
|
{ 129, "TabBox" },
|
|
{ 130, "ListBox" },
|
|
{ 132, "TextBox" },
|
|
{ 133, "ActionBox" },
|
|
{ 136, "DataBox" },
|
|
{ 137, "TimerBox" },
|
|
{ 144, "AOMVBox" },
|
|
{ 145, "TelephonicBox" },
|
|
{ 146, "KeyboardContext" },
|
|
{ 151, "TelephonicBoxItem" },
|
|
{ 158, "HeaderBox" },
|
|
{ 0, NULL }
|
|
};
|
|
|
|
static const value_string szCallServerEvent[] =
|
|
{
|
|
{ 2, "KeyPress" },
|
|
{ 4, "KeyShortPress" },
|
|
{ 6, "OnHook" },
|
|
{ 7, "OffHook" },
|
|
{ 128, "TabBox" },
|
|
{ 133, "ActionBox" },
|
|
{ 152, "DialogBoxDismissed" },
|
|
{ 0, NULL }
|
|
};
|
|
|
|
static const value_string szStartRtpPropID[] =
|
|
{
|
|
{ 0x00, "LocalUDPPort" },
|
|
{ 0x01, "RemoteIP" },
|
|
{ 0x02, "RemoteUDPPort" },
|
|
{ 0x03, "TypeOfService" },
|
|
{ 0x04, "Payload" },
|
|
{ 0x05, "PayloadConcatenation" }, /* in ms */
|
|
{ 0x06, "EchoCancelationEnabler" },
|
|
{ 0x07, "SilenceCompression" },
|
|
{ 0x08, "_802_1QUserPriority" },
|
|
{ 0x0A, "PostFiltering" },
|
|
{ 0x0B, "HighPassFilter" },
|
|
{ 0, NULL }
|
|
};
|
|
|
|
static const value_string szStartRtpPayload[] =
|
|
{
|
|
{ 0, "G.711 A-law" },
|
|
{ 1, "G.711 mu-law" },
|
|
{ 2, "G.723.1 5.3 kbps" },
|
|
{ 3, "G.723.1 6.3 kbps" },
|
|
{ 0x11, "G.729A 8kbps"},
|
|
{ 0, NULL }
|
|
};
|
|
|
|
static const value_string szNoeAction[] =
|
|
{
|
|
{ 0x01, "Start RTP" },
|
|
{ 0x02, "Stop RTP" },
|
|
{ 0, NULL }
|
|
};
|
|
|
|
/**
|
|
* TLV PROPERTY
|
|
*/
|
|
static const value_string szTlvProperty[] =
|
|
{
|
|
{ 8, "Count" },
|
|
{ 11, "NavigatorOwnerShip" },
|
|
{ 15, "NumpadEvent" },
|
|
{ 16, "Format_16" },
|
|
{ 18, "W" },
|
|
{ 19, "H" },
|
|
{ 24, "Year" },
|
|
{ 25, "Month" },
|
|
{ 26, "Day" },
|
|
{ 27, "Minutes" },
|
|
{ 28, "Seconds" },
|
|
{ 36, "AnchorID" },
|
|
{ 39, "Y" },
|
|
{ 40, "Visible" },
|
|
{ 42, "FontID" },
|
|
{ 44, "HAlign" },
|
|
{ 54, "Icon_54" },
|
|
{ 55, "Label" },
|
|
{ 56, "Value" },
|
|
{ 61, "Focus" },
|
|
{ 62, "State_62" },
|
|
{ 63, "Format_63" },
|
|
{ 76, "VSplit" },
|
|
{ 78, "RealCount" },
|
|
{ 79, "Start" },
|
|
{ 95, "_95" },
|
|
{ 131, "Key Ownership" },
|
|
{ 134, "Mode" },
|
|
{ 135, "Color" },
|
|
{ 137, "Icon_137" },
|
|
{ 138, "Label_138" },
|
|
{ 141, "State_141" },
|
|
{ 142, "Name" },
|
|
{ 143, "Number" },
|
|
{ 147, "Today" },
|
|
{ 148, "Tomorrow" },
|
|
{ 0, NULL }
|
|
};
|
|
|
|
|
|
|
|
|
|
/************************************************************
|
|
* Dissectors
|
|
************************************************************/
|
|
|
|
/*
|
|
* DissectUA - The dissector for UA (Universal Alcatel Protocol)
|
|
*/
|
|
static int DissectUA(tvbuff_t *pTvb, packet_info *pInfo, proto_tree *pTree)
|
|
{
|
|
gint nLen, iOffs;
|
|
proto_item *pRootUA;
|
|
proto_tree *pSubTreeUA;
|
|
tvbuff_t *pTvbNoe;
|
|
|
|
nLen = tvb_length(pTvb);
|
|
|
|
/* INFO column */
|
|
if(check_col(pInfo->cinfo, COL_INFO))
|
|
col_append_str(pInfo->cinfo, COL_INFO, " - UA");
|
|
|
|
if(pTree)
|
|
{
|
|
/* root element "UA Protocol, ..." */
|
|
pRootUA = proto_tree_add_item(pTree, proto_ua, pTvb, 0, -1, ENC_NA);
|
|
pSubTreeUA = proto_item_add_subtree(pRootUA, ett_ua);
|
|
|
|
/* NOE items */
|
|
for(iOffs = 0; iOffs < nLen; )
|
|
{
|
|
guint16 nNoeLen;
|
|
nNoeLen = tvb_get_letohs(pTvb, iOffs);
|
|
nNoeLen += 2;
|
|
|
|
pTvbNoe = tvb_new_subset(pTvb, iOffs, nNoeLen, nNoeLen);
|
|
DissectNOE(pTvbNoe, pSubTreeUA);
|
|
|
|
iOffs += nNoeLen;
|
|
}
|
|
}
|
|
|
|
return nLen;
|
|
}
|
|
|
|
|
|
/***********************************************
|
|
* NOE section
|
|
***********************************************
|
|
Noe
|
|
NoeVoiceMode
|
|
NoeMute
|
|
NoeIP
|
|
NoeIPStartRTP
|
|
NoeCallServer
|
|
NoeCallServerCreate
|
|
NoeCallServerSetProperty
|
|
NoeCallServerNotify
|
|
NoeCallServerNotifyKeyPress
|
|
NoeCallServerNotifyKeyShortPress
|
|
***********************************************/
|
|
static int DissectNOE(tvbuff_t *pTvb, proto_tree *pRootUA)
|
|
{
|
|
gint iOffs = 0, nLen;
|
|
|
|
nLen = tvb_length(pTvb);
|
|
if(pRootUA)
|
|
{
|
|
proto_item *pNoeItem = proto_tree_add_item(pRootUA, hf_noe, pTvb, 0, nLen, ENC_NA);
|
|
if(pNoeItem)
|
|
{
|
|
proto_tree* pSubTreeNOE;
|
|
|
|
pSubTreeNOE = proto_item_add_subtree(pNoeItem, ett_noe);
|
|
proto_tree_add_item(pSubTreeNOE, hf_noe_length, pTvb, iOffs, 2, ENC_LITTLE_ENDIAN);
|
|
iOffs += 2;
|
|
|
|
iOffs = DissectNOE_type(pTvb, pSubTreeNOE, iOffs);
|
|
}
|
|
}
|
|
return iOffs;
|
|
}
|
|
|
|
static int DissectNOE_type(tvbuff_t *pTvb, proto_tree *pNoeItem, int iOffs)
|
|
{
|
|
guint8 u8Type;
|
|
|
|
u8Type = tvb_get_guint8(pTvb, iOffs);
|
|
proto_item_append_text(pNoeItem, ": %s", val_to_str(u8Type, szNoeType, "Unknown"));
|
|
proto_tree_add_item(pNoeItem, hf_noe_type, pTvb, iOffs++, 1, ENC_LITTLE_ENDIAN);
|
|
|
|
switch(u8Type)
|
|
{
|
|
case 0x13: /*IP*/
|
|
{
|
|
iOffs = DissectNOE_ip(pTvb, pNoeItem, iOffs);
|
|
break;
|
|
}
|
|
case 0x15: /*CallServer*/
|
|
{
|
|
iOffs = DissectNOE_callserver(pTvb, pNoeItem, iOffs);
|
|
break;
|
|
}
|
|
}
|
|
|
|
return iOffs;
|
|
}
|
|
|
|
static int DissectNOE_callserver(tvbuff_t *pTvb, proto_tree *pNoeItem, int iOffs)
|
|
{
|
|
tvbuff_t *pTvbTlv;
|
|
|
|
gint nLen;
|
|
guint8 u8Method;
|
|
|
|
nLen = tvb_length(pTvb);
|
|
u8Method = tvb_get_guint8(pTvb, iOffs);
|
|
|
|
proto_item_append_text(pNoeItem, ", %s", val_to_str(u8Method, szCallServerMethod, "Unknown"));
|
|
proto_tree_add_item(pNoeItem, hf_noe_method, pTvb, iOffs++, 1, ENC_NA);
|
|
|
|
switch(u8Method)
|
|
{
|
|
case 0x00: /*Create*/
|
|
case 0x02: /*SetProperty*/
|
|
{
|
|
guint8 u8Class;
|
|
|
|
u8Class = tvb_get_guint8(pTvb, iOffs);
|
|
proto_item_append_text(pNoeItem, ", %s", val_to_str(u8Class, szCallServerClass, "Unknown"));
|
|
proto_tree_add_item(pNoeItem, hf_noe_class, pTvb, iOffs++, 1, ENC_NA);
|
|
|
|
if(u8Class >= 100)
|
|
{
|
|
proto_item_append_text(pNoeItem, ", Id(0x%04x)", tvb_get_ntohs(pTvb, iOffs));
|
|
proto_tree_add_item(pNoeItem, hf_noe_objid, pTvb, iOffs, 2, ENC_LITTLE_ENDIAN);
|
|
iOffs += 2;
|
|
}
|
|
|
|
/* TLV items */
|
|
for( ; iOffs < nLen; )
|
|
{
|
|
guint8 nTlvLen, nTlvProperty;
|
|
|
|
nTlvProperty = tvb_get_guint8(pTvb, iOffs);
|
|
/* for property of more than 100 before the field is still arrindex propsize */
|
|
if(nTlvProperty < 100)
|
|
{
|
|
nTlvLen = tvb_get_guint8(pTvb, iOffs+1);
|
|
nTlvLen += 2;
|
|
}
|
|
else
|
|
{
|
|
nTlvLen = tvb_get_guint8(pTvb, iOffs+2);
|
|
nTlvLen += 3;
|
|
}
|
|
pTvbTlv = tvb_new_subset(pTvb, iOffs, nTlvLen, nTlvLen);
|
|
DissectTLV(pTvbTlv, pNoeItem);
|
|
|
|
iOffs += nTlvLen;
|
|
}
|
|
break;
|
|
}
|
|
case 0x04: /*Notify*/
|
|
{
|
|
guint8 u8Event;
|
|
|
|
u8Event = tvb_get_guint8(pTvb, iOffs);
|
|
proto_tree_add_item(pNoeItem, hf_noe_event, pTvb, iOffs++, 1, ENC_NA);
|
|
|
|
switch(u8Event)
|
|
{
|
|
case 2: /*KeyPress*/
|
|
{
|
|
proto_tree_add_item(pNoeItem, hf_noe_keychar, pTvb, iOffs, nLen -iOffs, ENC_NA);
|
|
break;
|
|
}
|
|
case 4: /*KeyShortPress*/
|
|
{
|
|
proto_tree_add_item(pNoeItem, hf_noe_keychar, pTvb, iOffs, 2, ENC_NA);
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
return nLen;
|
|
}
|
|
|
|
static int DissectNOE_ip(tvbuff_t *pTvb, proto_tree *pNoeItem, int iOffs)
|
|
{
|
|
gint nLen;
|
|
guint8 u8Action;
|
|
|
|
nLen = tvb_length(pTvb);
|
|
/* Action */
|
|
u8Action = tvb_get_guint8(pTvb, iOffs);
|
|
proto_item_append_text(pNoeItem, " %s", val_to_str(u8Action, szNoeAction, "Unknown"));
|
|
proto_tree_add_item(pNoeItem, hf_noe_action, pTvb, iOffs++, 1, ENC_NA);
|
|
|
|
switch(u8Action)
|
|
{
|
|
case 0x01: /*Start RTP*/
|
|
{
|
|
DissectNOE_ip_startrtp(pTvb, pNoeItem, iOffs);
|
|
break;
|
|
}
|
|
case 0x02: /*Stop RTP*/
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
|
|
return nLen;
|
|
}
|
|
|
|
static int DissectNOE_ip_startrtp(tvbuff_t *pTvb, proto_tree *pNoeItem, int iOffs)
|
|
{
|
|
gint nLen;
|
|
|
|
nLen = tvb_length(pTvb);
|
|
/*Reserved*/
|
|
proto_tree_add_item(pNoeItem, hf_noe_reserved, pTvb, iOffs++, 1, ENC_NA);
|
|
|
|
/*Properties*/
|
|
for(; iOffs < nLen; )
|
|
{
|
|
guint8 u8PropSize;
|
|
tvbuff_t *pTvbTlv;
|
|
|
|
u8PropSize = tvb_get_guint8(pTvb, iOffs+1) +2;
|
|
pTvbTlv = tvb_new_subset(pTvb, iOffs, u8PropSize, u8PropSize);
|
|
|
|
DissectNOE_ip_startrtp_properties(pTvbTlv, pNoeItem);
|
|
iOffs += u8PropSize;
|
|
}
|
|
|
|
return iOffs;
|
|
}
|
|
|
|
static int DissectNOE_ip_startrtp_properties(tvbuff_t *pTvb, proto_tree *pNoeItem)
|
|
{
|
|
gint iOffs = 0;
|
|
proto_item *pProp;
|
|
|
|
pProp = proto_tree_add_item(pNoeItem, hf_noe_property, pTvb, 0, -1, ENC_NA);
|
|
if(pProp)
|
|
{
|
|
guint8 u8ID, u8Size;
|
|
proto_tree* pSubTreeProp;
|
|
|
|
pSubTreeProp = proto_item_add_subtree(pProp, ett_noe_property);
|
|
/*ID*/
|
|
u8ID = tvb_get_guint8(pTvb, iOffs);
|
|
proto_item_append_text(pProp, " - %25s", val_to_str(u8ID, szStartRtpPropID, "Unknown"));
|
|
proto_tree_add_item(pSubTreeProp, hf_noe_id, pTvb, iOffs++, 1, ENC_NA);
|
|
|
|
/*SIZE*/
|
|
u8Size = tvb_get_guint8(pTvb, iOffs);
|
|
proto_tree_add_item(pSubTreeProp, hf_noe_size, pTvb, iOffs++, 1, ENC_NA);
|
|
|
|
/*data*/
|
|
switch(u8ID)
|
|
{
|
|
default:
|
|
{
|
|
proto_item_append_text(pProp, ": %s", tvb_bytes_to_str(pTvb, iOffs, u8Size));
|
|
proto_tree_add_item(pSubTreeProp, hf_noe_data, pTvb, iOffs, u8Size, ENC_NA);
|
|
break;
|
|
}
|
|
case 0x00: /*LocalUDPPort*/
|
|
{
|
|
proto_item_append_text(pProp, ": %u", tvb_get_ntohs(pTvb, iOffs));
|
|
proto_tree_add_item(pSubTreeProp, hf_noe_local_port, pTvb, iOffs, 2, ENC_LITTLE_ENDIAN);
|
|
break;
|
|
}
|
|
case 0x01: /*RemoteIP*/
|
|
{
|
|
proto_item_append_text(pProp, ": %s", tvb_ip_to_str(pTvb, iOffs));
|
|
proto_tree_add_item(pSubTreeProp, hf_noe_remote_ip, pTvb, iOffs, 4, ENC_NA);
|
|
break;
|
|
}
|
|
case 0x02: /*RemoteUDPPort*/
|
|
{
|
|
proto_item_append_text(pProp, ": %u", tvb_get_ntohs(pTvb, iOffs));
|
|
proto_tree_add_item(pSubTreeProp, hf_noe_remote_port, pTvb, iOffs, 2, ENC_LITTLE_ENDIAN);
|
|
break;
|
|
}
|
|
case 0x03: /*TypeOfService*/
|
|
{
|
|
proto_item_append_text(pProp, ": %u", tvb_get_guint8(pTvb, iOffs));
|
|
proto_tree_add_item(pSubTreeProp, hf_noe_typeofservice, pTvb, iOffs, 1, ENC_NA);
|
|
break;
|
|
}
|
|
case 0x04: /*Payload*/
|
|
{
|
|
proto_item_append_text(pProp, ": %s", val_to_str(tvb_get_guint8(pTvb, iOffs), szStartRtpPayload, "Unknown"));
|
|
proto_tree_add_item(pSubTreeProp, hf_noe_compressor, pTvb, iOffs, 1, ENC_NA);
|
|
break;
|
|
}
|
|
case 0x05: /*PayloadConcatenation*/
|
|
{
|
|
proto_item_append_text(pProp, ": %u ms", tvb_get_guint8(pTvb, iOffs));
|
|
proto_tree_add_item(pSubTreeProp, hf_noe_payloadconcat, pTvb, iOffs, 1, ENC_NA);
|
|
break;
|
|
}
|
|
}
|
|
|
|
iOffs += u8Size;
|
|
}
|
|
return iOffs;
|
|
}
|
|
|
|
/***********************************************
|
|
* TLV section
|
|
***********************************************/
|
|
static int DissectTLV(tvbuff_t *pTvb, proto_tree *pNoeItem)
|
|
{
|
|
gint iOffs = 0, nLen;
|
|
|
|
proto_item *pTlv;
|
|
|
|
nLen = tvb_length(pTvb);
|
|
pTlv = proto_tree_add_item(pNoeItem, hf_tlv, pTvb, 0, nLen, ENC_NA);
|
|
if(pTlv)
|
|
{
|
|
guint8 u8Property, u8PropSize;
|
|
proto_tree* pSubTreeTLV;
|
|
|
|
pSubTreeTLV = proto_item_add_subtree(pTlv, ett_tlv);
|
|
u8Property = tvb_get_guint8(pTvb, iOffs);
|
|
proto_item_append_text(pTlv, "%u %s ", u8Property, val_to_str(u8Property, szTlvProperty, "Unknown"));
|
|
proto_tree_add_item(pSubTreeTLV, hf_tlv_property, pTvb, iOffs++, 1, ENC_NA);
|
|
|
|
if(u8Property >= 100)
|
|
proto_tree_add_item(pTlv, hf_tlv_arrindex, pTvb, iOffs++, 1, ENC_NA);
|
|
|
|
u8PropSize = tvb_get_guint8(pTvb, iOffs);
|
|
proto_tree_add_item(pSubTreeTLV, hf_tlv_propsize, pTvb, iOffs++, 1, ENC_NA);
|
|
|
|
if(u8PropSize > 0)
|
|
DissectTLV_data(pTvb, pSubTreeTLV, iOffs, u8PropSize, u8Property);
|
|
}
|
|
return nLen;
|
|
}
|
|
|
|
/* TLV DATA */
|
|
static int DissectTLV_data(tvbuff_t *pTvb, proto_tree *pTlv, int iOffs, guint8 u8Length, guint8 u8Property)
|
|
{
|
|
proto_tree* pNoeItem;
|
|
switch(u8Property)
|
|
{
|
|
default:
|
|
{
|
|
proto_item_append_text(pTlv, "%s", tvb_bytes_to_str(pTvb, iOffs, u8Length));
|
|
proto_tree_add_item(pTlv, hf_tlv_data, pTvb, iOffs, u8Length, ENC_NA);
|
|
break;
|
|
}
|
|
|
|
case 24: /*Year*/
|
|
{
|
|
proto_item_append_text(pTlv, "%u", tvb_get_ntohs(pTvb, iOffs));
|
|
proto_tree_add_item(pTlv, hf_tlv_year, pTvb, iOffs, 2, ENC_BIG_ENDIAN);
|
|
break;
|
|
}
|
|
|
|
case 55: /*Label*/
|
|
case 138: /*Label_138*/
|
|
{
|
|
proto_item_append_text(pTlv, "'%s'", tvb_get_string(pTvb, iOffs, u8Length));
|
|
proto_tree_add_item(pTlv, hf_tlv_label, pTvb, iOffs, u8Length, ENC_ASCII|ENC_NA);
|
|
|
|
/* append text on NOE level */
|
|
pNoeItem = proto_item_get_parent(pTlv);
|
|
proto_item_append_text(pNoeItem, ", Label='%s'", tvb_get_string(pTvb, iOffs, u8Length));
|
|
break;
|
|
}
|
|
case 147: /*Today*/
|
|
case 148: /*Tomorrow*/
|
|
{
|
|
proto_item_append_text(pTlv, "'%s'", tvb_get_string(pTvb, iOffs, u8Length));
|
|
proto_tree_add_item(pTlv, hf_tlv_data, pTvb, iOffs, u8Length, ENC_NA);
|
|
break;
|
|
}
|
|
}
|
|
iOffs += u8Length;
|
|
return iOffs;
|
|
}
|
|
|
|
|
|
|
|
/* Register all the bits needed by the filtering engine */
|
|
void proto_register_ua(void)
|
|
{
|
|
static hf_register_info hf[] =
|
|
{
|
|
{ &hf_noe, { "NOE", "ua.noe", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
|
{ &hf_noe_length, { "Length", "ua.noe.length", FT_UINT16, BASE_DEC, NULL, 0x0, "NOE item length (without 2 bytes containing the length)", HFILL }},
|
|
{ &hf_noe_type, { "Type", "ua.noe.type", FT_UINT8, BASE_DEC, VALS(szNoeType), 0x0, "NOE item type", HFILL }},
|
|
{ &hf_noe_method, { "Method", "ua.noe.method", FT_UINT8, BASE_DEC, VALS(szCallServerMethod), 0x0, "Call Server method", HFILL }},
|
|
{ &hf_noe_class, { "Class", "ua.noe.class", FT_UINT8, BASE_DEC, VALS(szCallServerClass), 0x0, "Call Server class", HFILL }},
|
|
{ &hf_noe_objid, { "ObjectID", "ua.noe.objid", FT_UINT16, BASE_HEX_DEC, NULL, 0x0, "Call Server object id", HFILL }},
|
|
{ &hf_noe_event, { "Event", "ua.noe.event", FT_UINT8, BASE_DEC, VALS(szCallServerEvent), 0x0, "Call Server event", HFILL }},
|
|
{ &hf_noe_keychar, { "KeyChar", "ua.noe.event.keychar", FT_BYTES, BASE_NONE, NULL, 0x0, "Event key char", HFILL }},
|
|
|
|
{ &hf_noe_action, { "Action", "ua.noe.action", FT_UINT8, BASE_DEC, VALS(szNoeAction), 0x0, "IP action", HFILL }},
|
|
{ &hf_noe_reserved, { "Reserved", "ua.noe.action.startrtp.reserved", FT_UINT8, BASE_DEC, NULL, 0x0, "IP start rtp reserved", HFILL }},
|
|
{ &hf_noe_property, { "Property", "ua.noe.action.startrtp.property", FT_NONE, BASE_NONE, NULL, 0x0, "IP property", HFILL }},
|
|
{ &hf_noe_id, { "ID", "ua.noe.action.startrtp.property.id", FT_UINT8, BASE_DEC, VALS(szStartRtpPropID), 0x0, "IP property id", HFILL }},
|
|
{ &hf_noe_size, { "Size", "ua.noe.action.startrtp.property.size", FT_UINT8, BASE_DEC, NULL, 0x0, "IP property size", HFILL }},
|
|
{ &hf_noe_data, { "Data", "ua.noe.action.startrtp.data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
|
|
|
{ &hf_noe_local_port, { "LocalPort", "ua.noe.action.startrtp.localport", FT_UINT16, BASE_DEC, NULL, 0x0, "IP start rtp property localport", HFILL }},
|
|
{ &hf_noe_remote_ip, { "RemoteIP", "ua.noe.action.startrtp.remoteip", FT_IPv4, BASE_NONE, NULL, 0x0, "IP start rtp property remote ipv4", HFILL }},
|
|
{ &hf_noe_remote_port, { "RemotePort", "ua.noe.action.startrtp.remoteport", FT_UINT16, BASE_DEC, NULL, 0x0, "IP start rtp property remoteport", HFILL }},
|
|
{ &hf_noe_compressor, { "Payload", "ua.noe.action.startrtp.payload", FT_UINT8, BASE_DEC, VALS(szStartRtpPayload), 0x0, "IP start rtp property payload", HFILL }},
|
|
{ &hf_noe_typeofservice,{ "TypeOfService", "ua.noe.action.startrtp.typeofservice", FT_UINT8, BASE_DEC, NULL, 0x0, "IP start rtp property type of service", HFILL }},
|
|
{ &hf_noe_payloadconcat,{ "Payld Concat", "ua.noe.action.startrtp.payldconcat", FT_UINT8, BASE_DEC, NULL, 0x0, "IP start rtp property payload concatenation (in ms)", HFILL }},
|
|
|
|
{ &hf_tlv, { "TLV", "ua.noe.tlv", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
|
{ &hf_tlv_property, { "Property", "ua.noe.tlv.property", FT_UINT8, BASE_DEC, VALS(szTlvProperty), 0x0, "TLV property", HFILL }},
|
|
{ &hf_tlv_arrindex, { "ArrIndex", "ua.noe.tlv.arrindex", FT_UINT8, BASE_DEC, NULL, 0x0, "TLV array index", HFILL }},
|
|
{ &hf_tlv_propsize, { "PropSize", "ua.noe.tlv.propsize", FT_UINT8, BASE_DEC, NULL, 0x0, "TLV property size", HFILL }},
|
|
{ &hf_tlv_data, { "Data", "ua.noe.tlv.data", FT_BYTES, BASE_NONE, NULL, 0x0, "TLV data", HFILL }},
|
|
{ &hf_tlv_label, { "Label", "ua.noe.tlv.label", FT_STRING, BASE_NONE, NULL, 0x0, "TLV label", HFILL }},
|
|
{ &hf_tlv_year, { "Year", "ua.noe.tlv.year", FT_UINT16, BASE_DEC, NULL, 0x0, "TLV year", HFILL }},
|
|
};
|
|
static gint *ett[] =
|
|
{
|
|
&ett_ua,
|
|
&ett_noe,
|
|
&ett_noe_property,
|
|
&ett_tlv,
|
|
&ett_tlv_sub,
|
|
};
|
|
|
|
proto_ua = proto_register_protocol("UA Protocol (Universal Alcatel Protocol)", "UA", "ua");
|
|
proto_register_field_array(proto_ua, hf, array_length(hf));
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
}
|
|
|
|
|
|
/* The registration hand-off routine is called at startup */
|
|
void proto_reg_handoff_ua(void)
|
|
{
|
|
dissector_handle_t hDis = new_create_dissector_handle(DissectUA, proto_ua);
|
|
dissector_add_uint("uaudp.opcode", 7, hDis);
|
|
}
|
|
/*
|
|
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
|
*
|
|
* Local variables:
|
|
* c-basic-offset: 4
|
|
* tab-width: 8
|
|
* indent-tabs-mode: nil
|
|
* End:
|
|
*
|
|
* ex: set shiftwidth=4 tabstop=8 expandtab:
|
|
* :indentSize=4:tabSize=8:noTabs=true:
|
|
*/
|