Class: Dap::Filter::FilterDecodeWDBRPC_Reply
- Inherits:
-
Object
- Object
- Dap::Filter::FilterDecodeWDBRPC_Reply
- Includes:
- BaseDecoder
- Defined in:
- lib/dap/filter/udp.rb
Overview
Decode a VxWorks WDBRPC probe response ( zmap: wdbrpc_17185.pkt )
Instance Attribute Summary
Attributes included from Base
Instance Method Summary collapse
Methods included from BaseDecoder
Methods included from Base
Instance Method Details
#decode(data) ⇒ Object
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/dap/filter/udp.rb', line 100 def decode(data) buff = data.dup info = {} head = buff.slice!(0,36) return info unless head.to_s.length == 36 return unless buff.length > 0 info['agent_ver'] = Dap::Proto::WDBRPC.wdbrpc_decode_str(buff) info['agent_mtu'] = Dap::Proto::WDBRPC.wdbrpc_decode_int(buff) info['agent_mod'] = Dap::Proto::WDBRPC.wdbrpc_decode_int(buff) info['rt_type'] = Dap::Proto::WDBRPC.wdbrpc_decode_int(buff) info['rt_vers'] = Dap::Proto::WDBRPC.wdbrpc_decode_str(buff) info['rt_cpu_type'] = Dap::Proto::WDBRPC.wdbrpc_decode_int(buff) info['rt_has_fpp'] = Dap::Proto::WDBRPC.wdbrpc_decode_bool(buff) info['rt_has_wp'] = Dap::Proto::WDBRPC.wdbrpc_decode_bool(buff) info['rt_page_size'] = Dap::Proto::WDBRPC.wdbrpc_decode_int(buff) info['rt_endian'] = Dap::Proto::WDBRPC.wdbrpc_decode_int(buff) info['rt_bsp_name'] = Dap::Proto::WDBRPC.wdbrpc_decode_str(buff) info['rt_bootline'] = Dap::Proto::WDBRPC.wdbrpc_decode_str(buff) info['rt_membase'] = Dap::Proto::WDBRPC.wdbrpc_decode_int(buff) info['rt_memsize'] = Dap::Proto::WDBRPC.wdbrpc_decode_int(buff) info['rt_region_count'] = Dap::Proto::WDBRPC.wdbrpc_decode_int(buff) info['rt_regions'] = Dap::Proto::WDBRPC.wdbrpc_decode_arr(buff, :int) info['rt_hostpool_base'] = Dap::Proto::WDBRPC.wdbrpc_decode_int(buff) info['rt_hostpool_size'] = Dap::Proto::WDBRPC.wdbrpc_decode_int(buff) if info['rt_regions'] info['rt_regions'] = info['rt_regions'].map{|x| x.to_s}.join(" ") end nulls = [] info.each_pair do |k,v| nulls << k if v.nil? end nulls.each {|k| info.delete(k) } info end |