aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Sree Kuchibhotla <sreecha@users.noreply.github.com>2016-04-18 10:03:06 -0700
committerGravatar Sree Kuchibhotla <sreecha@users.noreply.github.com>2016-04-18 10:03:06 -0700
commitfaaeab0869c56dca57e371910478c11bee19f027 (patch)
tree9fb52d0d68719a77d6c79821ea7f0b4e89125bd7
parentd51d9ae65ec5e3c3fa2befcbc0404669ce629b87 (diff)
parentff71c38be9bf8d8527a6a44655f100b86564f886 (diff)
Merge pull request #6124 from dgquintas/ip_parse_refactor
Factored out parse functions from sockaddr_resolver
-rw-r--r--BUILD6
-rw-r--r--Makefile2
-rw-r--r--binding.gyp1
-rw-r--r--build.yaml2
-rw-r--r--config.m41
-rw-r--r--gRPC.podspec3
-rwxr-xr-xgrpc.gemspec2
-rw-r--r--package.xml2
-rw-r--r--src/core/ext/client_config/parse_address.c137
-rw-r--r--src/core/ext/client_config/parse_address.h56
-rw-r--r--src/core/ext/resolver/sockaddr/sockaddr_resolver.c98
-rw-r--r--src/python/grpcio/grpc_core_dependencies.py1
-rw-r--r--tools/doxygen/Doxyfile.core.internal2
-rw-r--r--tools/run_tests/sources_and_headers.json3
-rw-r--r--vsprojects/vcxproj/grpc/grpc.vcxproj3
-rw-r--r--vsprojects/vcxproj/grpc/grpc.vcxproj.filters6
-rw-r--r--vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj3
-rw-r--r--vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters6
18 files changed, 237 insertions, 97 deletions
diff --git a/BUILD b/BUILD
index fa9a120989..b4751a7081 100644
--- a/BUILD
+++ b/BUILD
@@ -275,6 +275,7 @@ cc_library(
"src/core/ext/client_config/lb_policy.h",
"src/core/ext/client_config/lb_policy_factory.h",
"src/core/ext/client_config/lb_policy_registry.h",
+ "src/core/ext/client_config/parse_address.h",
"src/core/ext/client_config/resolver.h",
"src/core/ext/client_config/resolver_factory.h",
"src/core/ext/client_config/resolver_registry.h",
@@ -426,6 +427,7 @@ cc_library(
"src/core/ext/client_config/lb_policy.c",
"src/core/ext/client_config/lb_policy_factory.c",
"src/core/ext/client_config/lb_policy_registry.c",
+ "src/core/ext/client_config/parse_address.c",
"src/core/ext/client_config/resolver.c",
"src/core/ext/client_config/resolver_factory.c",
"src/core/ext/client_config/resolver_registry.c",
@@ -603,6 +605,7 @@ cc_library(
"src/core/ext/client_config/lb_policy.h",
"src/core/ext/client_config/lb_policy_factory.h",
"src/core/ext/client_config/lb_policy_registry.h",
+ "src/core/ext/client_config/parse_address.h",
"src/core/ext/client_config/resolver.h",
"src/core/ext/client_config/resolver_factory.h",
"src/core/ext/client_config/resolver_registry.h",
@@ -736,6 +739,7 @@ cc_library(
"src/core/ext/client_config/lb_policy.c",
"src/core/ext/client_config/lb_policy_factory.c",
"src/core/ext/client_config/lb_policy_registry.c",
+ "src/core/ext/client_config/parse_address.c",
"src/core/ext/client_config/resolver.c",
"src/core/ext/client_config/resolver_factory.c",
"src/core/ext/client_config/resolver_registry.c",
@@ -1434,6 +1438,7 @@ objc_library(
"src/core/ext/client_config/lb_policy.c",
"src/core/ext/client_config/lb_policy_factory.c",
"src/core/ext/client_config/lb_policy_registry.c",
+ "src/core/ext/client_config/parse_address.c",
"src/core/ext/client_config/resolver.c",
"src/core/ext/client_config/resolver_factory.c",
"src/core/ext/client_config/resolver_registry.c",
@@ -1604,6 +1609,7 @@ objc_library(
"src/core/ext/client_config/lb_policy.h",
"src/core/ext/client_config/lb_policy_factory.h",
"src/core/ext/client_config/lb_policy_registry.h",
+ "src/core/ext/client_config/parse_address.h",
"src/core/ext/client_config/resolver.h",
"src/core/ext/client_config/resolver_factory.h",
"src/core/ext/client_config/resolver_registry.h",
diff --git a/Makefile b/Makefile
index 488d6f4dce..50fc16753a 100644
--- a/Makefile
+++ b/Makefile
@@ -2583,6 +2583,7 @@ LIBGRPC_SRC = \
src/core/ext/client_config/lb_policy.c \
src/core/ext/client_config/lb_policy_factory.c \
src/core/ext/client_config/lb_policy_registry.c \
+ src/core/ext/client_config/parse_address.c \
src/core/ext/client_config/resolver.c \
src/core/ext/client_config/resolver_factory.c \
src/core/ext/client_config/resolver_registry.c \
@@ -2900,6 +2901,7 @@ LIBGRPC_UNSECURE_SRC = \
src/core/ext/client_config/lb_policy.c \
src/core/ext/client_config/lb_policy_factory.c \
src/core/ext/client_config/lb_policy_registry.c \
+ src/core/ext/client_config/parse_address.c \
src/core/ext/client_config/resolver.c \
src/core/ext/client_config/resolver_factory.c \
src/core/ext/client_config/resolver_registry.c \
diff --git a/binding.gyp b/binding.gyp
index 8efc8a2b8e..53d86534de 100644
--- a/binding.gyp
+++ b/binding.gyp
@@ -694,6 +694,7 @@
'src/core/ext/client_config/lb_policy.c',
'src/core/ext/client_config/lb_policy_factory.c',
'src/core/ext/client_config/lb_policy_registry.c',
+ 'src/core/ext/client_config/parse_address.c',
'src/core/ext/client_config/resolver.c',
'src/core/ext/client_config/resolver_factory.c',
'src/core/ext/client_config/resolver_registry.c',
diff --git a/build.yaml b/build.yaml
index a6feea5074..b096576b44 100644
--- a/build.yaml
+++ b/build.yaml
@@ -442,6 +442,7 @@ filegroups:
- src/core/ext/client_config/lb_policy.h
- src/core/ext/client_config/lb_policy_factory.h
- src/core/ext/client_config/lb_policy_registry.h
+ - src/core/ext/client_config/parse_address.h
- src/core/ext/client_config/resolver.h
- src/core/ext/client_config/resolver_factory.h
- src/core/ext/client_config/resolver_registry.h
@@ -461,6 +462,7 @@ filegroups:
- src/core/ext/client_config/lb_policy.c
- src/core/ext/client_config/lb_policy_factory.c
- src/core/ext/client_config/lb_policy_registry.c
+ - src/core/ext/client_config/parse_address.c
- src/core/ext/client_config/resolver.c
- src/core/ext/client_config/resolver_factory.c
- src/core/ext/client_config/resolver_registry.c
diff --git a/config.m4 b/config.m4
index 7d3d899a40..c26cb7b881 100644
--- a/config.m4
+++ b/config.m4
@@ -216,6 +216,7 @@ if test "$PHP_GRPC" != "no"; then
src/core/ext/client_config/lb_policy.c \
src/core/ext/client_config/lb_policy_factory.c \
src/core/ext/client_config/lb_policy_registry.c \
+ src/core/ext/client_config/parse_address.c \
src/core/ext/client_config/resolver.c \
src/core/ext/client_config/resolver_factory.c \
src/core/ext/client_config/resolver_registry.c \
diff --git a/gRPC.podspec b/gRPC.podspec
index 82c5eaac41..7ede97d1a9 100644
--- a/gRPC.podspec
+++ b/gRPC.podspec
@@ -277,6 +277,7 @@ Pod::Spec.new do |s|
'src/core/ext/client_config/lb_policy.h',
'src/core/ext/client_config/lb_policy_factory.h',
'src/core/ext/client_config/lb_policy_registry.h',
+ 'src/core/ext/client_config/parse_address.h',
'src/core/ext/client_config/resolver.h',
'src/core/ext/client_config/resolver_factory.h',
'src/core/ext/client_config/resolver_registry.h',
@@ -459,6 +460,7 @@ Pod::Spec.new do |s|
'src/core/ext/client_config/lb_policy.c',
'src/core/ext/client_config/lb_policy_factory.c',
'src/core/ext/client_config/lb_policy_registry.c',
+ 'src/core/ext/client_config/parse_address.c',
'src/core/ext/client_config/resolver.c',
'src/core/ext/client_config/resolver_factory.c',
'src/core/ext/client_config/resolver_registry.c',
@@ -616,6 +618,7 @@ Pod::Spec.new do |s|
'src/core/ext/client_config/lb_policy.h',
'src/core/ext/client_config/lb_policy_factory.h',
'src/core/ext/client_config/lb_policy_registry.h',
+ 'src/core/ext/client_config/parse_address.h',
'src/core/ext/client_config/resolver.h',
'src/core/ext/client_config/resolver_factory.h',
'src/core/ext/client_config/resolver_registry.h',
diff --git a/grpc.gemspec b/grpc.gemspec
index b8cfc4e6c4..9c858b2579 100755
--- a/grpc.gemspec
+++ b/grpc.gemspec
@@ -288,6 +288,7 @@ Gem::Specification.new do |s|
s.files += %w( src/core/ext/client_config/lb_policy.h )
s.files += %w( src/core/ext/client_config/lb_policy_factory.h )
s.files += %w( src/core/ext/client_config/lb_policy_registry.h )
+ s.files += %w( src/core/ext/client_config/parse_address.h )
s.files += %w( src/core/ext/client_config/resolver.h )
s.files += %w( src/core/ext/client_config/resolver_factory.h )
s.files += %w( src/core/ext/client_config/resolver_registry.h )
@@ -443,6 +444,7 @@ Gem::Specification.new do |s|
s.files += %w( src/core/ext/client_config/lb_policy.c )
s.files += %w( src/core/ext/client_config/lb_policy_factory.c )
s.files += %w( src/core/ext/client_config/lb_policy_registry.c )
+ s.files += %w( src/core/ext/client_config/parse_address.c )
s.files += %w( src/core/ext/client_config/resolver.c )
s.files += %w( src/core/ext/client_config/resolver_factory.c )
s.files += %w( src/core/ext/client_config/resolver_registry.c )
diff --git a/package.xml b/package.xml
index 2f4c625539..ced62b63d6 100644
--- a/package.xml
+++ b/package.xml
@@ -291,6 +291,7 @@
<file baseinstalldir="/" name="src/core/ext/client_config/lb_policy.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/client_config/lb_policy_factory.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/client_config/lb_policy_registry.h" role="src" />
+ <file baseinstalldir="/" name="src/core/ext/client_config/parse_address.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/client_config/resolver.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/client_config/resolver_factory.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/client_config/resolver_registry.h" role="src" />
@@ -446,6 +447,7 @@
<file baseinstalldir="/" name="src/core/ext/client_config/lb_policy.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/client_config/lb_policy_factory.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/client_config/lb_policy_registry.c" role="src" />
+ <file baseinstalldir="/" name="src/core/ext/client_config/parse_address.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/client_config/resolver.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/client_config/resolver_factory.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/client_config/resolver_registry.c" role="src" />
diff --git a/src/core/ext/client_config/parse_address.c b/src/core/ext/client_config/parse_address.c
new file mode 100644
index 0000000000..8b4abe24a6
--- /dev/null
+++ b/src/core/ext/client_config/parse_address.c
@@ -0,0 +1,137 @@
+/*
+ *
+ * Copyright 2016, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include "src/core/ext/client_config/parse_address.h"
+
+#include <stdio.h>
+#include <string.h>
+#ifdef GPR_HAVE_UNIX_SOCKET
+#include <sys/un.h>
+#endif
+
+#include <grpc/support/alloc.h>
+#include <grpc/support/host_port.h>
+#include <grpc/support/log.h>
+#include <grpc/support/string_util.h>
+
+#ifdef GPR_HAVE_UNIX_SOCKET
+int parse_unix(grpc_uri *uri, struct sockaddr_storage *addr, size_t *len) {
+ struct sockaddr_un *un = (struct sockaddr_un *)addr;
+
+ un->sun_family = AF_UNIX;
+ strcpy(un->sun_path, uri->path);
+ *len = strlen(un->sun_path) + sizeof(un->sun_family) + 1;
+
+ return 1;
+}
+#endif
+
+int parse_ipv4(grpc_uri *uri, struct sockaddr_storage *addr, size_t *len) {
+ const char *host_port = uri->path;
+ char *host;
+ char *port;
+ int port_num;
+ int result = 0;
+ struct sockaddr_in *in = (struct sockaddr_in *)addr;
+
+ if (*host_port == '/') ++host_port;
+ if (!gpr_split_host_port(host_port, &host, &port)) {
+ return 0;
+ }
+
+ memset(in, 0, sizeof(*in));
+ *len = sizeof(*in);
+ in->sin_family = AF_INET;
+ if (inet_pton(AF_INET, host, &in->sin_addr) == 0) {
+ gpr_log(GPR_ERROR, "invalid ipv4 address: '%s'", host);
+ goto done;
+ }
+
+ if (port != NULL) {
+ if (sscanf(port, "%d", &port_num) != 1 || port_num < 0 ||
+ port_num > 65535) {
+ gpr_log(GPR_ERROR, "invalid ipv4 port: '%s'", port);
+ goto done;
+ }
+ in->sin_port = htons((uint16_t)port_num);
+ } else {
+ gpr_log(GPR_ERROR, "no port given for ipv4 scheme");
+ goto done;
+ }
+
+ result = 1;
+done:
+ gpr_free(host);
+ gpr_free(port);
+ return result;
+}
+
+int parse_ipv6(grpc_uri *uri, struct sockaddr_storage *addr, size_t *len) {
+ const char *host_port = uri->path;
+ char *host;
+ char *port;
+ int port_num;
+ int result = 0;
+ struct sockaddr_in6 *in6 = (struct sockaddr_in6 *)addr;
+
+ if (*host_port == '/') ++host_port;
+ if (!gpr_split_host_port(host_port, &host, &port)) {
+ return 0;
+ }
+
+ memset(in6, 0, sizeof(*in6));
+ *len = sizeof(*in6);
+ in6->sin6_family = AF_INET6;
+ if (inet_pton(AF_INET6, host, &in6->sin6_addr) == 0) {
+ gpr_log(GPR_ERROR, "invalid ipv6 address: '%s'", host);
+ goto done;
+ }
+
+ if (port != NULL) {
+ if (sscanf(port, "%d", &port_num) != 1 || port_num < 0 ||
+ port_num > 65535) {
+ gpr_log(GPR_ERROR, "invalid ipv6 port: '%s'", port);
+ goto done;
+ }
+ in6->sin6_port = htons((uint16_t)port_num);
+ } else {
+ gpr_log(GPR_ERROR, "no port given for ipv6 scheme");
+ goto done;
+ }
+
+ result = 1;
+done:
+ gpr_free(host);
+ gpr_free(port);
+ return result;
+}
diff --git a/src/core/ext/client_config/parse_address.h b/src/core/ext/client_config/parse_address.h
new file mode 100644
index 0000000000..74c86f4d93
--- /dev/null
+++ b/src/core/ext/client_config/parse_address.h
@@ -0,0 +1,56 @@
+/*
+ *
+ * Copyright 2015, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef GRPC_CORE_EXT_CLIENT_CONFIG_PARSE_ADDRESS_H
+#define GRPC_CORE_EXT_CLIENT_CONFIG_PARSE_ADDRESS_H
+
+#include <stddef.h>
+
+#include "src/core/ext/client_config/uri_parser.h"
+#include "src/core/lib/iomgr/sockaddr.h"
+
+#ifdef GPR_HAVE_UNIX_SOCKET
+/** Populate \a addr and \a len from \a uri, whose path is expected to contain a
+ * unix socket path. Returns true upon success. */
+int parse_unix(grpc_uri *uri, struct sockaddr_storage *addr, size_t *len);
+#endif
+
+/** Populate /a addr and \a len from \a uri, whose path is expected to contain a
+ * host:port pair. Returns true upon success. */
+int parse_ipv4(grpc_uri *uri, struct sockaddr_storage *addr, size_t *len);
+
+/** Populate /a addr and \a len from \a uri, whose path is expected to contain a
+ * host:port pair. Returns true upon success. */
+int parse_ipv6(grpc_uri *uri, struct sockaddr_storage *addr, size_t *len);
+
+#endif /* GRPC_CORE_EXT_CLIENT_CONFIG_PARSE_ADDRESS_H */
diff --git a/src/core/ext/resolver/sockaddr/sockaddr_resolver.c b/src/core/ext/resolver/sockaddr/sockaddr_resolver.c
index 1d54a86c39..a4fa9acf22 100644
--- a/src/core/ext/resolver/sockaddr/sockaddr_resolver.c
+++ b/src/core/ext/resolver/sockaddr/sockaddr_resolver.c
@@ -40,11 +40,8 @@
#include <grpc/support/port_platform.h>
#include <grpc/support/string_util.h>
-#ifdef GPR_HAVE_UNIX_SOCKET
-#include <sys/un.h>
-#endif
-
#include "src/core/ext/client_config/lb_policy_registry.h"
+#include "src/core/ext/client_config/parse_address.h"
#include "src/core/ext/client_config/resolver_registry.h"
#include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/iomgr/unix_sockets_posix.h"
@@ -167,105 +164,12 @@ static char *ipv6_get_default_authority(grpc_resolver_factory *factory,
}
#ifdef GPR_HAVE_UNIX_SOCKET
-static int parse_unix(grpc_uri *uri, struct sockaddr_storage *addr,
- size_t *len) {
- struct sockaddr_un *un = (struct sockaddr_un *)addr;
-
- un->sun_family = AF_UNIX;
- strcpy(un->sun_path, uri->path);
- *len = strlen(un->sun_path) + sizeof(un->sun_family) + 1;
-
- return 1;
-}
-
char *unix_get_default_authority(grpc_resolver_factory *factory,
grpc_uri *uri) {
return gpr_strdup("localhost");
}
#endif
-static int parse_ipv4(grpc_uri *uri, struct sockaddr_storage *addr,
- size_t *len) {
- const char *host_port = uri->path;
- char *host;
- char *port;
- int port_num;
- int result = 0;
- struct sockaddr_in *in = (struct sockaddr_in *)addr;
-
- if (*host_port == '/') ++host_port;
- if (!gpr_split_host_port(host_port, &host, &port)) {
- return 0;
- }
-
- memset(in, 0, sizeof(*in));
- *len = sizeof(*in);
- in->sin_family = AF_INET;
- if (inet_pton(AF_INET, host, &in->sin_addr) == 0) {
- gpr_log(GPR_ERROR, "invalid ipv4 address: '%s'", host);
- goto done;
- }
-
- if (port != NULL) {
- if (sscanf(port, "%d", &port_num) != 1 || port_num < 0 ||
- port_num > 65535) {
- gpr_log(GPR_ERROR, "invalid ipv4 port: '%s'", port);
- goto done;
- }
- in->sin_port = htons((uint16_t)port_num);
- } else {
- gpr_log(GPR_ERROR, "no port given for ipv4 scheme");
- goto done;
- }
-
- result = 1;
-done:
- gpr_free(host);
- gpr_free(port);
- return result;
-}
-
-static int parse_ipv6(grpc_uri *uri, struct sockaddr_storage *addr,
- size_t *len) {
- const char *host_port = uri->path;
- char *host;
- char *port;
- int port_num;
- int result = 0;
- struct sockaddr_in6 *in6 = (struct sockaddr_in6 *)addr;
-
- if (*host_port == '/') ++host_port;
- if (!gpr_split_host_port(host_port, &host, &port)) {
- return 0;
- }
-
- memset(in6, 0, sizeof(*in6));
- *len = sizeof(*in6);
- in6->sin6_family = AF_INET6;
- if (inet_pton(AF_INET6, host, &in6->sin6_addr) == 0) {
- gpr_log(GPR_ERROR, "invalid ipv6 address: '%s'", host);
- goto done;
- }
-
- if (port != NULL) {
- if (sscanf(port, "%d", &port_num) != 1 || port_num < 0 ||
- port_num > 65535) {
- gpr_log(GPR_ERROR, "invalid ipv6 port: '%s'", port);
- goto done;
- }
- in6->sin6_port = htons((uint16_t)port_num);
- } else {
- gpr_log(GPR_ERROR, "no port given for ipv6 scheme");
- goto done;
- }
-
- result = 1;
-done:
- gpr_free(host);
- gpr_free(port);
- return result;
-}
-
static void do_nothing(void *ignored) {}
static grpc_resolver *sockaddr_create(
diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py
index 1f7f2a196b..de25edbeb5 100644
--- a/src/python/grpcio/grpc_core_dependencies.py
+++ b/src/python/grpcio/grpc_core_dependencies.py
@@ -210,6 +210,7 @@ CORE_SOURCE_FILES = [
'src/core/ext/client_config/lb_policy.c',
'src/core/ext/client_config/lb_policy_factory.c',
'src/core/ext/client_config/lb_policy_registry.c',
+ 'src/core/ext/client_config/parse_address.c',
'src/core/ext/client_config/resolver.c',
'src/core/ext/client_config/resolver_factory.c',
'src/core/ext/client_config/resolver_registry.c',
diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal
index b131a55b59..4b3c8ab4bf 100644
--- a/tools/doxygen/Doxyfile.core.internal
+++ b/tools/doxygen/Doxyfile.core.internal
@@ -903,6 +903,7 @@ src/core/ext/client_config/initial_connect_string.h \
src/core/ext/client_config/lb_policy.h \
src/core/ext/client_config/lb_policy_factory.h \
src/core/ext/client_config/lb_policy_registry.h \
+src/core/ext/client_config/parse_address.h \
src/core/ext/client_config/resolver.h \
src/core/ext/client_config/resolver_factory.h \
src/core/ext/client_config/resolver_registry.h \
@@ -1058,6 +1059,7 @@ src/core/ext/client_config/initial_connect_string.c \
src/core/ext/client_config/lb_policy.c \
src/core/ext/client_config/lb_policy_factory.c \
src/core/ext/client_config/lb_policy_registry.c \
+src/core/ext/client_config/parse_address.c \
src/core/ext/client_config/resolver.c \
src/core/ext/client_config/resolver_factory.c \
src/core/ext/client_config/resolver_registry.c \
diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json
index 0b68315c82..7978f12d53 100644
--- a/tools/run_tests/sources_and_headers.json
+++ b/tools/run_tests/sources_and_headers.json
@@ -5997,6 +5997,7 @@
"src/core/ext/client_config/lb_policy.h",
"src/core/ext/client_config/lb_policy_factory.h",
"src/core/ext/client_config/lb_policy_registry.h",
+ "src/core/ext/client_config/parse_address.h",
"src/core/ext/client_config/resolver.h",
"src/core/ext/client_config/resolver_factory.h",
"src/core/ext/client_config/resolver_registry.h",
@@ -6027,6 +6028,8 @@
"src/core/ext/client_config/lb_policy_factory.h",
"src/core/ext/client_config/lb_policy_registry.c",
"src/core/ext/client_config/lb_policy_registry.h",
+ "src/core/ext/client_config/parse_address.c",
+ "src/core/ext/client_config/parse_address.h",
"src/core/ext/client_config/resolver.c",
"src/core/ext/client_config/resolver.h",
"src/core/ext/client_config/resolver_factory.c",
diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj b/vsprojects/vcxproj/grpc/grpc.vcxproj
index f695468254..32540da499 100644
--- a/vsprojects/vcxproj/grpc/grpc.vcxproj
+++ b/vsprojects/vcxproj/grpc/grpc.vcxproj
@@ -412,6 +412,7 @@
<ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\lb_policy.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\lb_policy_factory.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\lb_policy_registry.h" />
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\parse_address.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\resolver.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\resolver_factory.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\resolver_registry.h" />
@@ -705,6 +706,8 @@
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\lb_policy_registry.c">
</ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\parse_address.c">
+ </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\resolver.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\resolver_factory.c">
diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters
index 37bd1e6645..09b94cffe9 100644
--- a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters
+++ b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters
@@ -409,6 +409,9 @@
<ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\lb_policy_registry.c">
<Filter>src\core\ext\client_config</Filter>
</ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\parse_address.c">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\resolver.c">
<Filter>src\core\ext\client_config</Filter>
</ClCompile>
@@ -926,6 +929,9 @@
<ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\lb_policy_registry.h">
<Filter>src\core\ext\client_config</Filter>
</ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\parse_address.h">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\resolver.h">
<Filter>src\core\ext\client_config</Filter>
</ClInclude>
diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj
index a866ddc333..fa571d9bf9 100644
--- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj
+++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj
@@ -388,6 +388,7 @@
<ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\lb_policy.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\lb_policy_factory.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\lb_policy_registry.h" />
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\parse_address.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\resolver.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\resolver_factory.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\resolver_registry.h" />
@@ -645,6 +646,8 @@
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\lb_policy_registry.c">
</ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\parse_address.c">
+ </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\resolver.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\resolver_factory.c">
diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters
index bc4e06e948..30dcb1ba1a 100644
--- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters
+++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters
@@ -355,6 +355,9 @@
<ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\lb_policy_registry.c">
<Filter>src\core\ext\client_config</Filter>
</ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\parse_address.c">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\resolver.c">
<Filter>src\core\ext\client_config</Filter>
</ClCompile>
@@ -821,6 +824,9 @@
<ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\lb_policy_registry.h">
<Filter>src\core\ext\client_config</Filter>
</ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\parse_address.h">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\resolver.h">
<Filter>src\core\ext\client_config</Filter>
</ClInclude>