Wireshark-dev: [Wireshark-dev] Wireshark support for UK ISUP
From: "Mike Davies" <[email protected]>
Date: Sat, 15 Jul 2006 17:56:50 +0100
Hello all,

I was looking at adding support for UK ISUP (UK PNO/ISC Spec ND1007:2004/11) to Ethereal. The UK national version of ISUP consists of additional/modified parameters and field values so should not be that difficult to implement but it looks as if I am in danger of working at cross purposes with other developments.
I am a tester not a programmer and any programming I do tends to take a long 
time but, as far as I can see, I have two basic problems:
1.   getting the hooks into the dissector to support several different 
national options - the latest version of my code (based on 0.10.14) is 
attached which could support multiple options based on a user preference. 
Is this a sensible way to go and could it co-exist with the ANSI support? 
Is there any requirement to support more than one variant at a time?
2.   is there a better way to do this than having lots of switch statements? 
This may be OK for the parameters where you only execute the code when the 
parameter is present but something like it needs to be in the code to decode 
a lot of the field values which could affect performance.  Is there a better 
way than changing
     g_snprintf(param_name, NAME_SIZE, val_to_str(upgraded_parameter, 
isup_parameter_type_value, "unknown"));
to something like

     switch(isup_national){
     case NATIONAL_UKISUP:
           if(upgraded_parameter>=PARAM_TYPE_NATIONAL_244
          && upgraded_parameter<=PARAM_TYPE_NATIONAL_254)
g_snprintf(param_name, NAME_SIZE, val_to_str(upgraded_parameter, isup_uknational_parameter_type_value, "unknown"));
          else
g_snprintf(param_name, NAME_SIZE, val_to_str(upgraded_parameter, isup_parameter_type_value, "unknown"));
          break;

     <<<repeat for any other national options>>>

     default:
g_snprintf(param_name, NAME_SIZE, val_to_str(upgraded_parameter, isup_parameter_type_value, "unknown"));
      }

All advice, comments and suggestions welcome.

Regards

    Mike

PS The attached code is an example only - it doesn't do anything useful yet.

Attachment: packet-isup.zip
Description: Zip compressed data