Microsoft Information Protection (MIP) SDK for C: Reference 1.16
Doxygen-generated documentation for MIP SDK written in C
Loading...
Searching...
No Matches
editable_stream_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 editable stream callback functions
30 *
31 * @file editable_stream_cc.h
32 */
33
34#ifndef API_MIP_EDITABLE_STREAM_CC_H_
35#define API_MIP_EDITABLE_STREAM_CC_H_
36
38#include "mip_cc/error_cc.h"
40#include "mip_cc/result_cc.h"
41#include "mip_cc/stream_cc.h"
42
43/**
44 * @brief Callback function definition for inserting a buffer into the stream
45 *
46 * @param context user provided context
47 * @param buffer pointer to a buffer
48 * @param bufferLength buffer size.
49 * @return number of bytes inserted.
50 */
51MIP_CC_CALLBACK(mip_cc_stream_insert_callback_fn /*typename*/,
52 int64_t /*return*/,
53 void* context,
54 const uint8_t* buffer,
55 int64_t bufferLength);
56
57/**
58 * @brief Callback function definition for updating the stream with a replacement buffer
59 *
60 * @param context user provided context
61 * @param buffer pointer to a buffer
62 * @param bufferLength buffer size.
63 * @param replaceLength number of bytes to replace.
64 * @return number of bytes inserted.
65 */
66MIP_CC_CALLBACK(mip_cc_stream_update_callback_fn /*typename*/,
67 int64_t /*return*/,
68 void* context,
69 const uint8_t* buffer,
70 int64_t bufferLength,
71 int64_t replaceLength);
72
73/**
74 * @brief Callback function definition for deleting bytes from the stream
75 *
76 * @param context user provided context
77 * @param numBytes number of bytes to replace.
78 * @return number of bytes deleted.
79 */
80MIP_CC_CALLBACK(mip_cc_stream_delete_callback_fn /*typename*/,
81 int64_t /*return*/,
82 void* context,
83 int64_t numBytes);
84
86
87/**
88 * @brief Creates a stream
89 *
90 * @param insertCallback Function pointer for inserting into the stream from a buffer
91 * @param updateCallback Function pointer for updating the stream with a replacement buffer
92 * @param deleteCallback Function pointer for deleting bytes from the stream
93 * @param readCallback Function pointer for reading into a buffer from the stream
94 * @param writeCallback Function pointer for writeing into the stream from a buffer
95 * @param flushCallback Function pointer for writing a log statement
96 * @param seekCallback Function pointer for seeking specific position within the stream
97 * @param canReadCallback Function pointer for a check if stream can be read from
98 * @param canWriteCallback Function pointer for a check if stream can be written to
99 * @param positionCallback Function pointer for getting the current position within the stream
100 * @param getSizeCallback Function pointer for getting the size of the content within the stream
101 * @param setSizeCallback Function pointer for setting the stream size
102 * @param context Context that will be supplied to each callback function as the first arg. Should remain valid for the lifetime of the stream
103 * @param stream [Output] Handle to stream object
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_CreateEditableStream(
109 const mip_cc_stream_insert_callback_fn insertCallback,
110 const mip_cc_stream_update_callback_fn updateCallback,
111 const mip_cc_stream_delete_callback_fn deleteCallback,
112 const mip_cc_stream_read_callback_fn readCallback,
113 const mip_cc_stream_write_callback_fn writeCallback,
114 const mip_cc_stream_flush_callback_fn flushCallback,
115 const mip_cc_stream_seek_callback_fn seekCallback,
116 const mip_cc_stream_canread_callback_fn canReadCallback,
117 const mip_cc_stream_canwrite_callback_fn canWriteCallback,
118 const mip_cc_stream_position_callback_fn positionCallback,
119 const mip_cc_stream_getsize_callback_fn getSizeCallback,
120 const mip_cc_stream_setsize_callback_fn setSizeCallback,
121 void *context,
124
125/**
126 * @brief Release resources associated with an editable stream handle
127 *
128 * @param stream stream to be released
129 */
130MIP_CC_API(void) MIP_CC_ReleaseEditableStream(mip_cc_editable_stream stream);
131
132#endif // API_MIP_EDITABLE_STREAM_CC_H_
A file Containing the common types used by the upe, file and protection modules.
const mip_cc_stream_update_callback_fn const mip_cc_stream_delete_callback_fn const mip_cc_stream_read_callback_fn const mip_cc_stream_write_callback_fn const mip_cc_stream_flush_callback_fn const mip_cc_stream_seek_callback_fn const mip_cc_stream_canread_callback_fn const mip_cc_stream_canwrite_callback_fn const mip_cc_stream_position_callback_fn const mip_cc_stream_getsize_callback_fn const mip_cc_stream_setsize_callback_fn setSizeCallback
const mip_cc_stream_update_callback_fn const mip_cc_stream_delete_callback_fn const mip_cc_stream_read_callback_fn const mip_cc_stream_write_callback_fn const mip_cc_stream_flush_callback_fn flushCallback
MIP_CC_API(void) MIP_CC_ReleaseEditableStream(mip_cc_editable_stream stream)
Release resources associated with an editable stream handle.
const mip_cc_stream_update_callback_fn updateCallback
const mip_cc_stream_update_callback_fn const mip_cc_stream_delete_callback_fn const mip_cc_stream_read_callback_fn const mip_cc_stream_write_callback_fn const mip_cc_stream_flush_callback_fn const mip_cc_stream_seek_callback_fn const mip_cc_stream_canread_callback_fn const mip_cc_stream_canwrite_callback_fn const mip_cc_stream_position_callback_fn const mip_cc_stream_getsize_callback_fn const mip_cc_stream_setsize_callback_fn void mip_cc_editable_stream * stream
const mip_cc_stream_update_callback_fn const mip_cc_stream_delete_callback_fn const mip_cc_stream_read_callback_fn const mip_cc_stream_write_callback_fn const mip_cc_stream_flush_callback_fn const mip_cc_stream_seek_callback_fn seekCallback
const mip_cc_stream_update_callback_fn const mip_cc_stream_delete_callback_fn const mip_cc_stream_read_callback_fn const mip_cc_stream_write_callback_fn const mip_cc_stream_flush_callback_fn const mip_cc_stream_seek_callback_fn const mip_cc_stream_canread_callback_fn canReadCallback
mip_cc_handle * mip_cc_editable_stream
const mip_cc_stream_update_callback_fn const mip_cc_stream_delete_callback_fn const mip_cc_stream_read_callback_fn const mip_cc_stream_write_callback_fn const mip_cc_stream_flush_callback_fn const mip_cc_stream_seek_callback_fn const mip_cc_stream_canread_callback_fn const mip_cc_stream_canwrite_callback_fn const mip_cc_stream_position_callback_fn const mip_cc_stream_getsize_callback_fn getSizeCallback
const mip_cc_stream_update_callback_fn const mip_cc_stream_delete_callback_fn const mip_cc_stream_read_callback_fn const mip_cc_stream_write_callback_fn const mip_cc_stream_flush_callback_fn const mip_cc_stream_seek_callback_fn const mip_cc_stream_canread_callback_fn const mip_cc_stream_canwrite_callback_fn const mip_cc_stream_position_callback_fn positionCallback
const mip_cc_stream_update_callback_fn const mip_cc_stream_delete_callback_fn const mip_cc_stream_read_callback_fn readCallback
const mip_cc_stream_update_callback_fn const mip_cc_stream_delete_callback_fn const mip_cc_stream_read_callback_fn const mip_cc_stream_write_callback_fn const mip_cc_stream_flush_callback_fn const mip_cc_stream_seek_callback_fn const mip_cc_stream_canread_callback_fn const mip_cc_stream_canwrite_callback_fn const mip_cc_stream_position_callback_fn const mip_cc_stream_getsize_callback_fn const mip_cc_stream_setsize_callback_fn void mip_cc_editable_stream mip_cc_error * errorInfo
const mip_cc_stream_update_callback_fn const mip_cc_stream_delete_callback_fn const mip_cc_stream_read_callback_fn const mip_cc_stream_write_callback_fn const mip_cc_stream_flush_callback_fn const mip_cc_stream_seek_callback_fn const mip_cc_stream_canread_callback_fn const mip_cc_stream_canwrite_callback_fn canWriteCallback
const mip_cc_stream_update_callback_fn const mip_cc_stream_delete_callback_fn const mip_cc_stream_read_callback_fn const mip_cc_stream_write_callback_fn const mip_cc_stream_flush_callback_fn const mip_cc_stream_seek_callback_fn const mip_cc_stream_canread_callback_fn const mip_cc_stream_canwrite_callback_fn const mip_cc_stream_position_callback_fn const mip_cc_stream_getsize_callback_fn const mip_cc_stream_setsize_callback_fn void * context
MIP_CC_CALLBACK(mip_cc_stream_insert_callback_fn, int64_t, void *context, const uint8_t *buffer, int64_t bufferLength)
Callback function definition for inserting a buffer into the stream.
const mip_cc_stream_update_callback_fn const mip_cc_stream_delete_callback_fn deleteCallback
const mip_cc_stream_update_callback_fn const mip_cc_stream_delete_callback_fn const mip_cc_stream_read_callback_fn const mip_cc_stream_write_callback_fn writeCallback
Error definition and functions.
Export/import and other macros for C API.
Defines success/error result codes.
mip_cc_result
API success/failure result.
Definition result_cc.h:44
Defines stream callback functions.
Error information.
Definition error_cc.h:79
Opaque handle to MIP object.