Wireshark dissector for Pro DJ Link protocol
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

add missing fields for media response

Stella 4be12721 5a42b925

+29 -23
+29 -23
pro_dj_link.lua
··· 52 52 local f_countdown = ProtoField.uint16("pdjl.cue_countdown", "Cue Countdown", base.DEC) 53 53 local f_pitch_3 = ProtoField.uint32("pdjl.pitch_3", "Pitch 3", base.HEX) 54 54 55 - local f_queried_ip = ProtoField.ipv4("pdjl.queried_ip", "Querying IP") 56 - local f_queried_dev = ProtoField.uint32("pdjl.queried_device", "Querying Device", base.DEC) 57 - local f_queried_slot= ProtoField.uint32("pdjl.queried_slot", "Querying Slot", base.HEX) 55 + local f_queried_ip = ProtoField.ipv4("pdjl.queried_ip", "Queried IP") 56 + local f_queried_dev = ProtoField.uint8("pdjl.queried_device", "Target Device", base.DEC) 57 + local f_queried_slot = ProtoField.uint8("pdjl.queried_slot", "Target Slot", base.HEX) 58 58 local f_slot_owner = ProtoField.uint8("pdjl.slot_owner", "Slot Owner Device", base.DEC) 59 59 local f_playlist_count = ProtoField.uint16("pdjl.playlist_count", "Playlist Count", base.DEC) 60 60 local f_total_media_space = ProtoField.uint64("pdjl.total_media_space", "Total Space", base.DEC) 61 61 local f_avail_media_space = ProtoField.uint64("pdjl.avail_media_space", "Available Space", base.DEC) 62 - local f_settings_present = ProtoField.bool("pdjl.settings_present", "MYSETTINGS.DAT present", 1, nil, 0x01) 62 + local f_interface_color = ProtoField.uint8("pdjl.interface_color", "Interface Color", base.HEX) 63 + local f_settings_present = ProtoField.bool("pdjl.settings_present", "MYSETTINGS.DAT present", 8, nil, 0x01) 63 64 64 65 65 66 local f_media_type = ProtoField.uint8("pdjl.media_type", "Media Type", base.HEX) 66 - local f_media_tracks_type = ProtoField.uint8("pdjl.media_tracks_type", "Media Tracks Type", base.DEC) 67 67 local f_media_status = ProtoField.uint8("pdjl.media_status", "Media Status", base.HEX) 68 - local f_media_tracks = ProtoField.uint32("pdjl.media_tracks", "Media Tracks", base.DEC) 68 + local f_media_tracks = ProtoField.uint16("pdjl.media_tracks", "Media Tracks", base.DEC) 69 69 local f_media_name = ProtoField.string("pdjl.media_name", "Media Name") 70 70 local f_media_db_date= ProtoField.string("pdjl.media_db_date", "DB Creation Date") 71 71 ··· 107 107 f_rb_id, f_track_num, f_track_dev, f_slot, f_track_type, f_activity, f_firmware, f_beat_count, 108 108 f_play_mode_1, f_play_mode_2, f_pitch_1, f_pitch_2, f_master_info, f_handoff, f_countdown, f_pitch_3, 109 109 f_queried_ip, f_queried_dev, f_queried_slot, f_slot_owner, f_playlist_count, f_total_media_space, f_avail_media_space, 110 - f_settings_present, f_media_type, f_media_tracks_type, f_media_status, f_media_tracks, f_media_name, f_media_db_date, 110 + f_interface_color, f_settings_present, f_media_type, f_media_status, f_media_tracks, f_media_name, f_media_db_date, 111 111 f_flags, f_flag_playing, f_flag_master, f_flag_sync, f_flag_onair, 112 112 f_db_magic, f_db_tx_id, f_db_msg_type, f_db_arg_count, f_db_tag_blob, 113 113 f_db_field_u8, f_db_field_u16, f_db_field_u32, f_db_field_u64, f_db_field_str, f_db_field_bin, ··· 526 526 tree:add(f_dev_num, buf(0x21, 1)) 527 527 if length >= 0x30 then 528 528 tree:add(f_queried_ip, buf(0x24, 4)) 529 - tree:add(f_queried_dev, buf(0x28, 4)) 530 - tree:add(f_queried_slot, buf(0x2c, 4)) 529 + tree:add(f_queried_dev, buf(0x2B, 1)) -- Target Device: 1 byte at 0x2B 530 + tree:add(f_queried_slot, buf(0x2F, 1)) -- Target Slot: 1 byte at 0x2F 531 531 end 532 532 elseif p_type == 0x06 then -- Media Response 533 533 tree:add(f_device_name, buf(0x0B, 20)) 534 534 tree:add(f_dev_num, buf(0x21, 1)) 535 535 536 - -- In newer 156+ byte formats (like XDJ-1000MK2), the layout differs from the old 80-byte format. 537 - if length >= 0x84 then 536 + -- The real Pioneer response is 192 bytes (0xC0): 36 bytes header + 156 bytes payload 537 + if length >= 0xC0 then 538 538 local enc = (ENC_UTF_16 or 2) + (ENC_BIG_ENDIAN or 0) 539 - tree:add(f_media_type, buf(0x26, 1)) 540 - tree:add(f_media_status, buf(0x27, 1)) 541 - tree:add(f_media_tracks, buf(0xa6, 2)) 542 - -- Slot is at 0x28 in the newer format 543 - tree:add(f_queried_slot, buf(0x28, 4)) 539 + tree:add(f_slot_owner, buf(0x27, 1)) -- Target Device ($D_r$) 540 + tree:add(f_queried_slot, buf(0x2B, 1)) -- Target Slot ($S_r$): 1 byte at 0x2B 544 541 545 - -- Media Name starts at 0x2C (UTF-16, up to 64 bytes) 542 + -- Media Name starts at 0x2C (UTF-16, 64 bytes) 546 543 local name_str = buf(0x2C, 64):string(enc):gsub("%z", "") 547 544 tree:add(f_media_name, buf(0x2C, 64), name_str) 548 545 549 - -- DB Creation Date starts at 0x6C (UTF-16, up to 24 bytes) 550 - local date_str = buf(0x6C, 24):string(enc):gsub("%z", "") 551 - tree:add(f_media_db_date, buf(0x6C, 24), date_str) 546 + -- DB Creation Date starts at 0x6C (UTF-16, 40 bytes) 547 + local date_str = buf(0x6C, 40):string(enc):gsub("%z", "") 548 + tree:add(f_media_db_date, buf(0x6C, 40), date_str) 552 549 553 - tree:add(f_media_tracks_type, buf(0xaa, 1)) 554 - tree:add(f_settings_present, buf(0xab, 1)) 550 + -- Unknown Text at 0x94–0xA5 (18 bytes) 551 + local unknown_str = buf(0x94, 18):string(enc):gsub("%z", "") 552 + tree:add(f_raw_payload, buf(0x94, 18)):set_text("Unknown Text: \"" .. unknown_str .. "\"") 553 + 554 + tree:add(f_media_tracks, buf(0xa6, 2)) 555 + tree:add(f_interface_color, buf(0xa8, 1)) -- UI/USB light tint color (CDJ-3000) 556 + 557 + tree:add(f_media_type, buf(0xaa, 1)) -- Media Type $T_r$ at correct offset 558 + tree:add(f_settings_present, buf(0xab, 1)) -- Settings presence bit 559 + 555 560 tree:add(f_playlist_count, buf(0xae, 2)) 556 561 tree:add(f_total_media_space, buf(0xb0, 8)) 557 562 tree:add(f_avail_media_space, buf(0xb8, 8)) 558 563 elseif length >= 0x2C + 32 then 559 - -- Fallback to old format (e.g. CDJ-2000) 564 + -- Fallback: 80-byte synthetic format from our own NFS server (djlink/src/server.rs). 565 + -- This does NOT match real Pioneer hardware; offsets differ from the spec above. 560 566 local enc = (ENC_ASCII or 0) 561 567 local name_str = buf(0x2C, 32):string(enc):gsub("%z", "") 562 568 tree:add(f_media_type, buf(0x26, 1))