From Kriang Lerdsuwanakij:

1 Add ALCAP and NBAP as subdissectors of SSCOP. Previously it only
 knows about SSCF-NNI and data. (Changes in packet-sscop.c,
 packet-sscop.h)

2 Add capability for lower layer to force SSCOP to choose a particular
 dissector. It is passed as "subdissector" field of SSCOP protocol
 data. This is required because different payload protocol is
 distinguished by different VPI/VCI. There is no protocol field inside
 SSCOP frame. (Changes in packet-sscop.c, packet-sscop.h)

3 Make K12xx configuration file supporting the following syntax:
   C:\k1297\stacks\umts_iub\umts_iub_aal2l3.stk sscop:alcap
 This says dissect with SSCOP first and then pass to ALCAP.
 The change is made general, so it supports arbitrary number of
 protocol, like "proto1:proto2:proto3". Using ":" as separator
 allow us to expand the syntax further to support parameters like
 "proto1 param1:proto2 param2 param3". (Changes in packet-k12.c)

With above 3 changes together, dissecting Iub traces are correct for
control and signaling planes. I am still investigating user plane
frames because writing UMTS RLC/MAC protocol dissector is required.
The patch and sample .rf file (same as my previous patch) is in the
attachment.

plus:
Add Kriang to the AUTHORS list (and once at it upate my own record)


svn path=/trunk/; revision=20580
This commit is contained in:
Luis Ontanon 2007-01-28 01:41:58 +00:00
parent 6a2d87516a
commit c6009ed5ab
4 changed files with 174 additions and 34 deletions

14
AUTHORS
View File

@ -2253,8 +2253,15 @@ Kelly Byrd <kbyrd-ethereal [AT] memcpy.com> {
}
Luis Ontanon <luis.ontanon[AT]gmail.com> {
RADIUS and ISUP enhancements
MATE plugin
H.248 context tracing
ALCAP call tracing
RADIUS dictionary support
XML dissector (DTD support)
IuUP dissector
Lua interface
Tektronix K12 rf5 file support
SNMPv3 decryption support
}
Luca Deri <deri [AT] ntop.org> {
@ -2562,6 +2569,11 @@ Clay Jones <clay.jones [AT] email.com> {
Shomiti wireless packet support
}
Kriang Lerdsuwanakij <lerdsuwa [AT] users.sourceforge.net> {
SSCOP improvements
K12-rf5 file format improvements
}
and by:
Pavel Roskin <proski [AT] gnu.org>

View File

@ -36,6 +36,7 @@
#include <prefs.h>
#include <epan/report_err.h>
#include <epan/emem.h>
#include "packet-sscop.h"
static int proto_k12 = -1;
@ -54,6 +55,9 @@ static gint ett_port = -1;
static dissector_handle_t k12_handle;
static dissector_handle_t data_handle;
static dissector_handle_t sscop_handle;
extern int proto_sscop;
static module_t *k12_module;
@ -101,6 +105,10 @@ static void dissect_k12(tvbuff_t* tvb,packet_info* pinfo,proto_tree* tree) {
(guint)pinfo->pseudo_header->k12.input_info.atm.vc,
(guint)pinfo->pseudo_header->k12.input_info.atm.cid);
/*
* XXX: this is prone to collisions!
* we need an uniform way to manage circuits between dissectors
*/
pinfo->circuit_id = g_str_hash(circuit_str);
proto_tree_add_uint(k12_tree, hf_k12_atm_vp, tvb, 0,0,pinfo->pseudo_header->k12.input_info.atm.vp);
@ -116,18 +124,40 @@ static void dissect_k12(tvbuff_t* tvb,packet_info* pinfo,proto_tree* tree) {
if (! k12_cfg ) {
sub_handle = data_handle;
} else {
sub_handle = g_hash_table_lookup(k12_cfg,pinfo->pseudo_header->k12.stack_file);
dissector_handle_t* handles;
handles = g_hash_table_lookup(k12_cfg,pinfo->pseudo_header->k12.stack_file);
if (! sub_handle )
if (! handles )
sub_handle = data_handle;
else {
guint i;
sub_handle = handles[0];
/* Setup subdissector information */
for (i = 0; handles[i] && handles[i+1]; ++i) {
if (handles[i] == sscop_handle) {
sscop_payload_info *p_sscop_info = p_get_proto_data(pinfo->fd, proto_sscop);
if (p_sscop_info)
p_sscop_info->subdissector = handles[i+1];
else {
p_sscop_info = se_alloc0(sizeof(sscop_payload_info));
if (p_sscop_info) {
p_sscop_info->subdissector = handles[i+1];
p_add_proto_data(pinfo->fd, proto_sscop, p_sscop_info);
}
}
}
/* Add more protocols here */
}
}
}
call_dissector(sub_handle, tvb, pinfo, tree);
}
static gboolean free_just_key (gpointer k, gpointer v _U_, gpointer p _U_) {
static gboolean free_key_value (gpointer k, gpointer v _U_, gpointer p _U_) {
g_free(k);
g_free(v);
return TRUE;
}
@ -138,9 +168,11 @@ static GHashTable* k12_load_config(const gchar* filename) {
size_t len;
GHashTable* hash;
gchar** curr;
gchar** protos;
gchar** lines = NULL;
guint i;
dissector_handle_t handle;
guint i, j, k;
guint num_protos;
dissector_handle_t *handles;
/* XXX: should look for the file in common locations */
@ -165,27 +197,64 @@ static GHashTable* k12_load_config(const gchar* filename) {
if(*(lines[i]) == '#' || *(lines[i]) == '\0')
continue;
curr = g_strsplit(lines[i]," ",0);
curr = g_strsplit(lines[i]," ",2);
g_strstrip(curr[0]);
if (! (curr[0] != NULL && *(curr[0]) != '\0' && curr[1] != NULL && *(curr[1]) != '\0' ) ) {
report_failure("K12xx: Format error in line %u",i+1);
g_strfreev(curr);
g_strfreev(lines);
g_hash_table_foreach_remove(hash,free_just_key,NULL);
g_hash_table_foreach_remove(hash,free_key_value,NULL);
g_hash_table_destroy(hash);
return NULL;
}
g_strstrip(curr[0]);
g_strstrip(curr[1]);
handle = find_dissector(curr[1]);
protos = g_strsplit(curr[1],":",0);
for (j = 0; protos[j]; j++)
g_strstrip(protos[j]);
num_protos = j;
if (! handle ) {
report_failure("k12: proto %s not found",curr[1]);
handle = data_handle;
/* Allocate extra space for NULL marker */
handles = g_malloc(sizeof(dissector_handle_t)*(num_protos+1));
for (j = 0; j <= num_protos; j++)
handles[j] = NULL;
for (j = 0; j < num_protos; j++) {
if (protos[j][0] == '\0') {
report_failure("K12xx: empty protocol in line %u",i+1);
break;
}
handles[j] = find_dissector(protos[j]);
if (! handles[j]) {
report_failure("K12xx: protocol %s not found",protos[j]);
break;
}
if (j > 0) {
if (handles[j-1] != sscop_handle) {
report_failure("K12xx: only sscop protocol support subdissector format");
break;
}
if (!sscop_allowed_subdissector(handles[j])) {
report_failure("K12xx: %s cannot be subdissector of %s",protos[j],protos[j-1]);
break;
}
for (k = 0; k < j; k++)
if (handles[k] == handles[j]) {
report_failure("K12xx: cannot nest protocol %s inside itself",protos[j]);
break;
}
}
}
g_hash_table_insert(hash,g_strdup(curr[0]),handle);
/* Revert to data_handle when all
protocol seen is error */
if (handles[0] == NULL)
handles[0] = data_handle;
g_hash_table_insert(hash,g_strdup(curr[0]),handles);
g_strfreev(protos);
g_strfreev(curr);
}
@ -202,23 +271,33 @@ static GHashTable* k12_load_config(const gchar* filename) {
return NULL;
}
/* Make sure handles for various protocols are initialized */
static void initialize_handles_once(void) {
static gboolean initialized = FALSE;
if (!initialized) {
k12_handle = find_dissector("k12");
data_handle = find_dissector("data");
sscop_handle = find_dissector("sscop");
initialized = TRUE;
}
}
static void k12_load_prefs(void) {
if (k12_cfg) {
g_hash_table_foreach_remove(k12_cfg,free_just_key,NULL);
g_hash_table_foreach_remove(k12_cfg,free_key_value,NULL);
g_hash_table_destroy(k12_cfg);
k12_cfg = NULL;
}
if (*k12_config_filename != '\0') {
initialize_handles_once();
k12_cfg = k12_load_config(k12_config_filename);
return;
}
}
void proto_reg_handoff_k12(void) {
k12_handle = find_dissector("k12");
data_handle = find_dissector("data");
initialize_handles_once();
dissector_add("wtap_encap", WTAP_ENCAP_K12, k12_handle);
}

View File

@ -35,7 +35,7 @@
#include <prefs.h>
#include "packet-sscop.h"
static int proto_sscop = -1;
int proto_sscop = -1;
static int hf_sscop_type = -1;
static int hf_sscop_sq = -1;
@ -52,6 +52,8 @@ static gint ett_stat = -1;
static dissector_handle_t q2931_handle;
static dissector_handle_t data_handle;
static dissector_handle_t sscf_nni_handle;
static dissector_handle_t alcap_handle;
static dissector_handle_t nbap_handle;
static module_t *sscop_module;
@ -60,17 +62,13 @@ static range_t *udp_port_range;
static dissector_handle_t sscop_handle;
typedef enum {
DATA_DISSECTOR = 1,
Q2931_DISSECTOR = 2,
SSCF_NNI_DISSECTOR = 3
} Dissector_Option;
static enum_val_t sscop_payload_dissector_options[] = {
{ "data", "Data (no further dissection)", DATA_DISSECTOR },
{ "Q.2931", "Q.2931", Q2931_DISSECTOR },
{ "Q.2931", "Q.2931", Q2931_DISSECTOR },
{ "SSCF-NNI", "SSCF-NNI (MTP3-b)", SSCF_NNI_DISSECTOR },
{ "ALCAP", "ALCAP", ALCAP_DISSECTOR },
{ "NBAP", "NBAP", NBAP_DISSECTOR },
{ NULL, NULL, 0 }
};
@ -343,7 +341,22 @@ dissect_sscop_and_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, d
static void dissect_sscop(tvbuff_t* tvb, packet_info* pinfo,proto_tree* tree)
{
dissect_sscop_and_payload(tvb,pinfo,tree,default_handle);
struct _sscop_payload_info *p_sscop_info;
dissector_handle_t subdissector;
/* Look for packet info for subdissector information */
p_sscop_info = p_get_proto_data(pinfo->fd, proto_sscop);
if ( p_sscop_info
&& ( subdissector = p_sscop_info->subdissector )
&& ( subdissector == data_handle
|| subdissector == q2931_handle
|| subdissector == sscf_nni_handle
|| subdissector == alcap_handle
|| subdissector == nbap_handle) )
dissect_sscop_and_payload(tvb,pinfo,tree,subdissector);
else
dissect_sscop_and_payload(tvb,pinfo,tree,default_handle);
}
@ -360,19 +373,40 @@ static void range_add_callback(guint32 port)
dissector_add("udp.port", port, sscop_handle);
}
}
/* Make sure handles for various protocols are initialized */
static void initialize_handles_once(void) {
static gboolean initialized = FALSE;
if (!initialized) {
sscop_handle = create_dissector_handle(dissect_sscop, proto_sscop);
q2931_handle = find_dissector("q2931");
data_handle = find_dissector("data");
sscf_nni_handle = find_dissector("sscf-nni");
alcap_handle = find_dissector("alcap");
nbap_handle = find_dissector("nbap");
initialized = TRUE;
}
}
gboolean sscop_allowed_subdissector(dissector_handle_t handle)
{
initialize_handles_once();
if (handle == q2931_handle || handle == data_handle
|| handle == sscf_nni_handle || handle == alcap_handle
|| handle == nbap_handle)
return TRUE;
return FALSE;
}
void
proto_reg_handoff_sscop(void)
{
static int prefs_initialized = FALSE;
if (!prefs_initialized) {
sscop_handle = create_dissector_handle(dissect_sscop, proto_sscop);
q2931_handle = find_dissector("q2931");
data_handle = find_dissector("data");
sscf_nni_handle = find_dissector("sscf-nni");
initialize_handles_once();
prefs_initialized = TRUE;
} else {
@ -390,6 +424,8 @@ proto_reg_handoff_sscop(void)
case DATA_DISSECTOR: default_handle = data_handle; break;
case Q2931_DISSECTOR: default_handle = q2931_handle; break;
case SSCF_NNI_DISSECTOR: default_handle = sscf_nni_handle; break;
case ALCAP_DISSECTOR: default_handle = alcap_handle; break;
case NBAP_DISSECTOR: default_handle = nbap_handle; break;
}
}

View File

@ -28,4 +28,17 @@ typedef struct _sscop_info_t {
guint32 payload_len;
} sscop_info_t;
typedef struct _sscop_payload_info {
dissector_handle_t subdissector;
} sscop_payload_info;
typedef enum {
DATA_DISSECTOR = 1,
Q2931_DISSECTOR = 2,
SSCF_NNI_DISSECTOR = 3,
ALCAP_DISSECTOR = 4,
NBAP_DISSECTOR = 5
} Dissector_Option;
extern gboolean sscop_allowed_subdissector(dissector_handle_t handle);
extern void dissect_sscop_and_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, dissector_handle_t handle);