Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
roc::address::EndpointUri Class Reference

Network endpoint URI. More...

#include <endpoint_uri.h>

Inheritance diagram for roc::address::EndpointUri:
Collaboration diagram for roc::address::EndpointUri:

Public Types

enum  Subset { Subset_Full , Subset_Resource }
 URI subset. More...
 

Public Member Functions

 EndpointUri (core::IArena &)
 Initialize empty URI. More...
 
bool is_equal (const EndpointUri &other) const
 Check if URI is equivalent to another URI. More...
 
ROC_ATTR_NODISCARD bool assign (const EndpointUri &other)
 Copy data from another URI. More...
 
bool verify (Subset subset) const
 Check given subset of the URI. More...
 
void clear (Subset subset)
 Clear given subset of the URI. More...
 
void invalidate (Subset subset)
 Invalidate given subset of the URI. More...
 
ROC_ATTR_NODISCARD bool set_proto (Protocol)
 Set protocol ID (URI scheme). More...
 
Protocol proto () const
 Protocol ID (URI scheme). More...
 
ROC_ATTR_NODISCARD bool get_proto (Protocol &proto) const
 Get protocol ID (URI scheme). More...
 
ROC_ATTR_NODISCARD bool format_proto (core::StringBuilder &dst) const
 Get URI proto. More...
 
ROC_ATTR_NODISCARD bool set_host (const char *str)
 Set URI host. String should be zero-terminated. More...
 
ROC_ATTR_NODISCARD bool set_host (const char *str, size_t str_len)
 Set URI host. String should not be zero-terminated. More...
 
const char * host () const
 Hostname or IP address. More...
 
ROC_ATTR_NODISCARD bool format_host (core::StringBuilder &dst) const
 Get URI host. More...
 
ROC_ATTR_NODISCARD bool set_port (int)
 Set port. More...
 
int port () const
 TCP or UDP port. More...
 
ROC_ATTR_NODISCARD bool get_port (int &port) const
 Get URI port. More...
 
const char * service () const
 Get string representation of port. If port is not set, default port for the protocol is used. This string is suitable for passing to getaddrinfo(). More...
 
ROC_ATTR_NODISCARD bool set_path (const char *str)
 Set decoded URI path. More...
 
ROC_ATTR_NODISCARD bool set_path (const char *str, size_t str_len)
 Set decoded URI path. String should not be zero-terminated. More...
 
ROC_ATTR_NODISCARD bool set_encoded_path (const char *str)
 Set encoded URI path. String should be percent-encoded. More...
 
ROC_ATTR_NODISCARD bool set_encoded_path (const char *str, size_t str_len)
 Set encoded URI path. String should be percent-encoded. String should not be zero-terminated. More...
 
const char * path () const
 Decoded path. More...
 
ROC_ATTR_NODISCARD bool format_encoded_path (core::StringBuilder &dst) const
 Get URI path. String will be percent-encoded. More...
 
ROC_ATTR_NODISCARD bool set_encoded_query (const char *str)
 Set query. String should be percent-encoded. More...
 
ROC_ATTR_NODISCARD bool set_encoded_query (const char *str, size_t str_len)
 Set query. String should be percent-encoded. String should not be zero-terminated. More...
 
const char * encoded_query () const
 Raw query. More...
 
ROC_ATTR_NODISCARD bool format_encoded_query (core::StringBuilder &dst) const
 Get URI query. String will be percent-encoded. More...
 

Detailed Description

Network endpoint URI.

Definition at line 27 of file endpoint_uri.h.

Member Enumeration Documentation

◆ Subset

URI subset.

Enumerator
Subset_Full 

Entire URI.

Subset_Resource 

Absolute path and query.

Definition at line 30 of file endpoint_uri.h.

Constructor & Destructor Documentation

◆ EndpointUri()

roc::address::EndpointUri::EndpointUri ( core::IArena )
explicit

Initialize empty URI.

Member Function Documentation

◆ assign()

ROC_ATTR_NODISCARD bool roc::address::EndpointUri::assign ( const EndpointUri other)

Copy data from another URI.

◆ clear()

void roc::address::EndpointUri::clear ( Subset  subset)

