2 * Copyright (c) 2012 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.
19 #include <glib-object.h>
21 #include "vconf-keys.h"
22 #include "net_connection.h"
24 #include "download-agent-plugin-conf.h"
25 #include "download-agent-debug.h"
26 #include "download-agent-file.h"
28 #define DEFAULT_UA_STR "Mozilla/5.0 (Linux; U; Tizen 1.0; en-us) AppleWebKit/534.46 (KHTML, like Gecko) Mobile Tizen Browser/1.0"
30 da_ret_t __get_conf_string(const char *key, char **out_string)
32 if (!key || !out_string) {
33 DA_LOGE("Invalid Argument");
34 return DA_ERR_INVALID_ARGUMENT;
37 *out_string = vconf_get_str(key);
41 da_ret_t get_user_agent_string(char **uagent_str)
43 da_ret_t ret = DA_RESULT_OK;
48 DA_LOGE("Invalid Argument");
49 return DA_ERR_INVALID_ARGUMENT;
52 DA_LOGI("No UA information from vconf !!");
53 *uagent_str = strdup(DEFAULT_UA_STR);
54 DA_LOGV("Set default UA");
58 char *get_proxy_address(void)
61 char *proxyRet = NULL;
62 connection_h handle = NULL;
63 connection_address_family_e family = CONNECTION_ADDRESS_FAMILY_IPV4;
66 if (connection_create(&handle) < 0) {
67 DA_LOGE("Fail to create connection handle");
71 if (connection_get_proxy(handle, family, &proxyRet) < 0) {
72 DA_LOGE("Fail to get proxy address");
73 connection_destroy(handle);
78 DA_SECURE_LOGD("===== Proxy address[%s] =====", proxyRet);
79 proxy = strdup(proxyRet);
82 connection_destroy(handle);
86 if (connection_destroy(handle) < 0) {
87 DA_LOGE("Fail to desctory connection handle");
94 void get_smart_bonding_vconf()
97 vconf_get_int("file/private/wifi/network_bonding", &ret);
98 DA_LOGI("Smart Bonding Vconf:%d", ret);