blob: ca0a0d18f03141c9703ca6dadbcb00507107edcf [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
David Garcia Quintas53af23c2017-04-15 10:29:46 -070027/** Populate \a resolved_addr from \a uri, whose path is expected to contain a
David Garcia Quintas9885bff2016-04-07 17:31:29 -070028 * unix socket path. Returns true upon success. */
Craig Tillerbaa14a92017-11-03 09:09:36 -070029bool grpc_parse_unix(const grpc_uri* uri, grpc_resolved_address* resolved_addr);
David Garcia Quintas9885bff2016-04-07 17:31:29 -070030
David Garcia Quintas53af23c2017-04-15 10:29:46 -070031/** Populate \a resolved_addr from \a uri, whose path is expected to contain an
32 * IPv4 host:port pair. Returns true upon success. */
Craig Tillerbaa14a92017-11-03 09:09:36 -070033bool grpc_parse_ipv4(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 * IPv6 host:port pair. Returns true upon success. */
Craig Tillerbaa14a92017-11-03 09:09:36 -070037bool grpc_parse_ipv6(const grpc_uri* uri, grpc_resolved_address* resolved_addr);
David Garcia Quintas53af23c2017-04-15 10:29:46 -070038
39/** Populate \a resolved_addr from \a uri. Returns true upon success. */
Craig Tillerbaa14a92017-11-03 09:09:36 -070040bool grpc_parse_uri(const grpc_uri* uri, grpc_resolved_address* resolved_addr);
David Garcia Quintas9885bff2016-04-07 17:31:29 -070041
Mark D. Roth96fc54c2017-05-18 14:33:07 -070042/** Parse bare IPv4 or IPv6 "IP:port" strings. */
Craig Tillerbaa14a92017-11-03 09:09:36 -070043bool grpc_parse_ipv4_hostport(const char* hostport, grpc_resolved_address* addr,
Mark D. Roth96fc54c2017-05-18 14:33:07 -070044 bool log_errors);
Craig Tillerbaa14a92017-11-03 09:09:36 -070045bool grpc_parse_ipv6_hostport(const char* hostport, grpc_resolved_address* addr,
Mark D. Roth96fc54c2017-05-18 14:33:07 -070046 bool log_errors);
47
Yash Tibrewal12fc6d42017-10-09 16:43:34 -070048#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_PARSE_ADDRESS_H */