-- This file is generated by tools/json2lua.js

local ffxiv_ipc_fellowship_list = Proto("ffxiv_ipc_fellowship_list", "FFXIV-IPC FellowshipList")

local fellowship_list_fields = {
  id                            = ProtoField.uint64("ffxiv_ipc_fellowship_list.id", "ID", base.DEC),
  create_time                   = ProtoField.uint32("ffxiv_ipc_fellowship_list.create_time", "CreateTime", base.DEC),
  join_time                     = ProtoField.uint32("ffxiv_ipc_fellowship_list.join_time", "JoinTime", base.DEC),
}

ffxiv_ipc_fellowship_list.fields = fellowship_list_fields

function ffxiv_ipc_fellowship_list.dissector(tvbuf, pktinfo, root)
  local tree = root:add(ffxiv_ipc_fellowship_list, tvbuf)
  pktinfo.cols.info:set("FellowshipList")

  local len = tvbuf:len()

  -- dissect the id field
  local id_tvbr = tvbuf:range(0, 8)
  local id_val  = id_tvbr:le_uint64()
  tree:add_le(fellowship_list_fields.id, id_tvbr, id_val)

  -- dissect the create_time field
  local create_time_tvbr = tvbuf:range(8, 4)
  local create_time_val  = create_time_tvbr:le_uint()
  tree:add_le(fellowship_list_fields.create_time, create_time_tvbr, create_time_val)

  -- dissect the join_time field
  local join_time_tvbr = tvbuf:range(12, 4)
  local join_time_val  = join_time_tvbr:le_uint()
  tree:add_le(fellowship_list_fields.join_time, join_time_tvbr, join_time_val)

  -- dissect fellowship_message_board_item
  local fellowship_message_board_item_dissector = Dissector.get('ffxiv_ipc_fellowship_message_board_item')
  local fellowship_message_board_item_pos = 16
  local fellowship_message_board_item_len = 172
  local fellowship_message_board_item_count = 10

  while fellowship_message_board_item_pos + fellowship_message_board_item_len <= len do
    local fellowship_message_board_item_tvbr = tvbuf:range(fellowship_message_board_item_pos, 172)
    fellowship_message_board_item_dissector:call(fellowship_message_board_item_tvbr:tvb(), pktinfo, root)
    fellowship_message_board_item_pos = fellowship_message_board_item_pos + fellowship_message_board_item_len
    fellowship_message_board_item_count = fellowship_message_board_item_count - 1
    if fellowship_message_board_item_count <= 0 then
      break
    end
  end

  return len
end