First time here? Check out the FAQ!

Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

answered Mar 5 '5

Chuckc gravatar image

This is done as a post dissector (EASYPOST.lua) but try it with your dissector. Here using a field from the UDP addressbook example.

easypost_payload_f = Field.new("pbf.tutorial.Person.PhoneNumber.number")

-- Step 5 - create the postdissector function that will run on each frame/packet
function easypost_p.dissector(tvb,pinfo,tree)
    local subtree = nil

    -- copy existing field(s) into table for processing
    finfo = { easypost_payload_f() }

    if (#finfo > 0) then
        if not subtree then
            subtree = tree:add(easypost_p)
        end
        for k, v in pairs(finfo) do
            -- process data and add results to the tree
            local field_data = string.format("%s", v):upper()
            subtree:add(pf.payload, field_data)
        pinfo.cols.info:append(" " .. tostring(v))
        end
    end
end
click to hide/show revision 2
No.2 Revision

This is done as a post dissector (EASYPOST.lua) but try it with your dissector. dissector.
Here using a field from the UDP addressbook example.

easypost_payload_f = Field.new("pbf.tutorial.Person.PhoneNumber.number")

-- Step 5 - create the postdissector function that will run on each frame/packet
function easypost_p.dissector(tvb,pinfo,tree)
    local subtree = nil

    -- copy existing field(s) into table for processing
    finfo = { easypost_payload_f() }

    if (#finfo > 0) then
        if not subtree then
            subtree = tree:add(easypost_p)
        end
        for k, v in pairs(finfo) do
            -- process data and add results to the tree
            local field_data = string.format("%s", v):upper()
            subtree:add(pf.payload, field_data)
        pinfo.cols.info:append(" " .. tostring(v))
        end
    end
end
click to hide/show revision 3
No.3 Revision

This is done as a post dissector (EASYPOST.lua) but try it with your dissector.
Here using a field from the UDP addressbook example.

easypost_payload_f = Field.new("pbf.tutorial.Person.PhoneNumber.number")

-- Step 5 - create the postdissector function that will run on each frame/packet
function easypost_p.dissector(tvb,pinfo,tree)
    local subtree = nil

    -- copy existing field(s) into table for processing
    finfo = { easypost_payload_f() }

    if (#finfo > 0) then
        if not subtree then
            subtree = tree:add(easypost_p)
        end
        for k, v in pairs(finfo) do
            -- process data and add results to the tree
            local field_data = string.format("%s", v):upper()
            subtree:add(pf.payload, field_data)
        pinfo.cols.info:append(" " .. tostring(v))
        end
    end
end

To get the formatted strings like ABC, XYZ and SYS_EV_SEND_DATA:

        local field_display = v.display
        field_display = string.gsub(field_display, "%(%d+%)$", "")
        pinfo.cols.info:append(" " .. field_display
click to hide/show revision 4
No.4 Revision

This is done as a post dissector (EASYPOST.lua) but try it with your dissector.
Here using a field from the UDP addressbook example.

easypost_payload_f = Field.new("pbf.tutorial.Person.PhoneNumber.number")

-- Step 5 - create the postdissector function that will run on each frame/packet
function easypost_p.dissector(tvb,pinfo,tree)
    local subtree = nil

    -- copy existing field(s) into table for processing
    finfo = { easypost_payload_f() }

    if (#finfo > 0) then
        if not subtree then
            subtree = tree:add(easypost_p)
        end
        for k, v in pairs(finfo) do
            -- process data and add results to the tree
            local field_data = string.format("%s", v):upper()
            subtree:add(pf.payload, field_data)
        pinfo.cols.info:append(" " .. tostring(v))
        end
    end
end

To get the formatted strings like ABC, XYZ and SYS_EV_SEND_DATA:

        local field_display = v.display
        field_display = string.gsub(field_display, "%(%d+%)$", "")
        pinfo.cols.info:append(" " .. field_display

Produces 63334 → 8127 Len=128 (PROTOBUF) people people HOME HOME WORK for field easypost_payload_f = Field.new("pbf.tutorial.Person.PhoneNumber.type"

click to hide/show revision 5
No.5 Revision

This is done as a post dissector (EASYPOST.lua) but try it with your dissector.
Here using a field from the UDP addressbook example.

easypost_payload_f = Field.new("pbf.tutorial.Person.PhoneNumber.number")

-- Step 5 - create the postdissector function that will run on each frame/packet
function easypost_p.dissector(tvb,pinfo,tree)
    local subtree = nil

    -- copy existing field(s) into table for processing
    finfo = { easypost_payload_f() }

    if (#finfo > 0) then
        if not subtree then
            subtree = tree:add(easypost_p)
        end
        for k, v in pairs(finfo) do
            -- process data and add results to the tree
            local field_data = string.format("%s", v):upper()
            subtree:add(pf.payload, field_data)
        pinfo.cols.info:append(" " .. tostring(v))
        end
    end
end

To get the formatted strings like ABC, XYZ and SYS_EV_SEND_DATA:

        local field_display = v.display
        field_display = string.gsub(field_display, "%(%d+%)$", "")
        pinfo.cols.info:append(" " .. field_display

Produces 63334 → 8127 Len=128 (PROTOBUF) people people HOME HOME WORK for field easypost_payload_f = Field.new("pbf.tutorial.Person.PhoneNumber.type"
Put pinfo.cols.info:clear() above the for loop to start with an empty Info column.
HOME HOME WORK