3 * Copyright (c) 2020 Project CHIP Authors
4 * Copyright (c) 2017 Nest Labs, Inc.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 * Support functions for parsing command-line arguments for Inet types
25 #include <inet/InetArgParser.h>
27 #include <inet/IPAddress.h>
33 * Parse an IP address in text form.
35 * @param[in] str A pointer to a NULL-terminated C string containing
36 * the address to parse.
37 * @param[out] output A reference to an IPAddress object in which the parsed
38 * value will be stored on success.
40 * @return true if the value was successfully parsed; false if not.
42 bool ParseIPAddress(const char * str, chip::Inet::IPAddress & output)
44 return chip::Inet::IPAddress::FromString(str, output);
47 } // namespace ArgParser