{"action":"opened","issue":{"url":"https://api.github.com/repos/tulak/pdu_tools/issues/5","repository_url":"https://api.github.com/repos/tulak/pdu_tools","labels_url":"https://api.github.com/repos/tulak/pdu_tools/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/tulak/pdu_tools/issues/5/comments","events_url":"https://api.github.com/repos/tulak/pdu_tools/issues/5/events","html_url":"https://github.com/tulak/pdu_tools/issues/5","id":138424003,"number":5,"title":"Decoding of user header is broken","user":{"login":"skandragon","id":43517,"avatar_url":"https://avatars.githubusercontent.com/u/43517?v=3","gravatar_id":"","url":"https://api.github.com/users/skandragon","html_url":"https://github.com/skandragon","followers_url":"https://api.github.com/users/skandragon/followers","following_url":"https://api.github.com/users/skandragon/following{/other_user}","gists_url":"https://api.github.com/users/skandragon/gists{/gist_id}","starred_url":"https://api.github.com/users/skandragon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skandragon/subscriptions","organizations_url":"https://api.github.com/users/skandragon/orgs","repos_url":"https://api.github.com/users/skandragon/repos","events_url":"https://api.github.com/users/skandragon/events{/privacy}","received_events_url":"https://api.github.com/users/skandragon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-03-04T09:19:57Z","updated_at":"2016-03-04T09:19:57Z","closed_at":null,"body":"I am getting an exception parsing several messages types.  These all include the addressing scheme, which is not supported.\r\n\r\n'05' translates into an addressing scheme, where there addresses are 16 bits for source and destination.  However, i'm not sure what I have below works in all cases.  For one, I don't know if/what to set @offset_7bit to here.  From my understanding, the user data header is a series of tag/length/value items, so this should iterate over the user data fields, extracting the TLV fields and populating some data structure.\r\n\r\nI suspect you want something similar to this:\r\n\r\n```\r\n    def parse_user_data_header header\r\n      ret = {}\r\n      while header.length > 0\r\n        iei_type = take 2, :string, header\r\n        iei_length = take 2, :integer, header\r\n        iei_data = take iei_length * 2, :string, header\r\n        case iei_type\r\n        when \"00\"\r\n          reference = take 2, :integer, iei_data\r\n          parts = take 2, :integer, iei_data\r\n          part_number = take 2, :integer, iei_data\r\n          ret[:multipart] = { reference: reference, parts: parts, part_number: part_number }\r\n          @offset_7bit = 0\r\n        when '05'\r\n          dest_port = take 4, :integer, iei_data\r\n          source_port = take 4, :integer, iei_data\r\n          ret[:addressing] = { source: source_port, destination: dest_port }\r\n        when \"08\"\r\n          reference = take 4, :integer, iei_data\r\n          parts = take 2, :integer, iei_data\r\n          part_number = take 2, :integer, iei_data\r\n          ret[:multipart] = { reference: reference, parts: parts, part_number: part_number }\r\n          @offset_7bit += 1\r\n        else\r\n          raise DecodeError, \"unsupported Information Element Identifier in User Data Header: #{iei}\"\r\n        end\r\n        if iei_data.length != 0\r\n          raise DecodeError, \"Failure to decode: iei length is not correct for type\"\r\n        end\r\n      end\r\n      ret\r\n    end\r\n```\r\n\r\nThis would require changing the multipart \"am I done?\" check of course."}}