Orthanc Plugin SDK Documentation

This C/C++ SDK allows external developers to create plugins that can be loaded into Orthanc to extend its functionality. Each Orthanc plugin must expose 4 public functions with the following signatures:

1. `int32_t OrthancPluginInitialize(const OrthancPluginContext* context)`: This function is invoked by Orthanc when it loads the plugin on startup. The plugin must:
   - Check its compatibility with the Orthanc version using OrthancPluginCheckVersion().
   - Store the context pointer so that it can use the plugin services of Orthanc.
   - Register all its REST callbacks using OrthancPluginRegisterRestCallback().
   - Possibly register its callback for received DICOM instances using OrthancPluginRegisterOnStoredInstanceCallback().
   - Possibly register its callback for changes to the DICOM store using OrthancPluginRegisterOnChangeCallback().
   - Possibly register a custom storage area using OrthancPluginRegisterStorageArea().
   - Possibly register a custom database back-end area using OrthancPluginRegisterDatabaseBackendV2().
   - Possibly register a handler for C-Find SCP using OrthancPluginRegisterFindCallback().
   - Possibly register a handler for C-Find SCP against DICOM worklists using OrthancPluginRegisterWorklistCallback().
   - Possibly register a handler for C-Move SCP using OrthancPluginRegisterMoveCallback().
   - Possibly register a custom decoder for DICOM images using OrthancPluginRegisterDecodeImageCallback().
   - Possibly register a callback to filter incoming HTTP requests using OrthancPluginRegisterIncomingHttpRequestFilter2().
2. `void OrthancPluginFinalize()`: This function is invoked by Orthanc during its shutdown. The plugin must free all its memory.
3. `const char* OrthancPluginGetName()`: The plugin must return a short string to identify itself.
4. `const char* OrthancPluginGetVersion()`: The plugin must return a string containing its version number.

The name and the version of a plugin is only used to prevent it from being loaded twice. Note that, in C++, it is mandatory to declare these functions within an `extern "C"` section.

To ensure multi-threading safety, the various REST callbacks are guaranteed to be executed in mutual exclusion since Orthanc 0.8.5. If this feature is undesired (notably when developing high-performance plugins handling simultaneous requests), use OrthancPluginRegisterRestCallbackNoLock().