Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
parse_socket_addr.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 Roc Streaming authors
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  */
8 
9 //! @file roc_address/parse_socket_addr.h
10 //! @brief Parse address from string.
11 
12 #ifndef ROC_ADDRESS_PARSE_SOCKET_ADDR_H_
13 #define ROC_ADDRESS_PARSE_SOCKET_ADDR_H_
14 
16 #include "roc_core/attributes.h"
17 
18 namespace roc {
19 namespace address {
20 
21 //! Parse socket address (host and port).
22 //!
23 //! @remarks
24 //! The @p host string should be in one of the following forms:
25 //! - "IPv4" e.g. "1.2.3.4"
26 //! - "[IPv6]" e.g. "[::1]"
27 //!
28 //! @returns
29 //! false if @p host can't be parsed.
30 ROC_ATTR_NODISCARD bool parse_socket_addr(const char* host, int port, SocketAddr& addr);
31 
32 } // namespace address
33 } // namespace roc
34 
35 #endif // ROC_ADDRESS_PARSE_SOCKET_ADDR_H_
Compiler attributes.
#define ROC_ATTR_NODISCARD
Emit warning if function result is not checked.
Definition: attributes.h:31
Socket address.
Definition: socket_addr.h:26
ROC_ATTR_NODISCARD bool parse_socket_addr(const char *host, int port, SocketAddr &addr)
Parse socket address (host and port).
Root namespace.
Socket address.