The COPSTAT macro covers the following session management functions
- outputting a copy of the state of the cryptographic operations of a session 
- restoring the state of the cryptographic operations of a session 
A detailed description of the functions of the COPSTAT macro can be found in PKCS#11 V2.20: Cryptographic Token Interface Standard in section 11.6 “Session management functions” under “C_GetOperationState” and “C_SetOperationState”.
| Macro | Operands | 
| COPSTAT | MF=C / D / L / M / E ,ACTION=*GETOPERATIONSTATE / *SETOPERATIONSTATE / <var: enum-of _action_set: 1> / default: _action_set.undefined ,SESSION=<var: int:4> / <integer 0..2147483647> / 0 ,STATE=<var: pointer> / NULL ,STATEL=<var: int:4> / <integer 0..2147483647> / 0 ,CRYKEY=<var: int:4> / <integer 0..2147483647> / 0 ,AUTHKEY=<var: int:4> / <integer 0..2147483647> / 0 | 
ACTION
Type of action.
The corresponding PKCS#11 function is specified for each action code.
=*GETOPERATIONSTATE
corresponds to the PKCS#11 function C_GetOperationState;
outputs a copy of the state of the cryptographic operations of a session
=*SETOPERATIONSTATE
corresponds to the PKCS#11 function C_SetOperationState;restores the state of the cryptographic operations of a session
SESSION
Session identifier
STATE
State of the cryptographic operation:
- *GETOPERATIONSTATE: Memory location that receives the state 
- *SETOPERATIONSTATE: Memory location in which the stored state is located 
STATEL
Length of the *...OPERATIONSTATE memory location
CRYKEY
Encryption and decryption key, only in *SETOPERATIONSTATE;*GETOPERATIONSTATE: CRYKEY is not used.
AUTHKEY
signs/verifies the authentication key, 
only with *SETOPERATINSTATE;*GETOPERATIONSTATE: AUTHKEY is not used.