Python API
The functions in the follow-up table could be called from a Python script.
Function | Description |
---|---|
send | Send a packet |
receive | Receives a packet. |
sleep | Delays script execution. |
gettime | Returns the time in milliseconds elapsed from start. |
run | Starts a child script. |
waitchild | Waits for child script to complete. The child script must be previously run() in asynchronous mode. |
stop | Stops script execution. |
decode | Decodes data element from a string of octets or bits. |
decodeex | Decodes multiple PDUs from a string of octets or bits or from a lower PDU. |
create | Creates a variable of a given type, typically a packet. |
gettype | Returns type of a data element). |
getpco | Determines PCO of the data type. Yields run-time error if the type is not a packet at any PCO. |
copy | Creates a copy of a PDU (or any data element - e.g., PDU’s field). |
equal | Compares data elements - PDUs or their fields. |
spoil | Overwrites the data element passed as the argument with a value of ASN.1 ‘ANY’ type. You can then modify that ‘ANY’ and thus substitute any possible encoding for the ‘spoiled’ element. This is useful in negative testing, when invalid from the point of view of the protocol specification packet has to be sent. |
random | Pseudo-random number in range 0..1. Independent from language-specific random generation. Pseudo-random sequence can be restarted by seedrandom. |
Outputs one or more values to the [Execution Log][exec-log-lnk] | |
sprint | Formats one or more values as a string, identically to print() |
keypressed | Checks for keyboard input |
getchar | Gets a character from keyboard |
getchars | Gets all available characters from keyboard. |
bindevent | Creates a handler for the event from a HTML control. Assign it to a HTML event handler. |
createwindow | Creates a modeless dialog box that displays HTML |
helper | Creates a Packet Studio-defined helper object |
definevariable | Define variable for usage in including Flowchart |
getcorecount | Get the number of CPU cores available |
mos_get_val | Retrieves the calculated MOS value |
mos_get_delay | Retrieves the calculated MOS delay |
presskey | Simulates keyboard hit |