summaryrefslogtreecommitdiffstats
path: root/tunnel.h
blob: 18b9abbbd68ba345d1827a2025530d7a7ed4b81b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/*
 * Copyright (C) 2018 Knowles Electronics
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef _TUNNEL_H_
#define _TUNNEL_H_

#if __cplusplus
extern "C"
{
#endif

struct ia_tunneling_hal;

/**
 * Opens up the tunnel port and sets it up to start the tunneling of data
 *
 * Input  - buffering size
 *          If buffering size is non-zero, then set Non Buffering Flag
 * Output - Handle to Tunneling HAL
 *        - NULL on failure, non null on success
 */
struct ia_tunneling_hal* ia_start_tunneling(int buffering_size);

/**
 * Enable the tunneling of the data for a particular tunnel id and a source id
 *
 * Input  - tun_hdl - Handle to the Tunneling HAL.
 *          src_id - Source system ID for this tunnel
 *          tunl_mode - tunnel out in sync or async mode.
 *          tunl_encode -tunnel encoding format.
 *
 * Output - Zero on success, errno on failure.
 */
int ia_enable_tunneling_source(struct ia_tunneling_hal *tun_hdl,
                               unsigned int src_id,
                               unsigned int tunl_mode,
                               unsigned int tunl_encode);

/**
 * Disable the tunneling of the data for a particular tunnel id and a source id
 *
 * Input  - tun_hdl - Handle to the Tunneling HAL.
 *          src_id - Source system ID for this tunnel
 *          tunl_mode - tunnel out in sync or async mode.
 *          tunl_encode -tunnel encoding format.
 *
 * Output - Zero on success, errno on failure.
 */
int ia_disable_tunneling_source(struct ia_tunneling_hal *tun_hdl,
                               unsigned int src_id,
                               unsigned int tunl_mode,
                               unsigned int tunl_encode);


/**
 * Get the tunneled data. This data is an interleaved data from all the tunnels that were
 * enabled.
 *
 * Input  - tun_hdl - Handle to the Tunneling HAL.
 *          buf - buffer in which the data will be filled.
 *          buf_size - Size of the buffer buf
 * Output - Number of bytes filled into the buffer
 */
int ia_read_tunnel_data(struct ia_tunneling_hal *tun_hdl, void *buf, int buf_size);

/**
 * Set the output buffer threshold for the event generation.
 *
 * Input  - threshold
 *
 * Output - Zero on success, errno on failure.
 */
int ia_set_tunnel_out_buf_threshold(struct ia_tunneling_hal *thdl,
                                    uint32_t threshold);

/**
 * Closes tunneling port
 *
 * Input  - tun_hdl - Handle to the Tunneling HAL.
 * Output - Zero on success, errno on failure.
 */
int ia_stop_tunneling(struct ia_tunneling_hal *tun_hdl);

#if __cplusplus
} // extern "C"
#endif

#endif