diff options
author | Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com> | 2011-06-22 09:28:54 +0300 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2011-06-27 16:15:08 +0200 |
commit | 4d6fdeeb29d9c78ce99f54c6f7d01e6177706cad (patch) | |
tree | a71e16cf3d18aa68f82175d13be3984c06f24572 /gweb/gweb.c | |
parent | b3eb89368c50be00119171f577e3b4c86c5464ab (diff) | |
download | connman-4d6fdeeb29d9c78ce99f54c6f7d01e6177706cad.tar.gz connman-4d6fdeeb29d9c78ce99f54c6f7d01e6177706cad.tar.bz2 connman-4d6fdeeb29d9c78ce99f54c6f7d01e6177706cad.zip |
gweb: added the capability to restrict the requests to a specific address family.
Diffstat (limited to 'gweb/gweb.c')
-rw-r--r-- | gweb/gweb.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gweb/gweb.c b/gweb/gweb.c index 1183cc6b..536de006 100644 --- a/gweb/gweb.c +++ b/gweb/gweb.c @@ -101,6 +101,8 @@ struct _GWeb { guint next_query_id; + int family; + int index; GList *session_list; @@ -203,6 +205,8 @@ GWeb *g_web_new(int index) web->next_query_id = 1; + web->family = AF_UNSPEC; + web->index = index; web->session_list = NULL; @@ -280,6 +284,19 @@ gboolean g_web_set_proxy(GWeb *web, const char *proxy) return TRUE; } +gboolean g_web_set_address_family(GWeb *web, int family) +{ + if (web == NULL) + return FALSE; + + if (family != AF_UNSPEC && family != AF_INET && family != AF_INET6) + return FALSE; + + web->family = family; + + return TRUE; +} + gboolean g_web_add_nameserver(GWeb *web, const char *address) { if (web == NULL) @@ -1059,6 +1076,7 @@ static void resolv_result(GResolvResultStatus status, memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_flags = AI_NUMERICHOST; + hints.ai_family = session->web->family; if (session->addr != NULL) { freeaddrinfo(session->addr); @@ -1155,6 +1173,7 @@ static guint do_request(GWeb *web, const char *url, memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_flags = AI_NUMERICHOST; + hints.ai_family = session->web->family; if (session->addr != NULL) { freeaddrinfo(session->addr); |