Line data Source code
1 : /*
2 : *
3 : * Copyright (c) 2020 Project CHIP Authors
4 : * Copyright (c) 2017 Nest Labs, Inc.
5 : * All rights reserved.
6 : *
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
10 : *
11 : * http://www.apache.org/licenses/LICENSE-2.0
12 : *
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.
18 : */
19 :
20 : /**
21 : * @file
22 : * Support functions for parsing command-line arguments for Inet types
23 : *
24 : */
25 : #include <inet/InetArgParser.h>
26 :
27 : #include <inet/IPAddress.h>
28 :
29 : namespace chip {
30 : namespace ArgParser {
31 :
32 : /**
33 : * Parse an IP address in text form.
34 : *
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.
39 : *
40 : * @return true if the value was successfully parsed; false if not.
41 : */
42 0 : bool ParseIPAddress(const char * str, chip::Inet::IPAddress & output)
43 : {
44 0 : return chip::Inet::IPAddress::FromString(str, output);
45 : }
46 :
47 : } // namespace ArgParser
48 : } // namespace chip
|