Simple Virtual Machine
A simple but flexible virtual machine
SVM access control instructions

This module contains API functions to handle SVM access control instructions limit. More...

Functions

SVM_FUNCTION SVM_Boolean svm_accesscontrol_has_instructions (const void *svm, const SVM_AccessControl access_control)
 This function checks whether a quota for a SVM code execution contains a limit for instructions. More...
 
SVM_FUNCTION unsigned long int svm_accesscontrol_get_instructions (const void *svm, const SVM_AccessControl access_control)
 This function retrieves the remaining instructions counter from a quota for a SVM code execution. More...
 
SVM_FUNCTION void svm_accesscontrol_set_instructions (const void *svm, SVM_AccessControl access_control, const unsigned long int instructions)
 This function changes the remaining instructions counter within a quota for a SVM code execution. More...
 

Detailed Description

This module contains API functions to handle SVM access control instructions limit.

Function Documentation

◆ svm_accesscontrol_get_instructions()

SVM_FUNCTION unsigned long int svm_accesscontrol_get_instructions ( const void *  svm,
const SVM_AccessControl  access_control 
)

This function retrieves the remaining instructions counter from a quota for a SVM code execution.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]access_controlThe access control to check.
Returns
The number of remaining instructions to execute.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)
FAILUREinterruption when the access control has no instruction limit.
See also
svm_accesscontrol_has_instructions

◆ svm_accesscontrol_has_instructions()

SVM_FUNCTION SVM_Boolean svm_accesscontrol_has_instructions ( const void *  svm,
const SVM_AccessControl  access_control 
)

This function checks whether a quota for a SVM code execution contains a limit for instructions.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]access_controlThe access control to check.
Returns
TRUE when the access control has an instructions limit, FALSE otherwise.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)

◆ svm_accesscontrol_set_instructions()

SVM_FUNCTION void svm_accesscontrol_set_instructions ( const void *  svm,
SVM_AccessControl  access_control,
const unsigned long int  instructions 
)

This function changes the remaining instructions counter within a quota for a SVM code execution.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]access_controlThe access control to update.
[in]instructionsThe number of remaining instructions to run.

This function changes the number of remaining instructions on the access control:

  • if the access control had no limit, a limit is set to the number of remaining instructions,
  • the number of remaining instructions can not be increased, and the function will have no effect.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)