QDMI v1.1.0
Quantum Device Management Interface
|
Provides functions to manage sessions between the client and driver.
A session is a connection between a client and a QDMI driver that allows the client to interact with the driver and the devices it manages.
The typical workflow for a client session is as follows:
Typedefs | |
typedef struct QDMI_Session_impl_d * | QDMI_Session |
A handle for a session. | |
typedef enum QDMI_SESSION_PARAMETER_T | QDMI_Session_Parameter |
Session parameter type. | |
typedef enum QDMI_SESSION_PROPERTY_T | QDMI_Session_Property |
Session property type. | |
Enumerations | |
enum | QDMI_SESSION_PARAMETER_T { QDMI_SESSION_PARAMETER_TOKEN = 0 , QDMI_SESSION_PARAMETER_USERNAME = 1 , QDMI_SESSION_PARAMETER_PROJECTID = 2 , QDMI_SESSION_PARAMETER_MAX = 3 , QDMI_SESSION_PARAMETER_CUSTOM1 = 999999995 , QDMI_SESSION_PARAMETER_CUSTOM2 = 999999996 , QDMI_SESSION_PARAMETER_CUSTOM3 = 999999997 , QDMI_SESSION_PARAMETER_CUSTOM4 = 999999998 , QDMI_SESSION_PARAMETER_CUSTOM5 = 999999999 } |
Enum of the session parameters that can be set via QDMI_session_set_parameter. More... | |
enum | QDMI_SESSION_PROPERTY_T { QDMI_SESSION_PROPERTY_DEVICES = 0 , QDMI_SESSION_PROPERTY_MAX = 1 , QDMI_SESSION_PROPERTY_CUSTOM1 = 999999995 , QDMI_SESSION_PROPERTY_CUSTOM2 = 999999996 , QDMI_SESSION_PROPERTY_CUSTOM3 = 999999997 , QDMI_SESSION_PROPERTY_CUSTOM4 = 999999998 , QDMI_SESSION_PROPERTY_CUSTOM5 = 999999999 } |
Enum of the session properties that can be queried via QDMI_session_query_session_property. More... | |
Functions | |
int | QDMI_session_alloc (QDMI_Session *session) |
Allocate a new session. | |
int | QDMI_session_set_parameter (QDMI_Session session, QDMI_Session_Parameter param, size_t size, const void *value) |
Set a parameter for a session. | |
int | QDMI_session_init (QDMI_Session session) |
Initialize a session. | |
int | QDMI_session_query_session_property (QDMI_Session session, QDMI_Session_Property prop, size_t size, void *value, size_t *size_ret) |
Query a property of a session. | |
void | QDMI_session_free (QDMI_Session session) |
Free a session. | |
typedef struct QDMI_Session_impl_d* QDMI_Session |
A handle for a session.
An opaque pointer to a type defined by the driver that encapsulates all information about a session between a client and a QDMI driver.
Enum of the session parameters that can be set via QDMI_session_set_parameter.
If not noted otherwise, parameters are optional and drivers must not require them to be set.
Enumerator | ||
---|---|---|
QDMI_SESSION_PARAMETER_TOKEN | 0 |
The token is used for authentication within the session. The driver documentation must document if the implementation requires this parameter to be set. |
QDMI_SESSION_PARAMETER_USERNAME | 1 |
The username is used for authentication within the session. The driver documentation must document if the implementation requires this parameter to be set. |
QDMI_SESSION_PARAMETER_PROJECTID | 2 |
Can be used to associate the session with a certain project, for example, for accounting purposes. The driver documentation must document if the implementation requires this parameter to be set. |
QDMI_SESSION_PARAMETER_MAX | 3 | The maximum value of the enum. It can be used by drivers for bounds checking and validation of function parameters.
|
QDMI_SESSION_PARAMETER_CUSTOM1 | 999999995 | This enum value is reserved for a custom parameter. The driver defines the meaning and the type of this parameter.
|
QDMI_SESSION_PARAMETER_CUSTOM2 | 999999996 |
|
QDMI_SESSION_PARAMETER_CUSTOM3 | 999999997 |
|
QDMI_SESSION_PARAMETER_CUSTOM4 | 999999998 |
|
QDMI_SESSION_PARAMETER_CUSTOM5 | 999999999 |
|
Enum of the session properties that can be queried via QDMI_session_query_session_property.
If not noted otherwise, properties are optional and drivers must not require them to be set.
Enumerator | ||
---|---|---|
QDMI_SESSION_PROPERTY_DEVICES | 0 |
|
QDMI_SESSION_PROPERTY_MAX | 1 | The maximum value of the enum. It can be used by drivers for bounds checking and validation of function parameters.
|
QDMI_SESSION_PROPERTY_CUSTOM1 | 999999995 | This enum value is reserved for a custom property. The driver defines the meaning and the type of this property.
|
QDMI_SESSION_PROPERTY_CUSTOM2 | 999999996 |
|
QDMI_SESSION_PROPERTY_CUSTOM3 | 999999997 |
|
QDMI_SESSION_PROPERTY_CUSTOM4 | 999999998 |
|
QDMI_SESSION_PROPERTY_CUSTOM5 | 999999999 |
|
int QDMI_session_alloc | ( | QDMI_Session * | session | ) |
Allocate a new session.
This is the main entry point for a client to establish a session with a QDMI driver. The returned handle can be used throughout the client session interface to refer to the session.
[out] | session | A handle to the session that is allocated. Must not be NULL . The session must be freed by calling QDMI_session_free when it is no longer used. |
session
is NULL
. int QDMI_session_set_parameter | ( | QDMI_Session | session, |
QDMI_Session_Parameter | param, | ||
size_t | size, | ||
const void * | value ) |
Set a parameter for a session.
[in] | session | A handle to the session to set the parameter for. Must not be NULL . |
[in] | param | The parameter to set. Must be one of the values specified for QDMI_Session_Parameter. |
[in] | size | The size of the data pointed to by value in bytes. Must not be zero, except when value is NULL , in which case it is ignored. |
[in] | value | A pointer to the memory location that contains the value of the parameter to be set. The data pointed to by value is copied and can be safely reused after this function returns. If this is NULL , it is ignored. |
param
and, when value
is not NULL
, the value of the parameter was set successfully. session
is NULL
,param
is invalid, orvalue
is not NULL
and size
is zero or not the expected size for the parameter (if specified by the QDMI_Session_Parameter documentation). value
set to NULL
, the function can be used to check if the driver supports the specified parameter without setting a value.int QDMI_session_init | ( | QDMI_Session | session | ) |
Initialize a session.
This function initializes the session and prepares it for use. The session must be initialized before properties can be queried using QDMI_session_query_session_property. Some devices may require authentication information to be set using QDMI_session_set_parameter before calling this function. A session may only be successfully initialized once.
[in] | session | The session to initialize. Must not be NULL . |
session
is NULL
. int QDMI_session_query_session_property | ( | QDMI_Session | session, |
QDMI_Session_Property | prop, | ||
size_t | size, | ||
void * | value, | ||
size_t * | size_ret ) |
Query a property of a session.
[in] | session | The session to query. Must not be NULL . |
[in] | prop | The property to query. Must be one of the values specified for QDMI_Session_Property. |
[in] | size | The size of the memory pointed to by value in bytes. Must be greater or equal to the size of the return type specified for the QDMI_Session_Property prop , except when value is NULL , in which case it is ignored. |
[out] | value | A pointer to the memory location where the value of the property will be stored. If this is NULL , it is ignored. |
[out] | size_ret | The actual size of the data being queried in bytes. If this is NULL , it is ignored. |
value
is not NULL
, the property was successfully retrieved. session
is NULL
,prop
is invalid, orvalue
is not NULL
and size
is less than the size of the data being queried. value
set to NULL
, the function can be used to check if the driver supports the specified property without retrieving the property and without the need to provide a buffer for it. Additionally, the size of the buffer needed to retrieve the property will be returned in size_ret
if size_ret
is not NULL
.void QDMI_session_free | ( | QDMI_Session | session | ) |
Free a session.
This function frees the memory allocated for the session. Accessing a (dangling) handle to a device that was attached to the session after the session was freed is undefined behavior.
[in] | session | The session to free. |