This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

Problem in displaying/printing a predefined string as per packet in the tree.

0

Hello,

I am facing a problem in displaying the predefined string in the tree at a specific place. Below is the code using which I want to display the specific predefined string as per its packet info.

The code below corresponds to the failure messages which I want to print at a specific place:

    const value_string s1ap_CauseRadioNetwork_vals[] = {
  {   0, "unspecified" },
  {   1, "tx2relocoverall-expiry" },
  {   2, "successful-handover" },
  {   3, "release-due-to-eutran-generated-reason" },
  {   4, "handover-cancelled" },
  {   5, "partial-handover" },
  {   6, "ho-failure-in-target-EPC-eNB-or-target-system" },
  {   7, "ho-target-not-allowed" },
  {   8, "tS1relocoverall-expiry" },
  {   9, "tS1relocprep-expiry" },
  {  10, "cell-not-available" },
  {  11, "unknown-targetID" },
  {  12, "no-radio-resources-available-in-target-cell" },
  {  13, "unknown-mme-ue-s1ap-id" },
  {  14, "unknown-enb-ue-s1ap-id" },
  {  15, "unknown-pair-ue-s1ap-id" },
  {  16, "handover-desirable-for-radio-reason" },
  {  17, "time-critical-handover" },
  {  18, "resource-optimisation-handover" },
  {  19, "reduce-load-in-serving-cell" },
  {  20, "user-inactivity" },
  {  21, "radio-connection-with-ue-lost" },
  {  22, "load-balancing-tau-required" },
  {  23, "cs-fallback-triggered" },
  {  24, "ue-not-available-for-ps-service" },
  {  25, "radio-resources-not-available" },
  {  26, "failure-in-radio-interface-procedure" },
  {  27, "invalid-qos-combination" },
  {  28, "interrat-redirection" },
  {  29, "interaction-with-other-procedure" },
  {  30, "unknown-E-RAB-ID" },
  {  31, "multiple-E-RAB-ID-instances" },
  {  32, "encryption-and-or-integrity-protection-algorithms-not-supported" },
  {  33, "s1-intra-system-handover-triggered" },
  {  34, "s1-inter-system-handover-triggered" },
  {  35, "x2-handover-triggered" },
  {  36, "redirection-towards-1xRTT" },
  {  37, "not-supported-QCI-value" },
  {  38, "invalid-CSG-Id" },
  { 0, NULL }
};
static value_string_ext s1ap_CauseRadioNetwork_vals_ext = VALUE_STRING_EXT_INIT(s1ap_CauseRadioNetwork_vals);

static int dissect_s1ap_CauseRadioNetwork(tvbuff_t *tvb U, int offset U, asn1_ctx_t *actx U, proto_tree *tree U, int hf_index U) { offset = dissect_per_enumerated(tvb, offset, actx, tree, hf_index, 36, NULL, TRUE, 3, &CauseRadio);

return offset; }

Below in proto_item_append_text() function, in its cause field I want to display it :

    static void
dissect_s1ap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_item  *s1ap_item = NULL;
proto_tree  *s1ap_tree = NULL;

/* make entry in the Protocol column on summary display */
col_set_str(pinfo->cinfo, COL_PROTOCOL, "S1AP");

/* create the s1ap protocol tree */

s1ap_item = proto_tree_add_item(tree, proto_s1ap, tvb, 0, -1, ENC_NA); s1ap_tree = proto_item_add_subtree(s1ap_item, ett_s1ap);

dissect_S1AP_PDU_PDU(tvb, pinfo, s1ap_tree, NULL); proto_item_append_text(s1ap_item, ", Event-Message:%s ,Result:%s, Cause:%s ",val_to_str_ext(ProcedureCode, &s1ap_ProcedureCode_vals_ext, "unknown message"),val_to_str(S1AP_PDU,s1ap_S1AP_PDU_vals, "unknown"),val_to_str(CauseRadio,s1ap_CauseRadioNetwork_vals, "unknown"));

}

Need help urgently,

Thanks in advance,

Regards,

Ankur

asked 12 May ‘14, 04:34

ankur92's gravatar image

ankur92
31227
accept rate: 0%

what exactly is “the problem you are facing” ?

(12 May ‘14, 05:25) Bill Meier ♦♦

Hello Sir,

I need to sort out all the failure events and then I need to display its cause hence I want to display the s1ap_CauseRadioNetwork_vals strings in the cause as the failures here are due to them only. So, what is the procedure to print the corresponding cause to the failure.

I am not able to get any clue about how to print them also I have an issue regarding printing the failures due to NAS which is located in other file packet-nas_eps.c

It would be very helpful if you can help me out.

Regards, Ankur

(12 May ‘14, 06:09) ankur92

What is going wrong with the code, it looks kind of ok if CauseRadio contains a valid cause.

(12 May ‘14, 07:33) Anders ♦

Ankur,

The code in trunk shows the cause type and value in the Info column. There is a copy/paste error at the moment where RadioNetwork causes are incorrectly looking up s1ap_CauseRadioNetwork_vals, but I will try to check in my fix for this tonight.

Also, did you see the example code I pasted into your other query about the NAS reasons? We currently show (in the Info column) the codes for Detach, I can check in the change I described in your other question if it works for you.

(12 May ‘14, 10:38) MartinM

Hey Martin,

Thanks for the help in NAS part of query. Also, I need your help to add a string to each and every cause like for Network Failure I need to display the following “Causes related to PLMN specific network failures and congestion / Authentication Failures) This cause is sent to the MS if the MSC cannot service an MS generated request because of PLMN failures, e.g. problems in MAP."

I need this to be printed as first text in the S1 Application Protocol.

(12 May ‘14, 23:50) ankur92