.Dd Jan 18, 2021 .Dt YURI 3 .Sh NAME .Nm uri_set_scheme , .Nm uri_set_authority , .Nm uri_set_authority_type , .Nm uri_set_authority_user , .Nm uri_set_authority_host , .Nm uri_set_authority_port , .Nm uri_append_path , .Nm uri_set_query , .Nm uri_set_fragment .Nd URI object manipulation functions .Sh SYNOPSIS .In yuri.h .Ft int .Fo uri_set_scheme .Fa "struct uri *u" .Fa "const char *scheme" .Fc .Ft int .Fo uri_set_authority .Fa "struct uri *u" .Fa "int type" .Fa "const char *user" .Fa "const char *host" .Fa "int port" .Fc .Ft int .Fo uri_set_authority_type .Fa "struct uri *u" .Fa "int type" .Fc .Ft int .Fo uri_set_authority_user .Fa "struct uri *u" .Fa "const char *user" .Fc .Ft int .Fo uri_set_authority_host .Fa "struct uri *u" .Fa "const char *host" .Fc .Ft int .Fo uri_set_authority_port .Fa "struct uri *u" .Fa "int port" .Fc .Ft int .Fo uri_append_path .Fa "struct uri *u" .Fa "const char *elem" .Fc .Ft int .Fo uri_set_query .Fa "struct uri *u" .Fa "const char *query" .Fc .Ft int .Fo uri_set_fragment .Fa "struct uri *u" .Fa "const char *fragment" .Fc .Sh DESCRIPTION .Fn uri_set_scheme sets the scheme component of URI object pointed to by .Em u to string pointed to by .Em scheme . .Pp .Fn uri_set_authority sets the authority component of URI object pointed to by .Em u where .Em type would be the host type, .Em user would be the user subcomponent, .Em host would be the host subcomponent, and .Em port would be the host port. .Pp Possible values for .Em type 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 .Em user and .Em port can be omitted by setting their values to .Nm NULL or .Em 0 respectively, however, .Em type and .Em host are mandatory. .Pp .Fn uri_set_authority_type , .Fn uri_set_authority_user , .Fn uri_set_authority_host and .Fn uri_set_authority_port set corresponding authority subcomponenets individually. .Pp .Fn uri_append_path appends path segment pointed to by .Em elem to the URI object pointed to by .Em u . .Pp .Fn uri_set_query sets the query component of URI object pointed to by .Em u to query string pointed to by .Em query . .Pp .Fn uri_set_fragment sets the fragment component for URI object pointed to by .Em u to fragment string pointed to by .Em fragment . .Sh RETURN VALUES All above functions return .Em 0 on success, or .Em -1 on failure. .Sh SEE ALSO .Xr uri 3 , .Xr uri_unset 3 , .Xr uri_get 3 .Sh AUTHORS .An Ali Fardan Aq Mt raiz@stellarbound.space