forked from osmocom/wireshark
Compare commits
6 Commits
master
...
daniel/osm
Author | SHA1 | Date |
---|---|---|
Daniel Willmann | 12ddfa87ba | |
Daniel Willmann | de522e2ff7 | |
Daniel Willmann | f6f9f7cc89 | |
Daniel Willmann | 62d66df57c | |
Daniel Willmann | 67ad1a276d | |
Daniel Willmann | 0ac2c285e9 |
|
@ -483,6 +483,11 @@ wireshark_LDADD = \
|
|||
if HAVE_SPEEXDSP
|
||||
wireshark_LDADD += $(SPEEXDSP_LIBS)
|
||||
endif
|
||||
|
||||
if HAVE_AMRNB
|
||||
wireshark_LDADD += $(AMRNB_LIBS)
|
||||
endif
|
||||
|
||||
endif # HAVE_Qt
|
||||
|
||||
if HAVE_GTK
|
||||
|
|
|
@ -42,6 +42,10 @@ if !HAVE_SPEEXDSP
|
|||
libwscodecs_la_SOURCES += speex/resample.c
|
||||
endif
|
||||
|
||||
if HAVE_AMRNB
|
||||
libwscodecs_la_SOURCES += amr/amrdecode.c
|
||||
endif
|
||||
|
||||
# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
|
||||
libwscodecs_la_LDFLAGS = -version-info 0:0:0 @LDFLAGS_SHAREDLIB@
|
||||
|
||||
|
@ -60,7 +64,8 @@ noinst_HEADERS = \
|
|||
sbc/sbc_private.h \
|
||||
speex/arch.h \
|
||||
speex/speex_resampler.h \
|
||||
speex/stack_alloc.h
|
||||
speex/stack_alloc.h \
|
||||
amr/amrdecode.h
|
||||
|
||||
EXTRA_DIST = \
|
||||
CMakeLists.txt \
|
||||
|
|
|
@ -0,0 +1,97 @@
|
|||
/* amrdecode.c
|
||||
* AMR codec
|
||||
*
|
||||
* Wireshark - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@wireshark.org>
|
||||
* Copyright 1998 Gerald Combs
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <string.h>
|
||||
#include "amrdecode.h"
|
||||
|
||||
#include <opencore-amrnb/interf_dec.h>
|
||||
|
||||
void *
|
||||
codec_amr_init(void)
|
||||
{
|
||||
void *state;
|
||||
state = Decoder_Interface_init();
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
void
|
||||
codec_amr_release(void *state)
|
||||
{
|
||||
Decoder_Interface_exit(state);
|
||||
}
|
||||
|
||||
unsigned
|
||||
codec_amr_get_channels(void *ctx _U_)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
unsigned
|
||||
codec_amr_get_frequency(void *ctx _U_)
|
||||
{
|
||||
return 8000;
|
||||
}
|
||||
|
||||
size_t
|
||||
codec_amr_decode(void *state, const void *input, size_t inputSizeBytes, void *output,
|
||||
size_t *outputSizeBytes)
|
||||
{
|
||||
int mode;
|
||||
unsigned packet_size;
|
||||
static const uint8_t block_size[16] = {12, 13, 15, 17, 19, 20, 26, 31, 5, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
/* First byte is CMR, second is the Payload TOC */
|
||||
mode = (((uint8_t *)input)[1] >> 3) & 0x0F;
|
||||
packet_size = block_size[mode] + 2;
|
||||
|
||||
if (!output || !outputSizeBytes)
|
||||
return 160*2;
|
||||
|
||||
*outputSizeBytes = 160 * 2; /* 160 frames, two byte per frame, 20ms */
|
||||
|
||||
/* If the size is screwed up, insert silence */
|
||||
if (packet_size > inputSizeBytes) {
|
||||
memset(output, 0, *outputSizeBytes);
|
||||
return *outputSizeBytes;
|
||||
}
|
||||
|
||||
Decoder_Interface_Decode(state, (const unsigned char *)input+1, (short *)output, 0);
|
||||
return *outputSizeBytes;
|
||||
}
|
||||
|
||||
/*
|
||||
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
||||
*
|
||||
* Local variables:
|
||||
* c-basic-offset: 4
|
||||
* tab-width: 8
|
||||
* indent-tabs-mode: nil
|
||||
* End:
|
||||
*
|
||||
* vi: set shiftwidth=4 tabstop=8 expandtab:
|
||||
* :indentSize=4:tabSize=8:noTabs=true:
|
||||
*/
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
/* G726decode.h
|
||||
* Definitions for A-law G.722 codec
|
||||
*
|
||||
* Wireshark - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@wireshark.org>
|
||||
* Copyright 1998 Gerald Combs
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __CODECS_AMRDECODE_H__
|
||||
#define __CODECS_AMRDECODE_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void *codec_amr_init(void);
|
||||
void codec_amr_release(void *ctx);
|
||||
unsigned codec_amr_get_channels(void *ctx);
|
||||
unsigned codec_amr_get_frequency(void *ctx);
|
||||
size_t codec_amr_decode(void *ctx, const void *input, size_t inputSizeBytes, void *output,
|
||||
size_t *outputSizeBytes);
|
||||
|
||||
#endif /* AMRdecode.h */
|
||||
|
||||
/*
|
||||
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
||||
*
|
||||
* Local variables:
|
||||
* c-basic-offset: 4
|
||||
* tab-width: 8
|
||||
* indent-tabs-mode: nil
|
||||
* End:
|
||||
*
|
||||
* vi: set shiftwidth=4 tabstop=8 expandtab:
|
||||
* :indentSize=4:tabSize=8:noTabs=true:
|
||||
*/
|
|
@ -32,6 +32,10 @@
|
|||
#include "sbc/sbc_private.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_AMRNB
|
||||
#include "amr/amrdecode.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PLUGINS
|
||||
|
||||
#include <gmodule.h>
|
||||
|
@ -115,6 +119,11 @@ register_all_codecs(void)
|
|||
codec_sbc_get_channels, codec_sbc_get_frequency, codec_sbc_decode);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_AMRNB
|
||||
register_codec("AMR", codec_amr_init, codec_amr_release,
|
||||
codec_amr_get_channels, codec_amr_get_frequency, codec_amr_decode);
|
||||
#endif
|
||||
|
||||
g_slist_foreach(codec_plugins, register_codec_plugin, NULL);
|
||||
}
|
||||
#endif /* HAVE_PLUGINS */
|
||||
|
|
10
configure.ac
10
configure.ac
|
@ -2402,6 +2402,15 @@ AS_IF([test "x$have_speexdsp" = xyes],
|
|||
[AC_DEFINE(HAVE_SPEEXDSP, 1, [Define to 1 if you have SpeexDSP])])
|
||||
AM_CONDITIONAL(HAVE_SPEEXDSP, [test "x$have_speexdsp" = "xyes"])
|
||||
|
||||
#
|
||||
# Check for AMR NB
|
||||
#
|
||||
AS_IF([test "x$have_qt_multimedia_lib" = xyes],
|
||||
[PKG_CHECK_MODULES(AMRNB, opencore-amrnb, [have_amrnb=yes], [have_amrnb=no])])
|
||||
AS_IF([test "x$have_amrnb" = xyes],
|
||||
[AC_DEFINE(HAVE_AMRNB, 1, [Define to 1 if you have AMRNB])])
|
||||
AM_CONDITIONAL(HAVE_AMRNB, [test "x$have_amrnb" = "xyes"])
|
||||
|
||||
# Check Bluetooth SBC codec for RTP Player
|
||||
# git://git.kernel.org/pub/scm/bluetooth/sbc.git
|
||||
AC_ARG_WITH([sbc],
|
||||
|
@ -3000,4 +3009,5 @@ echo " Use libssh library : $libssh_message"
|
|||
echo " Have ssh_userauth_agent : $ssh_userauth_agent_message"
|
||||
echo " Use nl library : $libnl_message"
|
||||
echo " Use SBC codec library : $have_sbc"
|
||||
echo " Use AMRNB codec library : $have_amrnb"
|
||||
#echo " Use GDK-Pixbuf with GResource: $have_gresource_pixbuf"
|
||||
|
|
|
@ -639,6 +639,7 @@ set(DISSECTOR_SRC
|
|||
packet-gsm_bssmap_le.c
|
||||
packet-gsm_cbch.c
|
||||
packet-gsm_ipa.c
|
||||
packet-osmux.c
|
||||
packet-gsm_rlcmac.c
|
||||
packet-gsm_sim.c
|
||||
packet-gsm_sms.c
|
||||
|
|
|
@ -668,6 +668,7 @@ DISSECTOR_SRC = \
|
|||
packet-gsm_bssmap_le.c \
|
||||
packet-gsm_cbch.c \
|
||||
packet-gsm_ipa.c \
|
||||
packet-osmux.c \
|
||||
packet-gsm_rlcmac.c \
|
||||
packet-gsm_sim.c \
|
||||
packet-gsm_sms.c \
|
||||
|
|
|
@ -0,0 +1,330 @@
|
|||
/* packet-osmux.c
|
||||
* Routines for packet dissection of OSmux voice/signalling multiplex protocol
|
||||
*
|
||||
*
|
||||
* Wireshark - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@wireshark.org>
|
||||
* Copyright 1998 Gerald Combs
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <epan/packet.h>
|
||||
#include <epan/stats_tree.h>
|
||||
#include <epan/tap.h>
|
||||
#include <epan/prefs.h>
|
||||
#include <epan/to_str.h>
|
||||
#include <epan/strutil.h>
|
||||
#include <epan/conversation.h>
|
||||
|
||||
void proto_register_osmux(void);
|
||||
void proto_reg_handoff_osmux(void);
|
||||
|
||||
/*
|
||||
* FIXME: Link to OSmux docs here
|
||||
*/
|
||||
|
||||
static const value_string osmux_ft_vals[] =
|
||||
{
|
||||
{0x00, "Signalling"},
|
||||
{0x01, "AMR"},
|
||||
{0x02, "Dummy"},
|
||||
{0, NULL}
|
||||
};
|
||||
|
||||
struct osmux_hdr {
|
||||
int ft;
|
||||
int ctr;
|
||||
int amr_f;
|
||||
int amr_q;
|
||||
int seq;
|
||||
int circuit_id;
|
||||
int amr_cmr;
|
||||
int amr_ft;
|
||||
};
|
||||
|
||||
/* Initialize the protocol and registered fields */
|
||||
static dissector_handle_t osmux_handle;
|
||||
static int proto_osmux = -1;
|
||||
static int osmux_tap = -1;
|
||||
|
||||
static int hf_osmux_ft_ctr = -1;
|
||||
static int hf_osmux_ft = -1;
|
||||
static int hf_osmux_ctr = -1;
|
||||
static int hf_osmux_amr_f = -1;
|
||||
static int hf_osmux_amr_q = -1;
|
||||
static int hf_osmux_seq = -1;
|
||||
static int hf_osmux_circuit_id = -1;
|
||||
static int hf_osmux_amr_ft_cmr = -1;
|
||||
static int hf_osmux_amr_ft = -1;
|
||||
static int hf_osmux_amr_cmr = -1;
|
||||
|
||||
/* Initialize the subtree pointers */
|
||||
static gint ett_osmux = -1;
|
||||
static gint ett_osmux_ft_ctr = -1;
|
||||
static gint ett_osmux_amr_ft_cmr = -1;
|
||||
|
||||
enum {
|
||||
SUB_RSL,
|
||||
SUB_AMR,
|
||||
SUB_DUMMY,
|
||||
|
||||
SUB_MAX
|
||||
};
|
||||
|
||||
|
||||
/* Code to actually dissect the packets */
|
||||
static gint
|
||||
dissect_osmux(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
|
||||
{
|
||||
int offset = 0;
|
||||
|
||||
struct osmux_hdr *osmuxh;
|
||||
proto_item *ti;
|
||||
proto_tree *osmux_tree = NULL;
|
||||
guint8 ft_ctr, amr_ft_cmr;
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "OSmux");
|
||||
col_clear(pinfo->cinfo, COL_INFO);
|
||||
|
||||
osmuxh = wmem_new0(wmem_packet_scope(), struct osmux_hdr);
|
||||
|
||||
ft_ctr = tvb_get_guint8(tvb, offset);
|
||||
|
||||
osmuxh->ft = ft_ctr >> 5;
|
||||
osmuxh->ctr = (ft_ctr >> 2) & 0x7;
|
||||
osmuxh->amr_q = !!(ft_ctr & 0x02);
|
||||
osmuxh->amr_f = !!(ft_ctr & 0x01);
|
||||
|
||||
osmuxh->seq = tvb_get_guint8(tvb, offset+1);
|
||||
osmuxh->circuit_id = tvb_get_guint8(tvb, offset+2);
|
||||
|
||||
amr_ft_cmr = tvb_get_guint8(tvb, offset+3);
|
||||
osmuxh->amr_ft = (amr_ft_cmr & 0xf0) >> 4;
|
||||
osmuxh->amr_cmr = amr_ft_cmr & 0x0f;
|
||||
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, "OSMux ");
|
||||
|
||||
|
||||
ti = proto_tree_add_protocol_format(tree, proto_osmux,
|
||||
tvb, offset, -1,
|
||||
"OSmux type %s frame",
|
||||
val_to_str(osmuxh->ft, osmux_ft_vals,
|
||||
"unknown 0x%02x"));
|
||||
osmux_tree = proto_item_add_subtree(ti, ett_osmux);
|
||||
|
||||
/* Two-byte dummy packets for firewalls */
|
||||
if (ft_ctr == 0x23 && tvb_reported_length(tvb) == 2) {
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, "Dummy frame");
|
||||
proto_tree_add_item(osmux_tree, hf_osmux_circuit_id, tvb, offset+1, 1, ENC_BIG_ENDIAN);
|
||||
return 2;
|
||||
}
|
||||
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, "%s ",
|
||||
val_to_str(osmuxh->ft, osmux_ft_vals,
|
||||
"unknown 0x%02x"));
|
||||
|
||||
{
|
||||
static const gint *ft_ctr_fields[] = {
|
||||
&hf_osmux_ft,
|
||||
&hf_osmux_ctr,
|
||||
&hf_osmux_amr_f,
|
||||
&hf_osmux_amr_q,
|
||||
NULL
|
||||
};
|
||||
proto_tree_add_bitmask(osmux_tree, tvb, offset, hf_osmux_ft_ctr,
|
||||
ett_osmux_ft_ctr, ft_ctr_fields, ENC_BIG_ENDIAN);
|
||||
offset++;
|
||||
}
|
||||
proto_tree_add_item(osmux_tree, hf_osmux_seq, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
offset++;
|
||||
proto_tree_add_item(osmux_tree, hf_osmux_circuit_id, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
offset++;
|
||||
|
||||
{
|
||||
static const gint *amr_ft_cmr_fields[] = {
|
||||
&hf_osmux_amr_ft,
|
||||
&hf_osmux_amr_cmr,
|
||||
NULL
|
||||
};
|
||||
proto_tree_add_bitmask(osmux_tree, tvb, offset, hf_osmux_amr_ft_cmr,
|
||||
ett_osmux_amr_ft_cmr, amr_ft_cmr_fields, ENC_BIG_ENDIAN);
|
||||
offset++;
|
||||
}
|
||||
|
||||
tap_queue_packet(osmux_tap, pinfo, osmuxh);
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
static const gchar *st_str_pkts = "Osmux Packets";
|
||||
static const gchar *st_str_pkts_by_cid = "Osmux Packets by CID";
|
||||
static const gchar *st_str_pkts_by_ctr = "Osmux Packets by AMR frame count";
|
||||
static const gchar *st_str_pkts_by_src = "Osmux Packets by src Addr";
|
||||
static const gchar *st_str_pkts_by_dst = "Osmux Packets by dst Addr";
|
||||
static const gchar *st_str_pkts_by_conn = "Osmux Packets by stream";
|
||||
|
||||
static int st_osmux_stats = -1;
|
||||
static int st_osmux_stats_cid = -1;
|
||||
static int st_osmux_stats_ctr = -1;
|
||||
static int st_osmux_stats_src = -1;
|
||||
static int st_osmux_stats_dst = -1;
|
||||
static int st_osmux_stats_conn = -1;
|
||||
|
||||
extern void osmux_stats_tree_init(stats_tree *st)
|
||||
{
|
||||
st_osmux_stats = stats_tree_create_node(st, st_str_pkts, 0, TRUE);
|
||||
st_osmux_stats_cid = stats_tree_create_node(st, st_str_pkts_by_cid, st_osmux_stats, TRUE);
|
||||
st_osmux_stats_ctr = stats_tree_create_node(st, st_str_pkts_by_ctr, st_osmux_stats, TRUE);
|
||||
st_osmux_stats_src = stats_tree_create_node(st, st_str_pkts_by_src, st_osmux_stats, TRUE);
|
||||
st_osmux_stats_dst = stats_tree_create_node(st, st_str_pkts_by_dst, st_osmux_stats, TRUE);
|
||||
st_osmux_stats_conn = stats_tree_create_node(st, st_str_pkts_by_conn, st_osmux_stats, TRUE);
|
||||
}
|
||||
|
||||
extern int osmux_stats_tree_packet(stats_tree *st, packet_info *pinfo,
|
||||
epan_dissect_t *edt _U_, const void *p _U_)
|
||||
{
|
||||
gchar *ip_str, *ip2_str;
|
||||
gchar temp[40];
|
||||
struct osmux_hdr *osmuxh = (struct osmux_hdr*) p;
|
||||
|
||||
|
||||
tick_stat_node(st, st_str_pkts, 0, FALSE);
|
||||
|
||||
tick_stat_node(st, st_str_pkts_by_cid, st_osmux_stats, FALSE);
|
||||
snprintf(temp, 30, "%i", osmuxh->circuit_id);
|
||||
tick_stat_node(st, temp, st_osmux_stats_cid, TRUE);
|
||||
|
||||
tick_stat_node(st, st_str_pkts_by_ctr, st_osmux_stats, FALSE);
|
||||
snprintf(temp, 30, "%i", osmuxh->ctr);
|
||||
tick_stat_node(st, temp, st_osmux_stats_ctr, TRUE);
|
||||
|
||||
tick_stat_node(st, st_str_pkts_by_src, 0, FALSE);
|
||||
ip_str = address_to_str(NULL, &pinfo->src);
|
||||
tick_stat_node(st, ip_str, st_osmux_stats_src, TRUE);
|
||||
|
||||
tick_stat_node(st, st_str_pkts_by_dst, 0, FALSE);
|
||||
ip2_str = address_to_str(NULL, &pinfo->dst);
|
||||
tick_stat_node(st, ip2_str, st_osmux_stats_dst, TRUE);
|
||||
|
||||
tick_stat_node(st, st_str_pkts_by_conn, 0, FALSE);
|
||||
snprintf(temp, 40, "%s->%s:%i", ip_str, ip2_str, osmuxh->circuit_id);
|
||||
tick_stat_node(st, temp, st_osmux_stats_conn, TRUE);
|
||||
|
||||
wmem_free(NULL, ip_str);
|
||||
wmem_free(NULL, ip2_str);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void proto_register_osmux(void)
|
||||
{
|
||||
static hf_register_info hf[] = {
|
||||
{&hf_osmux_ft_ctr,
|
||||
{"FTCTRByte", "osmux.ft_ctr",
|
||||
FT_UINT8, BASE_DEC, NULL, 0x00,
|
||||
"Byte with Fieldtype, Counter", HFILL}
|
||||
},
|
||||
{&hf_osmux_ft,
|
||||
{"FieldType", "osmux.ft",
|
||||
FT_UINT8, BASE_DEC, VALS(osmux_ft_vals), 0xe0,
|
||||
"Type of data in packet", HFILL}
|
||||
},
|
||||
{&hf_osmux_ctr,
|
||||
{"CTR", "osmux.ctr",
|
||||
FT_UINT8, BASE_HEX, NULL, 0x1c,
|
||||
"Number of AMR packets inside", HFILL}
|
||||
},
|
||||
{&hf_osmux_amr_q,
|
||||
{"AMR f", "osmux.amr_f",
|
||||
FT_UINT8, BASE_HEX, NULL, 0x02,
|
||||
"AMR f parameter", HFILL}
|
||||
},
|
||||
{&hf_osmux_amr_f,
|
||||
{"AMR q", "osmux.amr_q",
|
||||
FT_UINT8, BASE_HEX, NULL, 0x01,
|
||||
"AMR q parameter", HFILL}
|
||||
},
|
||||
{&hf_osmux_seq,
|
||||
{"Seq", "osmux.seq",
|
||||
FT_UINT8, BASE_HEX, NULL, 0x0,
|
||||
"Sequence number", HFILL}
|
||||
},
|
||||
{&hf_osmux_circuit_id,
|
||||
{"Circuit ID", "osmux.circuit_id",
|
||||
FT_UINT8, BASE_HEX, NULL, 0x0,
|
||||
"Circuit ID", HFILL}
|
||||
},
|
||||
{&hf_osmux_amr_ft_cmr,
|
||||
{"FourthByte", "osmux.amr_ft_cmr",
|
||||
FT_UINT8, BASE_DEC, NULL, 0x00,
|
||||
"Byte with AMR params ft and cmr", HFILL}
|
||||
},
|
||||
{&hf_osmux_amr_ft,
|
||||
{"AMR ft", "osmux.amr_ft",
|
||||
FT_UINT8, BASE_HEX, NULL, 0xf0,
|
||||
"AMR parameter ft", HFILL}
|
||||
},
|
||||
{&hf_osmux_amr_cmr,
|
||||
{"AMR cmr", "osmux.amr_cmr",
|
||||
FT_UINT8, BASE_HEX, NULL, 0x0f,
|
||||
"AMR parameter cmr", HFILL}
|
||||
},
|
||||
};
|
||||
|
||||
static gint *ett[] = {
|
||||
&ett_osmux,
|
||||
&ett_osmux_ft_ctr,
|
||||
&ett_osmux_amr_ft_cmr,
|
||||
};
|
||||
|
||||
proto_osmux = proto_register_protocol("GSM multiplexing for AMR", "GSM OSmux", "osmux");
|
||||
|
||||
proto_register_field_array(proto_osmux, hf, array_length(hf));
|
||||
proto_register_subtree_array(ett, array_length(ett));
|
||||
}
|
||||
|
||||
|
||||
void proto_reg_handoff_osmux(void)
|
||||
{
|
||||
static gboolean osmux_initialized = FALSE;
|
||||
|
||||
if (!osmux_initialized) {
|
||||
osmux_handle = create_dissector_handle(dissect_osmux, proto_osmux);
|
||||
dissector_add_uint("udp.port", 1984, osmux_handle);
|
||||
osmux_initialized = TRUE;
|
||||
}
|
||||
osmux_tap = register_tap("osmux");
|
||||
stats_tree_register_plugin("osmux", "osmux", "Osmux/Pakets", 0,
|
||||
osmux_stats_tree_packet, osmux_stats_tree_init,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
||||
*
|
||||
* Local variables:
|
||||
* c-basic-offset: 8
|
||||
* tab-width: 8
|
||||
* indent-tabs-mode: t
|
||||
* End:
|
||||
*
|
||||
* vi: set shiftwidth=8 tabstop=8 noexpandtab:
|
||||
* :indentSize=8:tabSize=8:noTabs=false:
|
||||
*/
|
|
@ -37,6 +37,7 @@
|
|||
#include "lapd_sapi.h"
|
||||
#include <epan/prefs.h>
|
||||
#include <epan/expert.h>
|
||||
#include <epan/conversation.h>
|
||||
|
||||
#include "packet-rtp.h"
|
||||
#include "packet-rtcp.h"
|
||||
|
@ -3031,13 +3032,22 @@ dissect_rsl_ie_tfo_transp_cont(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree
|
|||
return ie_offset + length;
|
||||
}
|
||||
|
||||
struct dyn_pl_info_t {
|
||||
guint8 rtp_codec;
|
||||
guint8 rtp_pt;
|
||||
};
|
||||
|
||||
static int
|
||||
dissct_rsl_ipaccess_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
|
||||
{
|
||||
guint8 msg_type;
|
||||
guint32 local_addr = 0;
|
||||
guint16 local_port = 0;
|
||||
guint8 rtp_codec = 255, rtp_pt = 0;
|
||||
address src_addr;
|
||||
rtp_dyn_payload_t *dyn_pl = NULL;
|
||||
struct dyn_pl_info_t *dyn_pl_info;
|
||||
conversation_t *conv;
|
||||
|
||||
msg_type = tvb_get_guint8(tvb, offset) & 0x7f;
|
||||
offset++;
|
||||
|
@ -3115,13 +3125,32 @@ dissct_rsl_ipaccess_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
|
|||
case RSL_IE_IPAC_SPEECH_MODE:
|
||||
proto_tree_add_item(ie_tree, hf_rsl_speech_mode_s, tvb,
|
||||
offset, len, ENC_BIG_ENDIAN);
|
||||
rtp_codec = tvb_get_guint8(tvb, offset) & 0x0f;
|
||||
conv = find_or_create_conversation(pinfo);
|
||||
dyn_pl_info = (struct dyn_pl_info_t *)conversation_get_proto_data(conv, proto_rsl);
|
||||
if (!dyn_pl_info) {
|
||||
dyn_pl_info = (struct dyn_pl_info_t *)wmem_alloc(wmem_file_scope(), sizeof(*dyn_pl_info));
|
||||
conversation_add_proto_data(conv, proto_rsl, (void *)dyn_pl_info);
|
||||
}
|
||||
dyn_pl_info->rtp_codec = rtp_codec;
|
||||
|
||||
proto_tree_add_item(ie_tree, hf_rsl_speech_mode_m, tvb,
|
||||
offset, len, ENC_BIG_ENDIAN);
|
||||
break;
|
||||
case RSL_IE_IPAC_RTP_PAYLOAD:
|
||||
case RSL_IE_IPAC_RTP_PAYLOAD2:
|
||||
/* Need to set pl here */
|
||||
proto_tree_add_item(ie_tree, hf_rsl_rtp_payload, tvb,
|
||||
offset, len, ENC_BIG_ENDIAN);
|
||||
rtp_pt = tvb_get_guint8(tvb, offset);
|
||||
conv = find_or_create_conversation(pinfo);
|
||||
dyn_pl_info = (struct dyn_pl_info_t *)conversation_get_proto_data(conv, proto_rsl);
|
||||
if (!dyn_pl_info) {
|
||||
dyn_pl_info = (struct dyn_pl_info_t *)wmem_alloc(wmem_file_scope(), sizeof(*dyn_pl_info));
|
||||
conversation_add_proto_data(conv, proto_rsl, (void *)dyn_pl_info);
|
||||
}
|
||||
dyn_pl_info->rtp_pt = rtp_pt;
|
||||
|
||||
break;
|
||||
case RSL_IE_IPAC_RTP_CSD_FMT:
|
||||
proto_tree_add_item(ie_tree, hf_rsl_rtp_csd_fmt_d, tvb,
|
||||
|
@ -3159,10 +3188,19 @@ dissct_rsl_ipaccess_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
|
|||
src_addr.type = AT_IPv4;
|
||||
src_addr.len = 4;
|
||||
src_addr.data = (guint8 *)&local_addr;
|
||||
|
||||
conv = find_or_create_conversation(pinfo);
|
||||
dyn_pl_info = (struct dyn_pl_info_t *)conversation_get_proto_data(conv, proto_rsl);
|
||||
if (dyn_pl_info && (dyn_pl_info->rtp_codec == 2 || dyn_pl_info->rtp_codec == 5)) {
|
||||
dyn_pl = rtp_dyn_payload_new();
|
||||
rtp_dyn_payload_insert(dyn_pl, dyn_pl_info->rtp_pt, "AMR", 8000);
|
||||
conversation_delete_proto_data(conv, proto_rsl);
|
||||
}
|
||||
rtp_add_address(pinfo, &src_addr, local_port, 0,
|
||||
"GSM A-bis/IP", pinfo->num, 0, NULL);
|
||||
"GSM A-bis/IP", pinfo->num, 0, dyn_pl);
|
||||
rtcp_add_address(pinfo, &src_addr, local_port+1, 0,
|
||||
"GSM A-bis/IP", pinfo->num);
|
||||
|
||||
break;
|
||||
}
|
||||
return offset;
|
||||
|
|
Loading…
Reference in New Issue