00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef MRCP_ENGINE_PLUGIN_H
00020 #define MRCP_ENGINE_PLUGIN_H
00021
00022
00023
00024
00025
00026
00027 #include "apr_version.h"
00028 #include "apt_log.h"
00029 #include "mrcp_engine_types.h"
00030
00031 APT_BEGIN_EXTERN_C
00032
00033
00034 #ifdef __cplusplus
00035 #define MRCP_PLUGIN_EXTERN_C extern "C"
00036 #else
00037 #define MRCP_PLUGIN_EXTERN_C extern
00038 #endif
00039
00040
00041 #ifdef WIN32
00042 #define MRCP_PLUGIN_DECLARE(type) MRCP_PLUGIN_EXTERN_C __declspec(dllexport) type
00043 #else
00044 #define MRCP_PLUGIN_DECLARE(type) MRCP_PLUGIN_EXTERN_C type
00045 #endif
00046
00047
00048 #define MRCP_PLUGIN_ENGINE_SYM_NAME "mrcp_plugin_create"
00049
00050 #define MRCP_PLUGIN_VERSION_SYM_NAME "mrcp_plugin_version"
00051
00052 #define MRCP_PLUGIN_LOGGER_SYM_NAME "mrcp_plugin_logger_set"
00053
00054
00055 typedef mrcp_engine_t* (*mrcp_plugin_creator_f)(apr_pool_t *pool);
00056
00057
00058 typedef apt_bool_t (*mrcp_plugin_log_accessor_f)(apt_logger_t *logger);
00059
00060
00061 #define MRCP_PLUGIN_LOGGER_IMPLEMENT \
00062 MRCP_PLUGIN_DECLARE(apt_bool_t) mrcp_plugin_logger_set(apt_logger_t *logger) \
00063 { return apt_log_instance_set(logger); }
00064
00065
00066 #define MRCP_PLUGIN_VERSION_DECLARE \
00067 MRCP_PLUGIN_DECLARE(mrcp_plugin_version_t) mrcp_plugin_version; \
00068 mrcp_plugin_version_t mrcp_plugin_version = \
00069 {PLUGIN_MAJOR_VERSION, PLUGIN_MINOR_VERSION, PLUGIN_PATCH_VERSION};
00070
00071
00072
00073
00074
00075
00076
00077 #define PLUGIN_MAJOR_VERSION 1
00078
00079
00080
00081
00082
00083 #define PLUGIN_MINOR_VERSION 1
00084
00085
00086
00087
00088
00089 #define PLUGIN_PATCH_VERSION 0
00090
00091
00092
00093
00094
00095
00096 #define PLUGIN_VERSION_AT_LEAST(major,minor,patch) \
00097 (((major) < PLUGIN_MAJOR_VERSION) \
00098 || ((major) == PLUGIN_MAJOR_VERSION && (minor) < PLUGIN_MINOR_VERSION) \
00099 || ((major) == PLUGIN_MAJOR_VERSION && (minor) == PLUGIN_MINOR_VERSION && (patch) <= PLUGIN_PATCH_VERSION))
00100
00101
00102 #define PLUGIN_VERSION_STRING \
00103 APR_STRINGIFY(PLUGIN_MAJOR_VERSION) "." \
00104 APR_STRINGIFY(PLUGIN_MINOR_VERSION) "." \
00105 APR_STRINGIFY(PLUGIN_PATCH_VERSION)
00106
00107
00108 typedef apr_version_t mrcp_plugin_version_t;
00109
00110
00111 static APR_INLINE void mrcp_plugin_version_get(mrcp_plugin_version_t *version)
00112 {
00113 version->major = PLUGIN_MAJOR_VERSION;
00114 version->minor = PLUGIN_MINOR_VERSION;
00115 version->patch = PLUGIN_PATCH_VERSION;
00116 }
00117
00118
00119 static APR_INLINE int mrcp_plugin_version_check(mrcp_plugin_version_t *version)
00120 {
00121 return PLUGIN_VERSION_AT_LEAST(version->major,version->minor,version->patch);
00122 }
00123
00124 APT_END_EXTERN_C
00125
00126 #endif