![]() |
ImFusion C++ SDK 4.4.0
|
Namespace for network communication bundled in the subfolder 'Stream/Network'. More...
Namespace for network communication bundled in the subfolder 'Stream/Network'.
Classes | |
| struct | AccessToken |
| Represents an access token for a HTTP server. More... | |
| class | AuthorizationProvider |
| Interface for providing the Authorization header for WebRequests. More... | |
| class | StaticAuthorizationProvider |
| A most basic AuthorizationProvider that only tracks a static list of authorization headers. More... | |
| struct | HttpError |
| class | LoginDialog |
| Basic dialog for authentication with username and password TODO: Merge with Labels LoginDialog. More... | |
| class | ClientConnectionBase |
| Base class providing an interface for client communication. More... | |
| class | ConnectionBase |
| Abstract non-templated base class for all connection types. More... | |
| class | TypedConnectionBase |
| Templated base class providing an interface for client-server communication (e.g., WebSocket, TCP) or peer-to-peer communication (e.g., UDP). More... | |
| struct | ConnectionBlueprint |
| Defines the necessary information for registering a new connection type. More... | |
| class | ConnectionFactory |
| The ConnectionFactory manages available connection protocols and creates new connections based on the provided configuration. More... | |
| class | ConnectionLatencyMeasuringAlgorithm |
| Measure the delay (latency) experienced in transmitting data with the corresponding protocol, where the transmission data is represented as std::string, and the each message is defined as[TIMESTAMP]:time_in_ms,[ID]:message_id. More... | |
| class | TCPSocketClient |
| TCP socket client implementation providing bidirectional communication. More... | |
| class | TCPSocketServer |
| TCP socket server implementation providing bidirectional communication. More... | |
| class | ServerConnectionBase |
| Abstract base class providing a server interface. More... | |
| class | IPAddress |
| A class for handling and validating IPv4 addresses. More... | |
| class | WebsocketClient |
| WebSocket client implementation providing bidirectional communication. More... | |
| class | WebsocketServer |
| Websocket server implementation providing bidirectional communication. More... | |
| class | UDPSocket |
| UDP socket implementation for network communication. More... | |
| struct | LockToken |
| class | ServerStatus |
| Contains the status of the server (used by checkServer) i.e. More... | |
| struct | RemoteEvent |
| class | RemoteEventListener |
| struct | NetworkManagerGuard |
Typedefs | |
| using | ConnectionProtocol = std::string |
| Alias representing the connection protocol type, used to identify connections registered with the ConnectionFactory. | |
Functions | |
| void | initManager () |
| void | deinitManager () |
| std::pair< HttpStatus, std::vector< char > > | blockingRequest (const Filesystem::Url &url, const AuthorizationProvider &authProvider, RequestType requestType, ContentType payloadType, ByteBufferView inputBuffer, bool takeOutput, Progress::Task *task=nullptr) |
| Does a network request and blocks until the request is finished. | |
| std::pair< HttpStatus, std::vector< char > > | blockingRequest (const Filesystem::Url &url, RequestType requestType, ContentType payloadType, ByteBufferView inputBuffer, bool takeOutput, Progress::Task *task=nullptr) |
| std::pair< HttpStatus, std::vector< char > > | blockingGetRequest (const Filesystem::Url &url, Progress::Task *task=nullptr) |
| bool | isSuccessStatus (HttpStatus httpStatus) |
| std::vector< std::string > | errorDetails (const QJsonObject &response) |
| std::string | messageFromHttpStatus (HttpStatus status) |
| Given a HttpStatus, returns the message associated with it. | |
| std::optional< ServerStatus > | runCheckServerInBackground (const std::string &urlText) |
| Runs the checkServer() function in background with a cancelable progress dialog. | |
| std::string | getProjectUrl (const Filesystem::Url &serverUrl, const std::string &projectId) |
| std::string | getServerUrl (const Filesystem::Url &projectUrl) |
| std::string | getServerVersion (const Filesystem::Url &serverUrl) |
| ServerStatus | checkServer (const Filesystem::Url &path, Progress::Task *task=nullptr) |
| void | editProject (const Filesystem::Url &serverUrl, const AuthorizationProvider &authProvider, Project::Settings settings, const std::vector< TagType > &tagTypes, const std::vector< std::unique_ptr< Project::PixelwiseData > > &pixelwiseLayers, const std::vector< std::unique_ptr< Project::GeometricAnnotationData > > &geometricAnnotationLayers, Progress::Task *progress) |
| QJsonObject | getProjectMetaData (const Filesystem::Url &projectUrl, const AuthorizationProvider &authProvider, Progress::Task *progress=nullptr) |
| std::optional< Project::Permissions > | getProjectPermissions (const Filesystem::Url &projectUrl, const AuthorizationProvider &authProvider, Progress::Task *progress) |
| bool | updateProjectMetaData (const Filesystem::Url &projectUrl, const AuthorizationProvider &authProvider, const QJsonObject &metaData, Progress::Task *progress=nullptr) |
| std::vector< std::pair< QString, QString > > | getProjectList (const Filesystem::Url &serverUrl, const AuthorizationProvider &authProvider) |
| Utils::Expected< int, std::string > | addDatasetToProject (const Filesystem::Url &projectUrl, const SharedImageSet &sis, const std::optional< std::string > resourcePath, const DataDescriptor &descriptor, const AuthorizationProvider &authProvider, Progress *progress) |
| bool | saveLabelMap (const Filesystem::Url &url, const SharedImageSet &labelMap, bool hasData, const std::string &lockToken, const AuthorizationProvider &authProvider, Progress *progress) |
| void | updateLabelMapName (const DataDescriptor &dataset, int version, const QString &name, Progress *progress) |
| void | deleteDatasets (const Filesystem::Url &projectUrl, const std::vector< QString > &ids, const AuthorizationProvider &authProvider) |
| bool | updateDatasetMetaData (const Filesystem::Url &projectUrl, const QString &id, const QJsonObject &updateData, const AuthorizationProvider &authProvider) |
| Updates the meta data like name or comments of the given dataset. | |
| bool | saveThumbnail (const Filesystem::Url &path, const QImage &image, const AuthorizationProvider &authProvider) |
| std::optional< LockToken > | lockDataset (const Filesystem::Url &projectUrl, const std::string &datasetId, const std::string &lockToken, const AuthorizationProvider &authProvider) |
| Locks the dataset so it cannot be modified by another user. | |
| bool | unlockDataset (const Filesystem::Url &projectUrl, const std::string &datasetId, const std::string &lockToken, const AuthorizationProvider &authProvider) |
| std::vector< std::string > | getDatasetIds (const Filesystem::Url &projectUrl, const AuthorizationProvider &authProvider, const std::optional< std::string > &seriesUidQuery=std::nullopt) |
| std::vector< std::pair< std::string, std::string > > | getDatasetDicomInstanceUids (const Filesystem::Url &projectUrl, const std::string &datasetId, const AuthorizationProvider &authProvider) |
| std::optional< std::vector< QString > > | getLocksState (const Filesystem::Url &projectUrl, const AuthorizationProvider &authProvider) |
| std::unique_ptr< QImage > | loadThumbnail (const Filesystem::Url &path, const AuthorizationProvider &authProvider) |
| Utils::Expected< std::unique_ptr< SharedImageSet >, HttpStatus > | loadImage (const Filesystem::Url &path, const AuthorizationProvider &authProvider, Progress *p=nullptr) |
| std::optional< GeometricAnnotations > | loadGeometricAnnotations (const Filesystem::Url &path, int numFrames, const std::vector< Project::GeometricAnnotationType > &types, const AuthorizationProvider &authProvider) |
| bool | saveGeometricAnnotations (const Filesystem::Url &path, const GeometricAnnotations &boxes, const std::vector< Project::GeometricAnnotationType > &types, const std::string &lockToken, const AuthorizationProvider &authProvider, Progress *progress) |
| std::optional< std::vector< RemoteEvent > > | queryProjectEvents (const Filesystem::Url &projectUrl, int newerThan, bool blocking, const AuthorizationProvider &authProvider, Progress::Task *task=nullptr) |
| Utils::Expected< int, HttpStatus > | queryLatestProjectEventTimestamp (const Filesystem::Url &projectUrl, const AuthorizationProvider &authProvider) |
Variables | |
| constexpr int | g_supportedMajorVersionServer = 1 |
| constexpr int | g_supportedMinorVersionServer = 0 |
|
strong |
| Enumerator | |
|---|---|
| Continue | Request received, continue process. |
| SwitchingProtocols | Switching to new protocol. |
| Processing | Request is being processed (WebDAV). |
| EarlyHints | Hints before final response. |
| Ok | Request succeeded. |
| Created | Resource created successfully. |
| Accepted | Request accepted, processing continues. |
| NonAuthoritativeInformation | Information from another source. |
| NoContent | No content to send. |
| ResetContent | Reset document view. |
| PartialContent | Partial content delivered. |
| MultiStatus | Multiple status for batch requests (WebDAV). |
| AlreadyReported | Already reported (WebDAV). |
| ImUsed | Instance has been used (HTTP Delta encoding). |
| MultipleChoices | Multiple possible responses. |
| MovedPermanently | Resource moved permanently. |
| Found | Resource found but at a different location. |
| SeeOther | See another URI for response. |
| NotModified | Resource not modified. |
| UseProxy | Must use a proxy. |
| TemporaryRedirect | Temporary redirect to another URI. |
| PermanentRedirect | Permanent redirect to another URI. |
| BadRequest | Bad request syntax. |
| Unauthorized | Authentication required. |
| PaymentRequired | Payment required (reserved). |
| Forbidden | Access forbidden. |
| NotFound | Resource not found. |
| MethodNotAllowed | HTTP method not allowed. |
| NotAcceptable | Cannot produce acceptable response. |
| ProxyAuthenticationRequired | Proxy authentication required. |
| RequestTimeout | Client did not send request in time. |
| Conflict | Conflict with server state. |
| Gone | Resource no longer available. |
| LengthRequired | Content-Length header required. |
| PreconditionFailed | Precondition in headers failed. |
| PayloadTooLarge | Request entity too large. |
| UriTooLong | URI too long. |
| UnsupportedMediaType | Media type not supported. |
| RangeNotSatisfiable | Requested range not valid. |
| ExpectationFailed | Expectation in Expect header failed. |
| ImATeapot | I'm a teapot (RFC 2324 joke). |
| MisdirectedRequest | Request was misdirected. |
| UnprocessableEntity | Semantic errors in request (WebDAV). |
| Locked | Resource is locked (WebDAV). |
| FailedDependency | Failed dependency (WebDAV). |
| TooEarly | Risk of replay attack. |
| UpgradeRequired | Client must upgrade protocol. |
| PreconditionRequired | Precondition headers required. |
| TooManyRequests | Too many requests sent. |
| RequestHeaderFieldsTooLarge | Headers too large. |
| UnavailableForLegalReasons | Blocked for legal reasons. |
| InternalServerError | Generic server error. |
| NotImplemented | Not implemented on server. |
| BadGateway | Invalid response from upstream server. |
| ServiceUnavailable | Server is overloaded or under maintenance. |
| GatewayTimeout | Upstream server timeout. |
| HttpVersionNotSupported | HTTP version not supported. |
| VariantAlsoNegotiates | Server misconfiguration. |
| InsufficientStorage | Insufficient storage (WebDAV). |
| LoopDetected | Infinite loop detected (WebDAV). |
| NotExtended | Further extensions required. |
| NetworkAuthenticationRequired | Network authentication required. |
|
strong |
Available layer types of the server.
Corresponds to models.LayerType on the server.
| std::pair< HttpStatus, std::vector< char > > ImFusion::Network::blockingRequest | ( | const Filesystem::Url & | url, |
| const AuthorizationProvider & | authProvider, | ||
| RequestType | requestType, | ||
| ContentType | payloadType, | ||
| ByteBufferView | inputBuffer, | ||
| bool | takeOutput, | ||
| Progress::Task * | task = nullptr ) |
Does a network request and blocks until the request is finished.
The authProvider is used for the 'Authorization' header ('Bearer' is automically prepended). The payloadType sets the 'Content-Type' header. Use ContentType::NA to not set a this header (e.g. if the body is empty). The inputBuffer will be send as the body of the request. If takeOutput is true, the resulting response body text is returned. Returns the HTTP response code and the body of the response (empty if takeOutput was false). If a Progress::Task is passed as an argument, the progress will be updated via the update callback of curl. The caller is responsible for making these updates thread safe if needed.
| std::optional< ServerStatus > ImFusion::Network::runCheckServerInBackground | ( | const std::string & | urlText | ) |
Runs the checkServer() function in background with a cancelable progress dialog.
If the progress is canceled, a nullopt is returned.
| bool ImFusion::Network::updateDatasetMetaData | ( | const Filesystem::Url & | projectUrl, |
| const QString & | id, | ||
| const QJsonObject & | updateData, | ||
| const AuthorizationProvider & | authProvider ) |
Updates the meta data like name or comments of the given dataset.
The updateData is a json value like { "name": "Test", "comment": "", "meta_data": { "custom": 1 } }. If a value (like "comment") is missing, it won't be changed. The "meta_data" field can contain anything and is not validated by the server. The "meta_data" object is merged on the server with the existing meta_data. It is therefore not necessary to first request the existing meta_data to avoid accidentally removing values.
| std::optional< LockToken > ImFusion::Network::lockDataset | ( | const Filesystem::Url & | projectUrl, |
| const std::string & | datasetId, | ||
| const std::string & | lockToken, | ||
| const AuthorizationProvider & | authProvider ) |
Locks the dataset so it cannot be modified by another user.
The lockToken should be a random string. Returns the number of seconds the token will expire in or nullopt if the token could not be acquired.