# File lib/mcollective/message.rb, line 175
    def decode!
      raise "Cannot decode message type #{type}" unless [:request, :reply].include?(type)

      begin
        @payload = PluginManager["security_plugin"].decodemsg(self)
      rescue Exception => e
        if type == :request
          # If we're a server receiving a request, reraise
          raise(e)
        else
          # We're in the client, log and carry on as best we can

          # Note: mc_sender is unverified.  The verified identity is in the
          # payload we just failed to decode
          Log.warn("Failed to decode a message from '#{headers["mc_sender"]}': #{e}")
          return
        end
      end

      if type == :request
        raise 'callerid in request is not valid, surpressing reply to potentially forged request' unless PluginManager["security_plugin"].valid_callerid?(payload[:callerid])
      end

      [:collective, :agent, :filter, :requestid, :ttl, :msgtime].each do |prop|
        instance_variable_set("@#{prop}", payload[prop]) if payload.include?(prop)
      end
    end