2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
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.
18 #ifndef __MP_HTTP_MGR_H__
19 #define __MP_HTTP_MGR_H__
21 #include "mp-define.h"
23 #define HTTP_ADDR_LEN_MAX 64
28 MP_HTTP_SVC_STREAMING,
34 MP_HTTP_RESPONSE_NORMAL,
35 MP_HTTP_RESPONSE_DISCONNECT,
36 } mp_http_response_type;
42 } MpHttpRespResultType_t;
44 typedef void (*MpHttpRespCb) (gpointer user_data, int type, char *id, MpHttpRespResultType_t res, int view_id);
45 typedef void (*MpHttpOpenCb) (gpointer user_data);
46 typedef bool (*MpHttpRespExcuteCb)(gpointer user_data, mp_http_response_type response_type);
47 typedef bool(*MpHttpOpenExcuteCb) (gpointer user_data);
51 MP_HTTP_STATE_NONE = 0,
52 MP_HTTP_STATE_OFF = 0,
53 MP_HTTP_STATE_CELLULAR,
57 typedef struct mp_http_mgr_t
60 MpHttpState_t http_state; //the state of the http
61 char ip[HTTP_ADDR_LEN_MAX];
62 char proxy[HTTP_ADDR_LEN_MAX];
64 bool svc_state[MP_HTTP_SVC_MAX];
65 void *cb_data[MP_HTTP_SVC_MAX];
66 MpHttpOpenExcuteCb http_open_cb[MP_HTTP_SVC_MAX];
67 MpHttpRespExcuteCb http_resp_cb[MP_HTTP_SVC_MAX];
70 typedef struct mp_http_data_t
75 MpHttpRespCb user_callback;
80 bool mp_http_mgr_create(void *data);
81 bool mp_http_mgr_destory(void *data);
82 MpHttpState_t mp_http_mgr_get_state(void *data);
83 char* mp_http_mgr_get_user_agent(); /* return value should be freed */
85 const char* mp_http_mgr_get_ip(void *data);
86 const char* mp_http_mgr_get_proxy(void *data);
87 bool mp_http_mgr_get_svc_state(void *data, mp_http_svc_type svc_type);
88 bool mp_http_mgr_start_svc(void *data, mp_http_svc_type svc_type, MpHttpOpenExcuteCb open_cb, MpHttpRespExcuteCb rsp_cb, gpointer cb_data);
89 bool mp_http_mgr_stop_svc(void *data, mp_http_svc_type svc_type, mp_http_response_type response_type);
91 #define TOKEN "025B58C0"
92 #endif //__MP_HTTP_MGR_H__