00001 /* 00002 * Copyright 2008-2010 Arsen Chaloyan 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 * 00016 * $Id: mrcp_engine_iface.h 1677 2010-05-01 18:45:50Z achaloyan $ 00017 */ 00018 00019 #ifndef MRCP_ENGINE_IFACE_H 00020 #define MRCP_ENGINE_IFACE_H 00021 00022 /** 00023 * @file mrcp_engine_iface.h 00024 * @brief MRCP Engine User Interface (typically user is an MRCP server) 00025 */ 00026 00027 #include "mrcp_engine_types.h" 00028 00029 APT_BEGIN_EXTERN_C 00030 00031 /** Destroy engine */ 00032 apt_bool_t mrcp_engine_virtual_destroy(mrcp_engine_t *engine); 00033 00034 /** Open engine */ 00035 apt_bool_t mrcp_engine_virtual_open(mrcp_engine_t *engine); 00036 00037 /** Response to open engine request */ 00038 void mrcp_engine_on_open(mrcp_engine_t *engine, apt_bool_t status); 00039 00040 /** Close engine */ 00041 apt_bool_t mrcp_engine_virtual_close(mrcp_engine_t *engine); 00042 00043 /** Response to close engine request */ 00044 void mrcp_engine_on_close(mrcp_engine_t *engine); 00045 00046 00047 /** Create engine channel */ 00048 mrcp_engine_channel_t* mrcp_engine_channel_virtual_create(mrcp_engine_t *engine, mrcp_version_e mrcp_version, apr_pool_t *pool); 00049 00050 /** Destroy engine channel */ 00051 apt_bool_t mrcp_engine_channel_virtual_destroy(mrcp_engine_channel_t *channel); 00052 00053 /** Open engine channel */ 00054 static APR_INLINE apt_bool_t mrcp_engine_channel_virtual_open(mrcp_engine_channel_t *channel) 00055 { 00056 if(channel->is_open == FALSE) { 00057 channel->is_open = channel->method_vtable->open(channel); 00058 return channel->is_open; 00059 } 00060 return FALSE; 00061 } 00062 00063 /** Close engine channel */ 00064 static APR_INLINE apt_bool_t mrcp_engine_channel_virtual_close(mrcp_engine_channel_t *channel) 00065 { 00066 if(channel->is_open == TRUE) { 00067 channel->is_open = FALSE; 00068 return channel->method_vtable->close(channel); 00069 } 00070 return FALSE; 00071 } 00072 00073 /** Process request */ 00074 static APR_INLINE apt_bool_t mrcp_engine_channel_request_process(mrcp_engine_channel_t *channel, mrcp_message_t *message) 00075 { 00076 return channel->method_vtable->process_request(channel,message); 00077 } 00078 00079 /** Allocate engine config */ 00080 mrcp_engine_config_t* mrcp_engine_config_alloc(apr_pool_t *pool); 00081 00082 00083 APT_END_EXTERN_C 00084 00085 #endif /* MRCP_ENGINE_IFACE_H */