UniMRCP  1.3.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
mrcp_application.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008-2014 Arsen Chaloyan
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * $Id: mrcp_application.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
17  */
18 
19 #ifndef MRCP_APPLICATION_H
20 #define MRCP_APPLICATION_H
21 
22 /**
23  * @file mrcp_application.h
24  * @brief MRCP User Level Application Interface
25  */
26 
27 #include "mrcp_client_types.h"
28 #include "mpf_rtp_descriptor.h"
29 #include "mpf_stream.h"
30 
32 
33 /** MRCP application message declaration */
35 
36 /** MRCP signaling message declaration */
38 
39 /** MRCP application message dispatcher declaration */
41 
42 /** MRCP application message handler */
44 
45 /** Enumeration of MRCP signaling message types */
46 typedef enum {
47  MRCP_SIG_MESSAGE_TYPE_REQUEST, /**< request message */
48  MRCP_SIG_MESSAGE_TYPE_RESPONSE, /**< response message */
49  MRCP_SIG_MESSAGE_TYPE_EVENT /**< event message */
51 
52 /** Enumeration of MRCP signaling status codes */
53 typedef enum {
54  MRCP_SIG_STATUS_CODE_SUCCESS, /**< indicates success */
55  MRCP_SIG_STATUS_CODE_FAILURE, /**< request failed */
56  MRCP_SIG_STATUS_CODE_TERMINATE, /**< request failed, session/channel/connection unexpectedly terminated */
57  MRCP_SIG_STATUS_CODE_CANCEL /**< request cancelled */
59 
60 
61 /** Enumeration of MRCP signaling commands (requests/responses) */
62 typedef enum {
63  MRCP_SIG_COMMAND_SESSION_UPDATE,
64  MRCP_SIG_COMMAND_SESSION_TERMINATE,
65  MRCP_SIG_COMMAND_CHANNEL_ADD,
66  MRCP_SIG_COMMAND_CHANNEL_REMOVE,
67  MRCP_SIG_COMMAND_RESOURCE_DISCOVER
69 
70 /** Enumeration of MRCP signaling events */
71 typedef enum {
72  MRCP_SIG_EVENT_TERMINATE
74 
75 
76 /** Enumeration of MRCP application message types */
77 typedef enum {
78  MRCP_APP_MESSAGE_TYPE_SIGNALING, /**< signaling message type */
79  MRCP_APP_MESSAGE_TYPE_CONTROL /**< control message type */
81 
82 /** MRCP signaling message definition */
84  /** Message type (request/response/event) */
86  /** Command (request/response) identifier */
88  /** Event identifier */
90  /** Status code used in response */
92 };
93 
94 
95 /** MRCP application message definition */
97  /** Message type (signaling/control) */
99 
100  /** Application */
102  /** Session */
104  /** Channel */
106  /** Session/resource descriptor */
108 
109  /** MRCP signaling message (used if message_type == MRCP_APP_MESSAGE_SIGNALING) */
111  /** MRCP control message (used if message_type == MRCP_APP_MESSAGE_CONTROL) */
113 };
114 
115 /** MRCP application message dispatcher interface */
117  /** Response to mrcp_application_session_update()request */
119  /** Response to mrcp_application_session_terminate()request */
121 
122  /** Response to mrcp_application_channel_add() request */
124  /** Response to mrcp_application_channel_remove() request */
126 
127  /** Response (event) to mrcp_application_message_send() request */
129 
130  /** Event indicating unexpected session/channel termination */
132 
133  /** Response to mrcp_application_resource_discover() request */
135 };
136 
137 
138 
139 /**
140  * Create application instance.
141  * @param handler the event handler
142  * @param obj the external object
143  * @param pool the pool to allocate memory from
144  */
145 MRCP_DECLARE(mrcp_application_t*) mrcp_application_create(const mrcp_app_message_handler_f handler, void *obj, apr_pool_t *pool);
146 
147 /**
148  * Destroy application instance.
149  * @param application the application to destroy
150  */
152 
153 /**
154  * Get external object associated with the application.
155  * @param application the application to get object from
156  */
158 
159 /**
160  * Get dir layout structure.
161  * @param application the application to get dir layout from
162  */
164 
165 /**
166  * Create session.
167  * @param application the entire application
168  * @param profile the name of the profile to use
169  * @param obj the external object
170  * @return the created session instance
171  */
172 MRCP_DECLARE(mrcp_session_t*) mrcp_application_session_create(mrcp_application_t *application, const char *profile, void *obj);
173 
174 /**
175  * Get memory pool the session object is created out of.
176  * @param session the session to get pool from
177  */
179 
180 /**
181  * Get session identifier.
182  * @param session the session to get identifier of
183  */
185 
186 /**
187  * Get SIP or RTSP response code.
188  * @param session the session to use
189  */
191 
192 /**
193  * Get external object associated with the session.
194  * @param session the session to get object from
195  */
197 
198 /**
199  * Set (associate) external object to the session.
200  * @param session the session to set object for
201  * @param obj the object to set
202  */
204 
205 /**
206  * Set name of the session (informative only used for debugging).
207  * @param session the session to set name for
208  * @param name the name to set
209  */
210 MRCP_DECLARE(void) mrcp_application_session_name_set(mrcp_session_t *session, const char *name);
211 
212 /**
213  * Send session update request.
214  * @param session the session to update
215  */
217 
218 /**
219  * Send session termination request.
220  * @param session the session to terminate
221  */
223 
224 /**
225  * Destroy client session (session must be terminated prior to destroy).
226  * @param session the session to destroy
227  */
229 
230 
231 /**
232  * Create control channel.
233  * @param session the session to create channel for
234  * @param resource_id the resource identifier of the channel
235  * @param termination the media termination
236  * @param rtp_descriptor the RTP termination descriptor (NULL by default)
237  * @param obj the external object
238  */
240  mrcp_session_t *session,
241  mrcp_resource_id resource_id,
242  mpf_termination_t *termination,
243  mpf_rtp_termination_descriptor_t *rtp_descriptor,
244  void *obj);
245 
246 /**
247  * Get external object associated with the channel.
248  * @param channel the channel to get object from
249  */
251 
252 /**
253  * Get RTP termination descriptor.
254  * @param channel the channel to get descriptor from
255  */
257 
258 /**
259  * Get codec descriptor of source stream.
260  * @param channel the channel to get descriptor from
261  */
263 
264 /**
265  * Get codec descriptor of sink stream.
266  * @param channel the channel to get descriptor from
267  */
269 
270 /**
271  * Get associated audio stream.
272  * @param channel the channel to get associated stream from
273  */
275 
276 /**
277  * Send channel add request.
278  * @param session the session to create channel for
279  * @param channel the control channel
280  */
282 
283 /**
284  * Create MRCP message.
285  * @param session the session
286  * @param channel the control channel
287  * @param method_id the method identifier of MRCP message
288  */
290 
291 /**
292  * Send MRCP message.
293  * @param session the session
294  * @param channel the control channel
295  * @param message the MRCP message to send
296  */
298 
299 /**
300  * Remove channel.
301  * @param session the session to remove channel from
302  * @param channel the control channel to remove
303  */
305 
306 /**
307  * Discover resources.
308  * @param session the session to use as communication object
309  */
311 
312 /**
313  * Dispatch application message.
314  * @param dispatcher the dispatcher inteface
315  * @param app_message the message to dispatch
316  */
318 
319 /**
320  * Create audio termination
321  * @param session the session to create termination for
322  * @param stream_vtable the virtual table of audio stream
323  * @param capabilities the capabilities of the stream
324  * @param obj the external object
325  */
327  mrcp_session_t *session,
328  const mpf_audio_stream_vtable_t *stream_vtable,
329  mpf_stream_capabilities_t *capabilities,
330  void *obj);
331 /**
332  * Create source media termination
333  * @param session the session to create termination for
334  * @param stream_vtable the virtual table of audio stream
335  * @param codec_descriptor the descriptor of audio stream (NULL by default)
336  * @param obj the external object
337  * @deprecated @see mrcp_application_audio_termination_create()
338  */
340  mrcp_session_t *session,
341  const mpf_audio_stream_vtable_t *stream_vtable,
342  mpf_codec_descriptor_t *codec_descriptor,
343  void *obj);
344 /**
345  * Create sink media termination
346  * @param session the session to create termination for
347  * @param stream_vtable the virtual table of audio stream
348  * @param codec_descriptor the descriptor of audio stream (NULL by default)
349  * @param obj the external object
350  * @deprecated @see mrcp_application_audio_termination_create()
351  */
353  mrcp_session_t *session,
354  const mpf_audio_stream_vtable_t *stream_vtable,
355  mpf_codec_descriptor_t *codec_descriptor,
356  void *obj);
357 
359 
360 #endif /* MRCP_APPLICATION_H */