Mbed OS Reference
Loading...
Searching...
No Matches
ac_stream.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017, ARM Limited, All Rights Reserved
3 * SPDX-License-Identifier: Apache-2.0
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may
6 * not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17/**
18 * \file ac_stream.h
19 * \copyright Copyright (c) ARM Ltd 2015
20 * \author Donatien Garnier
21 */
22
23#ifndef ACORE_STREAM_H_
24#define ACORE_STREAM_H_
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30struct __ac_istream;
31struct __ac_ostream;
32
33typedef struct __ac_istream ac_istream_t;
34typedef struct __ac_ostream ac_ostream_t;
35
36#include "stddef.h"
37#include "stdbool.h"
38#include "stdint.h"
39
40#include "acore/ac_buffer.h"
41
42typedef void (*ac_istream_fn)(ac_buffer_t *pDataIn, bool *pClose, size_t maxLength, void *pUserParam);
43typedef void (*ac_ostream_fn)(ac_buffer_t *pDataOut, bool closed, void *pUserParam);
44
45//Input stream -- pulled by consumer
47 ac_istream_fn fn;
48 void *pUserParam;
49};
50
51//Output stream -- pushed by supplier
53 ac_ostream_fn fn;
54 void *pUserParam;
55};
56
57//Called by supplier
58void ac_istream_init(ac_istream_t *pac_istream, ac_istream_fn fn, void *pUserParam);
59//Called by consumer
60void ac_istream_pull(ac_istream_t *pac_istream, ac_buffer_t *pDataIn, bool *pClose, size_t maxLength);
61
62//Called by consumer
63void ac_ostream_init(ac_ostream_t *pac_ostream, ac_ostream_fn fn, void *pUserParam);
64//Called by supplier
65void ac_ostream_push(ac_ostream_t *pac_ostream, ac_buffer_t *pDataOut, bool closed);
66
67#ifdef __cplusplus
68}
69#endif
70
71#endif /* ACORE_STREAM_H_ */