chenqiyang
2021-08-20 7b95fb4d4549d3452ee17165236186afc1f2b393
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/*
 * Copyright (c) 2010-2019 Belledonne Communications SARL.
 *
 * This file is part of Liblinphone.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
 
#ifndef LINPHONE_BUFFER_H_
#define LINPHONE_BUFFER_H_
 
 
#include "linphone/types.h"
 
 
#ifdef __cplusplus
extern "C" {
#endif
 
 
/**
 * @addtogroup misc
 * @{
 */
 
/**
 * Create a new empty #LinphoneBuffer object.
 * @return A new #LinphoneBuffer object.
 */
LINPHONE_PUBLIC LinphoneBuffer * linphone_buffer_new(void);
 
/**
 * Create a new #LinphoneBuffer object from existing data.
 * @param[in] data The initial data to store in the LinphoneBuffer.
 * @param[in] size The size of the initial data to stroe in the LinphoneBuffer.
 * @return A new #LinphoneBuffer object.
 */
LINPHONE_PUBLIC LinphoneBuffer * linphone_buffer_new_from_data(const uint8_t *data, size_t size);
 
/**
 * Create a new #LinphoneBuffer object from a string.
 * @param[in] data The initial string content of the LinphoneBuffer.
 * @return A new #LinphoneBuffer object.
 */
LINPHONE_PUBLIC LinphoneBuffer * linphone_buffer_new_from_string(const char *data);
 
/**
 * Acquire a reference to the buffer.
 * @param[in] buffer #LinphoneBuffer object.
 * @return The same #LinphoneBuffer object.
**/
LINPHONE_PUBLIC LinphoneBuffer * linphone_buffer_ref(LinphoneBuffer *buffer);
 
/**
 * Release reference to the buffer.
 * @param[in] buffer #LinphoneBuffer object.
**/
LINPHONE_PUBLIC void linphone_buffer_unref(LinphoneBuffer *buffer);
 
/**
 * Retrieve the user pointer associated with the buffer.
 * @param[in] buffer #LinphoneBuffer object.
 * @return The user pointer associated with the buffer.
**/
LINPHONE_PUBLIC void *linphone_buffer_get_user_data(const LinphoneBuffer *buffer);
 
/**
 * Assign a user pointer to the buffer.
 * @param[in] buffer #LinphoneBuffer object.
 * @param[in] ud The user pointer to associate with the buffer.
**/
LINPHONE_PUBLIC void linphone_buffer_set_user_data(LinphoneBuffer *buffer, void *ud);
 
/**
 * Get the content of the data buffer.
 * @param[in] buffer #LinphoneBuffer object.
 * @return The content of the data buffer.
 */
LINPHONE_PUBLIC const uint8_t * linphone_buffer_get_content(const LinphoneBuffer *buffer);
 
/**
 * Set the content of the data buffer.
 * @param[in] buffer #LinphoneBuffer object.
 * @param[in] content The content of the data buffer.
 * @param[in] size The size of the content of the data buffer.
 */
LINPHONE_PUBLIC void linphone_buffer_set_content(LinphoneBuffer *buffer, const uint8_t *content, size_t size);
 
/**
 * Get the string content of the data buffer.
 * @param[in] buffer #LinphoneBuffer object
 * @return The string content of the data buffer.
 */
LINPHONE_PUBLIC const char * linphone_buffer_get_string_content(const LinphoneBuffer *buffer);
 
/**
 * Set the string content of the data buffer.
 * @param[in] buffer #LinphoneBuffer object.
 * @param[in] content The string content of the data buffer.
 */
LINPHONE_PUBLIC void linphone_buffer_set_string_content(LinphoneBuffer *buffer, const char *content);
 
/**
 * Get the size of the content of the data buffer.
 * @param[in] buffer #LinphoneBuffer object.
 * @return The size of the content of the data buffer.
 */
LINPHONE_PUBLIC size_t linphone_buffer_get_size(const LinphoneBuffer *buffer);
 
/**
 * Set the size of the content of the data buffer.
 * @param[in] buffer #LinphoneBuffer object
 * @param[in] size The size of the content of the data buffer.
 */
LINPHONE_PUBLIC void linphone_buffer_set_size(LinphoneBuffer *buffer, size_t size);
 
/**
 * Tell whether the #LinphoneBuffer is empty.
 * @param[in] buffer #LinphoneBuffer object
 * @return A boolean value telling whether the #LinphoneBuffer is empty or not.
 */
LINPHONE_PUBLIC bool_t linphone_buffer_is_empty(const LinphoneBuffer *buffer);
 
/**
 * @}
 */
 
 
#ifdef __cplusplus
}
#endif
 
#endif /* LINPHONE_BUFFER_H_ */