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
raise(e)
else
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