~ubuntu-branches/ubuntu/gutsy/wireshark/gutsy-security

« back to all changes in this revision

Viewing changes to epan/dissectors/packet-umts_fp.c

  • Committer: Bazaar Package Importer
  • Author(s): Frederic Peters
  • Date: 2007-04-01 08:58:40 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070401085840-or3qhrpv8alt1bwg
Tags: 0.99.5-1
* New upstream release.
* debian/patches/09_idl2wrs.dpatch: updated to patch idl2wrs.sh.in.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 *
3
3
 * Martin Mathieson
4
4
 *
5
 
 * $Id: packet-umts_fp.c 19626 2006-10-20 14:03:28Z martinm $
 
5
 * $Id: packet-umts_fp.c 20304 2007-01-04 13:25:25Z martinm $
6
6
 *
7
7
 * Wireshark - Network traffic analyzer
8
8
 * By Gerald Combs <gerald@wireshark.org>
33
33
#include "packet-umts_fp.h"
34
34
 
35
35
/* TODO:
36
 
   - remaining message types
 
36
   - IUR interface-specific formats
37
37
   - verify header & payload CRCs
38
 
   - look for (and report as expert info) spare extension bytes
 
38
   - look for (and report as expert info) possible spare extension bytes
 
39
   - R7?
39
40
*/
40
41
 
41
42
/* Initialize the protocol and registered fields. */
55
56
static int hf_fp_cpch_tfi = -1;
56
57
static int hf_fp_propagation_delay = -1;
57
58
static int hf_fp_tb = -1;
 
59
static int hf_fp_chan_zero_tbs = -1;
58
60
static int hf_fp_received_sync_ul_timing_deviation = -1;
59
61
static int hf_fp_pch_pi = -1;
60
62
static int hf_fp_pch_tfi = -1;
85
87
static int hf_fp_hsdsch_credits = -1;
86
88
static int hf_fp_hsdsch_max_macd_pdu_len = -1;
87
89
static int hf_fp_hsdsch_interval = -1;
 
90
static int hf_fp_hsdsch_calculated_rate = -1;
 
91
static int hf_fp_hsdsch_unlimited_rate = -1;
88
92
static int hf_fp_hsdsch_repetition_period = -1;
89
93
static int hf_fp_hsdsch_data_padding = -1;
90
94
static int hf_fp_hsdsch_new_ie_flags = -1;
379
383
    for (chan=0; chan < p_fp_info->num_chans; chan++)
