UniMRCP  1.7.0
mrcp_connection.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_H
18 #define MRCP_CONNECTION_H
19 
20 /**
21  * @file mrcp_connection.h
22  * @brief MRCP Connection
23  */
24 
25 #include <apr_poll.h>
26 #include <apr_hash.h>
27 #ifdef WIN32
28 #pragma warning(disable: 4127)
29 #endif
30 #include <apr_ring.h>
31 #include "mrcp_connection_types.h"
32 #include "mrcp_stream.h"
33 
35 
36 /** Size of the buffer used for MRCP rx/tx stream */
37 #define MRCP_STREAM_BUFFER_SIZE 1024
38 
39 /** MRCPv2 connection */
41  /** Ring entry */
43 
44  /** Memory pool */
45  apr_pool_t *pool;
46 
47  /** Accepted/Connected socket */
48  apr_socket_t *sock;
49  /** Socket poll descriptor */
50  apr_pollfd_t sock_pfd;
51  /** Local sockaddr */
52  apr_sockaddr_t *l_sockaddr;
53  /** Remote sockaddr */
54  apr_sockaddr_t *r_sockaddr;
55  /** Remote IP */
57  /** String identifier used for traces */
58  const char *id;
59  /** Transparently dump whatever received/sent on transport layer,
60  if verbose is set to TRUE (default) */
62 
63  /** Reference count */
64  apr_size_t access_count;
65  /** Usage count */
66  apr_size_t use_count;
67  /** Opaque agent */
68  void *agent;
69 
70  /** Table of control channels */
71  apr_hash_t *channel_table;
72 
73  /** Rx buffer */
74  char *rx_buffer;
75  /** Rx buffer size */
76  apr_size_t rx_buffer_size;
77  /** Rx stream */
79  /** MRCP parser */
81 
82  /** Tx buffer */
83  char *tx_buffer;
84  /** Tx buffer size */
85  apr_size_t tx_buffer_size;
86  /** MRCP generator */
88 
89  /** Inactivity timer */
91  /** Termination timer */
93 };
94 
95 /** Create MRCP connection. */
97 
98 /** Destroy MRCP connection. */
100 
101 /** Add Control Channel to MRCP connection. */
103 
104 /** Find Control Channel by Channel Identifier. */
106 
107 /** Remove Control Channel from MRCP connection. */
109 
110 /** Raise disconnect event for each channel from the specified connection. */
112 
114 
115 #endif /* MRCP_CONNECTION_H */
APR_RING_ENTRY(mrcp_connection_t) link
apr_size_t rx_buffer_size
Definition: mrcp_connection.h:76
apr_pool_t * pool
Definition: mrcp_connection.h:45
char * tx_buffer
Definition: mrcp_connection.h:83
apr_sockaddr_t * r_sockaddr
Definition: mrcp_connection.h:54
Definition: mrcp_connection_types.h:65
Definition: apt_text_stream.h:43
mrcp_generator_t * generator
Definition: mrcp_connection.h:87
#define APT_END_EXTERN_C
Definition: apt.h:38
mrcp_connection_t * mrcp_connection_create(void)
apt_str_t remote_ip
Definition: mrcp_connection.h:56
apr_hash_t * channel_table
Definition: mrcp_connection.h:71
int apt_bool_t
Definition: apt.h:57
char * rx_buffer
Definition: mrcp_connection.h:74
apr_pollfd_t sock_pfd
Definition: mrcp_connection.h:50
void mrcp_connection_destroy(mrcp_connection_t *connection)
Definition: mrcp_connection.h:40
MRCP Stream Parser and Generator.
mrcp_parser_t * parser
Definition: mrcp_connection.h:80
MRCP Connection Types Declaration.
struct mrcp_generator_t mrcp_generator_t
Definition: mrcp_stream.h:34
apt_timer_t * termination_timer
Definition: mrcp_connection.h:92
#define APT_BEGIN_EXTERN_C
Definition: apt.h:36
apr_sockaddr_t * l_sockaddr
Definition: mrcp_connection.h:52
apr_size_t use_count
Definition: mrcp_connection.h:66
mrcp_control_channel_t * mrcp_connection_channel_find(const mrcp_connection_t *connection, const apt_str_t *identifier)
apt_bool_t mrcp_connection_channel_remove(mrcp_connection_t *connection, mrcp_control_channel_t *channel)
Definition: apt_string.h:36
apt_bool_t verbose
Definition: mrcp_connection.h:61
apt_bool_t mrcp_connection_disconnect_raise(mrcp_connection_t *connection, const mrcp_connection_event_vtable_t *vtable)
typedefAPT_BEGIN_EXTERN_C struct mrcp_parser_t mrcp_parser_t
Definition: mrcp_stream.h:32
Definition: mrcp_connection_types.h:51
apr_size_t tx_buffer_size
Definition: mrcp_connection.h:85
const char * id
Definition: mrcp_connection.h:58
apr_size_t access_count
Definition: mrcp_connection.h:64
void * agent
Definition: mrcp_connection.h:68
typedefAPT_BEGIN_EXTERN_C struct apt_timer_t apt_timer_t
Definition: apt_timer_queue.h:30
apt_text_stream_t rx_stream
Definition: mrcp_connection.h:78
apr_socket_t * sock
Definition: mrcp_connection.h:48
apt_bool_t mrcp_connection_channel_add(mrcp_connection_t *connection, mrcp_control_channel_t *channel)
apt_timer_t * inactivity_timer
Definition: mrcp_connection.h:90