2 * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef MMS_PLUGIN_HTTP_H
18 #define MMS_PLUGIN_HTTP_H
21 #include "MmsPluginTypes.h"
24 #define MSG_MMS_HH_CONTENT_TYPE "application/vnd.wap.mms-message"
25 #define MSG_MMS_HH_ACCEPT "application/vnd.wap.mms-message, */*"
26 #define MSG_MMS_HH_CHARSET "utf-8, us-ascii"
27 #define MSG_MMS_HH_LANGUAGE "zh-cn, en"
28 #define MSG_MMS_HH_ENCODING "deflate,gzip"
30 #define MSG_MMS_HH_USER_AGENT "Mozilla/5.0 (Linux; Tizen 2.3) AppleWebKit/537.3 (KHTML, like Gecko) Version/2.2 Mobile Safari/537.3"
32 typedef unsigned int MMS_HTTP_HEADER_FIELD_T;
34 typedef enum _MMS_HTTP_HEADER_FIELD_E {
38 MMS_HH_ACCEPT_CHARSET,
39 MMS_HH_ACCEPT_LANGUAGE,
40 MMS_HH_ACCEPT_ENCODING,
43 #if defined(FEATURE_SMS_CDMA)
46 } MMS_HTTP_HEADER_FIELD_E;
48 typedef enum _MMS_HTTP_TRANSACTION_TYPE_E {
49 MMS_HTTP_TRANSACTION_TYPE_UNKNOWN = 0,
50 MMS_HTTP_TRANSACTION_TYPE_GET,
51 MMS_HTTP_TRANSACTION_TYPE_POST,
52 } MMS_HTTP_TRANSACTION_TYPE_E;
54 typedef enum _MMS_HTTP_ERROR_E {
55 MMS_HTTP_ERROR_NONE = 0,
57 MMS_HTTP_ERROR_TRANSACTION_TYPE,
58 MMS_HTTP_ERROR_TRANSACTION,
59 MMS_HTTP_ERROR_SESSION,
62 typedef struct _http_session_info_s {
63 MMS_HTTP_TRANSACTION_TYPE_E transaction_type;
67 const char *interface;
68 const char *post_data;
69 unsigned int post_data_len;
71 unsigned int response_data_len;
72 } http_request_info_s;
74 class MmsPluginHttpAgent {
76 static MmsPluginHttpAgent *instance();
78 MMS_HTTP_ERROR_E httpRequest(http_request_info_s &request_info);
81 MsgMutexLocker locker(mx);
86 MsgMutexLocker locker(mx);
91 static MmsPluginHttpAgent *pInstance;
94 ~MmsPluginHttpAgent();
97 MMS_HTTP_ERROR_E setSession(http_request_info_s &request_info);
98 MMS_HTTP_ERROR_E startTransaction();
101 void initAbortFlag(){
102 MsgMutexLocker locker(mx);
106 MMS_HTTP_TRANSACTION_TYPE_E transaction_type;
108 void *session_header;
109 void *session_option;
116 #endif /* MMS_PLUGIN_HTTP_H */