(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-ncp.c) |
| |
| 302 | | | dissect_ncp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, |
| 303 | | | gboolean is_tcp) |
| 304 | | | { |
| 305 | | | proto_tree *ncp_tree = NULL; |
| 306 | | | proto_item *ti; |
| 307 | | | struct ncpiph; |
| 308 | | | struct ncp_ip_rqhdr ncpiphrq; |
| 309 | | | guint16 ncp_burst_seqno, ncp_ack_seqno; |
| 310 | | | guint16 flags = 0; |
| 311 | | | proto_tree *flags_tree = NULL; |
| 312 | | | int hdr_offset = 0; |
| 313 | | | int commhdr = 0; |
| 314 | | | int offset = 0; |
| 315 | | | gint length_remaining; |
| 316 | | | tvbuff_t *next_tvb; |
| 317 | | | guint32 testvar = 0, ncp_burst_command, burst_len, burst_off, burst_file; |
| 318 | | | guint8 subfunction; |
| 319 | | | guint32 nw_connection = 0, data_offset; |
| 320 | | | guint16 data_len = 0; |
| 321 | | | guint16 missing_fraglist_count = 0; |
| 322 | | | mncp_rhash_value *request_value = NULL; |
| 323 | | | conversation_t *conversation; |
| 324 | | | proto_item *expert_item; |
| 325 | | | |
| 326 | | | if (check_col(pinfo->cinfo, COL_PROTOCOL)) |
| 327 | | | col_set_str(pinfo->cinfo, COL_PROTOCOL, "NCP"); |
| 328 | | | if (check_col(pinfo->cinfo, COL_INFO)) |
| 329 | | | col_clear(pinfo->cinfo, COL_INFO); |
| 330 | | | |
| 331 | | | hdr_offset = 0; |
Useless Assignment
This code assigns the variable the same value it already had. |
|
| 332 | | | ncp_hdr = &; |
| 333 | | | commhdr = hdr_offset; |
| 334 | | | |
| 335 | | | ti = proto_tree_add_item(tree, proto_ncp, tvb, 0, -1, FALSE); |
| 336 | | | ncp_tree = proto_item_add_subtree(ti, ett_ncp); |
| 337 | | | if (is_tcp) { |
| 338 | | | if (tvb_get_ntohl(tvb, hdr_offset) != NCPIP_RQST && tvb_get_ntohl(tvb, hdr_offset) != NCPIP_RPLY) |
| 339 | | | commhdr += 1; |
| 340 | | | |
| 341 | | | ncpiph.signature = tvb_get_ntohl(tvb, commhdr); |
| 342 | | | proto_tree_add_uint(ncp_tree, hf_ncp_ip_sig, tvb, commhdr, 4, ncpiph.signature); |
| 343 | | | ncpiph.length = (0x7fffffff & tvb_get_ntohl(tvb, commhdr+4)); |
| 344 | | | proto_tree_add_uint(ncp_tree, hf_ncp_ip_length, tvb, commhdr+4, 4, ncpiph.length); |
| 345 | | | commhdr += 8; |
| 346 | | | if (ncpiph.signature == NCPIP_RQST) { |
| 347 | | | ncpiphrq.version = tvb_get_ntohl(tvb, commhdr); |
| 348 | | | proto_tree_add_uint(ncp_tree, hf_ncp_ip_ver, tvb, commhdr, 4, ncpiphrq.version); |
| 349 | | | commhdr += 4; |
| 350 | | | ncpiphrq.rplybufsize = tvb_get_ntohl(tvb, commhdr); |
| 351 | | | proto_tree_add_uint(ncp_tree, hf_ncp_ip_rplybufsize, tvb, commhdr, 4, ncpiphrq.rplybufsize); |
| 352 | | | commhdr += 4; |
| 353 | | | } |
| 354 | | | |
| 355 | | | if (match_strval(tvb_get_ntohs(tvb, commhdr), ncp_type_vals)==NULL) { |
| 356 | | | |
| 357 | | | if (match_strval(tvb_get_ntohs(tvb, commhdr+8), ncp_type_vals)!=NULL) { |
| 358 | | | proto_tree_add_item(ncp_tree, hf_ncp_ip_packetsig, tvb, commhdr, 8, FALSE); |
| 359 | | | commhdr += 8; |
| 360 | | | } |
| 361 | | | } |
| 362 | | | } else { |
| 363 | | | |
| 364 | | | memset(&ncpiph, 0, sizeof(ncpiph)); |
| 365 | | | } |
| 366 | | | |
| 367 | | | .type = tvb_get_ntohs(tvb, commhdr); |
| 368 | | | .sequence = tvb_get_guint8(tvb, commhdr+2); |
| 369 | | | .conn_low = tvb_get_guint8(tvb, commhdr+3); |
| 370 | | | .task = tvb_get_guint8(tvb, commhdr+4); |
| 371 | | | .conn_high = tvb_get_guint8(tvb, commhdr+5); |
| 372 | | | proto_tree_add_uint(ncp_tree, hf_ncp_type, tvb, commhdr, 2, .type); |
| 373 | | | nw_connection = (.conn_high*256)+.conn_low; |
| 374 | | | |
| 375 | | | |
| 376 | | | |
| 377 | | | |
| 378 | | | |
| 379 | | | conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, |
| 380 | | | PT_NCP, (guint32) pinfo->srcport, (guint32) pinfo->destport, |
| 381 | | | 0); |
| 382 | | | if ((ncpiph.length & 0x80000000) || ncpiph.signature == NCPIP_RPLY) { |
| 383 | | | |
| 384 | | | |
| 385 | | | |
| 386 | | | if (!pinfo->fd->flags.visited) { |
| 387 | | | if (conversation != NULL) { |
| 388 | | | |
| 389 | | | |
| 390 | | | |
| 391 | | | |
| 392 | | | request_value = mncp_hash_lookup(conversation, nw_connection, .task); |
| 393 | | | |
| 394 | | | |
| 395 | | | |
| 396 | | | if (request_value == NULL) { |
| 397 | | | request_value = mncp_hash_insert(conversation, nw_connection, .task, pinfo); |
| 398 | | | } |
| 399 | | | } else { |
| 400 | | | |
| 401 | | | |
| 402 | | | |
| 403 | | | conversation = conversation_new(pinfo->fd->num, &pinfo->src, |
| 404 | | | &pinfo->dst, PT_NCP, (guint32) pinfo->srcport, (guint32) pinfo->destport, 0); |
| 405 | | | request_value = mncp_hash_insert(conversation, nw_connection, .task, pinfo); |
| 406 | | | } |
| 407 | | | |
| 408 | | | |
| 409 | | | |
| 410 | | | if (ncpiph.signature == NCPIP_RPLY) { |
| 411 | | | |
| 412 | | | |
| 413 | | | |
| 414 | | | |
| 415 | | | |
| 416 | | | request_value = mncp_hash_lookup(conversation, nw_connection, .task); |
| 417 | | | } |
| 418 | | | } else { |
| 419 | | | |
| 420 | | | request_value = mncp_hash_lookup(conversation, nw_connection, .task); |
| 421 | | | if (request_value) { |
| 422 | | | if ((request_value->session_start_packet_num == pinfo->fd->num) && ncp_echo_conn) |
| 423 | | | { |
| 424 | | | expert_add_info_format(pinfo, NULL, PI_RESPONSE_CODE, PI_CHAT, "Detected New Server Session. Connection %d, Task %d", nw_connection, .task); |
| 425 | | | } |
| 426 | | | } |
| 427 | | | } |
| 428 | | | } else { |
| 429 | | | if (!pinfo->fd->flags.visited) { |
| 430 | | | if (conversation != NULL) { |
| 431 | | | |
| 432 | | | |
| 433 | | | |
| 434 | | | |
| 435 | | | request_value = mncp_hash_lookup(conversation, nw_connection, .task); |
| 436 | | | |
| 437 | | | |
| 438 | | | |
| 439 | | | if (request_value == NULL) { |
| 440 | | | request_value = mncp_hash_insert(conversation, nw_connection, .task, pinfo); |
| 441 | | | } |
| 442 | | | } else { |
| 443 | | | |
| 444 | | | |
| 445 | | | |
| 446 | | | conversation = conversation_new(pinfo->fd->num, &pinfo->src, |
| 447 | | | &pinfo->dst, PT_NCP, (guint32) pinfo->srcport, (guint32) pinfo->destport, 0); |
| 448 | | | request_value = mncp_hash_insert(conversation, nw_connection, .task, pinfo); |
| 449 | | | } |
| 450 | | | |
| 451 | | | |
| 452 | | | |
| 453 | | | } else { |
| 454 | | | request_value = mncp_hash_lookup(conversation, nw_connection, .task); |
| 455 | | | if (request_value) { |
| 456 | | | if ((request_value->session_start_packet_num == pinfo->fd->num) && ncp_echo_conn) |
| 457 | | | { |
| 458 | | | expert_add_info_format(pinfo, NULL, PI_RESPONSE_CODE, PI_CHAT, "Detected New Server Session. Connection %d, Task %d", nw_connection, .task); |
| 459 | | | } |
| 460 | | | } |
| 461 | | | } |
| 462 | | | } |
| 463 | | | |
| 464 | | | tap_queue_packet(ncp_tap.hdr, pinfo, ncp_hdr); |
| 465 | | | |
| 466 | | | if (check_col(pinfo->cinfo, COL_INFO)) { |
| 467 | | | col_add_str(pinfo->cinfo, COL_INFO, |
| 468 | | | val_to_str(.type, ncp_type_vals, "Unknown type (0x%04x)")); |
| 469 | | | } |
| 470 | | | |
| 471 | | | |
| 472 | | | |
| 473 | | | |
| 474 | | | switch (.type) { |
| 475 | | | |
| 476 | | | case NCP_BROADCAST_SLOT: |
| 477 | | | proto_tree_add_uint(ncp_tree, hf_ncp_seq, tvb, commhdr + 2, 1, .sequence); |
| 478 | | | proto_tree_add_uint(ncp_tree, hf_ncp_connection,tvb, commhdr + 3, 3, nw_connection); |
| 479 | | | proto_tree_add_item(ncp_tree, hf_ncp_task, tvb, commhdr + 4, 1, FALSE); |
| 480 | | | proto_tree_add_item(ncp_tree, hf_ncp_oplock_flag, tvb, commhdr + 9, 1, tvb_get_guint8(tvb, commhdr+9)); |
| 481 | | | proto_tree_add_item(ncp_tree, hf_ncp_oplock_handle, tvb, commhdr + 10, 4, FALSE); |
| 482 | | | if ((tvb_get_guint8(tvb, commhdr+9)==0x24) && ncp_echo_file) |
| 483 | | | { |
| 484 | | | expert_add_info_format(pinfo, NULL, PI_RESPONSE_CODE, PI_CHAT, "Server requesting station to clear oplock on handle - %08x", tvb_get_ntohl(tvb, commhdr+10)); |
| 485 | | | } |
| 486 | | | break; |
| 487 | | | |
| 488 | | | case NCP_LIP_ECHO: |
| 489 | | | proto_tree_add_item(ncp_tree, hf_lip_echo, tvb, commhdr, 13, FALSE); |
| 490 | | | break; |
| 491 | | | |
| 492 | | | case NCP_BURST_MODE_XFER: |
| 493 | | | |
| 494 | | | |
| 495 | | | |
| 496 | | | |
| 497 | | | |
| 498 | | | |
| 499 | | | |
| 500 | | | |
| 501 | | | |
| 502 | | | |
| 503 520 |  | | [ Lines 503 to 520 omitted. ] |
| 521 | | | |
| 522 | | | |
| 523 | | | |
| 524 | | | |
| 525 | | | |
| 526 | | | |
| 527 | | | |
| 528 | | | |
| 529 | | | |
| 530 | | | |
| 531 | | | flags = tvb_get_guint8(tvb, commhdr + 2); |
| 532 | | | |
| 533 | | | ti = proto_tree_add_uint(ncp_tree, hf_ncp_system_flags, |
| 534 | | | tvb, commhdr + 2, 1, flags); |
| 535 | | | flags_tree = proto_item_add_subtree(ti, ett_ncp_system_flags); |
| 536 | | | |
| 537 | | | proto_tree_add_item(flags_tree, hf_ncp_system_flags_abt, |
| 538 | | | tvb, commhdr + 2, 1, FALSE); |
| 539 | | | if (flags & ABT) { |
| 540 | | | proto_item_append_text(ti, " ABT"); |
| 541 | | | } |
| 542 | | | flags&=(~( ABT )); |
| 543 | | | |
| 544 | | | proto_tree_add_item(flags_tree, hf_ncp_system_flags_bsy, |
| 545 | | | tvb, commhdr + 2, 1, FALSE); |
| 546 | | | if (flags & BSY) { |
| 547 | | | proto_item_append_text(ti, " BSY"); |
| 548 | | | } |
| 549 | | | flags&=(~( BSY )); |
| 550 | | | |
| 551 | | | proto_tree_add_item(flags_tree, hf_ncp_system_flags_eob, |
| 552 | | | tvb, commhdr + 2, 1, FALSE); |
| 553 | | | if (flags & EOB) { |
| 554 | | | proto_item_append_text(ti, " EOB"); |
| 555 | | | } |
| 556 | | | flags&=(~( EOB )); |
| 557 | | | |
| 558 | | | proto_tree_add_item(flags_tree, hf_ncp_system_flags_lst, |
| 559 | | | tvb, commhdr + 2, 1, FALSE); |
| 560 | | | if (flags & LST) { |
| 561 | | | proto_item_append_text(ti, " LST"); |
| 562 | | | } |
| 563 | | | flags&=(~( LST )); |
| 564 | | | |
| 565 | | | proto_tree_add_item(flags_tree, hf_ncp_system_flags_sys, |
| 566 | | | tvb, commhdr + 2, 1, FALSE); |
| 567 | | | if (flags & SYS) { |
| 568 | | | proto_item_append_text(ti, " SYS"); |
| 569 | | | } |
| 570 | | | flags&=(~( SYS )); |
| 571 | | | |
| 572 | | | |
| 573 | | | proto_tree_add_item(ncp_tree, hf_ncp_stream_type, |
| 574 | | | tvb, commhdr + 3, 1, FALSE); |
| 575 | | | proto_tree_add_item(ncp_tree, hf_ncp_src_connection, |
| 576 | | | tvb, commhdr + 4, 4, FALSE); |
| 577 | | | proto_tree_add_item(ncp_tree, hf_ncp_dst_connection, |
| 578 | | | tvb, commhdr + 8, 4, FALSE); |
| 579 | | | proto_tree_add_item(ncp_tree, hf_ncp_packet_seqno, |
| 580 | | | tvb, commhdr + 12, 4, FALSE); |
| 581 | | | proto_tree_add_item(ncp_tree, hf_ncp_delay_time, |
| 582 | | | tvb, commhdr + 16, 4, FALSE); |
| 583 | | | ncp_burst_seqno = tvb_get_ntohs(tvb, commhdr+20); |
| 584 | | | proto_tree_add_item(ncp_tree, hf_ncp_burst_seqno, |
| 585 | | | tvb, commhdr + 20, 2, FALSE); |
| 586 | | | ncp_ack_seqno = tvb_get_ntohs(tvb, commhdr+22); |
| 587 | | | proto_tree_add_item(ncp_tree, hf_ncp_ack_seqno, |
| 588 | | | tvb, commhdr + 22, 2, FALSE); |
| 589 | | | proto_tree_add_item(ncp_tree, hf_ncp_burst_len, |
| 590 | | | tvb, commhdr + 24, 4, FALSE); |
| 591 | | | data_offset = tvb_get_ntohl(tvb, commhdr + 28); |
| 592 | | | proto_tree_add_uint(ncp_tree, hf_ncp_data_offset, |
| 593 | | | tvb, commhdr + 28, 4, data_offset); |
| 594 | | | data_len = tvb_get_ntohs(tvb, commhdr + 32); |
| 595 | | | proto_tree_add_uint(ncp_tree, hf_ncp_data_bytes, |
| 596 | | | tvb, commhdr + 32, 2, data_len); |
| 597 | | | missing_fraglist_count = tvb_get_ntohs(tvb, commhdr + 34); |
| 598 | | | proto_tree_add_item(ncp_tree, hf_ncp_missing_fraglist_count, |
| 599 | | | tvb, commhdr + 34, 2, FALSE); |
| 600 | | | offset = commhdr + 36; |
| 601 | | | if (!(flags & SYS) && ncp_burst_seqno == ncp_ack_seqno && |
| 602 | | | data_offset == 0) { |
| 603 | | | |
| 604 | | | |
| 605 | | | |
| 606 | | | |
| 607 | | | |
| 608 | | | |
| 609 | | | |
| 610 | | | if (data_len < 4) |
| 611 | | | return; |
| 612 | | | ncp_burst_command = tvb_get_ntohl(tvb, offset); |
| 613 | | | proto_tree_add_item(ncp_tree, hf_ncp_burst_command, |
| 614 | | | tvb, offset, 4, FALSE); |
| 615 | | | offset += 4; |
| 616 | | | data_len -= 4; |
| 617 | | | |
| 618 | | | if (data_len < 4) |
| 619 | | | return; |
| 620 | | | burst_file = tvb_get_ntohl(tvb, offset); |
| 621 | | | proto_tree_add_item(ncp_tree, hf_ncp_burst_file_handle, |
| 622 | | | tvb, offset, 4, FALSE); |
| 623 | | | offset += 4; |
| 624 | | | data_len -= 4; |
| 625 | | | |
| 626 | | | if (data_len < 8) |
| 627 | | | return; |
| 628 | | | proto_tree_add_item(ncp_tree, hf_ncp_burst_reserved, |
| 629 | | | tvb, offset, 8, FALSE); |
| 630 | | | offset += 8; |
| 631 | | | data_len -= 8; |
| 632 | | | |
| 633 | | | if (data_len < 4) |
| 634 | | | return; |
| 635 | | | burst_off = tvb_get_ntohl(tvb, offset); |
| 636 | | | proto_tree_add_uint(ncp_tree, hf_ncp_burst_offset, |
| 637 | | | tvb, offset, 4, burst_off); |
| 638 | | | offset += 4; |
| 639 | | | data_len -= 4; |
| 640 | | | |
| 641 | | | if (data_len < 4) |
| 642 | | | return; |
| 643 | | | burst_len = tvb_get_ntohl(tvb, offset); |
| 644 | | | proto_tree_add_uint(ncp_tree, hf_ncp_burst_len, |
| 645 | | | tvb, offset, 4, burst_len); |
| 646 | | | offset += 4; |
| 647 | | | data_len -= 4; |
| 648 | | | |
| 649 | | | if (check_col(pinfo->cinfo, COL_INFO)) { |
| 650 | | | col_add_fstr(pinfo->cinfo, COL_INFO, |
| 651 | | | "%s %d bytes starting at offset %d in file 0x%08x", |
| 652 | | | val_to_str(ncp_burst_command, |
| 653 | | | burst_command, "Unknown (0x%08x)"), |
| 654 | | | burst_len, burst_off, burst_file); |
| 655 | | | } |
| 656 | | | break; |
| 657 | | | } else { |
| 658 | | | if (tvb_get_guint8(tvb, commhdr + 2) & 0x10) { |
| 659 | | | if (check_col(pinfo->cinfo, COL_INFO)) { |
| 660 | | | col_set_str(pinfo->cinfo, COL_INFO, |
| 661 | | | "End of Burst"); |
| 662 | | | } |
| 663 | | | } |
| 664 | | | } |
| 665 | | | break; |
| 666 | | | |
| 667 | | | case NCP_ALLOCATE_SLOT: |
| 668 | | | length_remaining = tvb_length_remaining(tvb, commhdr + 4); |
| 669 | | | if (length_remaining > 4) { |
| 670 | | | testvar = tvb_get_ntohl(tvb, commhdr+4); |
| 671 | | | if (testvar == 0x4c495020) { |
| 672 | | | proto_tree_add_item(ncp_tree, hf_lip_echo, tvb, commhdr+4, 13, FALSE); |
| 673 | | | break; |
| 674 | | | } |
| 675 | | | } |
| 676 | | | |
| 677 | | | |
| 678 | | | case NCP_POSITIVE_ACK: |
| 679 | | | case NCP_SERVICE_REQUEST: |
| 680 | | | case NCP_SERVICE_REPLY: |
| 681 | | | case NCP_WATCHDOG: |
| 682 | | | case NCP_DEALLOCATE_SLOT: |
| 683 | | | default: |
| 684 | | | proto_tree_add_uint(ncp_tree, hf_ncp_seq, tvb, commhdr + 2, 1, .sequence); |
| 685 | | | proto_tree_add_uint(ncp_tree, hf_ncp_connection,tvb, commhdr + 3, 3, nw_connection); |
| 686 | | | proto_tree_add_item(ncp_tree, hf_ncp_task, tvb, commhdr + 4, 1, FALSE); |
| 687 | | | break; |
| 688 | | | } |
| 689 | | | |
| 690 | | | |
| 691 | | | |
| 692 | | | |
| 693 | | | switch (.type) { |
| 694 | | | |
| 695 | | | case NCP_ALLOCATE_SLOT: |
| 696 | | | length_remaining = tvb_length_remaining(tvb, commhdr + 4); |
| 697 | | | if (length_remaining > 4) { |
| 698 | | | testvar = tvb_get_ntohl(tvb, commhdr+4); |
| 699 | | | if (testvar == 0x4c495020) { |
| 700 | | | proto_tree_add_text(ncp_tree, tvb, commhdr, -1, |
| 701 | | | "Lip Echo Packet"); |
| 702 | | | |
| 703 | | | } |
| 704 | | | } |
| 705 | | | next_tvb = tvb_new_subset(tvb, commhdr, -1, -1); |
| 706 | | | dissect_ncp_request(next_tvb, pinfo, nw_connection, |
| 707 | | | .sequence, .type, ncp_tree); |
| 708 | | | break; |
| 709 | | | |
| 710 | | | case NCP_DEALLOCATE_SLOT: |
| 711 | | | next_tvb = tvb_new_subset(tvb, commhdr, -1, -1); |
| 712 | | | dissect_ncp_request(next_tvb, pinfo, nw_connection, |
| 713 | | | .sequence, .type, ncp_tree); |
| 714 | | | break; |
| 715 | | | |
| 716 | | | case NCP_SERVICE_REQUEST: |
| 717 | | | case NCP_BROADCAST_SLOT: |
| 718 | | | next_tvb = tvb_new_subset(tvb, commhdr, -1, -1); |
| 719 | | | if (tvb_get_guint8(tvb, commhdr+6) == 0x68) { |
| 720 | | | subfunction = tvb_get_guint8(tvb, commhdr+7); |
| 721 | | | switch (subfunction) { |
| 722 | | | |
| 723 | | | case 0x02: |
| 724 | | | dissect_nds_request(next_tvb, pinfo, |
| 725 | | | nw_connection, .sequence, |
| 726 | | | .type, ncp_tree); |
| 727 | | | break; |
| 728 | | | |
| 729 | | | case 0x01: |
| 730 | | | dissect_ping_req(next_tvb, pinfo, |
| 731 | | | nw_connection, .sequence, |
| 732 | | | .type, ncp_tree); |
| 733 | | | break; |
| 734 | | | |
| 735 | | | default: |
| 736 | | | dissect_ncp_request(next_tvb, pinfo, |
| 737 | | | nw_connection, .sequence, |
| 738 | | | .type, ncp_tree); |
| 739 | | | break; |
| 740 | | | } |
| 741 | | | } else { |
| 742 | | | dissect_ncp_request(next_tvb, pinfo, nw_connection, |
| 743 | | | .sequence, .type, ncp_tree); |
| 744 | | | } |
| 745 | | | break; |
| 746 | | | |
| 747 | | | case NCP_SERVICE_REPLY: |
| 748 | | | next_tvb = tvb_new_subset(tvb, commhdr, -1, -1); |
| 749 | | | nds_defrag(next_tvb, pinfo, nw_connection, .sequence, |
| 750 | | | .type, ncp_tree, &ncp_tap); |
| 751 | | | break; |
| 752 | | | |
| 753 | | | case NCP_POSITIVE_ACK: |
| 754 | | | |
| 755 | | | |
| 756 | | | |
| 757 | | | |
| 758 | | | |
| 759 | | | next_tvb = tvb_new_subset(tvb, commhdr, -1, -1); |
| 760 | | | dissect_ncp_reply(next_tvb, pinfo, nw_connection, |
| 761 | | | .sequence, .type, ncp_tree, &ncp_tap); |
| 762 | | | break; |
| 763 | | | |
| 764 | | | case NCP_WATCHDOG: |
| 765 | | | |
| 766 | | | |
| 767 | | | |
| 768 | | | |
| 769 | | | |
| 770 | | | proto_tree_add_item(ncp_tree, hf_ncp_completion_code, |
| 771 | | | tvb, commhdr + 6, 1, TRUE); |
| 772 | | | proto_tree_add_item(ncp_tree, hf_ncp_connection_status, |
| 773 | | | tvb, commhdr + 7, 1, TRUE); |
| 774 | | | proto_tree_add_item(ncp_tree, hf_ncp_slot, |
| 775 | | | tvb, commhdr + 8, 1, TRUE); |
| 776 | | | proto_tree_add_item(ncp_tree, hf_ncp_control_code, |
| 777 | | | tvb, commhdr + 9, 1, TRUE); |
| 778 | | | |
| 779 | | | |
| 780 | | | |
| 781 | | | if (tvb_offset_exists(tvb, commhdr + 10)) { |
| 782 | | | call_dissector(data_handle, |
| 783 | | | tvb_new_subset(tvb, commhdr + 10, -1, -1), |
| 784 | | | pinfo, ncp_tree); |
| 785 | | | } |
| 786 | | | break; |
| 787 | | | |
| 788 | | | case NCP_BURST_MODE_XFER: |
| 789 | | | if (flags & SYS) { |
| 790 | | | |
| 791 | | | |
| 792 | | | |
| 793 | | | |
| 794 | | | while (missing_fraglist_count != 0) { |
| 795 | | | proto_tree_add_item(ncp_tree, hf_ncp_missing_data_offset, |
| 796 | | | tvb, offset, 4, FALSE); |
| 797 | | | offset += 4; |
| 798 | | | proto_tree_add_item(ncp_tree, hf_ncp_missing_data_count, |
| 799 | | | tvb, offset, 2, FALSE); |
| 800 | | | offset += 2; |
| 801 | | | missing_fraglist_count--; |
| 802 | | | } |
| 803 | | | } else { |
| 804 | | | |
| 805 | | | |
| 806 | | | |
| 807 | | | |
| 808 | | | |
| 809 | | | |
| 810 | | | |
| 811 | | | |
| 812 | | | length_remaining = tvb_length_remaining(tvb, offset); |
| 813 | | | if (length_remaining > data_len) |
| 814 | | | length_remaining = data_len; |
| 815 | | | if (data_len != 0) { |
| 816 | | | call_dissector(data_handle, |
| 817 | | | tvb_new_subset(tvb, offset, |
| 818 | | | length_remaining, data_len), |
| 819 | | | pinfo, ncp_tree); |
| 820 | | | } |
| 821 | | | } |
| 822 | | | break; |
| 823 | | | |
| 824 | | | case NCP_LIP_ECHO: |
| 825 | | | proto_tree_add_text(ncp_tree, tvb, commhdr, -1, |
| 826 | | | "Lip Echo Packet"); |
| 827 | | | break; |
| 828 | | | |
| 829 | | | default: |
| 830 | | | expert_item = proto_tree_add_text(ncp_tree, tvb, commhdr + 6, -1, |
| 831 | | | "%s packets not supported yet", |
| 832 | | | val_to_str(.type, ncp_type_vals, |
| 833 | | | "Unknown type (0x%04x)")); |
| 834 | | | if (ncp_echo_err) { |
| 835 | | | expert_add_info_format(pinfo, expert_item, PI_UNDECODED, PI_NOTE, "%s packets not supported yet", val_to_str(.type, ncp_type_vals, |
| 836 | | | "Unknown type (0x%04x)")); |
| 837 | | | } |
| 838 | | | break; |
| 839 | | | } |
| 840 | | | } |
| |