UniMRCP  1.3.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
mrcp_connection_types.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_connection_types.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
17  */
18 
19 #ifndef MRCP_CONNECTION_TYPES_H
20 #define MRCP_CONNECTION_TYPES_H
21 
22 /**
23  * @file mrcp_connection_types.h
24  * @brief MRCP Connection Types Declaration
25  */
26 
27 #include <apr_network_io.h>
28 #include "apt_string.h"
29 #include "apt_timer_queue.h"
30 #include "mrcp_types.h"
31 
33 
34 /** Opaque MRCPv2 control descriptor declaration */
36 
37 /** Opaque MRCPv2 connection declaration */
39 
40 /** Opaque MRCPv2 control channel declaration */
42 
43 /** Opaque MRCPv2 connection agent declaration */
45 
46 /** Opaque MRCPv2 connection agent factory declaration */
48 
49 /** MRCPv2 connection event vtable declaration */
51 
52 /** MRCPv2 connection event vtable */
54  /** Channel add event handler */
56  /** Channel modify event handler */
58  /** Channel remove event handler */
60  /** Message receive event handler */
62  /** Disconnect event handler */
64 };
65 
66 /** MRCPv2 control channel */
68  /** MRCPv2 Connection agent */
70  /** MRCPv2 (shared) connection */
72  /** Request sent to the server and waiting for a response */
74  /** Timer used for request timeouts */
76  /** Indicate removed connection (safe to destroy) */
78  /** External object associated with the channel */
79  void *obj;
80  /** External logger object associated with the channel */
81  void *log_obj;
82  /** Pool to allocate memory from */
83  apr_pool_t *pool;
84  /** Channel identifier (id at resource) */
86 };
87 
88 /** Send channel add response */
89 static APR_INLINE apt_bool_t mrcp_control_channel_add_respond(
90  const mrcp_connection_event_vtable_t *vtable,
91  mrcp_control_channel_t *channel,
92  mrcp_control_descriptor_t *descriptor,
93  apt_bool_t status)
94 {
95  if(vtable && vtable->on_add) {
96  return vtable->on_add(channel,descriptor,status);
97  }
98  return FALSE;
99 }
100 
101 /** Send channel modify response */
102 static APR_INLINE apt_bool_t mrcp_control_channel_modify_respond(
103  const mrcp_connection_event_vtable_t *vtable,
104  mrcp_control_channel_t *channel,
105  mrcp_control_descriptor_t *descriptor,
106  apt_bool_t status)
107 {
108  if(vtable && vtable->on_modify) {
109  return vtable->on_modify(channel,descriptor,status);
110  }
111  return FALSE;
112 }
113 
114 /** Send channel remove response */
115 static APR_INLINE apt_bool_t mrcp_control_channel_remove_respond(
116  const mrcp_connection_event_vtable_t *vtable,
117  mrcp_control_channel_t *channel,
118  apt_bool_t status)
119 {
120  if(vtable && vtable->on_remove) {
121  return vtable->on_remove(channel,status);
122  }
123  return FALSE;
124 }
125 
126 /** Send MRCP message receive event */
127 static APR_INLINE apt_bool_t mrcp_connection_message_receive(
128  const mrcp_connection_event_vtable_t *vtable,
129  mrcp_control_channel_t *channel,
130  mrcp_message_t *message)
131 {
132  if(vtable && vtable->on_receive) {
133  return vtable->on_receive(channel,message);
134  }
135  return FALSE;
136 }
137 
139 
140 #endif /* MRCP_CONNECTION_TYPES_H */