UniMRCP  1.4.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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  /** Opaque agent */
66  void *agent;
67 
68  /** Table of control channels */
69  apr_hash_t *channel_table;
70 
71  /** Rx buffer */
72  char *rx_buffer;
73  /** Rx buffer size */
74  apr_size_t rx_buffer_size;
75  /** Rx stream */
77  /** MRCP parser to parser MRCP messages out of rx stream */
79 
80  /** Tx buffer */
81  char *tx_buffer;
82  /** Tx buffer size */
83  apr_size_t tx_buffer_size;
84  /** MRCP generator to generate MRCP messages into tx stream */
86 };
87 
88 /** Create MRCP connection. */
90 
91 /** Destroy MRCP connection. */
93 
94 /** Add Control Channel to MRCP connection. */
96 
97 /** Find Control Channel by Channel Identifier. */
99 
100 /** Remove Control Channel from MRCP connection. */
102 
103 /** Raise disconnect event for each channel from the specified connection. */
105 
107 
108 #endif /* MRCP_CONNECTION_H */
APR_RING_ENTRY(mrcp_connection_t) link
apr_size_t rx_buffer_size
Definition: mrcp_connection.h:74
apr_pool_t * pool
Definition: mrcp_connection.h:45
char * tx_buffer
Definition: mrcp_connection.h:81
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:85
#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:69
int apt_bool_t
Definition: apt.h:57
char * rx_buffer
Definition: mrcp_connection.h:72
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:78
MRCP Connection Types Declaration.
struct mrcp_generator_t mrcp_generator_t
Definition: mrcp_stream.h:34
#define APT_BEGIN_EXTERN_C
Definition: apt.h:36
apr_sockaddr_t * l_sockaddr
Definition: mrcp_connection.h:52
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:83
const char * id
Definition: mrcp_connection.h:58
apr_size_t access_count
Definition: mrcp_connection.h:64
void * agent
Definition: mrcp_connection.h:66
apt_text_stream_t rx_stream
Definition: mrcp_connection.h:76
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)