blob: 742df380b7edae96f4c30fe272e73b4eca82446c [file] [log] [blame]
David Garcia Quintas9885bff2016-04-07 17:31:29 -07001/*
2 *
Jan Tattermusch7897ae92017-06-07 22:57:36 +02003 * Copyright 2015 gRPC authors.
David Garcia Quintas9885bff2016-04-07 17:31:29 -07004 *
Jan Tattermusch7897ae92017-06-07 22:57:36 +02005 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
David Garcia Quintas9885bff2016-04-07 17:31:29 -07008 *
Jan Tattermusch7897ae92017-06-07 22:57:36 +02009 * http://www.apache.org/licenses/LICENSE-2.0
David Garcia Quintas9885bff2016-04-07 17:31:29 -070010 *
Jan Tattermusch7897ae92017-06-07 22:57:36 +020011 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
David Garcia Quintas9885bff2016-04-07 17:31:29 -070016 *
17 */
18
Craig Tillerd608cd62017-04-02 16:23:17 -070019#ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_PARSE_ADDRESS_H
20#define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_PARSE_ADDRESS_H
David Garcia Quintas9885bff2016-04-07 17:31:29 -070021
22#include <stddef.h>
23
Craig Tiller9eb0fde2017-03-31 16:59:30 -070024#include "src/core/ext/filters/client_channel/uri_parser.h"
murgatroid997871f732016-09-23 13:49:05 -070025#include "src/core/lib/iomgr/resolve_address.h"
David Garcia Quintas9885bff2016-04-07 17:31:29 -070026
Yash Tibrewala7e6d652017-09-20 18:56:37 -070027#ifdef __cplusplus
28extern "C" {
29#endif
30
David Garcia Quintas53af23c2017-04-15 10:29:46 -070031/** Populate \a resolved_addr from \a uri, whose path is expected to contain a
David Garcia Quintas9885bff2016-04-07 17:31:29 -070032 * unix socket path. Returns true upon success. */
David Garcia Quintas53af23c2017-04-15 10:29:46 -070033bool grpc_parse_unix(const grpc_uri *uri, grpc_resolved_address *resolved_addr);
David Garcia Quintas9885bff2016-04-07 17:31:29 -070034
David Garcia Quintas53af23c2017-04-15 10:29:46 -070035/** Populate \a resolved_addr from \a uri, whose path is expected to contain an
36 * IPv4 host:port pair. Returns true upon success. */
37bool grpc_parse_ipv4(const grpc_uri *uri, grpc_resolved_address *resolved_addr);
David Garcia Quintas9885bff2016-04-07 17:31:29 -070038
David Garcia Quintas53af23c2017-04-15 10:29:46 -070039/** Populate \a resolved_addr from \a uri, whose path is expected to contain an
40 * IPv6 host:port pair. Returns true upon success. */
41bool grpc_parse_ipv6(const grpc_uri *uri, grpc_resolved_address *resolved_addr);
42
43/** Populate \a resolved_addr from \a uri. Returns true upon success. */
44bool grpc_parse_uri(const grpc_uri *uri, grpc_resolved_address *resolved_addr);
David Garcia Quintas9885bff2016-04-07 17:31:29 -070045
Mark D. Roth96fc54c2017-05-18 14:33:07 -070046/** Parse bare IPv4 or IPv6 "IP:port" strings. */
47bool grpc_parse_ipv4_hostport(const char *hostport, grpc_resolved_address *addr,
48 bool log_errors);
49bool grpc_parse_ipv6_hostport(const char *hostport, grpc_resolved_address *addr,
50 bool log_errors);
51
Yash Tibrewala7e6d652017-09-20 18:56:37 -070052#ifdef __cplusplus
53}
54#endif
55
56#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_PARSE_ADDRESS_H */