Microsoft Information Protection (MIP) SDK for C: Reference 1.15
Doxygen-generated documentation for MIP SDK written in C
Loading...
Searching...
No Matches
protection_engine_cc.h
Go to the documentation of this file.
1/*
2 *
3 * Copyright (c) Microsoft Corporation.
4 * All rights reserved.
5 *
6 * This code is licensed under the MIT License.
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files(the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions :
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 * THE SOFTWARE.
25 *
26 */
27
28/**
29 * @brief Defines C-Style ProtectionEngine functions
30 *
31 * @file protection_engine_cc.h
32 */
33
34#ifndef API_MIP_PROTECTION_PROTECTION_ENGINE_CC_H_
35#define API_MIP_PROTECTION_PROTECTION_ENGINE_CC_H_
36
37#include <stdint.h>
38
44#include "mip_cc/error_cc.h"
50#include "mip_cc/result_cc.h"
52
55
56/**
57 * @brief Release resources associated with a protection engine
58 *
59 * @param engine Protection engine to release
60 */
61MIP_CC_API(void) MIP_CC_ReleaseProtectionEngine(mip_cc_protection_engine engine);
62
63/**
64 * @brief Creates a protection handler for publishing new content
65 *
66 * @param engine Engine under which a handler will be created
67 * @param settings Protection handler settings
68 * @param context Client context that will be opaquely passed to HttpDelegate and AuthDelegate
69 * @param handler [Output] Newly-created protection handler instance
70 * @param errorInfo [Output] (Optional) Failure info if operation result is error
71 *
72 * @return Result code indicating success or failure
73 */
74MIP_CC_API(mip_cc_result) MIP_CC_ProtectionEngine_CreateProtectionHandlerForPublishing(
77 const void* context,
80
81/**
82 * @brief Creates a protection handler for consuming existing content
83 *
84 * @param engine Engine under which a handler will be created
85 * @param settings Protection handler settings
86 * @param context Client context that will be opaquely passed to HttpDelegate and AuthDelegate
87 * @param handler [Output] Newly-created protection handler instance
88 * @param errorInfo [Output] (Optional) Failure info if operation result is error
89 *
90 * @return Result code indicating success or failure
91 */
92MIP_CC_API(mip_cc_result) MIP_CC_ProtectionEngine_CreateProtectionHandlerForConsumption(
95 const void* context,
98
99/**
100 * @brief Gets size of buffer required to engine ID
101 *
102 * @param engine Protection engine
103 * @param idSize [Output] Size of buffer to hold engine ID (in number of chars)
104 * @param errorInfo [Output] (Optional) Failure info if operation result is error
105 *
106 * @return Result code indicating success or failure
107 */
108MIP_CC_API(mip_cc_result) MIP_CC_ProtectionEngine_GetEngineIdSize(
110 int64_t* idSize,
112
113/**
114 * @brief Gets engine ID
115 *
116 * @param engine Protection engine
117 * @param idBuffer [Output] Buffer the id will be copied into.
118 * @param idBufferSize Size (in number of chars) of the idBuffer.
119 * @param actualIdSize [Output] Number of chars written to the buffer
120 * @param errorInfo [Output] (Optional) Failure info if operation result is error
121 *
122 * @return Result code indicating success or failure
123 *
124 * @note If idBuffer is null or insufficient, MIP_RESULT_ERROR_INSUFFICIENT_BUFFER will be returned and
125 * actualIdSize will be set to the minimum required buffer size.
126 */
127MIP_CC_API(mip_cc_result) MIP_CC_ProtectionEngine_GetEngineId(
129 char* idBuffer,
130 const int64_t idBufferSize,
131 int64_t* actualIdSize,
133
134/**
135 * @brief Gets the number of RMS templates associated with a protection engine
136 *
137 * @param engine Protection engine
138 * @param context Client context that will be opaquely passed to HttpDelegate and AuthDelegate
139 * @param templatesSize [Output] Number of templates
140 * @param errorInfo [Output] (Optional) Failure info if operation result is error
141 *
142 * @return Result code indicating success or failure
143 *
144 * @note This API may result in an independent HTTP operation. Consider using 'MIP_CC_ProtectionEngine_GetTemplates'
145 * directly with a pre-defined buffer to avoid unnecessary extra HTTP operations.
146 */
147MIP_CC_API(mip_cc_result) MIP_CC_ProtectionEngine_GetTemplatesSize(
149 const void* context,
152
153/**
154 * @brief Get collection of templates available to a user
155 *
156 * @param engine Protection engine
157 * @param context Client context that will be opaquely passed to HttpDelegate and AuthDelegate
158 * @param mip_cc_template_descriptor [Output] buffer to create template handlers.
159 * @param templateBufferSize Size (in number of items) of the templateBuffer.
160 * @param actualTemplatesSize [Output] Number of template IDs written to the buffer
161 * @param errorInfo [Output] (Optional) Failure info if operation result is error
162 *
163 * @return Result code indicating success or failure
164 *
165 * @note If templateBuffer is null or insufficient, MIP_RESULT_ERROR_INSUFFICIENT_BUFFER will be returned and
166 * actualTemplateSize will be set to the minimum required buffer size. Each mip_cc_template_descriptor must
167 * be released by the caller by calling MIP_CC_ReleaseTemplateDescriptor().
168 */
169MIP_CC_API(mip_cc_result) MIP_CC_ProtectionEngine_GetTemplates(
171 const void* context,
173 const int64_t templateBufferSize,
176
177/**
178 * @brief Get list of rights granted to a user for a label ID
179 *
180 * @param engine Protection engine
181 * @param context Client context that will be opaquely passed to HttpDelegate and AuthDelegate
182 * @param documentId Document ID assigned to the document
183 * @param labelId Label ID applied to the document
184 * @param ownerEmail Owner of the document
185 * @param delagedUserEmail Email of user if the authenticating user/application is acting on behalf of another user, empty if none
186 * @param rights [Output] List of rights granted to a user, memory owned by caller
187 * @param errorInfo [Output] (Optional) Failure info if operation result is error
188 *
189 * @return Result code indicating success or failure
190 *
191 * @note The 'rights' variable must be released by the caller by calling MIP_CC_ReleaseStringList
192 */
193MIP_CC_API(mip_cc_result) MIP_CC_ProtectionEngine_GetRightsForLabelId(
195 const void* context,
196 const char* documentId,
197 const char* labelId,
198 const char* ownerEmail,
202
203/**
204 * @brief Get list of rights granted to a user for a label ID
205 *
206 * @param engine Protection engine
207 * @param context Client context that will be opaquely passed to the HttpDelegate and AuthDelegate
208 * @param documentId Document ID assigned to the document
209 * @param labelId Label ID applied to the document
210 * @param ownerEmail Owner of the document
211 * @param delagedUserEmail Email of the user if the authenticating user/application is acting on behalf of
212 * another user, empty if none
213 * @param licenseInfo [Output] LicenseInfo pertaining to a given label id. Memory owned by caller.
214 * @param errorInfo [Output] (Optional) Failure info if operation result is error
215 *
216 * @return Result code indicating success or failure
217 *
218 * @note The returned 'licenseInfo' (mip_cc_license_info*) must be freed by calling MIP_CC_ReleaseLicenseInfo
219 */
220MIP_CC_API(mip_cc_result) MIP_CC_ProtectionEngine_GetLicenseInfoForLabelId(
222 const void* context,
223 const char* documentId,
224 const char* labelId,
225 const char* ownerEmail,
226 const char* delegatedUserEmail,
229
230/**
231 * @brief Gets the size of client data associated with a protection engine
232 *
233 * @param engine Protection engine
234 * @param clientDataSize [Output] Size of client data (in number of chars)
235 * @param errorInfo [Output] (Optional) Failure info if operation result is error
236 *
237 * @return Result code indicating success or failure
238 */
239MIP_CC_API(mip_cc_result) MIP_CC_ProtectionEngine_GetClientDataSize(
243
244/**
245 * @brief Get client data associated with a protection engine
246 *
247 * @param engine Protection engine
248 * @param clientDataBuffer [Output] Buffer the client data will be copied into
249 * @param clientDataBufferSize Size (in number of chars) of clientDataBuffer.
250 * @param actualClientDataSize [Output] Number of chars written to the buffer
251 * @param errorInfo [Output] (Optional) Failure info if operation result is error
252 *
253 * @return Result code indicating success or failure
254 *
255 * @note If clientDataBuffer is null or insufficient, MIP_RESULT_ERROR_INSUFFICIENT_BUFFER will be returned and
256 * actualClientDataSize will be set to the minimum required buffer size.
257 */
258MIP_CC_API(mip_cc_result) MIP_CC_ProtectionEngine_GetClientData(
261 const int64_t clientDataBufferSize,
264
265/**
266 * @brief Get the delegation and end-user licenses associated with a protection license
267 *
268 * @param engine The \ref mip_cc_protection_engine and associated identity to use when querying the licenses
269 * @param settings A collection of \ref mip_cc_delegation_license_settings that determine which licenses to retrieve
270 * @param context (Optional) Optional context that is passed along to any listening HttpDelegate.
271 * @param delegationLicenses [Output] Returned collection of \ref mip_cc_delegation_license objects.
272 * @param errorInfo [Output] (Optional) Failure info if operation result is error
273 *
274 * @return Result code indicating success or failure
275
276 * @note To avoid memory leaks, \p delegationLicenses must be released using \ref MIP_CC_ReleaseDelegationLicenses.
277 */
278MIP_CC_API(mip_cc_result) MIP_CC_ProtectionEngine_GetDelegationLicenses(
281 const void* context,
284
285/**
286 * @deprecated See the replacement MIP_CC_CreateProtectionEngineSettingsWithIdentityAndAuthCallback
287 * @brief Create a settings object used to create a brand new protection engine
288 *
289 * @param identity Identity that will be associated with ProtectionEngine
290 * @param clientData Customizable client data that is stored alongside the engine
291 * @param locale Locale in which text results will output
292 * @param engineSettings [Output] Newly-created settings instance
293 * @param errorInfo [Output] (Optional) Failure info if operation result is error
294 *
295 * @return Result code indicating success or failure
296 */
297MIP_CC_DEPRECATED_API(mip_cc_result) MIP_CC_CreateProtectionEngineSettingsWithIdentity(
299 const char* clientData,
300 const char* locale,
303
304/**
305 * @deprecated See the replacement MIP_CC_CreateProtectionEngineSettingsWithEngineIdAndAuthCallback
306 * @brief Create a settings object used to load an existing protection engine by engine ID if it
307 already exists, else create a new engine
308 *
309 * @param engineId ID of existing cached engine
310 * @param identity (Optional) Identity that will be associated with ProtectionEngine
311 * @param clientData Customizable client data that is stored alongside the engine
312 * @param locale Locale in which text results will output
313 * @param engineSettings [Output] Newly-created settings instance
314 * @param errorInfo [Output] (Optional) Failure info if operation result is error
315 *
316 * @return Result code indicating success or failure
317 *
318 * @note 'identity' will only be used for new engines. If an engine with the specified engine id already exists in
319 * the local cache, the identity from the cached engine will be used instead.
320 */
321MIP_CC_DEPRECATED_API(mip_cc_result) MIP_CC_CreateProtectionEngineSettingsWithEngineId(
322 const char* engineId,
324 const char* clientData,
325 const char* locale,
328
329/**
330 * @brief Create a settings object used to create a brand new protection engine
331 *
332 * @param identity Identity that will be associated with ProtectionEngine
333 * @param authCallback Callback object to be used for authentication, implemented by client application
334 * @param clientData Customizable client data that is stored alongside the engine
335 * @param locale Locale in which text results will output
336 * @param engineSettings [Output] Newly-created settings instance
337 * @param errorInfo [Output] (Optional) Failure info if operation result is error
338 *
339 * @return Result code indicating success or failure
340 */
341MIP_CC_API(mip_cc_result) MIP_CC_CreateProtectionEngineSettingsWithIdentityAndAuthCallback(
343 const mip_cc_auth_callback authCallback,
344 const char* clientData,
345 const char* locale,
348
349/**
350 * @brief Create a settings object used to load an existing protection engine by engine ID if it
351 already exists, else create a new engine
352 *
353 * @param engineId ID of existing cached engine
354 * @param identity (Optional) Identity that will be associated with ProtectionEngine
355 * @param authCallback Callback object to be used for authentication, implemented by client application
356 * @param clientData Customizable client data that is stored alongside the engine
357 * @param locale Locale in which text results will output
358 * @param engineSettings [Output] Newly-created settings instance
359 * @param errorInfo [Output] (Optional) Failure info if operation result is error
360 *
361 * @return Result code indicating success or failure
362 *
363 * @note 'identity' will only be used for new engines. If an engine with the specified engine id already exists in
364 * the local cache, the identity from the cached engine will be used instead.
365 */
366MIP_CC_API(mip_cc_result) MIP_CC_CreateProtectionEngineSettingsWithEngineIdAndAuthCallback(
367 const char* engineId,
369 const mip_cc_auth_callback authCallback,
370 const char* clientData,
371 const char* locale,
374
375/**
376 * @brief Sets the client data that will be stored opaquely alongside this engine and persist across sessions
377 *
378 * @param settings Engine settings
379 * @param clientData Client data
380 * @param errorInfo [Output] (Optional) Failure info if operation result is error
381 *
382 * @return Result code indicating success or failure
383 */
384MIP_CC_API(mip_cc_result) MIP_CC_ProtectionEngineSettings_SetClientData(
386 const char* clientData,
388
389/**
390 * @brief Configures custom settings, used for feature gating and testing.
391 *
392 * @param engineSettings Engine settings
393 * @param customSettings Key/value pairs of custom settings
394 * @param errorInfo [Output] (Optional) Failure info if operation result is error
395 *
396 * @return Result code indicating success or failure
397 */
398MIP_CC_API(mip_cc_result) MIP_CC_ProtectionEngineSettings_SetCustomSettings(
402
403/**
404 * @brief Sets the session ID that can be used to correlate logs and telemetry
405 *
406 * @param settings Engine settings
407 * @param sessionId Session ID that represents the lifetime of a protection engine
408 * @param errorInfo [Output] (Optional) Failure info if operation result is error
409 *
410 * @return Result code indicating success or failure
411 */
412MIP_CC_API(mip_cc_result) MIP_CC_ProtectionEngineSettings_SetSessionId(
414 const char* sessionId,
416
417/**
418 * @brief Sets cloud which affects endpoint URLs for all service requests
419 *
420 * @param settings Engine settings
421 * @param cloud Cloud identifier (default = Unknown)
422 * @param errorInfo [Output] (Optional) Failure info if operation result is error
423 *
424 * @return Result code indicating success or failure
425 *
426 * @note If cloud is not specified, then it will be determined by DNS lookup of the engine's
427 * identity domain if possible, else fall back to global cloud.
428 */
429MIP_CC_API(mip_cc_result) MIP_CC_ProtectionEngineSettings_SetCloud(
433
434/**
435 * @brief Sets base URL for all service requests
436 *
437 * @param settings Engine settings
438 * @param cloudEndpointBaseUrl Base URL (e.g. 'https://api.aadrm.com')
439 * @param errorInfo [Output] (Optional) Failure info if operation result is error
440 *
441 * @return Result code indicating success or failure
442 *
443 * @note This value will only be read and must be set for Cloud = MIP_CLOUD_CUSTOM
444 */
445MIP_CC_API(mip_cc_result) MIP_CC_ProtectionEngineSettings_SetCloudEndpointBaseUrl(
449
450/**
451 * @brief Sets underlying application ID
452 *
453 * @param settings Engine settings
454 * @param underlyingApplicationId Application ID (could be a Guid)
455 * @param errorInfo [Output] (Optional) Failure info if operation result is error
456 *
457 * @return Result code indicating success or failure
458 */
459MIP_CC_API(mip_cc_result) MIP_CC_ProtectionEngineSettings_SetUnderlyingApplicationId(
463
464/**
465 * @brief Sets whether or not only cloud service is allowed
466 *
467 * @param settings Engine settings
468 * @param allowCloudServiceOnly A boolean value indicating whether or not only cloud service is allowed
469 * @param errorInfo [Output] (Optional) Failure info if operation result is error
470 *
471 * @return Result code indicating success or failure
472 */
473MIP_CC_API(mip_cc_result) MIP_CC_ProtectionEngineSettings_SetAllowCloudServiceOnly(
477
478/**
479 * @brief Sets whether or not only cloud service is allowed
480 *
481 * @param settings Engine settings
482 * @param templateRefreshIntervalHours How long, in hours, a cached template will be valid to use.
483 * A value of 0 means templates should never be cached. This is the default.
484 * @param templateBatchingSize If doing offline publishing, how many temlates will be fetched at a single time.
485 * Max 25.
486 * @param errorInfo [Output] (Optional) Failure info if operation result is error
487 *
488 * @return Result code indicating success or failure
489 */
490MIP_CC_API(mip_cc_result) MIP_CC_ProtectionEngineSettings_SetTemplateRefreshArgs(
495
496/**
497 * @brief Add a capability to the set of capabilities supported when calling RMS
498 *
499 * @param engineSettings Engine settings
500 * @param capability The capability to add to indicate a supported feature to RMS
501 * @param errorInfo [Output] (Optional) Failure info if operation result is error
502 *
503 * @return Result code indicating success or failure
504*/
505MIP_CC_API(mip_cc_result) MIP_CC_ProtectionEngineSettings_AddRmsCapability(
507 const char* capability,
509
510/**
511 * @brief Remove a capability from the set of capabilities supported when calling RMS
512 *
513 * @param engineSettings Engine settings
514 * @param capability The capability to remove from the supported features in RMS
515 * @param removed [Output] A boolean indiciating if the supplied capability was removed.
516 * @param errorInfo [Output] (Optional) Failure info if operation result is error
517 *
518 * @return Result code indicating success or failure
519*/
520MIP_CC_API(mip_cc_result) MIP_CC_ProtectionEngineSettings_RemoveRmsCapability(
522 const char* capability,
523 bool* removed,
525
526/**
527 * @brief Gets the set of supported capabilities being passed to RMS
528 *
529 * @param engineSettings Engine settings
530 * @param capabilities [Output] Gets the list of capabilities being passed to RMS
531 * @param errorInfo [Output] (Optional) Failure info if operation result is error
532 *
533 * @return Result code indicating success or failure
534 *
535 * @note The returned 'capabilities' (mip_cc_string_list*) must be freed by
536 * calling MIP_CC_ReleaseStringList.
537*/
538MIP_CC_API(mip_cc_result) MIP_CC_ProtectionEngineSettings_GetRmsCapability(
542
543/**
544 * @brief Release resources associated with a protection engine settings
545 *
546 * @param engineSettings Protection engine settings to be released
547 */
548MIP_CC_API(void) MIP_CC_ReleaseProtectionEngineSettings(mip_cc_protection_engine_settings engineSettings);
549
550#endif // API_MIP_PROTECTION_PROTECTION_ENGINE_CC_H_
ApplicationInfo definition.
Defines auth callback functions.
A file Containing the common types used by the upe, file and protection modules.
mip_cc_cloud
Defines consent callback functions.
Contains C API definitions for common string dictionary.
Error definition and functions.
Export/import and other macros for C API.
const void mip_cc_template_descriptor const int64_t int64_t * actualTemplatesSize
const mip_cc_protection_handler_publishing_settings const void mip_cc_protection_handler mip_cc_error * errorInfo
const mip_cc_delegation_license_settings const void mip_cc_delegation_licenses * delegationLicenses
const char bool * removed
int templateRefreshIntervalHours
const mip_cc_protection_handler_publishing_settings const void mip_cc_protection_handler * handler
const void const char const char const char const char * delegatedUserEmail
const char const char * locale
const void const char const char const char const char mip_cc_string_list * rights
MIP_CC_API(void) MIP_CC_ReleaseProtectionEngine(mip_cc_protection_engine engine)
Release resources associated with a protection engine.
const mip_cc_auth_callback authCallback
const mip_cc_identity * identity
const void mip_cc_template_descriptor * templateDescriptors
const char * sessionId
char const int64_t int64_t * actualClientDataSize
const mip_cc_protection_handler_publishing_settings settings
const char * clientData
MIP_CC_DEPRECATED_API(mip_cc_result) MIP_CC_CreateProtectionEngineSettingsWithIdentity(const mip_cc_identity *identity
Create a settings object used to create a brand new protection engine.
char * clientDataBuffer
const mip_cc_cloud cloud
char const int64_t clientDataBufferSize
int64_t * clientDataSize
bool allowCloudServiceOnly
int64_t * idSize
const mip_cc_dictionary customSettings
mip_cc_handle * mip_cc_protection_engine_settings
mip_cc_string_list * capabilities
const void const char const char * labelId
const void const char const char const char * ownerEmail
const void mip_cc_template_descriptor const int64_t templateBufferSize
const char * underlyingApplicationId
const char * capability
const char * cloudEndpointBaseUrl
const mip_cc_protection_handler_publishing_settings const void * context
const void const char const char const char const char mip_cc_license_info * licenseInfo
int int templateBatchingSize
char const int64_t idBufferSize
const void int64_t * templatesSize
char const int64_t int64_t * actualIdSize
const void const char * documentId
mip_cc_handle * mip_cc_protection_engine
const char const char mip_cc_protection_engine_settings * engineSettings
char * idBuffer
Defines C-Style ProtectionHandler interface.
const mip_cc_protection_engine_settings mip_cc_protection_engine * engine
Defines success/error result codes.
mip_cc_result
API success/failure result.
Definition result_cc.h:44
Contains C API definitions for common string list.
Error information.
Definition error_cc.h:79
Opaque handle to MIP object.
A struct that contains user identification info.
Definition identity_cc.h:42
Defines C-Style TemplateDescriptor functions.