Mercurial > hg > orthanc
comparison Plugins/OrthancCPlugin/OrthancCPlugin.h @ 894:690aeb4cb899 plugins
REST callbacks
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 16 Jun 2014 17:31:09 +0200 |
parents | d44b845c1c89 |
children | c4053ac5db04 |
comparison
equal
deleted
inserted
replaced
893:f57802f8b4dc | 894:690aeb4cb899 |
---|---|
53 #ifdef __cplusplus | 53 #ifdef __cplusplus |
54 extern "C" | 54 extern "C" |
55 { | 55 { |
56 #endif | 56 #endif |
57 | 57 |
58 typedef void (*OrthancPluginLogError) (const char* str); | 58 typedef struct OrthancRestOutput_t OrthancRestOutput; |
59 | 59 |
60 typedef void (*OrthancPluginLogWarning) (const char* str); | 60 typedef enum |
61 { | |
62 OrthancHttpMethod_Get = 1, | |
63 OrthancHttpMethod_Post = 2, | |
64 OrthancHttpMethod_Put = 3, | |
65 OrthancHttpMethod_Delete = 4 | |
66 } OrthancHttpMethod; | |
61 | 67 |
62 typedef void (*OrthancPluginLogInfo) (const char* str); | 68 typedef struct OrthancRestUrl_t |
69 { | |
70 const char* path; | |
71 const char* const* components; | |
72 uint32_t componentsSize; | |
73 const char* const* parameters; | |
74 uint32_t parametersSize; | |
75 } OrthancRestUrl; | |
76 | |
63 | 77 |
64 typedef int32_t (*OrthancPluginService) (const char* serviceName, | 78 typedef int32_t (*OrthancPluginService) (const char* serviceName, |
65 const void* serviceParameters); | 79 const void* serviceParameters); |
66 | 80 |
67 typedef struct OrthancPluginContext | 81 typedef int32_t (*OrthancRestCallback) (OrthancRestOutput* output, |
82 OrthancHttpMethod method, | |
83 const OrthancRestUrl* url, | |
84 const char* body, | |
85 uint32_t bodySize); | |
86 | |
87 typedef struct OrthancPluginContext_t | |
68 { | 88 { |
89 void* pimpl; | |
90 | |
69 const char* orthancVersion; | 91 const char* orthancVersion; |
70 OrthancPluginService InvokeService; | 92 void (*FreeBuffer) (void* buffer); |
71 OrthancPluginLogError LogError; | |
72 OrthancPluginLogWarning LogWarning; | |
73 OrthancPluginLogInfo LogInfo; | |
74 | 93 |
75 /* TODO REGISTER */ | 94 /* Logging functions */ |
95 void (*LogError) (const char* str); | |
96 void (*LogWarning) (const char* str); | |
97 void (*LogInfo) (const char* str); | |
76 | 98 |
99 /* REST API */ | |
100 void (*RegisterRestCallback) (const struct OrthancPluginContext_t* context, | |
101 const char* path, | |
102 OrthancRestCallback callback); | |
103 | |
104 void (*AnswerBuffer) (OrthancRestOutput* output, | |
105 const char* answer, | |
106 uint32_t answerSize, | |
107 const char* mimeType); | |
77 } OrthancPluginContext; | 108 } OrthancPluginContext; |
78 | 109 |
79 | 110 |
80 /** | 111 /** |
81 Each plugin must define 4 functions, whose signature is: | 112 Each plugin must define 4 functions, whose signature are: |
82 - int32_t OrthancPluginInitialize(const OrthancPluginContext*); | 113 - int32_t OrthancPluginInitialize(const OrthancPluginContext*); |
83 - void OrthancPluginFinalize(); | 114 - void OrthancPluginFinalize(); |
84 - const char* OrthancPluginGetName(); | 115 - const char* OrthancPluginGetName(); |
85 - const char* OrthancPluginGetVersion(); | 116 - const char* OrthancPluginGetVersion(); |
86 | 117 |