Microsoft Information Protection (MIP) SDK for C: Reference 1.15
Doxygen-generated documentation for MIP SDK written in C
Loading...
Searching...
No Matches
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 stream callback functions
30 *
31 * @file stream_cc.h
32 */
33
34#ifndef API_MIP_STREAM_CC_H_
35#define API_MIP_STREAM_CC_H_
36
38#include "mip_cc/error_cc.h"
40#include "mip_cc/result_cc.h"
41
42/**
43 * @brief Callback function definition for reading into a buffer from the stream
44 *
45 * @param input user defined input parameters
46 * @param buffer pointer to a buffer
47 * @param bufferLength buffer size.
48 * @return number of bytes read.
49 */
50MIP_CC_CALLBACK(mip_cc_stream_read_callback_fn /*typename*/,
51 int64_t /*return*/,
52 void* input,
53 uint8_t* buffer,
54 int64_t bufferLength);
55
56/**
57 * @brief Callback function definition for Writing into the stream from a buffer.
58 *
59 * @param input user defined input parameters
60 * @param buffer pointer to a buffer
61 * @param bufferLength buffer size.
62 * @return number of bytes written.
63 */
64MIP_CC_CALLBACK(mip_cc_stream_write_callback_fn /*typename*/,
65 int64_t /*return*/,
66 void* input,
67 const uint8_t* buffer,
68 int64_t bufferLength);
69
70/**
71 * @brief callback function definition for flushing the stream.
72 *
73 * @param input user defined input parameters
74 * @return true if successful else false.
75 */
76MIP_CC_CALLBACK(mip_cc_stream_flush_callback_fn /*typename*/,
77 bool /*return*/,
78 void* input);
79
80/**
81 * @brief callback function definition for Seeking specific position within the stream.
82 *
83 * @param input user defined input parameters
84 * @param position to seek into stream.
85 */
86MIP_CC_CALLBACK(mip_cc_stream_seek_callback_fn /*typename*/,
87 void /*return*/,
88 void* input,
89 int64_t position );
90
91/**
92 * @brief call back function definition for a check if stream can be read from.
93 *
94 * @param input user defined input parameters
95 * @return true if readable else false.
96 */
97MIP_CC_CALLBACK(mip_cc_stream_canread_callback_fn /*typename*/,
98 bool /*return*/,
99 void* input);
100
101/**
102 * @brief call back function definition for a check if stream can be written to.
103 *
104 * @param input user defined input parameters
105 * @return true if writeable else false.
106 */
107MIP_CC_CALLBACK(mip_cc_stream_canwrite_callback_fn /*typename*/,
108 bool /*return*/,
109 void* input);
110
111/**
112 * @brief call back function definition for getting the current position within the stream.
113 *
114 * @param input user defined input parameters
115 * @return position within the stream.
116 */
117MIP_CC_CALLBACK(mip_cc_stream_position_callback_fn /*typename*/,
118 int64_t /*return*/,
119 void* input);
120
121/**
122 * @brief call back function definition for getting the size of the content within the stream.
123 *
124 * @param input user defined input parameters
125 * @return the stream size.
126 */
127MIP_CC_CALLBACK(mip_cc_stream_getsize_callback_fn /*typename*/,
128 int64_t /*return*/,
129 void* input);
130
131/**
132 * @brief call back function definition for setting the stream size.
133 *
134 * @param input user defined input parameters
135 * @param stream size.
136 */
137MIP_CC_CALLBACK(mip_cc_stream_setsize_callback_fn /*typename*/,
138 void /*return*/,
139 void* input,
140 int64_t value);
141
143
144/**
145 * @brief Creates a stream
146 *
147 * @param readCallback Function pointer for reading into a buffer from the stream
148 * @param writeCallback Function pointer for writeing into the stream from a buffer
149 * @param flushCallback Function pointer for writing a log statement
150 * @param seekCallback Function pointer for seeking specific position within the stream
151 * @param canReadCallback Function pointer for a check if stream can be read from
152 * @param canWriteCallback Function pointer for a check if stream can be written to
153 * @param positionCallback Function pointer for getting the current position within the stream
154 * @param getSizeCallback Function pointer for getting the size of the content within the stream
155 * @param setSizeCallback Function pointer for setting the stream size
156 * @param input User defined input parameters
157 * @param stream [Output] Handle to stream object
158 * @param errorInfo [Output] (Optional) Failure info if operation result is error
159 *
160 * @return Result code indicating success or failure
161 */
162MIP_CC_API(mip_cc_result) MIP_CC_CreateStream(
163 const mip_cc_stream_read_callback_fn readCallback,
164 const mip_cc_stream_write_callback_fn writeCallback,
165 const mip_cc_stream_flush_callback_fn flushCallback,
166 const mip_cc_stream_seek_callback_fn seekCallback,
167 const mip_cc_stream_canread_callback_fn canReadCallback,
168 const mip_cc_stream_canwrite_callback_fn canWriteCallback,
169 const mip_cc_stream_position_callback_fn positionCallback,
170 const mip_cc_stream_getsize_callback_fn getSizeCallback,
171 const mip_cc_stream_setsize_callback_fn setSizeCallback,
172 void *input,
175
176
177/**
178 * @brief Release resources associated with a stream handle
179 *
180 * @param stream stream to be released
181 */
182MIP_CC_API(void) MIP_CC_ReleaseStream(mip_cc_stream stream);
183
184#endif // API_MIP_STREAM_CC_H_
A file Containing the common types used by the upe, file and protection modules.
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
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
Definition stream_cc.h:169
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
Definition stream_cc.h:167
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
Definition stream_cc.h:170
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_stream * stream
Definition stream_cc.h:173
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_stream mip_cc_error * errorInfo
Definition stream_cc.h:174
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
Definition stream_cc.h:171
const mip_cc_stream_write_callback_fn writeCallback
Definition stream_cc.h:164
mip_cc_handle * mip_cc_stream
Definition stream_cc.h:142
MIP_CC_CALLBACK(mip_cc_stream_read_callback_fn, int64_t, void *input, uint8_t *buffer, int64_t bufferLength)
Callback function definition for reading into a buffer from the stream.
const mip_cc_stream_write_callback_fn const mip_cc_stream_flush_callback_fn const mip_cc_stream_seek_callback_fn seekCallback
Definition stream_cc.h:166
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 * input
Definition stream_cc.h:172
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
Definition stream_cc.h:168
MIP_CC_API(void) MIP_CC_ReleaseStream(mip_cc_stream stream)
Release resources associated with a stream handle.
const mip_cc_stream_write_callback_fn const mip_cc_stream_flush_callback_fn flushCallback
Definition stream_cc.h:165
Error information.
Definition error_cc.h:79
Opaque handle to MIP object.