The CSESION macro covers the following session management functions
- opening a session between an application and a token in a specified slot 
- closing a session between an application and a token 
- closing all sessions of an application with a token 
- outputting information about a session 
The functions C_OpenSession, C_CloseSession and C_CloseAllSessions are performed asynchronously if asynchronous function execution was specified for the task with C_Initialize.
A detailed description of the functions of the CSESION macro can be found in PKCS#11 V2.20: Cryptographic Token Interface Standard in section 11.6 “Session management functions” under “C_OpenSession”, “C_CloseSession”, “C_CloseAllSessions” and “C_GetSessionInfo”.
| Macro | Operands | 
| CSESION | MF=C / D / L / M / E ,VERSION=001 / 002 ,ACTION=*OPENSESSION / *CLOSESESSION / *CLOSEALLSESSIONS / *GETSESSIONINFO / <var: enum-of _action_set: 1> / default: _action_set.undefined ,SESSION=<var: int:4> / <integer 0..2147483647> / 0 ,SLOTID=<var: int:4> / 0 ,RWSESS=<var: bit:1> / *NO / *YES ,SERIAL=<var: bit:1> / *NO / *YES ,INFO=<var: pointer> / NULL ,NOTIFY=<var: pointer> / NULL ,BOID=<var: int:4> / 0 ,RPOSTAD=<var: pointer> / NULL ,RPOSTL=<integer 1..2> / <var: int:4> / 0 ,GENKPR=<var: bit:1> / *ALLOWED / *NOTALLOWED | 
VERSION
specifies which version of the parameter area is to be generated. It is always advisable to use the latest version.
=001
This generates the format that was supported by CRYPT V1.0. This format only supports the parameters already known in CRYPT V1.0.
VERSION=001 is the default.
=002
This generates the format which is supported as of CRYPT V1.1.
ACTION
Type of action.
The corresponding PKCS#11 function is specified for each action code.
=*OPENSESSION
corresponds to the PKCS#11 function C_OpenSession; 
opens a session between an application and a token in a specified slot
=*CLOSESESSION
corresponds to the PKCS#11 function C_CloseSession;
closes a session between an application and a token
=*CLOSEALLSESSIONS
corresponds to the PKCS#11 function C_CloseAllSessions;
closes all sessions between an application and a token
=*GETSESSIONINFO
corresponds to the PKCS#11 function C_GetSessionInfo;
outputs information about a session.
This function is not supported.
SESSION
Session identifier
SLOTID
ID of the slot
RWSESS
indicates Read/Write and Read-only sessions.
=*NO
Read-only session
=*YES
Read/Write session
SERIAL
Serial session
- *OPENSESSION: SERIAL should always be set to *YES. 
- *GETSESSIONINFO / *CLOSESESSION / *CLOSEALLSESSIONS: SERIAL is not used. 
INFO
The type of information depends on the action:
- *OPENSESSION: INFO is a pointer defined in the application which is passed to the notification callback function; 
 is not supported.
- *GETSESSIONINFO: INFO points to the memory location that receives the session information. 
- *CLOSESESSION / *CLOSEALLSESSIONS: INFO is not used. 
NOTIFY
Callback function
- *OPENSESSION: Address of the notification callback function; 
 is not supported
- *CLOSESESSION / *CLOSEALLSESSIONS / *GETSESSIONINFO: The callback function is not used. 
BOID
Event identification
- in the case of synchronous execution: BOID is not used. 
- in the case of asynchronous execution: event identification to which the end of the function processing is signalled. 
RPOSTAD
Postcode address
- in the case of synchronous execution: RPOSTAD is not used. 
- in the case of asynchronous execution: specifies a field containing postcode information which is to be transferred to the corresponding program that issues the SOLSIG call (see also “Executive Macros” user guide [3]). 
 Length of postcode: 4 or 8 bytes
RPOSTL
Length of postcode
- in the case of synchronous execution: RPOSTL is not used. 
- in the case of asynchronous execution: specifies the length of the postcode information in words (1 or 2). 
GENKPR
This operand has no function.