.Dd Jan 18, 2021 .Dt YURI 3 .Sh NAME .Nm uri_get_scheme , .Nm uri_get_authority_type , .Nm uri_get_authority_user , .Nm uri_get_authority_host , .Nm uri_get_authority_port , .Nm uri_get_path , .Nm uri_string_path , .Nm uri_get_npath , .Nm uri_get_query , .Nm uri_get_fragment .Nd Retrieve values of individual components/subcomponents of URI object .Sh SYNOPSIS .In yuri.h .Ft "const char *" .Fn uri_get_scheme "struct uri *u" .Ft int .Fn uri_get_authority_type "struct uri *u" .Ft "const char *" .Fn uri_get_authority_user "struct uri *u" .Ft "const char *" .Fn uri_get_authority_host "struct uri *u" .Ft int .Fn uri_get_authority_port "struct uri *u" .Ft "const char **" .Fn uri_get_path "struct uri *u" .Ft "char *" .Fn uri_string_path "struct uri *u" .Ft int .Fn uri_get_npath "struct uri *u" .Ft "const char *" .Fn uri_get_query "struct uri *u" .Ft "const char *" .Fn uri_get_fragment "struct uri *u" .Sh DESCRIPTION .Fn uri_get_scheme returns the scheme component of URI object pointed to by .Em u . .Pp .Fn uri_get_authority_type returns the host type of authority component of URI object pointed to by .Em u . .Pp Possible host types are as follows: .Bd -literal -offset indent #define YURI_HOST_NAME 1 /* DNS name */ #define YURI_HOST_IP4 2 /* IPv4 address */ #define YURI_HOST_IP6 3 /* IPv6 address */ #define YURI_HOST_IPFUTURE 4 /* Future-proof place holder set by RFC 3986 for IP versions above v6 */ .Ed .Pp .Fn uri_get_authority_user returns the user subcomponent of authority component of URI object pointed to by .Em u . .Pp .Fn uri_get_authority_host returns the host subcomponent of authority component of URI object pointed to by .Em u . .Pp .Fn uri_get_authority_port returns the port of host subcomponent of authority component of URI object pointed to by .Em u . .Pp .Fn uri_get_path returns the array of path segments of URI object pointed to by .Em u . .Pp .Fn uri_string_path returns string representation of path component of URI object pointed to by .Em u . .Pp .Fn uri_get_npath returns the amount of segments contained in the path componenet of URI object pointed to by .Em u . .Pp .Fn uri_get_query returns the query componenet of URI object pointed to by .Em u . .Pp .Fn uri_get_fragment returns the fragment component of URI object pointed to by .Em u . .Sh RETURN VALUES .Fn uri_get_scheme , .Fn uri_get_authority_user , .Fn uri_get_authority_host , .Fn uri_get_path , .Fn uri_get_query and .Fn uri_get_fragment return a pointer to the underlying value contained within the URI object pointed to by .Em u . .Pp .Fn uri_string_path returns pointer to heap-allocated string that should be passed to .Xr free 3 after use, or .Nm NULL on error. .Sh ERRORS All above functions never fail except .Fn uri_string_path . .Sh CAVEATS Array returned by .Fn uri_get_path is not .Nm NULL terminated. Array length can be obtained using .Fn uri_get_npath . .Sh SEE ALSO .Xr uri 3 , .Xr uri_set 3 , .Xr uri_unset 3 .Sh AUTHORS .An Ali Fardan Aq Mt raiz@stellarbound.space