Text   |  XML   |  ReML   |   Visible Warnings:

Format String  at packet-x25.c:760

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

dump_facilities

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-x25.c)expand/collapse
Show more  
 628  dump_facilities(proto_tree *tree, int *offset, tvbuff_t *tvb)
 629  {
 630      guint8 fac, byte1, byte2, byte3;
 631      guint32 len;      /* facilities length */
 632      proto_item *ti=0;
 633      proto_tree *fac_tree = 0;
 634      proto_tree *fac_subtree;
 635   
 636      len = tvb_get_guint8(tvb, *offset);
 637      if (len && tree) {
 638          ti = proto_tree_add_text(tree, tvb, *offset, len + 1,
 639                                   "Facilities");
 640          fac_tree = proto_item_add_subtree(ti, ett_x25_fac);
 641          proto_tree_add_text(fac_tree, tvb, *offset, 1,
 642                              "Facilities length: %d", len);
 643      }
 644      (*offset)++;
 645   
 646      while (len > 0) {
 647          fac = tvb_get_guint8(tvb, *offset);
 648          switch(fac & X25_FAC_CLASS_MASK) {
 649          case X25_FAC_CLASS_A:
 650              switch (fac) {
 651              case X25_FAC_COMP_MARK:
 652                  if (fac_tree)
 653                      ti = proto_tree_add_text(fac_tree, tvb, *offset, 1,
 654                              "Code : 00 (Marker)");
 655                  switch (tvb_get_guint8(tvb, *offset + 1)) {
 656                  case 0x00:
 657                      if (fac_tree) {
 658                          fac_subtree = proto_item_add_subtree(ti, ett_x25_fac_mark);
 659                          proto_tree_add_text(fac_subtree, tvb, *offset+1, 1,
 660                                              "Parameter : 00 (Network complementary "
 661                                              "services - calling DTE)");
 662                      }
 663                      break;
 664                  case 0xFF:
 665                      if (fac_tree) {
 666                          fac_subtree = proto_item_add_subtree(ti, ett_x25_fac_mark);
 667                          proto_tree_add_text(fac_subtree, tvb, *offset+1, 1,
 668                                              "Parameter : FF (Network complementary "
 669                                              "services - called DTE)");
 670                      }
 671                      break;
 672                  case 0x0F:
 673                      if (fac_tree) {
 674                          fac_subtree = proto_item_add_subtree(ti, ett_x25_fac_mark);
 675                          proto_tree_add_text(fac_subtree, tvb, *offset+1, 1,
 676                                              "Parameter : 0F (DTE complementary "
 677                                              "services)");
 678                      }
 679                      break;
 680                  default:
 681                      if (fac_tree) {
 682                          fac_subtree = proto_item_add_subtree(ti, ett_x25_fac_mark);
 683                          proto_tree_add_text(fac_subtree, tvb, *offset+1, 1,
 684                                              "Parameter : %02X (Unknown marker)",
 685                                              tvb_get_guint8(tvb, *offset+1));
 686                      }
 687                      break;
 688                  }
 689                  break;
 690              case X25_FAC_REVERSE:
 691                  if (fac_tree) {
 692                      ti = proto_tree_add_text(fac_tree, tvb, *offset, 1, "Code : %02X "
 693                              "(Reverse charging / Fast select)", fac);
 694                      fac_subtree = proto_item_add_subtree(ti, ett_x25_fac_reverse);
 695                      byte1 = tvb_get_guint8(tvb, *offset + 1);
 696                      proto_tree_add_text(fac_subtree, tvb, *offset+1, 1,
 697                              "Parameter : %02X", byte1);
 698                      if (byte1 & 0xC0)
 699                          proto_tree_add_text(fac_subtree, tvb, *offset+1, 1,
 700                                  "11.. .... = Fast select with restriction");
 701                      else if (byte1 & 0x80)
 702                          proto_tree_add_text(fac_subtree, tvb, *offset+1, 1,
 703                                  "10.. .... = Fast select - no restriction");
 704                      else 
 705                          proto_tree_add_text(fac_subtree, tvb, *offset+1, 1,
 706                                  "00.. .... = Fast select not requested");
 707                      proto_tree_add_text(fac_subtree, tvb, *offset+1, 1, "%s",
 708                              decode_boolean_bitfield(byte1, 0x01, 1*8,
 709                                  "Reverse charging requested",
 710                                  "Reverse charging not requested"));
 711                  }
 712                  break;
 713              case X25_FAC_CHARGING_INFO:
 714                  if (fac_tree) {
 715                      ti = proto_tree_add_text(fac_tree, tvb, *offset, 1, "Code : %02X "
 716                              "(Charging information)", fac);
 717                      fac_subtree = proto_item_add_subtree(ti, ett_x25_fac_charging_info);
 718                      byte1 = tvb_get_guint8(tvb, *offset + 1);
 719                      proto_tree_add_text(fac_subtree, tvb, *offset+1, 1,
 720                              "Parameter : %02X", byte1);
 721                      proto_tree_add_text(fac_subtree, tvb, *offset+1, 1, "%s",
 722                              decode_boolean_bitfield(byte1, 0x01, 1*8,
 723                                  "Charging information requested",
 724                                  "Charging information not requested"));
 725                  }
 726                  break;
 727              case X25_FAC_THROUGHPUT:
 728                  if (fac_tree) {
 729                      char *tmpbuf;
 730   
 731                      tmpbuf=ep_alloc(80);
 732                      ti = proto_tree_add_text(fac_tree, tvb, *offset, 1, "Code : %02X "
 733                              "(Throughput class negotiation)", fac);
 734                      fac_subtree = proto_item_add_subtree(ti, ett_x25_fac_throughput);
 735                      byte1 = tvb_get_guint8(tvb, *offset + 1);
 736                      switch (byte1 >> 4)
 737                      {
 738                      case 3:
 739                      case 4:
 740                      case 5:
 741                      case 6:
 742                      case 7:
 743                      case 8:
 744                      case 9:
 745                      case 10:
 746                      case 11:
 747                          g_snprintf(tmpbuf, 80, "From the called DTE : %%u (%d bps)",
 748                                  75*(1<<((byte1 >> 4)-3)));
 749                          break;
 750                      case 12:
 751                          g_snprintf(tmpbuf, 80, "From the called DTE : %%u (48000 bps)");
 752                          break;
 753                      case 13:
 754                          g_snprintf(tmpbuf, 80, "From the called DTE : %%u (64000 bps)");
 755                          break;
 756                      default:
 757                          g_snprintf(tmpbuf, 80, "From the called DTE : %%u (Reserved)");
 758                      }
 759                      proto_tree_add_text(fac_subtree, tvb, *offset+1, 1, "%s",
 760                              decode_numeric_bitfield(byte1, 0xF0, 1*8, tmpbuf));
 761                      switch (byte1 & 0x0F)
 762                      {
 763                      case 3:
 764                      case 4:
 765                      case 5:
 766                      case 6:
 767                      case 7:
 768                      case 8:
 769                      case 9:
 770                      case 10:
 771                      case 11:
 772                          g_snprintf(tmpbuf, 80, "From the calling DTE : %%u (%d bps)",
 773                                  75*(1<<((byte1 & 0x0F)-3)));
 774                          break;
 775                      case 12:
 776                          g_snprintf(tmpbuf, 80, "From the calling DTE : %%u (48000 bps)");
 777                          break;
 778                      case 13:
 779                          g_snprintf(tmpbuf, 80, "From the calling DTE : %%u (64000 bps)");
 780                          break;
 781                      default:
 782                          g_snprintf(tmpbuf, 80, "From the calling DTE : %%u (Reserved)");
 783                      }
 784                      proto_tree_add_text(fac_subtree, tvb, *offset+1, 1, "%s",
 785                              decode_numeric_bitfield(byte1, 0x0F, 1*8, tmpbuf));
 786                  }
 787                  break;
 788              case X25_FAC_CUG:
 789                  if (fac_tree) {
 790                      ti = proto_tree_add_text(fac_tree, tvb, *offset, 1, "Code : %02X "
 791                              "(Closed user group selection)", fac);
 792                      fac_subtree = proto_item_add_subtree(ti, ett_x25_fac_cug);
 793                      proto_tree_add_text(fac_subtree, tvb, *offset+1, 1,
 794                              "Closed user group: %02X", tvb_get_guint8(tvb, *offset+1));
 795                  }
 796                  break;
 797              case X25_FAC_CALLED_MODIF:
 798                  if (fac_tree) {
 799                      ti = proto_tree_add_text(fac_tree, tvb, *offset, 1, "Code : %02X "
 800                              "(Called address modified)", fac);
 801                      fac_subtree = proto_item_add_subtree(ti,
 802                              ett_x25_fac_called_modif);
 803                      proto_tree_add_text(fac_tree, tvb, *offset+1, 1,
 804                              "Parameter %02X", tvb_get_guint8(tvb, *offset+1));
 805                  }
 806                  break;
 807              case X25_FAC_CUG_OUTGOING_ACC:
 808                  if (fac_tree) {
 809                      ti = proto_tree_add_text(fac_tree, tvb, *offset, 1, "Code : %02X "
 810                              "(Closed user group with outgoing access selection)",
 811                              fac);
 812                      fac_subtree = proto_item_add_subtree(ti,
 813                              ett_x25_fac_cug_outgoing_acc);
 814                      proto_tree_add_text(fac_subtree, tvb, *offset+1, 1,
 815                              "Closed user group: %02X", tvb_get_guint8(tvb, *offset+1));
 816                  }
 817                  break;
 818              case X25_FAC_THROUGHPUT_MIN:
 819                  if (fac_tree) {
 820                      ti = proto_tree_add_text(fac_tree, tvb, *offset, 1, "Code : %02X "
 821                              "(Minimum throughput class)", fac);
 822                      fac_subtree = proto_item_add_subtree(ti,
 823                              ett_x25_fac_throughput_min);
 824                      proto_tree_add_text(fac_subtree, tvb, *offset+1, 1,
 825                              "Parameter %02X", tvb_get_guint8(tvb, *offset+1));
 826                  }
 827                  break;
 828              case X25_FAC_EXPRESS_DATA:
 829                  if (fac_tree) {
 830                      ti = proto_tree_add_text(fac_tree, tvb, *offset, 1, "Code : %02X "
 831                              "(Negotiation of express data)", fac);
 832                      fac_subtree = proto_item_add_subtree(ti,
 833                              ett_x25_fac_express_data);
 834                      proto_tree_add_text(fac_subtree, tvb, *offset+1, 1,
 835                              "Parameter %02X", tvb_get_guint8(tvb, *offset+1));
 836                  }
 837                  break;
 838              default:
 839                  if (fac_tree) {
 840                      ti = proto_tree_add_text(fac_tree, tvb, *offset, 1,
 841                              "Code : %02X (Unknown class A)", fac);
 842                      fac_subtree = proto_item_add_subtree(ti, ett_x25_fac_unknown);
 843                      proto_tree_add_text(fac_subtree, tvb, *offset+1, 1,
 844                              "Parameter %02X", tvb_get_guint8(tvb, *offset+1));
 845                  }
 846                  break;
 847              }
 848              (*offset) += 2;
 849              len -= 2;
 850              break;
 851          case X25_FAC_CLASS_B:
 852              switch (fac) {
 853              case X25_FAC_BILATERAL_CUG:
 854                  if (fac_tree) {
 855                      ti = proto_tree_add_text(fac_tree, tvb, *offset, 1, "Code : %02X "
 856                              "(Bilateral closed user group selection)", fac);
 857                      fac_subtree = proto_item_add_subtree(ti,
 858                              ett_x25_fac_bilateral_cug);
 859                      proto_tree_add_text(fac_subtree, tvb, *offset+1, 2,
 860                                          "Bilateral CUG: %04X",
 861                                          tvb_get_ntohs(tvb, *offset+1));
 862                  }
 863                  break;
 864              case X25_FAC_PACKET_SIZE:
 865                  if (fac_tree)
 866                  {
 867                      char *tmpbuf;
 868   
 869                      tmpbuf=ep_alloc(80);
 870                      ti = proto_tree_add_text(fac_tree, tvb, *offset, 1, "Code : %02X "
 871                              "(Packet size)", fac);
 872                      fac_subtree = proto_item_add_subtree(ti, ett_x25_fac_packet_size);
 873                      byte1 = tvb_get_guint8(tvb, *offset + 1);
 874                      switch (byte1)
 875                      {
 876                      case 0x04:
 877                          g_snprintf(tmpbuf, 80, "From the called DTE : %%u (16)");
 878                          break;
 879                      case 0x05:
 880                          g_snprintf(tmpbuf, 80, "From the called DTE : %%u (32)");
 881                          break;
 882                      case 0x06:
 883                          g_snprintf(tmpbuf, 80, "From the called DTE : %%u (64)");
 884                          break;
 885                      case 0x07:
 886                          g_snprintf(tmpbuf, 80, "From the called DTE : %%u (128)");
 887                          break;
 888                      case 0x08:
 889                          g_snprintf(tmpbuf, 80, "From the called DTE : %%u (256)");
 890                          break;
 891                      case 0x09:
 892                          g_snprintf(tmpbuf, 80, "From the called DTE : %%u (512)");
 893                          break;
 894                      case 0x0A:
 895                          g_snprintf(tmpbuf, 80, "From the called DTE : %%u (1024)");
 896                          break;
 897                      case 0x0B:
 898                          g_snprintf(tmpbuf, 80, "From the called DTE : %%u (2048)");
 899                          break;
 900                      case 0x0C:
 901                          g_snprintf(tmpbuf, 80, "From the called DTE : %%u (4096)");
 902                          break;
 903                      default:
 904                          g_snprintf(tmpbuf, 80, "From the called DTE : %%u (Unknown)");
 905                          break;
 906                      }
 907                      proto_tree_add_text(fac_subtree, tvb, *offset+1, 1, "%s",
 908                              decode_numeric_bitfield(byte1, 0x0F, 1*8, tmpbuf));
 909   
 910                      byte2 = tvb_get_guint8(tvb, *offset + 2);
 911                      switch (byte2)
 912                      {
 913                      case 0x04:
 914                          g_snprintf(tmpbuf, 80, "From the calling DTE : %%u (16)");
 915                          break;
 916                      case 0x05:
 917                          g_snprintf(tmpbuf, 80, "From the calling DTE : %%u (32)");
 918                          break;
 919                      case 0x06:
 920                          g_snprintf(tmpbuf, 80, "From the calling DTE : %%u (64)");
 921                          break;
 922                      case 0x07:
 923                          g_snprintf(tmpbuf, 80, "From the calling DTE : %%u (128)");
 924                          break;
 925                      case 0x08:
 926                          g_snprintf(tmpbuf, 80, "From the calling DTE : %%u (256)");
 927                          break;
 928                      case 0x09:
 929                          g_snprintf(tmpbuf, 80, "From the calling DTE : %%u (512)");
 930                          break;
 931                      case 0x0A:
 932                          g_snprintf(tmpbuf, 80, "From the calling DTE : %%u (1024)");
 933                          break;
 934                      case 0x0B:
 935                          g_snprintf(tmpbuf, 80, "From the calling DTE : %%u (2048)");
 936                          break;
 937                      case 0x0C:
 938                          g_snprintf(tmpbuf, 80, "From the calling DTE : %%u (4096)");
 939                          break;
 940                      default:
 941                          g_snprintf(tmpbuf, 80, "From the calling DTE : %%u (Unknown)");
 942                          break;
 943                      }
 944                      proto_tree_add_text(fac_subtree, tvb, *offset+2, 1, "%s",
 945                              decode_numeric_bitfield(byte2, 0x0F, 1*8, tmpbuf));
 946                  }
 947                  break;
 948              case X25_FAC_WINDOW_SIZE:
 949                  if (fac_tree) {
 950                      ti = proto_tree_add_text(fac_tree, tvb, *offset, 1, "Code : %02X "
 951                              "(Window size)", fac);
 952                      fac_subtree = proto_item_add_subtree(ti, ett_x25_fac_window_size);
 953                      proto_tree_add_text(fac_subtree, tvb, *offset+1, 1, "%s",
 954                              decode_numeric_bitfield(tvb_get_guint8(tvb, *offset+1),
 955                                  0x7F, 1*8, "From the called DTE: %u"));
 956                      proto_tree_add_text(fac_subtree, tvb, *offset+2, 1, "%s",
 957                              decode_numeric_bitfield(tvb_get_guint8(tvb, *offset+2),
 958                                  0x7F, 1*8, "From the calling DTE: %u"));
 959                  }
 960                  break;
 961              case X25_FAC_RPOA_SELECTION:
 962                  if (fac_tree) {
 963                      ti = proto_tree_add_text(fac_tree, tvb, *offset, 1, "Code : %02X "
 964                              "(RPOA selection)", fac);
 965                      fac_subtree = proto_item_add_subtree(ti,
 966                              ett_x25_fac_rpoa_selection);
 967                      proto_tree_add_text(fac_subtree, tvb, *offset+1, 2,
 968                                          "Data network identification code : %04X",
 969                                          tvb_get_ntohs(tvb, *offset+1));
 970                  }
 971                  break;
 972              case X25_FAC_CUG_EXT:
 973                  if (fac_tree) {
 974                      ti = proto_tree_add_text(fac_tree, tvb, *offset, 1, "Code : %02X "
 975                              "(Extended closed user group selection)", fac);
 976                      fac_subtree = proto_item_add_subtree(ti, ett_x25_fac_cug_ext);
 977                      proto_tree_add_text(fac_subtree, tvb, *offset+1, 2,
 978                              "Closed user group: %04X", tvb_get_ntohs(tvb, *offset+1));
 979                  }
 980                  break;
 981              case X25_FAC_CUG_OUTGOING_ACC_EXT:
 982                  if (fac_tree) {
 983                      ti = proto_tree_add_text(fac_tree, tvb, *offset, 1, "Code : %02X "
 984                              "(Extended closed user group with outgoing access selection)",
 985                              fac);
 986                      fac_subtree = proto_item_add_subtree(ti,
 987                              ett_x25_fac_cug_outgoing_acc_ext);
 988                      proto_tree_add_text(fac_subtree, tvb, *offset+1, 2,
 989                              "Closed user group: %04X", tvb_get_ntohs(tvb, *offset+1));
 990                  }
 991                  break;
 992              case X25_FAC_TRANSIT_DELAY:
 993                  if (fac_tree) {
 994                      ti = proto_tree_add_text(fac_tree, tvb, *offset, 1, "Code : %02X "
 995                              "(Transit delay selection and indication)", fac);
 996                      fac_subtree = proto_item_add_subtree(ti,
 997                              ett_x25_fac_transit_delay);
 998                      proto_tree_add_text(fac_subtree, tvb, *offset+1, 2,
 999                                          "Transit delay: %d ms",
 1000                                          tvb_get_ntohs(tvb, *offset+1));
 1001                  }
 1002                  break;
 1003              default:
 1004                  if (fac_tree) {
 1005                      ti = proto_tree_add_text(fac_tree, tvb, *offset, 1,
 1006                              "Code : %02X (Unknown class B)", fac);
 1007                      fac_subtree = proto_item_add_subtree(ti, ett_x25_fac_unknown);
 1008                      proto_tree_add_text(fac_subtree, tvb, *offset+1, 2,
 1009                              "Parameter %04X", tvb_get_ntohs(tvb, *offset+1));
 1010                  }
 1011                  break;
 1012              }
 1013              (*offset) += 3;
 1014              len -= 3;
 1015              break;
 1016          case X25_FAC_CLASS_C:
 1017              if (fac_tree) {
 1018                  ti = proto_tree_add_text(fac_tree, tvb, *offset, 1,
 1019                          "Code : %02X (Unknown class C)", fac);
 1020                  fac_subtree = proto_item_add_subtree(ti, ett_x25_fac_unknown);
 1021                  proto_tree_add_text(fac_subtree, tvb, *offset+1, 3,
 1022                          "Parameter %06X",
 1023                          tvb_get_ntoh24(tvb, *offset+1));
 1024              }
 1025              (*offset) += 4;
 1026              len -= 4;
 1027              break;
 1028          case X25_FAC_CLASS_D:
 1029              switch (fac) {
 1030              case X25_FAC_CALL_DURATION:
 1031                  if (fac_tree) {
 1032                      int i;
 1033   
 1034                      ti = proto_tree_add_text(fac_tree, tvb, *offset, 1, "Code : %02X "
 1035                              "(Call duration)", fac);
 1036                      fac_subtree = proto_item_add_subtree(ti,
 1037                              ett_x25_fac_call_duration);
 1038                      byte1 = tvb_get_guint8(tvb, *offset+1);
 1039                      if ((byte1 < 4) || (byte1 % 4)) {
 1040                          proto_tree_add_text(fac_subtree, tvb, *offset+1, 1,
 1041                                  "Bogus length : %d", byte1);
 1042                          return;
 1043                      } else {
 1044                          proto_tree_add_text(fac_subtree, tvb, *offset+1, 1,
 1045                                  "Length : %u", byte1);
 1046                      }
 1047                      for (i = 0; (i<byte1); i+=4) {
 1048                              proto_tree_add_text(fac_subtree, tvb, *offset+2+i, 4,
 1049                                  "Call duration : %u Day(s) %02X:%02X:%02X Hour(s)",
 1050                                  tvb_get_guint8(tvb, *offset+2+i),
 1051                                  tvb_get_guint8(tvb, *offset+3+i),
 1052                                  tvb_get_guint8(tvb, *offset+4+i),
 1053                                  tvb_get_guint8(tvb, *offset+5+i));
 1054                          }
 1055                  }
 1056                  break;
 1057              case X25_FAC_SEGMENT_COUNT:
 1058                  if (fac_tree) {
 1059                          int i;
 1060                      ti = proto_tree_add_text(fac_tree, tvb, *offset, 1, "Code : %02X "
 1061                              "(Segment count)", fac);
 1062                      fac_subtree = proto_item_add_subtree(ti,
 1063                              ett_x25_fac_segment_count);
 1064                      byte1 = tvb_get_guint8(tvb, *offset+1);
 1065                      if ((byte1 < 8) || (byte1 % 8)) {
 1066                          proto_tree_add_text(fac_subtree, tvb, *offset+1, 1,
 1067                                  "Bogus length : %d", byte1);
 1068                          return;
 1069                      } else {
 1070                          proto_tree_add_text(fac_subtree, tvb, *offset+1, 1,
 1071                                  "Length : %u", byte1);
 1072                      }
 1073                      for (i = 0; (i<byte1); i+=8) {
 1074                              proto_tree_add_text(fac_subtree, tvb, *offset+2+i, 4,
 1075                                  "Segments sent to DTE : %02X%02X%02X%02X",
 1076                                  tvb_get_guint8(tvb, *offset+2+i),
 1077                                  tvb_get_guint8(tvb, *offset+3+i),
 1078                                  tvb_get_guint8(tvb, *offset+4+i),
 1079                                  tvb_get_guint8(tvb, *offset+5+i));
 1080                              proto_tree_add_text(fac_subtree, tvb, *offset+6+i, 4,
 1081                                  "Segments received from DTE : %02X%02X%02X%02X",
 1082                                  tvb_get_guint8(tvb, *offset+6+i),
 1083                                  tvb_get_guint8(tvb, *offset+7+i),
 1084                                  tvb_get_guint8(tvb, *offset+8+i),
 1085                                  tvb_get_guint8(tvb, *offset+9+i));
 1086                          }
 1087                  }
 1088                  break;
 1089              case X25_FAC_CALL_TRANSFER:
 1090                  if (fac_tree) {
 1091                      int i;
 1092                      char *tmpbuf;
 1093   
 1094                      tmpbuf=ep_alloc(258);
 1095                      ti = proto_tree_add_text(fac_tree, tvb, *offset, 1, "Code : %02X "
 1096                              "(Call redirection or deflection notification)", fac);
 1097                      fac_subtree = proto_item_add_subtree(ti, ett_x25_fac_call_transfer);
 1098                      byte1 = tvb_get_guint8(tvb, *offset+1);
 1099                      if (byte1 < 2) {
 1100                          proto_tree_add_text(fac_subtree, tvb, *offset+1, 1,
 1101                                  "Bogus length : %d", byte1);
 1102                          return;
 1103                      } else {
 1104                          proto_tree_add_text(fac_subtree, tvb, *offset+1, 1,
 1105                                  "Length : %u", byte1);
 1106                      }
 1107                      byte2 = tvb_get_guint8(tvb, *offset+2);
 1108                      if ((byte2 & 0xC0) == 0xC0) {
 1109                          proto_tree_add_text(fac_subtree, tvb, *offset+2, 1,
 1110                                  "Reason : call deflection by the originally "
 1111                                  "called DTE address");
 1112                      }
 1113                      else {
 1114                          switch (byte2) {
 1115                          case 0x01:
 1116                              proto_tree_add_text(fac_subtree, tvb, *offset+2, 1,
 1117                                      "Reason : originally called DTE busy");
 1118                              break;
 1119                          case 0x07:
 1120                              proto_tree_add_text(fac_subtree, tvb, *offset+2, 1,
 1121                                      "Reason : call dist. within a hunt group");
 1122                              break;
 1123                          case 0x09:
 1124                              proto_tree_add_text(fac_subtree, tvb, *offset+2, 1,
 1125                                      "Reason : originally called DTE out of order");
 1126                              break;
 1127                          case 0x0F:
 1128                              proto_tree_add_text(fac_subtree, tvb, *offset+2, 1,
 1129                                      "Reason : systematic call redirection");
 1130                              break;
 1131                          default:
 1132                              proto_tree_add_text(fac_subtree, tvb, *offset+2, 1,
 1133                                      "Reason : unknown");
 1134                              break;
 1135                          }
 1136                      }
 1137                      byte3 = tvb_get_guint8(tvb, *offset+3);
 1138                      proto_tree_add_text(fac_subtree, tvb, *offset+3, 1,
 1139                              "Number of semi-octets in DTE address : %u",
 1140                              byte3);
 1141                      for (i = 0; (i<byte3)&&(i<256); i++) {
 1142                          if (i % 2 == 0) {
 1143                              tmpbuf[i] = ((tvb_get_guint8(tvb, *offset+4+i/2) >> 4)
 1144                                      & 0x0F) + '0';
 1145                              /* if > 9, convert to the right hexadecimal letter */
 1146                              if (tmpbuf[i] > '9') tmpbuf[i] += ('A' - '0' - 10);
 1147                          } else {
 1148                              tmpbuf[i] = (tvb_get_guint8(tvb, *offset+4+i/2)
 1149                                      & 0x0F) + '0';
 1150                              /* if > 9, convert to the right hexadecimal letter */
 1151                              if (tmpbuf[i] > '9') tmpbuf[i] += ('A' - '0' - 10);
 1152                          }
 1153                      }
 1154                      tmpbuf[i] = 0;
 1155                      proto_tree_add_text(fac_subtree, tvb, *offset+4, byte1 - 2,
 1156                              "DTE address : %s", tmpbuf);
 1157                  }
 1158                  break;
 1159              case X25_FAC_RPOA_SELECTION_EXT:
 1160                  if (fac_tree) {
 1161                      int i;
 1162   
 1163                      ti = proto_tree_add_text(fac_tree, tvb, *offset, 1, "Code : %02X "
 1164                              "(Extended RPOA selection)", fac);
 1165                      fac_subtree = proto_item_add_subtree(ti,
 1166                              ett_x25_fac_rpoa_selection_ext);
 1167                      byte1 = tvb_get_guint8(tvb, *offset+1);
 1168                      if ((byte1 < 2) || (byte1 % 2)) {
 1169                          proto_tree_add_text(fac_subtree, tvb, *offset+1, 1,
 1170                                  "Bogus length : %d", byte1);
 1171                          return;
 1172                      } else {
 1173                          proto_tree_add_text(fac_subtree, tvb, *offset+1, 1,
 1174                                  "Length : %u", byte1);
 1175                      }
 1176                      for (i = 0; (i<byte1); i+=2) {
 1177                              proto_tree_add_text(fac_subtree, tvb, *offset+2+i, 2,
 1178                                  "Data network identification code : %04X",
 1179                                  tvb_get_ntohs(tvb, *offset+2+i));
 1180                          }
 1181                  }
 1182                  break;
 1183              case X25_FAC_CALLING_ADDR_EXT:
 1184                  if (fac_tree) {
 1185                      int i;
 1186                      char *tmpbuf;
 1187   
 1188                      tmpbuf=ep_alloc(258);
 1189                      ti = proto_tree_add_text(fac_tree, tvb, *offset, 1, "Code : %02X "
 1190                              "(Calling address extension)", fac);
 1191                      fac_subtree = proto_item_add_subtree(ti,
 1192                              ett_x25_fac_calling_addr_ext);
 1193                      byte1 = tvb_get_guint8(tvb, *offset+1);
 1194                      if (byte1 < 1) {
 1195                          proto_tree_add_text(fac_subtree, tvb, *offset+1, 1,
 1196                                  "Bogus length : %d", byte1);
 1197                          return;
 1198                      } else {
 1199                          proto_tree_add_text(fac_subtree, tvb, *offset+1, 1,
 1200                                  "Length : %u", byte1);
 1201                      }
 1202                      byte2 = tvb_get_guint8(tvb, *offset+2) & 0x3F;
 1203                      proto_tree_add_text(fac_subtree, tvb, *offset+2, 1,
 1204                              "Number of semi-octets in DTE address : %u", byte2);
 1205                      for (i = 0; (i<byte2)&&(i<256) ; i++) {
 1206                          if (i % 2 == 0) {
 1207                              tmpbuf[i] = ((tvb_get_guint8(tvb, *offset+3+i/2) >> 4)
 1208                                      & 0x0F) + '0';
 1209                              /* if > 9, convert to the right hexadecimal letter */
 1210                              if (tmpbuf[i] > '9') tmpbuf[i] += ('A' - '0' - 10);
 1211                          } else {
 1212                              tmpbuf[i] = (tvb_get_guint8(tvb, *offset+3+i/2)
 1213                                      & 0x0F) + '0';
 1214                              /* if > 9, convert to the right hexadecimal letter */
 1215                              if (tmpbuf[i] > '9') tmpbuf[i] += ('A' - '0' - 10);
 1216                          }
 1217                      }
 1218                      tmpbuf[i] = 0;
 1219                      proto_tree_add_text(fac_subtree, tvb, *offset+3, byte1 - 1,
 1220                              "DTE address : %s", tmpbuf);
 1221                  }
 1222                  break;
 1223              case X25_FAC_MONETARY_UNIT:
 1224                  if (fac_tree) {
 1225                      ti = proto_tree_add_text(fac_tree, tvb, *offset, 1, "Code : %02X "
 1226                              "(Monetary Unit)", fac);
 1227                      fac_subtree = proto_item_add_subtree(ti,
 1228                              ett_x25_fac_monetary_unit);
 1229                      byte1 = tvb_get_guint8(tvb, *offset+1);
 1230                      proto_tree_add_text(fac_subtree, tvb, *offset+1, 1,
 1231                              "Length : %u", byte1);
 1232                      proto_tree_add_text(fac_subtree, tvb, *offset+2, byte1, "Value");
 1233                  }
 1234                  break;
 1235              case X25_FAC_NUI:
 1236                  if (fac_tree) {
 1237                      ti = proto_tree_add_text(fac_tree, tvb, *offset, 1, "Code : %02X "
 1238                              "(Network User Identification selection)", fac);
 1239                      fac_subtree = proto_item_add_subtree(ti,
 1240                              ett_x25_fac_nui);
 1241                      byte1 = tvb_get_guint8(tvb, *offset+1);
 1242                      proto_tree_add_text(fac_subtree, tvb, *offset+1, 1,
 1243                              "Length : %u", byte1);
 1244                      proto_tree_add_text(fac_subtree, tvb, *offset+2, byte1, "NUI");
 1245                  }
 1246                  break;
 1247              case X25_FAC_CALLED_ADDR_EXT:
 1248                  if (fac_tree) {
 1249                      int i;
 1250                      char *tmpbuf;
 1251   
 1252                      tmpbuf=ep_alloc(258);
 1253                      ti = proto_tree_add_text(fac_tree, tvb, *offset, 1, "Code : %02X "
 1254                              "(Called address extension)", fac);
 1255                      fac_subtree = proto_item_add_subtree(ti,
 1256                              ett_x25_fac_called_addr_ext);
 1257                      byte1 = tvb_get_guint8(tvb, *offset+1);
 1258                      if (byte1 < 1) {
 1259                          proto_tree_add_text(fac_subtree, tvb, *offset+1, 1,
 1260                                  "Bogus length : %d", byte1);
 1261                          return;
 1262                      } else {
 1263                          proto_tree_add_text(fac_subtree, tvb, *offset+1, 1,
 1264                                  "Length : %u", byte1);
 1265                      }
 1266                      byte2 = tvb_get_guint8(tvb, *offset+2) & 0x3F;
 1267                      proto_tree_add_text(fac_subtree, tvb, *offset+2, 1,
 1268                              "Number of semi-octets in DTE address : %u", byte2);
 1269                      for (i = 0; (i<byte2)&&(i<256) ; i++) {
 1270                          if (i % 2 == 0) {
 1271                              tmpbuf[i] = ((tvb_get_guint8(tvb, *offset+3+i/2) >> 4)
 1272                                      & 0x0F) + '0';
 1273                              /* if > 9, convert to the right hexadecimal letter */
 1274                              if (tmpbuf[i] > '9') tmpbuf[i] += ('A' - '0' - 10);
 1275                          } else {
 1276                              tmpbuf[i] = (tvb_get_guint8(tvb, *offset+3+i/2)
 1277                                      & 0x0F) + '0';
 1278                              /* if > 9, convert to the right hexadecimal letter */
 1279                              if (tmpbuf[i] > '9') tmpbuf[i] += ('A' - '0' - 10);
 1280                          }
 1281                      }
 1282                      tmpbuf[i] = 0;
 1283                      proto_tree_add_text(fac_subtree, tvb, *offset+3, byte1 - 1,
 1284                              "DTE address : %s", tmpbuf);
 1285                  }
 1286                  break;
 1287              case X25_FAC_ETE_TRANSIT_DELAY:
 1288                  if (fac_tree) {
 1289                      ti = proto_tree_add_text(fac_tree, tvb, *offset, 1, "Code : %02X "
 1290                              "(End to end transit delay)", fac);
 1291                      fac_subtree = proto_item_add_subtree(ti,
 1292                              ett_x25_fac_ete_transit_delay);
 1293                      byte1 = tvb_get_guint8(tvb, *offset+1);
 1294                      proto_tree_add_text(fac_subtree, tvb, *offset+1, 1,
 1295                              "Length : %u", byte1);
 1296                      proto_tree_add_text(fac_subtree, tvb, *offset+2, byte1, "Value");
 1297                  }
 1298                  break;
 1299              case X25_FAC_CALL_DEFLECT:
 1300                  if (fac_tree) {
 1301                      int i;
 1302                      char *tmpbuf;
 1303   
 1304                      tmpbuf=ep_alloc(258);
 1305                      ti = proto_tree_add_text(fac_tree, tvb, *offset, 1, "Code : %02X "
 1306                              "(Call deflection selection)", fac);
 1307                      fac_subtree = proto_item_add_subtree(ti,
 1308                              ett_x25_fac_call_deflect);
 1309                      byte1 = tvb_get_guint8(tvb, *offset+1);
 1310                      if (byte1 < 2) {
 1311                          proto_tree_add_text(fac_subtree, tvb, *offset+1, 1,
 1312                                  "Bogus length : %d", byte1);
 1313                          return;
 1314                      } else {
 1315                          proto_tree_add_text(fac_subtree, tvb, *offset+1, 1,
 1316                                  "Length : %u", byte1);
 1317                      }
 1318                      byte2 = tvb_get_guint8(tvb, *offset+2);
 1319                      if ((byte2 & 0xC0) == 0xC0)
 1320                          proto_tree_add_text(fac_subtree, tvb, *offset+2, 1,
 1321                                  "Reason : call DTE originated");
 1322                      else 
 1323                          proto_tree_add_text(fac_subtree, tvb, *offset+2, 1,
 1324                                  "Reason : unknown");
 1325                      byte3 = tvb_get_guint8(tvb, *offset+3);
 1326                      proto_tree_add_text(fac_subtree, tvb, *offset+3, 1,
 1327                              "Number of semi-octets in the alternative DTE address : %u",
 1328                              byte3);
 1329                      for (i = 0; (i<byte3)&&(i<256) ; i++) {
 1330                          if (i % 2 == 0) {
 1331                              tmpbuf[i] = ((tvb_get_guint8(tvb, *offset+4+i/2) >> 4)
 1332                                      & 0x0F) + '0';
 1333                              /* if > 9, convert to the right hexadecimal letter */
 1334                              if (tmpbuf[i] > '9') tmpbuf[i] += ('A' - '0' - 10);
 1335                          } else {
 1336                              tmpbuf[i] = (tvb_get_guint8(tvb, *offset+4+i/2)
 1337                                      & 0x0F) + '0';
 1338                              /* if > 9, convert to the right hexadecimal letter */
 1339                              if (tmpbuf[i] > '9') tmpbuf[i] += ('A' - '0' - 10);
 1340                          }
 1341                      }
 1342                      tmpbuf[i] = 0;
 1343                      proto_tree_add_text(fac_subtree, tvb, *offset+4, byte1 - 2,
 1344                              "Alternative DTE address : %s", tmpbuf);
 1345                  }
 1346                  break;
 1347              case X25_FAC_PRIORITY:
 1348                  if (fac_tree) {
 1349                      ti = proto_tree_add_text(fac_tree, tvb, *offset, 1,
 1350                              "Code : %02X (Priority)", fac);
 1351                      fac_subtree = proto_item_add_subtree(ti, ett_x25_fac_priority);
 1352                      byte1 = tvb_get_guint8(tvb, *offset+1);
 1353                      proto_tree_add_text(fac_subtree, tvb, *offset+1, 1,
 1354                              "Length : %u", byte1);
 1355                      proto_tree_add_text(fac_subtree, tvb, *offset+2, byte1, "Value");
 1356                  }
 1357                  break;
 1358              default:
 1359                  if (fac_tree) {
 1360                      ti = proto_tree_add_text(fac_tree, tvb, *offset, 1,
 1361                              "Code : %02X (Unknown class D)", fac);
 1362                      fac_subtree = proto_item_add_subtree(ti, ett_x25_fac_unknown);
 1363                      byte1 = tvb_get_guint8(tvb, *offset+1);
 1364                      proto_tree_add_text(fac_subtree, tvb, *offset+1, 1,
 1365                              "Length : %u", byte1);
 1366                      proto_tree_add_text(fac_subtree, tvb, *offset+2, byte1, "Value");
 1367                  }
 1368              }
 1369              byte1 = tvb_get_guint8(tvb, *offset+1);
 1370              (*offset) += byte1+2;
 1371              len -= byte1+2;
 1372              break;
 1373          }
 1374      }
 1375  }
Show more  




Change Warning 5587.35891 : Format String

Priority:
State:
Finding:
Owner:
Note: