Wireshark dissector for Pro DJ Link protocol
3
fork

Configure Feed

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

fix media name & creation date parsing

Stella 37d4ef66 3d0a5b4b

+54 -1
+54 -1
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", "Queried IP") 56 + local f_queried_dev = ProtoField.uint32("pdjl.queried_device", "Queried Device", base.DEC) 57 + local f_queried_slot= ProtoField.uint32("pdjl.queried_slot", "Queried Slot", base.HEX) 58 + local f_slot_owner = ProtoField.uint8("pdjl.slot_owner", "Slot Owner Device", base.DEC) 59 + 60 + local f_media_type = ProtoField.uint8("pdjl.media_type", "Media Type", base.HEX) 61 + local f_media_status = ProtoField.uint8("pdjl.media_status", "Media Status", base.HEX) 62 + local f_media_tracks = ProtoField.uint32("pdjl.media_tracks", "Media Tracks", base.DEC) 63 + local f_media_name = ProtoField.string("pdjl.media_name", "Media Name") 64 + local f_media_db_date= ProtoField.string("pdjl.media_db_date", "DB Creation Date") 65 + 55 66 local f_flags = ProtoField.uint8("pdjl.flags", "Status Flags", base.HEX) 56 67 local f_flag_playing= ProtoField.bool("pdjl.flags.playing", "Is Playing", 8, nil, 0x40) 57 68 local f_flag_master = ProtoField.bool("pdjl.flags.master", "Is Master", 8, nil, 0x20) ··· 88 99 f_track_len, f_playhead, f_pitch_abs, f_bpm_abs, f_sync_cmd, 89 100 f_rb_id, f_track_num, f_track_dev, f_slot, f_track_type, f_activity, f_firmware, f_beat_count, 90 101 f_play_mode_1, f_play_mode_2, f_pitch_1, f_pitch_2, f_master_info, f_handoff, f_countdown, f_pitch_3, 102 + f_queried_ip, f_queried_dev, f_queried_slot, f_slot_owner, f_media_type, f_media_status, f_media_tracks, f_media_name, f_media_db_date, 91 103 f_flags, f_flag_playing, f_flag_master, f_flag_sync, f_flag_onair, 92 104 f_db_magic, f_db_tx_id, f_db_msg_type, f_db_arg_count, f_db_tag_blob, 93 105 f_db_field_u8, f_db_field_u16, f_db_field_u32, f_db_field_str, f_db_field_bin, ··· 427 439 local p_type = buf(10, 1):uint() 428 440 local p_type_str = PACKET_TYPES[p_type] 429 441 442 + if dst_port == 50002 or src_port == 50002 then 443 + if p_type == 0x05 then p_type_str = "Media Query" end 444 + if p_type == 0x06 then p_type_str = "Media Response" end 445 + end 446 + 430 447 if p_type_str then 431 448 tree:add(f_type, buf(10, 1)):append_text(" (" .. p_type_str .. ")") 432 449 pkt.cols.info:set(p_type_str) ··· 496 513 tree:add(f_sync_cmd, buf(0x2b, 1)):append_text(" (" .. (SYNC_COMMANDS[scmd] or "Unknown") .. ")") 497 514 end 498 515 elseif dst_port == 50002 or src_port == 50002 then 499 - if p_type == 0x0a then -- CDJ Status 516 + if p_type == 0x05 then -- Media Query 517 + tree:add(f_device_name, buf(0x0B, 20)) 518 + tree:add(f_dev_num, buf(0x21, 1)) 519 + if length >= 0x30 then 520 + tree:add(f_queried_ip, buf(0x24, 4)) 521 + tree:add(f_queried_dev, buf(0x28, 4)) 522 + tree:add(f_queried_slot, buf(0x2c, 4)) 523 + end 524 + elseif p_type == 0x06 then -- Media Response 525 + tree:add(f_device_name, buf(0x0B, 20)) 526 + tree:add(f_dev_num, buf(0x21, 1)) 527 + 528 + -- In newer 156+ byte formats (like XDJ-1000MK2), the layout differs from the old 80-byte format. 529 + if length >= 0x84 then 530 + local enc = (ENC_UTF_16 or 2) + (ENC_BIG_ENDIAN or 0) 531 + tree:add(f_media_type, buf(0x26, 1)) 532 + tree:add(f_media_status, buf(0x27, 1)) 533 + -- Slot is at 0x28 in the newer format 534 + tree:add(f_queried_slot, buf(0x28, 4)) 535 + 536 + -- Media Name starts at 0x2C (UTF-16, up to 64 bytes) 537 + local name_str = buf(0x2C, 64):string(enc):gsub("%z", "") 538 + tree:add(f_media_name, buf(0x2C, 64), name_str) 539 + 540 + -- DB Creation Date starts at 0x6C (UTF-16, up to 24 bytes) 541 + local date_str = buf(0x6C, 24):string(enc):gsub("%z", "") 542 + tree:add(f_media_db_date, buf(0x6C, 24), date_str) 543 + elseif length >= 0x2C + 32 then 544 + -- Fallback to old format (e.g. CDJ-2000) 545 + local enc = (ENC_ASCII or 0) 546 + local name_str = buf(0x2C, 32):string(enc):gsub("%z", "") 547 + tree:add(f_media_type, buf(0x26, 1)) 548 + tree:add(f_media_status, buf(0x27, 1)) 549 + tree:add(f_media_tracks, buf(0x28, 4)) 550 + tree:add(f_media_name, buf(0x2C, 32), name_str) 551 + end 552 + elseif p_type == 0x0a then -- CDJ Status 500 553 tree:add(f_device_name, buf(0x0B, 20)) 501 554 tree:add(f_dev_num, buf(0x21, 1)) 502 555