Clear given subset of the URI.

◆ encoded_query()

const char* roc::address::EndpointUri::encoded_query ( ) const

Raw query.

◆ format_encoded_path()

ROC_ATTR_NODISCARD bool roc::address::EndpointUri::format_encoded_path ( core::StringBuilder dst) const

Get URI path. String will be percent-encoded.

◆ format_encoded_query()

ROC_ATTR_NODISCARD bool roc::address::EndpointUri::format_encoded_query ( core::StringBuilder dst) const

Get URI query. String will be percent-encoded.

◆ format_host()

ROC_ATTR_NODISCARD bool roc::address::EndpointUri::format_host ( core::StringBuilder dst) const

Get URI host.

◆ format_proto()

ROC_ATTR_NODISCARD bool roc::address::EndpointUri::format_proto ( core::StringBuilder dst) const

Get URI proto.

◆ get_port()

ROC_ATTR_NODISCARD bool roc::address::EndpointUri::get_port ( int &  port) const

Get URI port.

◆ get_proto()

ROC_ATTR_NODISCARD bool roc::address::EndpointUri::get_proto ( Protocol proto) const

Get protocol ID (URI scheme).

◆ host()

const char* roc::address::EndpointUri::host ( ) const

Hostname or IP address.

◆ invalidate()

void roc::address::EndpointUri::invalidate ( Subset  subset)

Invalidate given subset of the URI.

◆ is_equal()

bool roc::address::EndpointUri::is_equal ( const EndpointUri other) const

Check if URI is equivalent to another URI.

◆ path()

const char* roc::address::EndpointUri::path ( ) const

Decoded path.

◆ port()

int roc::address::EndpointUri::port ( ) const

TCP or UDP port.

◆ proto()

Protocol roc::address::EndpointUri::proto ( ) const

Protocol ID (URI scheme).

◆ service()

const char* roc::address::EndpointUri::service ( ) const

Get string representation of port. If port is not set, default port for the protocol is used. This string is suitable for passing to getaddrinfo().

Returns
NULL if both port and default port are not set.

◆ set_encoded_path() [1/2]

ROC_ATTR_NODISCARD bool roc::address::EndpointUri::set_encoded_path ( const char *  str)

Set encoded URI path. String should be percent-encoded.

◆ set_encoded_path() [2/2]

ROC_ATTR_NODISCARD bool roc::address::EndpointUri::set_encoded_path ( const char *  str,
size_t  str_len 
)

Set encoded URI path. String should be percent-encoded. String should not be zero-terminated.

◆ set_encoded_query() [1/2]

ROC_ATTR_NODISCARD bool roc::address::EndpointUri::set_encoded_query ( const char *  str)

Set query. String should be percent-encoded.

◆ set_encoded_query() [2/2]

ROC_ATTR_NODISCARD bool roc::address::EndpointUri::set_encoded_query ( const char *  str,
size_t  str_len 
)

Set query. String should be percent-encoded. String should not be zero-terminated.

◆ set_host() [1/2]

ROC_ATTR_NODISCARD bool roc::address::EndpointUri::set_host ( const char *  str)

Set URI host. String should be zero-terminated.

◆ set_host() [2/2]

ROC_ATTR_NODISCARD bool roc::address::EndpointUri::set_host ( const char *  str,
size_t  str_len 
)

Set URI host. String should not be zero-terminated.

◆ set_path() [1/2]

ROC_ATTR_NODISCARD bool roc::address::EndpointUri::set_path ( const char *  str)

Set decoded URI path.

◆ set_path() [2/2]

ROC_ATTR_NODISCARD bool roc::address::EndpointUri::set_path ( const char *  str,
size_t  str_len 
)

Set decoded URI path. String should not be zero-terminated.

◆ set_port()

ROC_ATTR_NODISCARD bool roc::address::EndpointUri::set_port ( int  )

Set port.

◆ set_proto()

ROC_ATTR_NODISCARD bool roc::address::EndpointUri::set_proto ( Protocol  )

Set protocol ID (URI scheme).

◆ verify()

bool roc::address::EndpointUri::verify ( Subset  subset) const

Check given subset of the URI.


The documentation for this class was generated from the following file: