VLC 4.0.0-dev
Collaboration diagram for Credential API:

Data Structures

struct  vlc_credential
 

Macros

#define vlc_credential_get(a, b, c, d, e, f, ...)    vlc_credential_get(a, VLC_OBJECT(b), c, d, e, f, ##__VA_ARGS__)
 
#define vlc_credential_store(a, b)    vlc_credential_store(a, VLC_OBJECT(b))
 

Functions

void vlc_credential_init (vlc_credential *p_credential, const vlc_url_t *p_url)
 Init a credential struct. More...
 
void vlc_credential_clean (vlc_credential *p_credential)
 Clean a credential struct. More...
 
int vlc_credential_get (vlc_credential *p_credential, vlc_object_t *p_parent, const char *psz_option_username, const char *psz_option_password, const char *psz_dialog_title, const char *psz_dialog_fmt,...)
 Get a username/password couple. More...
 
bool vlc_credential_store (vlc_credential *p_credential, vlc_object_t *p_parent)
 Store the last dialog credential returned by vlc_credential_get() More...
 

Detailed Description

Macro Definition Documentation

◆ vlc_credential_get

#define vlc_credential_get (   a,
  b,
  c,
  d,
  e,
  f,
  ... 
)     vlc_credential_get(a, VLC_OBJECT(b), c, d, e, f, ##__VA_ARGS__)

◆ vlc_credential_store

#define vlc_credential_store (   a,
 
)     vlc_credential_store(a, VLC_OBJECT(b))

Function Documentation

◆ vlc_credential_clean()

◆ vlc_credential_get()

int vlc_credential_get ( vlc_credential p_credential,
vlc_object_t p_parent,
const char *  psz_option_username,
const char *  psz_option_password,
const char *  psz_dialog_title,
const char *  psz_dialog_fmt,
  ... 
)

Get a username/password couple.

This will search for a credential using url, VLC options, the vlc_keystore or by asking the user via dialog_Login(). This function can be called indefinitely, it will first return the user/password from the url (if any), then from VLC options (if any), then from the keystore (if any), and finally from the dialog (if any). This function will return true as long as the user fill the dialog texts and will return false when the user cancel it.

Parameters
p_parentthe parent object (for var, keystore and dialog)
psz_option_usernameVLC option name for the username
psz_option_passwordVLC option name for the password
psz_dialog_titledialog title, if NULL, this function won't use the keystore or the dialog
psz_dialog_fmtdialog text using format
Returns
0 if vlc_credential.psz_username and vlc_credential.psz_password are valid, or a negative errno code.

References vlc_credential::b_from_keystore, vlc_credential::b_store, credential_find_keystore(), get_memory_keystore(), vlc_credential::i_get_order, is_credential_valid(), is_url_valid(), msg_Err, msg_Warn, vlc_credential::p_keystore, vlc_credential::p_url, protocol_is_smb(), vlc_credential::psz_dialog_password, vlc_credential::psz_dialog_username, vlc_credential::psz_password, vlc_url_t::psz_password, vlc_credential::psz_username, vlc_url_t::psz_username, vlc_credential::psz_var_password, vlc_credential::psz_var_username, smb_split_domain(), var_InheritString(), vlc_dialog_wait_login_va(), vlc_keystore_create(), and vlc_killed().

◆ vlc_credential_init()

void vlc_credential_init ( vlc_credential p_credential,
const vlc_url_t p_url 
)

Init a credential struct.

Note
to be cleaned with vlc_credential_clean()
Parameters
psz_urlurl to store or to search

References vlc_credential::i_get_order, and vlc_credential::p_url.

Referenced by Open().

◆ vlc_credential_store()

bool vlc_credential_store ( vlc_credential p_credential,
vlc_object_t p_parent 
)

Store the last dialog credential returned by vlc_credential_get()

This function will store the credential in the memory keystore if it's valid, or will store in the permanent one if it comes from the dialog and if the user asked for it.

Returns
true if the credential was stored or comes from the keystore, false otherwise

References asprintf(), vlc_credential::b_from_keystore, vlc_credential::b_store, get_memory_keystore(), is_credential_valid(), KEY_AUTHTYPE, KEY_MAX, KEY_PATH, KEY_PORT, KEY_PROTOCOL, KEY_REALM, KEY_SERVER, KEY_USER, vlc_credential::p_keystore, vlc_credential::p_url, protocol_is_smb(), protocol_set_port(), protocol_store_path(), vlc_credential::psz_authtype, vlc_url_t::psz_host, psz_label, vlc_credential::psz_password, vlc_url_t::psz_path, vlc_url_t::psz_protocol, vlc_credential::psz_realm, vlc_credential::psz_username, vlc_keystore_store(), VLC_SUCCESS, and vlc_uri_decode_duplicate().