def to_msgpack(*a)
      msg = {
        'msgpack_class' => self.class.name,
        'data'          => instance_variables.inject({}) do |m, ivar|
                             name = ivar.to_s.sub(/@/, '')
                             m[name] = instance_variable_get(ivar) unless NOT_SERIALIZED.include?(name)
                             m
                           end,
        'size'          => nil
      }.to_msgpack(*a)
      @size = msg.size
      # For msgpack 0.5.1 the to_msgpack result is a MessagePack::Packer so need to convert to string
      msg = msg.to_s.sub!(PACKET_SIZE_REGEXP) { |m| "size" + @size.to_msgpack }
      msg
    end
def to_msgpack(*a)
      msg = {
        'msgpack_class' => self.class.name,
        'data'          => instance_variables.inject({}) do |m, ivar|
                             name = ivar.to_s.sub(/@/, '')
                             m[name] = instance_variable_get(ivar) unless NOT_SERIALIZED.include?(name)
                             m
                           end,
        'size'          => nil
      }.to_msgpack(*a)
      @size = msg.size
      # For msgpack 0.5.1 the to_msgpack result is a MessagePack::Packer so need to convert to string
      msg = msg.to_s.sub!(PACKET_SIZE_REGEXP) { |m| "size" + @size.to_msgpack }
      msg
    end
Marshal packet into MessagePack format

 === Parameters
 a(Array):: Arguments

 === Return
 msg(String):: Marshalled packet