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_generic_header.h 1710 2010-05-24 17:36:19Z achaloyan $ 00017 */ 00018 00019 #ifndef MRCP_GENERIC_HEADER_H 00020 #define MRCP_GENERIC_HEADER_H 00021 00022 /** 00023 * @file mrcp_generic_header.h 00024 * @brief MRCP Generic Header 00025 */ 00026 00027 #include "mrcp_types.h" 00028 #include "mrcp_header_accessor.h" 00029 00030 APT_BEGIN_EXTERN_C 00031 00032 /** Enumeration of MRCP generic header fields */ 00033 typedef enum { 00034 GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST, 00035 GENERIC_HEADER_PROXY_SYNC_ID, 00036 GENERIC_HEADER_ACCEPT_CHARSET, 00037 GENERIC_HEADER_CONTENT_TYPE, 00038 GENERIC_HEADER_CONTENT_ID, 00039 GENERIC_HEADER_CONTENT_BASE, 00040 GENERIC_HEADER_CONTENT_ENCODING, 00041 GENERIC_HEADER_CONTENT_LOCATION, 00042 GENERIC_HEADER_CONTENT_LENGTH, 00043 GENERIC_HEADER_CACHE_CONTROL, 00044 GENERIC_HEADER_LOGGING_TAG, 00045 GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS, 00046 00047 /** Additional header fields for MRCP v2 */ 00048 GENERIC_HEADER_ACCEPT, 00049 GENERIC_HEADER_FETCH_TIMEOUT, 00050 GENERIC_HEADER_SET_COOKIE, 00051 GENERIC_HEADER_SET_COOKIE2, 00052 00053 GENERIC_HEADER_COUNT 00054 } mrcp_generic_header_id; 00055 00056 /** MRCP request identifiers list declaration */ 00057 typedef struct mrcp_request_id_list_t mrcp_request_id_list_t; 00058 /** MRCP vendor specific parameter list of pairs */ 00059 typedef struct mrcp_vendor_specific_params_list_t mrcp_vendor_specific_params_list_t; 00060 /** MRCP generic header declaration */ 00061 typedef struct mrcp_generic_header_t mrcp_generic_header_t; 00062 00063 /** Max number of request ids in active request id list */ 00064 #define MAX_ACTIVE_REQUEST_ID_COUNT 5 00065 /** List (array) of MRCP request identifiers */ 00066 struct mrcp_request_id_list_t { 00067 /** Array of request identifiers */ 00068 mrcp_request_id ids[MAX_ACTIVE_REQUEST_ID_COUNT]; 00069 /** Number of request identifiers */ 00070 apr_size_t count; 00071 }; 00072 00073 00074 /** MRCP generic header */ 00075 struct mrcp_generic_header_t { 00076 /** Indicates the list of request-ids to which it should apply */ 00077 mrcp_request_id_list_t active_request_id_list; 00078 /** Helps the resource receiving the event, proxied by the client, 00079 to decide if this event has been processed through a direct interaction of the resources */ 00080 apt_str_t proxy_sync_id; 00081 /** Specifies the acceptable character set for entities returned in the response or events associated with this request */ 00082 apt_str_t accept_charset; 00083 /** Restricted to speech markup, grammar, recognition results, etc. */ 00084 apt_str_t content_type; 00085 /** Contains an ID or name for the content, by which it can be referred to */ 00086 apt_str_t content_id; 00087 /** May be used to specify the base URI for resolving relative URLs within the entity */ 00088 apt_str_t content_base; 00089 /** Indicates what additional content coding has been applied to the entity-body */ 00090 apt_str_t content_encoding; 00091 /** Statement of the location of the resource corresponding to this particular entity at the time of the request */ 00092 apt_str_t content_location; 00093 /** Contains the length of the content of the message body */ 00094 size_t content_length; 00095 /** Defines the default caching algorithms on the media server for the session or request */ 00096 apt_str_t cache_control; 00097 /** Sets the logging tag for logs generated by the media server */ 00098 apt_str_t logging_tag; 00099 /** Specifies the vendor specific parameters used by the media server */ 00100 apt_pair_arr_t *vendor_specific_params; 00101 00102 /** Additional header fields for MRCP v2 */ 00103 /** Specifies the acceptable media types set for entities returned in the response or events associated with this request */ 00104 apt_str_t accept; 00105 /** Defines the timeout for content that the server may need to fetch over the network */ 00106 apr_size_t fetch_timeout; 00107 /** Enables to synchronize the cookie store of MRCP v2 client and server */ 00108 apt_str_t set_cookie; 00109 /** Enables to synchronize the cookie store of MRCP v2 client and server */ 00110 apt_str_t set_cookie2; 00111 }; 00112 00113 /** Get generic header vtable */ 00114 MRCP_DECLARE(const mrcp_header_vtable_t*) mrcp_generic_header_vtable_get(mrcp_version_e version); 00115 00116 00117 /** Append active request id list */ 00118 MRCP_DECLARE(apt_bool_t) active_request_id_list_append(mrcp_generic_header_t *generic_header, mrcp_request_id request_id); 00119 /** Find request id in active request id list */ 00120 MRCP_DECLARE(apt_bool_t) active_request_id_list_find(const mrcp_generic_header_t *generic_header, mrcp_request_id request_id); 00121 00122 00123 APT_END_EXTERN_C 00124 00125 #endif /* MRCP_GENERIC_HEADER_H */