Wireshark dissector for Pro DJ Link protocol
3
fork

Configure Feed

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

add a bunch of missing fields

Stella a5bc8c81 b6d9e37a

+94 -10
+94 -10
pro_dj_link.lua
··· 15 15 local f_mac = ProtoField.ether("pdjl.mac", "MAC Address") 16 16 local f_ip = ProtoField.ipv4("pdjl.ip", "IP Address") 17 17 local f_sequence = ProtoField.uint8("pdjl.sequence", "Sequence", base.DEC) 18 + local f_dev_type = ProtoField.uint8("pdjl.device_type", "Device Type", base.HEX) 19 + local f_peer_count = ProtoField.uint8("pdjl.peer_count", "Peer Count", base.DEC) 18 20 19 21 -- Port 50001 (Beat Sync) 20 22 local f_bpm_raw = ProtoField.uint16("pdjl.bpm_raw", "BPM (Raw x100)", base.DEC) 21 23 local f_pitch = ProtoField.uint32("pdjl.pitch", "Pitch (Raw)", base.HEX) 22 24 local f_beat_in_bar = ProtoField.uint8("pdjl.beat_in_bar", "Beat in Bar", base.DEC) 23 25 local f_next_beat = ProtoField.uint32("pdjl.next_beat", "Next Beat (ms)", base.DEC) 26 + local f_second_beat = ProtoField.uint32("pdjl.second_beat", "Second Beat (ms)", base.DEC) 27 + local f_next_bar = ProtoField.uint32("pdjl.next_bar", "Next Bar (ms)", base.DEC) 28 + local f_fourth_beat = ProtoField.uint32("pdjl.fourth_beat", "Fourth Beat (ms)", base.DEC) 29 + local f_second_bar = ProtoField.uint32("pdjl.second_bar", "Second Bar (ms)", base.DEC) 30 + local f_eighth_beat = ProtoField.uint32("pdjl.eighth_beat", "Eighth Beat (ms)", base.DEC) 24 31 local f_track_len = ProtoField.uint32("pdjl.track_length", "Track Length (s)", base.DEC) 25 32 local f_playhead = ProtoField.uint32("pdjl.playhead", "Playhead (ms)", base.DEC) 33 + local f_pitch_abs = ProtoField.int32("pdjl.pitch_abs", "Position Pitch", base.DEC) 34 + local f_bpm_abs = ProtoField.uint32("pdjl.bpm_abs", "Position BPM", base.DEC) 26 35 local f_sync_cmd = ProtoField.uint8("pdjl.sync_cmd", "Sync Command", base.HEX) 27 36 28 37 -- Port 50002 (Status) ··· 30 39 local f_track_num = ProtoField.uint16("pdjl.track_number", "Track Number", base.DEC) 31 40 local f_track_dev = ProtoField.uint8("pdjl.track_device", "Track Host Device", base.DEC) 32 41 local f_slot = ProtoField.uint8("pdjl.slot", "Slot", base.HEX) 42 + local f_track_type = ProtoField.uint8("pdjl.track_type", "Track Type", base.HEX) 33 43 local f_activity = ProtoField.uint8("pdjl.activity", "Activity", base.HEX) 34 44 local f_firmware = ProtoField.string("pdjl.firmware", "Firmware") 35 45 local f_beat_count = ProtoField.uint32("pdjl.beat_count", "Beat Count", base.DEC) 46 + local f_play_mode_1 = ProtoField.uint8("pdjl.play_mode_1", "Play Mode 1", base.HEX) 47 + local f_play_mode_2 = ProtoField.uint8("pdjl.play_mode_2", "Play Mode 2", base.HEX) 48 + local f_pitch_1 = ProtoField.uint32("pdjl.pitch_1", "Effective Pitch", base.HEX) 49 + local f_pitch_2 = ProtoField.uint32("pdjl.pitch_2", "Local Pitch", base.HEX) 50 + local f_master_info = ProtoField.uint8("pdjl.master_info", "Master Info", base.HEX) 51 + local f_handoff = ProtoField.uint8("pdjl.handoff", "Master Handoff", base.DEC) 52 + local f_countdown = ProtoField.uint16("pdjl.cue_countdown", "Cue Countdown", base.DEC) 53 + local f_pitch_3 = ProtoField.uint32("pdjl.pitch_3", "Pitch 3", base.HEX) 54 + local f_pitch_4 = ProtoField.uint32("pdjl.pitch_4", "Pitch 4", base.HEX) 36 55 37 56 local f_flags = ProtoField.uint8("pdjl.flags", "Status Flags", base.HEX) 38 57 local f_flag_playing= ProtoField.bool("pdjl.flags.playing", "Is Playing", 8, nil, 0x40) ··· 65 84 66 85 p_djl.fields = { 67 86 f_header, f_type, f_device_name, f_dev_num, 68 - f_mac, f_ip, f_sequence, 69 - f_bpm_raw, f_pitch, f_beat_in_bar, f_next_beat, f_track_len, f_playhead, f_sync_cmd, 70 - f_rb_id, f_track_num, f_track_dev, f_slot, f_activity, f_firmware, f_beat_count, 87 + f_mac, f_ip, f_sequence, f_dev_type, f_peer_count, 88 + f_bpm_raw, f_pitch, f_beat_in_bar, f_next_beat, f_second_beat, f_next_bar, f_fourth_beat, f_second_bar, f_eighth_beat, 89 + f_track_len, f_playhead, f_pitch_abs, f_bpm_abs, f_sync_cmd, 90 + f_rb_id, f_track_num, f_track_dev, f_slot, f_track_type, f_activity, f_firmware, f_beat_count, 91 + f_play_mode_1, f_play_mode_2, f_pitch_1, f_pitch_2, f_master_info, f_handoff, f_countdown, f_pitch_3, f_pitch_4, 71 92 f_flags, f_flag_playing, f_flag_master, f_flag_sync, f_flag_onair, 72 93 f_db_magic, f_db_tx_id, f_db_msg_type, f_db_arg_count, f_db_tag_blob, 73 94 f_db_field_u8, f_db_field_u16, f_db_field_u32, f_db_field_str, f_db_field_bin, ··· 117 138 [0x5105] = "TrackCountResp", 118 139 [0x1103] = "GetTrackList", 119 140 [0x5103] = "TrackListResp", 141 + } 142 + 143 + local PLAY_MODES = { 144 + [0x00] = "No Track", 145 + [0x02] = "Loading", 146 + [0x03] = "Playing", 147 + [0x04] = "Looping", 148 + [0x05] = "Paused", 149 + [0x06] = "Paused at Cue", 150 + [0x07] = "Cue Play", 151 + [0x08] = "Cue Scratch", 152 + [0x09] = "Searching", 153 + [0x0e] = "CD Spun Down", 154 + [0x11] = "Ended", 155 + } 156 + 157 + local TRACK_TYPES = { 158 + [0x00] = "None", 159 + [0x01] = "Rekordbox", 160 + [0x02] = "Unanalyzed", 161 + [0x05] = "Audio CD", 162 + } 163 + 164 + local SYNC_COMMANDS = { 165 + [0x10] = "Turn On Sync", 166 + [0x20] = "Turn Off Sync", 167 + [0x01] = "Become Master", 168 + } 169 + 170 + local DEV_TYPES = { 171 + [0x01] = "CDJ/Player", 172 + [0x02] = "Mixer", 173 + [0x03] = "Rekordbox/PC", 120 174 } 121 175 122 176 local MENU_ITEM_TYPES = { ··· 402 456 tree:add(f_device_name, buf(0x0C, 20)) 403 457 if p_type == 0x06 then 404 458 tree:add(f_dev_num, buf(0x24, 1)) 459 + local dtype = buf(0x25, 1):uint() 460 + tree:add(f_dev_type, buf(0x25, 1)):append_text(" (" .. (DEV_TYPES[dtype] or "Unknown") .. ")") 405 461 tree:add(f_mac, buf(0x26, 6)) 406 462 tree:add(f_ip, buf(0x2C, 4)) 463 + tree:add(f_peer_count, buf(0x30, 1)) 407 464 elseif p_type == 0x00 or p_type == 0x02 or p_type == 0x04 then 408 - tree:add(f_sequence, buf(length-1, 1)) 409 - if p_type == 0x02 or p_type == 0x04 then 410 - tree:add(f_dev_num, buf(length-2, 1)) 465 + tree:add(f_sequence, buf(0x24, 1)) 466 + if p_type == 0x02 then 467 + tree:add(f_dev_num, buf(0x2E, 1)) 468 + elseif p_type == 0x04 then 469 + tree:add(f_dev_num, buf(0x24, 1)) 411 470 end 412 471 end 413 472 elseif dst_port == 50001 or src_port == 50001 then ··· 415 474 tree:add(f_device_name, buf(0x0B, 20)) 416 475 tree:add(f_dev_num, buf(0x21, 1)) 417 476 tree:add(f_next_beat, buf(0x24, 4)) 477 + tree:add(f_second_beat, buf(0x28, 4)) 478 + tree:add(f_next_bar, buf(0x2C, 4)) 479 + tree:add(f_fourth_beat, buf(0x30, 4)) 480 + tree:add(f_second_bar, buf(0x34, 4)) 481 + tree:add(f_eighth_beat, buf(0x38, 4)) 418 482 tree:add(f_pitch, buf(0x54, 4)) 419 483 tree:add(f_bpm_raw, buf(0x5a, 2)) 420 484 tree:add(f_beat_in_bar, buf(0x5c, 1)) ··· 422 486 tree:add(f_dev_num, buf(0x21, 1)) 423 487 tree:add(f_track_len, buf(0x24, 4)) 424 488 tree:add(f_playhead, buf(0x28, 4)) 425 - tree:add(f_bpm_raw, buf(0x38, 4)):append_text(" (Position Scale)") 489 + tree:add(f_pitch_abs, buf(0x2C, 4)) 490 + tree:add(f_bpm_abs, buf(0x38, 4)) 426 491 elseif p_type == 0x2a then -- Sync Control 427 492 tree:add(f_dev_num, buf(0x21, 1)) 428 - tree:add(f_sync_cmd, buf(0x2b, 1)) 493 + local scmd = buf(0x2b, 1):uint() 494 + tree:add(f_sync_cmd, buf(0x2b, 1)):append_text(" (" .. (SYNC_COMMANDS[scmd] or "Unknown") .. ")") 429 495 end 430 496 elseif dst_port == 50002 or src_port == 50002 then 431 497 if p_type == 0x0a then -- CDJ Status ··· 435 501 tree:add(f_activity, buf(0x27, 1)) 436 502 tree:add(f_track_dev, buf(0x28, 1)) 437 503 tree:add(f_slot, buf(0x29, 1)) 504 + local ttype = buf(0x2a, 1):uint() 505 + tree:add(f_track_type, buf(0x2a, 1)):append_text(" (" .. (TRACK_TYPES[ttype] or "Unknown") .. ")") 438 506 tree:add(f_rb_id, buf(0x2c, 4)) 439 507 tree:add(f_track_num, buf(0x32, 2)) 440 - tree:add(f_bpm_raw, buf(0x92, 2)) 441 - tree:add(f_beat_count, buf(0xa0, 4)) 508 + 509 + local pmode1 = buf(0x7b, 1):uint() 510 + tree:add(f_play_mode_1, buf(0x7b, 1)):append_text(" (" .. (PLAY_MODES[pmode1] or "Unknown") .. ")") 442 511 tree:add(f_firmware, buf(0x7c, 4)) 512 + 443 513 local flag_tree = tree:add(f_flags, buf(0x89, 1)) 444 514 flag_tree:add(f_flag_playing, buf(0x89, 1)) 445 515 flag_tree:add(f_flag_master, buf(0x89, 1)) 446 516 flag_tree:add(f_flag_sync, buf(0x89, 1)) 447 517 flag_tree:add(f_flag_onair, buf(0x89, 1)) 518 + 519 + local pmode2 = buf(0x8b, 1):uint() 520 + tree:add(f_play_mode_2, buf(0x8b, 1)):append_text(" (" .. (PLAY_MODES[pmode2] or "Unknown") .. ")") 521 + 522 + tree:add(f_pitch_1, buf(0x8c, 4)) 523 + tree:add(f_bpm_raw, buf(0x92, 2)) 524 + tree:add(f_pitch_2, buf(0x98, 4)) 525 + tree:add(f_master_info, buf(0x9e, 1)) 526 + tree:add(f_handoff, buf(0x9f, 1)) 527 + tree:add(f_beat_count, buf(0xa0, 4)) 528 + tree:add(f_countdown, buf(0xa4, 2)) 529 + tree:add(f_beat_in_bar, buf(0xa6, 1)) 530 + tree:add(f_pitch_3, buf(0xc0, 4)) 531 + tree:add(f_pitch_4, buf(0xc4, 4)) 448 532 end 449 533 end 450 534 end