Add a helper function to parse a Portal URL.

A Portal URL is of the form
   iscsi://[<username>[%<password>]@]<host>[:<port>]
and is used by command such as iscsi-ls during the discovery login phase.

During discovery we do not yet know the target iqn name, nor the lun of
any devices.
This commit is contained in:
Ronnie Sahlberg
2011-01-03 15:22:01 +11:00
parent 51662af5ba
commit 7253a667ae
2 changed files with 107 additions and 1 deletions

View File

@@ -54,17 +54,41 @@ struct iscsi_url {
/*
* This function is used to parse an iSCSI URL into a iscsi_url structure.
* iSCSI URL format :
* iscsi://[<username>%<password>@]<host>[:<port>]/<target-iqn>/<lun>
* iscsi://[<username>[%<password>]@]<host>[:<port>]/<target-iqn>/<lun>
*
* Function will return a pointer to an iscsi url structure if successful,
* or it will return NULL and set iscsi_get_error() accrodingly if there was a problem
* with the URL.
*
* CHAP username/password can also be provided via environment variables
* LIBISCSI_CHAP_USERNAME=ronnie
* LIBISCSI_CHAP_PASSWORD=password
*
* The returnes structure is freed by calling iscsi_destroy_url()
*/
struct iscsi_url *iscsi_parse_full_url(struct iscsi_context *iscsi, const char *url);
void iscsi_destroy_url(struct iscsi_url *iscsi_url);
/*
* This function is used to parse an iSCSI Portal URL into a iscsi_url structure.
* iSCSI Portal URL format :
* iscsi://[<username>[%<password>]@]<host>[:<port>]
*
* iSCSI Portal URL is used when describing a discovery session, where the target-iqn and the
* lun is not yet known.
*
* Function will return a pointer to an iscsi url structure if successful,
* or it will return NULL and set iscsi_get_error() accrodingly if there was a problem
* with the URL.
*
* CHAP username/password can also be provided via environment variables
* LIBISCSI_CHAP_USERNAME=ronnie
* LIBISCSI_CHAP_PASSWORD=password
*
* The returnes structure is freed by calling iscsi_destroy_url()
*/
struct iscsi_url *
iscsi_parse_portal_url(struct iscsi_context *iscsi, const char *url);
/*
* This function returns a description of the last encountered error.