UniMRCP  1.7.0
mrcp_connection_types.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008-2015 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 
17 #ifndef MRCP_CONNECTION_TYPES_H
18 #define MRCP_CONNECTION_TYPES_H
19 
20 /**
21  * @file mrcp_connection_types.h
22  * @brief MRCP Connection Types Declaration
23  */
24 
25 #include <apr_network_io.h>
26 #include "apt_string.h"
27 #include "apt_timer_queue.h"
28 #include "mrcp_types.h"
29 
31 
32 /** Opaque MRCPv2 control descriptor declaration */
34 
35 /** Opaque MRCPv2 connection declaration */
37 
38 /** Opaque MRCPv2 control channel declaration */
40 
41 /** Opaque MRCPv2 connection agent declaration */
43 
44 /** Opaque MRCPv2 connection agent factory declaration */
46 
47 /** MRCPv2 connection event vtable declaration */
49 
50 /** MRCPv2 connection event vtable */
52  /** Channel add event handler */
54  /** Channel modify event handler */
56  /** Channel remove event handler */
58  /** Message receive event handler */
60  /** Disconnect event handler */
62 };
63 
64 /** MRCPv2 control channel */
66  /** MRCPv2 Connection agent */
68  /** MRCPv2 (shared) connection */
70  /** Request sent to the server and waiting for a response */
72  /** Timer used for request timeouts */
74  /** Indicate removed connection (safe to destroy) */
76  /** External object associated with the channel */
77  void *obj;
78  /** External logger object associated with the channel */
79  void *log_obj;
80  /** Pool to allocate memory from */
81  apr_pool_t *pool;
82  /** Channel identifier (id at resource) */
84 };
85 
86 /** Send channel add response */
87 static APR_INLINE apt_bool_t mrcp_control_channel_add_respond(
88  const mrcp_connection_event_vtable_t *vtable,
89  mrcp_control_channel_t *channel,
90  mrcp_control_descriptor_t *descriptor,
91  apt_bool_t status)
92 {
93  if(vtable && vtable->on_add) {
94  return vtable->on_add(channel,descriptor,status);
95  }
96  return FALSE;
97 }
98 
99 /** Send channel modify response */
100 static APR_INLINE apt_bool_t mrcp_control_channel_modify_respond(
101  const mrcp_connection_event_vtable_t *vtable,
102  mrcp_control_channel_t *channel,
103  mrcp_control_descriptor_t *descriptor,
104  apt_bool_t status)
105 {
106  if(vtable && vtable->on_modify) {
107  return vtable->on_modify(channel,descriptor,status);
108  }
109  return FALSE;
110 }
111 
112 /** Send channel remove response */
113 static APR_INLINE apt_bool_t mrcp_control_channel_remove_respond(
114  const mrcp_connection_event_vtable_t *vtable,
115  mrcp_control_channel_t *channel,
116  apt_bool_t status)
117 {
118  if(vtable && vtable->on_remove) {
119  return vtable->on_remove(channel,status);
120  }
121  return FALSE;
122 }
123 
124 /** Send MRCP message receive event */
125 static APR_INLINE apt_bool_t mrcp_connection_message_receive(
126  const mrcp_connection_event_vtable_t *vtable,
127  mrcp_control_channel_t *channel,
128  mrcp_message_t *message)
129 {
130  if(vtable && vtable->on_receive) {
131  return vtable->on_receive(channel,message);
132  }
133  return FALSE;
134 }
135 
137 
138 #endif /* MRCP_CONNECTION_TYPES_H */
apt_bool_t(* on_remove)(mrcp_control_channel_t *channel, apt_bool_t status)
Definition: mrcp_connection_types.h:57
struct mrcp_connection_agent_t mrcp_connection_agent_t
Definition: mrcp_connection_types.h:42
Definition: mrcp_connection_types.h:65
Timer Queue.
#define APT_END_EXTERN_C
Definition: apt.h:38
int apt_bool_t
Definition: apt.h:57
Definition: mrcp_control_descriptor.h:78
Definition: mrcp_connection.h:40
apt_bool_t(* on_modify)(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status)
Definition: mrcp_connection_types.h:55
mrcp_connection_t * connection
Definition: mrcp_connection_types.h:69
apt_str_t identifier
Definition: mrcp_connection_types.h:83
#define APT_BEGIN_EXTERN_C
Definition: apt.h:36
apt_bool_t(* on_receive)(mrcp_control_channel_t *channel, mrcp_message_t *message)
Definition: mrcp_connection_types.h:59
Basic MRCP Types.
mrcp_connection_agent_t * agent
Definition: mrcp_connection_types.h:67
struct mrcp_ca_factory_t mrcp_ca_factory_t
Definition: mrcp_connection_types.h:45
apr_pool_t * pool
Definition: mrcp_connection_types.h:81
void * obj
Definition: mrcp_connection_types.h:77
apt_bool_t(* on_disconnect)(mrcp_control_channel_t *channel)
Definition: mrcp_connection_types.h:61
Definition: apt_string.h:36
void * log_obj
Definition: mrcp_connection_types.h:79
apt_bool_t removed
Definition: mrcp_connection_types.h:75
Definition: mrcp_connection_types.h:51
apt_bool_t(* on_add)(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status)
Definition: mrcp_connection_types.h:53
mrcp_message_t * active_request
Definition: mrcp_connection_types.h:71
String Representation.
typedefAPT_BEGIN_EXTERN_C struct apt_timer_t apt_timer_t
Definition: apt_timer_queue.h:30
apt_timer_t * request_timer
Definition: mrcp_connection_types.h:73
Definition: mrcp_message.h:37