Connecting to a RAD Instance by Using a URI in C

You can use a uniform resource identifier (URI) to connect to a local or remote RAD instance. For more information, see Connecting in Python to a RAD Instance by Using a URI.

The following functions are supported in C:

  • rc_uri_t *rc_alloc_uri(const char *src, rc_scheme_t schemes)
  • rc_credentials_t *rc_alloc_pam_credentials(const char *pass)
  • void rc_free_credentials(rc_credentials_t *cred)
  • rc_credentials_class_t rc_uri_get_cred_class(rc_uri_t *uri)
  • rc_uri_t *rc_alloc_uri(const char *src, rc_scheme_t schemes)
  • rc_conn_t * rc_connect_uri(const char *uri, rc_credentials_t *cred)
  • void rc_uri_set_cred_class(rc_uri_t *uri, rc_credentials_class_t class)
  • rc_scheme_t rc_uri_get_schemes(rc_uri_t *uri)
  • int rc_uri_get_port(rc_uri_t *uri)
  • const char *rc_uri_get_host(rc_uri_t *uri)
  • rc_scheme_t rc_uri_get_scheme(rc_uri_t *uri)
  • const char *rc_uri_scheme_tostr(rc_scheme_t scheme)
  • const char *rc_uri_get_src(rc_uri_t *uri)
  • const char *rc_uri_get_user(rc_uri_t *uri)
  • const char *rc_uri_get_path(rc_uri_t *uri)
  • void rc_free_uri(rc_uri_t *uri)

You can use the rc_uri_t structure to connect to a RAD instance. rc_uri_t is the main structure with which you interact.

You can allocate a rc_uri_t structure with the rc_alloc_uri() function. This function returns NULL on failure or a pointer to a valid rc_uri_t structure. For example, if you require PAM authentication for a remote connection, you must allocate a rc_credentials_t structure using one of the alloc() credential functions. This allocation depends on the authentication type. RAD supports two types of authentication, PAM and generic security service (GSS).

You can connect to RAD by using the rc_connect_uri() function. This returns a rc_conn_t() function that can be used to establish the connection by using rc_connect_unix(), rc_connect_tcp(), or other functions. You can use the other informative functions to interact with the allocated structure to obtain useful information. The various rc_free_uri() functions can clean the memory after you finish using the structures.