380
384
    {
381
385
        int n;
 
386
 
 
387
        /* Clearly show channels with no TBs */
 
388
        if (p_fp_info->chan_num_tbs[chan] == 0)
 
389
        {
 
390
            proto_item *no_tb_ti = proto_tree_add_uint(data_tree, hf_fp_chan_zero_tbs, tvb,
 
391
                                                       offset+(bit_offset/8),
 
392
                                                       0, chan+1);
 
393
            proto_item_append_text(no_tb_ti, " (of size %d)",
 
394
                                   p_fp_info->chan_tf_size[chan]);
 
395
            PROTO_ITEM_SET_GENERATED(no_tb_ti);
 
396
        }
 
397
 
 
398
        /* Show TBs from non-empty channels */
382
399
        for (n=0; n < p_fp_info->chan_num_tbs[chan]; n++)
383
400
        {
384
401
            proto_item *ti;
716
733
                                       tvbuff_t *tvb, int offset)
717
734
{
718
735
    proto_item *ti;
 
736
    proto_item *rate_ti;
719
737
    guint16 max_pdu_length;
720
738
    guint8 repetition_period;
721
739
    guint8 interval;
737
755
    if (credits == 0)
738
756
    {
739
757
        proto_item_append_text(ti, " (stop transmission)");
 
758
        expert_add_info_format(pinfo, ti,
 
759
                               PI_RESPONSE_CODE, PI_NOTE,
 
760
                               "Stop HSDPA transmission");
740
761
    }
741
762
    if (credits == 2047)
742
763
    {
761
782
        proto_item_append_text(ti, " (unlimited repetition period)");
762
783
    }
763
784
 
 
785
    /* Calculated and show effective rate enabled */
 
786
    if (credits == 2047)
 
787
    {
 
788
        rate_ti = proto_tree_add_item(tree, hf_fp_hsdsch_unlimited_rate, tvb, 0, 0, FALSE);
 
789
    }
 
790
    else
 
791
    {
 
792
        rate_ti = proto_tree_add_uint(tree, hf_fp_hsdsch_calculated_rate, tvb, 0, 0,
 
793
                            credits * max_pdu_length * (1000 / (interval*10)));
 
794
    }
 
795
    PROTO_ITEM_SET_GENERATED(rate_ti);
 
796
 
 
797
 
764
798
    if (check_col(pinfo->cinfo, COL_INFO))
765
799
    {
766
800
        col_append_fstr(pinfo->cinfo, COL_INFO,
1031
1065
 
1032
1066
        /* Transmit power level */
1033
1067
        proto_tree_add_float(tree, hf_fp_transmit_power_level, tvb, offset, 1,
1034
 
                             (float)(tvb_get_guint8(tvb, offset)) / 10);
 
1068
                             (float)(int)(tvb_get_guint8(tvb, offset)) / 10);
1035
1069
        offset++;
1036
1070
 
1037
1071
        /* TB data */
1097
1131
            /* Power offset */
1098
1132
            proto_tree_add_float(tree, hf_fp_power_offset, tvb, offset, 1,
1099
1133
                                 (float)(-32.0) +
1100
 
                                  ((float)(tvb_get_guint8(tvb, offset)) * (float)(0.25)));
 
1134
                                  ((float)(int)(tvb_get_guint8(tvb, offset)) * (float)(0.25)));
1101
1135
            offset++;
1102
1136
 
1103
1137
            /* Code number */
1123
1157
    
1124
1158
            /* Transmit power level */
1125
1159
            proto_tree_add_float(tree, hf_fp_transmit_power_level, tvb, offset, 1,
1126
 
                                 (float)(tvb_get_guint8(tvb, offset)) / 10);
 
1160
                                 (float)(int)(tvb_get_guint8(tvb, offset)) / 10);
1127
1161
            offset++;
1128
1162
        }
1129
1163
 
1446
1480
void dissect_dch_outer_loop_power_control(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, int offset)
1447
1481
{
1448
1482
    /* SIR target */
1449
 
    float target = -8.2 + (0.1 * (float)(tvb_get_guint8(tvb, offset)));
 
1483
    float target = -8.2 + (0.1 * (float)(int)(tvb_get_guint8(tvb, offset)));
1450
1484
    proto_tree_add_float(tree, hf_fp_ul_sir_target, tvb, offset, 1, target);
1451
1485
 
1452
1486
    if (check_col(pinfo->cinfo, COL_INFO))
1684
1718
    else
1685
1719
    {
1686
1720
        /********************************/
1687
 
        /* E-DCH data here        */
 
1721
        /* E-DCH data here              */
1688
1722
 
1689
1723
        guint  bit_offset = 0;
 
1724
        guint  total_pdus = 0;
1690
1725
        guint  total_bits = 0;
1691
1726
 
1692
1727
        /* FSN */
1695
1730
 
1696
1731
        /* Number of subframes.
1697
1732
           This was 3 bits in early releases, is 4 bits offset by 1 in later releases  */
1698
 
        if ((p_fp_info->dct2000_variant % 256) > 1)
 
1733
        if (((p_fp_info->dct2000_variant / 256) >= 2) ||
 
1734
             (p_fp_info->release > 6))
1699
1735
        {
1700
1736
            /* Use 4 bits plus offset of 1 */
1701
1737
            number_of_subframes = (tvb_get_guint8(tvb, offset) & 0x0f) + 1;
1719
1755
        for (n=0; n < number_of_subframes; n++)
1720
1756
        {
1721
1757
            int i;
 
1758
            int start_offset = offset;
1722
1759
            proto_item *subframe_header_ti;
1723
1760
            proto_tree *subframe_header_tree;
1724
1761
 
1810
1847
                bit_offset += 6;
1811
1848
            }
1812
1849
 
 
1850
            offset += ((bit_offset+7)/8);
 
1851
 
1813
1852
            /* Tree should cover entire subframe header */
1814
 
            proto_item_set_len(subframe_header_ti, bit_offset/8);
1815
 
 
1816
 
            offset += ((bit_offset+7)/8);
 
1853
            proto_item_set_len(subframe_header_ti, offset - start_offset);
1817
1854
        }
1818
1855
 
1819
1856
        /* EDCH subframes */
1837
1874
            {
1838
1875
                int         m;
1839
1876
                guint16     size = 0;
 
1877
                guint8      tsn;
1840
1878
                guint       send_size;
1841
1879
                proto_item  *ti;
1842
1880
 
1866
1904
                bit_offset += 2;
1867
1905
 
1868
1906
                /* TSN */
 
1907
                tsn = (tvb_get_guint8(tvb, offset + (bit_offset/8)) & 0x3f);
1869
1908
                proto_tree_add_item(subframe_tree, hf_fp_edch_tsn, tvb,
1870
1909
                                    offset + (bit_offset/8),
1871
1910
                                    1, FALSE);
1903
1942
                proto_item_append_text(subframe_ti, " (%u bits in %u MAC-d PDUs)",
1904
1943
                                       bits_in_subframe, mac_d_pdus_in_subframe);
1905
1944
            }
 
1945
            total_pdus += mac_d_pdus_in_subframe;
1906
1946
            total_bits += bits_in_subframe;
1907
1947
 
1908
1948
            offset += (bit_offset/8);
1912
1952
        if (check_col(pinfo->cinfo, COL_INFO))
1913
1953
        {
1914
1954
            col_append_fstr(pinfo->cinfo, COL_INFO,
1915
 
                            " CFN = %03u   (%u bits in %u subframes)",
1916
 
                            cfn, total_bits, number_of_subframes);
 
1955
                            " CFN = %03u   (%u bits in %u pdus in %u subframes)",
 
1956
                            cfn, total_bits, total_pdus, number_of_subframes);
1917
1957
        }
1918
1958
 
1919
1959
        /* Payload CRC (optional) */
1955
1995
    {
1956
1996
        guint8 number_of_pdus;
1957
1997
        guint16 pdu_length;
 
1998
        guint16 user_buffer_size;
1958
1999
 
1959
2000
        /********************************/
1960
2001
        /* HS-DCH data here             */
1974
2015
        offset++;
1975
2016
 
1976
2017
        /* User buffer size */
 
2018
        user_buffer_size = tvb_get_ntohs(tvb, offset);
1977
2019
        proto_tree_add_item(tree, hf_fp_user_buffer_size, tvb, offset, 2, FALSE);
1978
2020
        offset += 2;
1979
2021
 
1981
2023
        offset = dissect_macd_pdu_data(tvb, pinfo, tree, offset, pdu_length,
1982
2024
                                       number_of_pdus);
1983
2025
 
 
2026
        if (check_col(pinfo->cinfo, COL_INFO))
 
2027
        {
 
2028
            col_append_fstr(pinfo->cinfo, COL_INFO, "  User-Buffer-Size=%u", user_buffer_size);
 
2029
        }
 
2030
 
1984
2031
        /* Extra R6 stuff */
1985
2032
        if (p_fp_info->release == 6)
1986
2033
        {
2206
2253
              "Transport Block", HFILL
2207
2254
            }
2208
2255
        },
 
2256
        { &hf_fp_chan_zero_tbs,
 
2257
            { "No TBs for channel",
 
2258
              "fp.channel-with-zero-tbs", FT_UINT32, BASE_DEC, NULL, 0x0,
 
2259
              "Channel with 0 TBs", HFILL
 
2260
            }
 
2261
        },
2209
2262
        { &hf_fp_tfi,
2210
2263
            { "TFI",
2211
2264
              "fp.tfi", FT_UINT8, BASE_DEC, NULL, 0x0,
2464
2517
              "HS-DSCH Interval in milliseconds", HFILL
2465
2518
            }
2466
2519
        },
 
2520
        { &hf_fp_hsdsch_calculated_rate,
 
2521
            { "Calculated rate allocation (bps)",
 
2522
              "fp.hsdsch-calculated-rate", FT_UINT32, BASE_DEC, 0, 0x0,
 
2523
              "Calculated rate RNC is allowed to send in bps", HFILL
 
2524
            }
 
2525
        },
 
2526
        { &hf_fp_hsdsch_unlimited_rate,
 
2527
            { "Unlimited rate",
 
2528
              "fp.hsdsch-unlimited-rate", FT_NONE, BASE_NONE, 0, 0x0,
 
2529
              "No restriction on rate at which date may be sent", HFILL
 
2530
            }
 
2531
        },
2467
2532
        { &hf_fp_hsdsch_repetition_period,
2468
2533
            { "HS-DSCH Repetition Period",
2469
2534
              "fp.hsdsch-repetition-period", FT_UINT8, BASE_DEC, 0, 0x0,
2592
2657
        },
2593
2658
        { &hf_fp_ul_sir_target,
2594
2659
            { "UL_SIR_TARGET",
2595
 
              "fp.ul-sir_target", FT_FLOAT, BASE_DEC, 0, 0x0,
 
2660
              "fp.ul-sir-target", FT_FLOAT, BASE_DEC, 0, 0x0,
2596
2661
              "Value (in dB) of the SIR target to be used by the UL inner loop power control", HFILL
2597
2662
            }
2598
2663
        },
2701
2766
 
2702
2767
        { &hf_fp_radio_interface_parameter_update_flag[0],
2703
2768
            { "CFN valid",
2704
 
              "fp.radio_interface_param.cfn-valid", FT_UINT16, BASE_DEC, 0, 0x0001,
 
2769
              "fp.radio-interface-param.cfn-valid", FT_UINT16, BASE_DEC, 0, 0x0001,
2705
2770
              "CFN valid", HFILL
2706
2771
            }
2707
2772
        },
2708
2773
        { &hf_fp_radio_interface_parameter_update_flag[1],
2709
2774
            { "TPC PO valid",
2710
 
              "fp.radio_interface_param.tpc-po-valid", FT_UINT16, BASE_DEC, 0, 0x0002,
 
2775
              "fp.radio-interface-param.tpc-po-valid", FT_UINT16, BASE_DEC, 0, 0x0002,
2711
2776
              "TPC PO valid", HFILL
2712
2777
            }
2713
2778
        },
2714
2779
        { &hf_fp_radio_interface_parameter_update_flag[2],
2715
2780
            { "DPC mode valid",
2716
 
              "fp.radio_interface_param.dpc-mode-valid", FT_UINT16, BASE_DEC, 0, 0x0004,
 
2781
              "fp.radio-interface-param.dpc-mode-valid", FT_UINT16, BASE_DEC, 0, 0x0004,
2717
2782
              "DPC mode valid", HFILL
2718
2783
            }
2719
2784
        },
2720
2785
        { &hf_fp_radio_interface_parameter_update_flag[3],
2721
2786
            { "RL sets indicator valid",
2722
 
              "fp.radio_interface_param.rl-sets-indicator-valid", FT_UINT16, BASE_DEC, 0, 0x0020,
 
2787
              "fp.radio-interface_param.rl-sets-indicator-valid", FT_UINT16, BASE_DEC, 0, 0x0020,
2723
2788
              "RI valid", HFILL
2724
2789
            }
2725
2790
        },
2726
2791
        { &hf_fp_radio_interface_parameter_update_flag[4],
2727
2792
            { "MAX_UE_TX_POW valid",
2728
 
              "fp.radio_interface_param.max-ue-tx-pow-valid", FT_UINT16, BASE_DEC, 0, 0x0040,
 
2793
              "fp.radio-interface-param.max-ue-tx-pow-valid", FT_UINT16, BASE_DEC, 0, 0x0040,
2729
2794
              "MAX UE TX POW valid", HFILL
2730
2795
            }
2731
2796
        },