mtc_util.h
7.75 KB
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
/************************************************************************
Copyright (c) 2005-2011 by Juphoon System Software, Inc.
All rights reserved.
This software is confidential and proprietary to Juphoon System,
Inc. No part of this software may be reproduced, stored, transmitted,
disclosed or used in any form or by any means other than as expressly
provided by the written license agreement between Juphoon and its
licensee.
THIS SOFTWARE IS PROVIDED BY JUPHOON "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL JUPHOON BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Juphoon System Software, Inc.
Email: support@juphoon.com
Web: http://www.juphoon.com
************************************************************************/
/*************************************************
File name : mtc_util.h
Module : multimedia talk client
Author : leo.lv
Created on : 2011-01-03
Description :
Data structure and function declare required by MTC utility
Modify History:
1. Date: Author: Modification:
*************************************************/
#ifndef _MTC_UTIL_H__
#define _MTC_UTIL_H__
/**
* @file mtc_util.h
* @brief MTC Utility Interface Functions.
*/
#ifdef __cplusplus
extern "C" {
#endif
/** @brief User defined callback when timer triggers. */
typedef ZVOID (*PFN_ZMTCTMRA)(ZTIMERID zTimerId, ZCOOKIE zCookie);
/** @brief User defined schedule when timer triggers. */
typedef ZVOID (*PFN_ZMTCTMRS)(ZCOOKIE zCookie);
/** @brief Mtc system time. */
typedef struct tagMTC_SYS_TIME
{
ZUSHORT wYear; /**< @brief Year */
ZUCHAR ucMonth; /**< @brief Month 1 - 12 */
ZUCHAR ucDay; /**< @brief Day 1 - 31 */
ZUCHAR ucWeekDay; /**< @brief Week day 0 - 6, 0 for Sunday */
ZUCHAR ucHour; /**< @brief Hour 0 - 23 */
ZUCHAR ucMinute; /**< @brief Minute 0 - 59 */
ZUCHAR ucSecond; /**< @brief Second 0 - 59 */
ZINT iTzOffset; /**< @brief Time zone offset in seconds */
} ST_MTC_SYS_TIME;
/**
* @brief Print ERROR log with format string information.
* User can specific log name as the log module prefix
* Log print level can be set by Mtc_CliDbSetLogLevel.
*
* @param [in] pcLogName The log name. Default name is "ZOS" if no log name.
* @param [in] pcFormat String format.
* @param [in] ... String vars.
*
* @see @ref Mtc_AnyLogInfoStr
*/
MTCFUNC ZVOID Mtc_AnyLogErrStr(ZCHAR *pcLogName, ZCHAR *pcFormat, ...);
/**
* @brief Print INFO log with format string information.
* User can specific log name as the log module prefix
* Log print level can be set by Mtc_CliDbSetLogLevel.
*
* @param [in] pcLogName The log name. Default name is "ZOS" if no log name.
* @param [in] pcFormat String format.
* @param [in] ... String vars.
*
* @see @ref Mtc_AnyLogErrStr
*/
MTCFUNC ZVOID Mtc_AnyLogInfoStr(ZCHAR *pcLogName, ZCHAR *pcFormat, ...);
/**
* @brief Print DEBUG log with format string information.
* User can specific log name as the log module prefix
* Log print level can be set by Mtc_DbSetLogLevel.
*
* @param [in] pcLogName The log name. Default name is "ZOS" if no log name.
* @param [in] pcFormat String format.
* @param [in] ... String vars.
*
* @see @ref Mtc_AnyLogInfoStr
*/
MTCFUNC ZVOID Mtc_AnyLogDbgStr(ZCHAR *pcLogName, ZCHAR *pcFormat, ...);
/**
* @brief Get local ip count.
*
* @return Local ip count successfully, otherwise retrun 0.
*
* @see @ref Mtc_GetLclIp
*/
MTCFUNC ZINT Mtc_GetLclIpCnt();
/**
* @brief Get local ip.
*
* @param [in] iIndex Local ip index.
*
* @return Local ip successfully, otherwise return loopback address.
* the caller must copy it, then use.
*
* @see @ref Mtc_GetLclIpCnt
*/
MTCFUNC ZCHAR * Mtc_GetLclIp(ZINT iIndex);
/**
* @brief Get access network type.
*
* @return Access network type successfully,
* otherwise return MTC_ANET_UNKNOWN.
*
* @see @ref group_def_access_net_type
*/
MTCFUNC ZINT Mtc_GetAccessNetType();
/**
* @brief Convert time value from ZTIME_T to ST_MTC_SYS_TIME structure.
*
* @param [in] zTime Time value.
* @param [out] pstTime Time value in ST_MTC_SYS_TIME structure.
*
* @retval ZOK Convert successfully.
* @retval ZFAILED Convert failed.
*
* @see
*/
MTCFUNC ZINT Mtc_Time2SysTime(ZTIME_T zTime, ST_MTC_SYS_TIME *pstTime);
/**
* @brief Convert time value from ST_MTC_SYS_TIME structure to ZTIME_T.
*
* @param [in] pstTime Time value in ST_MTC_SYS_TIME structure.
* @param [out] pzTime Time value in ZTIME_T structure.
*
* @retval ZOK Convert successfully.
* @retval ZFAILED Convert failed.
*
* @see
*/
MTCFUNC ZINT Mtc_SysTime2Time(ST_MTC_SYS_TIME *pstTime, ZTIME_T *pzTime);
/**
* @defgroup MtcError MTC error string.
* @{
*/
/** @brief No environment. MTC maynot initilized or already destroied. */
#define MTC_ERROR_NO_ENV "Mtc.NoEnv"
/** @brief Invalid state. MTC maynot started. */
#define MTC_ERROR_INV_STATE "Mtc.InvState"
/** @brief During auth. MTC during authorization. */
#define MTC_ERROR_IN_AUTH "Mtc.InAuth"
/** @brief Invlaid parameter. */
#define MTC_ERROR_INV_PARM "Mtc.InvParm"
/** @brief Allocate memory. */
#define MTC_ERROR_ALLOC_MEM "Mtc.AllocMem"
/** @brief New Object. */
#define MTC_ERROR_NEW_OBJ "Mtc.NewObj"
/** @brief No Agent. */
#define MTC_ERROR_NO_AGENT "Mtc.NoAgent"
/** @brief Invalid ID */
#define MTC_ERROR_INV_ID "Mtc.InvId"
/** @brief No password. */
#define MTC_ERROR_NO_PWD "Mtc.NoPwd"
/** @brief Subscribe event. */
#define MTC_ERROR_SUB_EVNT "Mtc.SubEvnt"
/** @brief Provision. */
#define MTC_ERROR_PROVISION "Mtc.Provision"
/** @brief Authorizaiton failed. */
#define MTC_ERROR_AUTH_FAIL "Mtc.AuthFail"
/** @brief No account. */
#define MTC_ERROR_NO_ACCOUNT "Mtc.NoAccount"
/** @brief Expired. */
#define MTC_ERROR_EXPIRED "Mtc.Expired"
/** @brief No auth code. */
#define MTC_ERROR_NO_AUTH "Mtc.NoAuth"
/** @brief Internal error. */
#define MTC_ERROR_INTERNAL "Mtc.Internal"
/** @brief Call initialize connection. */
#define MTC_ERROR_CALL_INIT_CONN "MtcCall.InitConn"
/** @brief Call initialize session. */
#define MTC_ERROR_CALL_INIT_SESS "MtcCall.InitSess"
/** @brief Call add audio stream. */
#define MTC_ERROR_CALL_ADD_AUDIO_STRM "MtcCall.AddAudioStrm"
/** @brief Call add video stream. */
#define MTC_ERROR_CALL_ADD_VIDEO_STRM "MtcCall.AddVideoStrm"
/** @brief Call no SIP registeration. */
#define MTC_ERROR_CALL_NO_SIP_REG "MtcCall.NoSipReg"
/** @brief Call exist */
#define MTC_ERROR_CALL_EXIST "MtcCall.Exist"
/** @brief Call fill SDP. */
#define MTC_ERROR_CALL_FILL_SDP "MtcCall.FillSdp"
/** @brief Call perform action. */
#define MTC_ERROR_CALL_ACTION "MtcCall.Action"
/**
* @}
*/
/**
* @brief Get last error.
*
* @retval Last error string.
*/
MTCFUNC ZCONST ZCHAR * Mtc_GetLastError(ZFUNC_VOID);
#ifdef __cplusplus
}
#endif
#endif /* _MTC_UTIL_H__ */