Skip to content

Commit

Permalink
Update dissector for peer sharing
Browse files Browse the repository at this point in the history
Update dissector for the peer sharing protocol.
  • Loading branch information
karknu committed Aug 24, 2023
1 parent f54839c commit db65fec
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions ouroboros-network/wireshark-plugin/ouroboros_network.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ local conv_ids = {
[0x8004] = "TxSubmission Responder",
[0x0004] = "TxSubmission Initiator",
[0x8008] = "KeepAlive Responder",
[0x0008] = "KeepAlive Initiator"
[0x0008] = "KeepAlive Initiator",
[0x800a] = "Peer Sharing Responder",
[0x000a] = "Peer Sharing Initiator"
}
local on_conversation = ProtoField.uint16("ouroboros.conv", "Conversation", base.HEX, conv_ids, nil, "Conversation ids")

Expand Down Expand Up @@ -81,6 +83,14 @@ local keepalive_msg_codes = {

local on_keepalive_msg = ProtoField.uint8("ouroboros.keepalivemsg", "KeepAlive Message", base.DEC, keepalive_msg_codes, nil, "KeepAlive Message Types")

local peersharing_msg_codes = {
[0] = "MsgShareRequest",
[1] = "MsgSharePeers",
[2] = "MsgDone"
}

local on_peersharing_msg = ProtoField.uint8("ouroboros.peersharingmsg", "PeerSharing Message", base.DEC, peersharing_msg_codes, nil, "PeerSharing Message Types")


ouroboros.fields = {
on_transmission_time,
Expand All @@ -90,7 +100,8 @@ ouroboros.fields = {
on_chainsync_msg,
on_blockfetch_msg,
on_txsubmission_msg,
on_keepalive_msg
on_keepalive_msg,
on_peersharing_msg
}


Expand Down Expand Up @@ -151,6 +162,7 @@ dissectOuroboros = function (tvbuf, pktinfo, root, offset)
elseif convId == 3 then subtree:add(on_blockfetch_msg, tvbuf:range(offset + 9, 1))
elseif convId == 4 then subtree:add(on_txsubmission_msg, tvbuf:range(offset + 9, 1))
elseif convId == 8 then subtree:add(on_keepalive_msg, tvbuf:range(offset + 9, 1))
elseif convId == 10 then subtree:add(on_peersharing_msg, tvbuf:range(offset + 9, 1))
end

cbor:call(tvbuf(ON_HDR_LEN):tvb(), pktinfo, subtree)
Expand Down

0 comments on commit db65fec

Please sign in to comment.