diff OrthancServer/DicomInstanceToStore.h @ 1572:904096e7367e

More information about the origin request in OnStoredInstance() callbacks
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 25 Aug 2015 12:10:12 +0200
parents bba8a47922d1
children 3309878b3e16
line wrap: on
line diff
--- a/OrthancServer/DicomInstanceToStore.h	Tue Aug 25 11:04:19 2015 +0200
+++ b/OrthancServer/DicomInstanceToStore.h	Tue Aug 25 12:10:12 2015 +0200
@@ -35,6 +35,7 @@
 #include "ParsedDicomFile.h"
 #include "ServerIndex.h"
 #include "../Core/OrthancException.h"
+#include "../Core/RestApi/RestApiCall.h"
 
 namespace Orthanc
 {
@@ -143,13 +144,34 @@
     SmartContainer<DicomMap>  summary_;
     SmartContainer<Json::Value>  json_;
 
-    std::string remoteAet_;
-    std::string calledAet_;
+    RequestOrigin origin_;
+    std::string dicomRemoteAet_;
+    std::string dicomCalledAet_;
+    std::string httpRemoteIp_;
+    std::string httpUsername_;
     ServerIndex::MetadataMap metadata_;
 
     void ComputeMissingInformation();
 
   public:
+    DicomInstanceToStore() : origin_(RequestOrigin_Unknown)
+    {
+    }
+
+    void SetDicomProtocolOrigin(const char* remoteAet,
+                                const char* calledAet);
+
+    void SetRestOrigin(const RestApiCall& call);
+
+    void SetHttpOrigin(const char* remoteIp,
+                       const char* username);
+
+    void SetLuaOrigin();
+
+    void SetPluginsOrigin();
+
+    const char* GetRemoteAet() const; 
+
     void SetBuffer(const std::string& dicom)
     {
       buffer_.SetConstReference(dicom);
@@ -170,26 +192,6 @@
       json_.SetConstReference(json);
     }
 
-    const std::string& GetRemoteAet() const
-    {
-      return remoteAet_;
-    }
-
-    void SetRemoteAet(const std::string& aet)
-    {
-      remoteAet_ = aet;
-    }
-
-    const std::string& GetCalledAet() const
-    {
-      return calledAet_;
-    }
-
-    void SetCalledAet(const std::string& aet)
-    {
-      calledAet_ = aet;
-    }
-
     void AddMetadata(ResourceType level,
                      MetadataType metadata,
                      const std::string& value);
@@ -211,5 +213,7 @@
     const DicomMap& GetSummary();
     
     const Json::Value& GetJson();
+
+    void GetOriginInformation(Json::Value& result) const;
   };
 }