Share this page

# lrs_save_param_ex

Correlating Statements Functions

Saves data from a static, received, or user buffer to a parameter.

    int lrs_save_param_ex( char *s_desc, char *type, char *buff, int offset, int length, char *encoding, char *param );

s_desc | A descriptor identifying a socket.
type | The type of buffer data to save into the parameter. Possible values: user - save the user data, static - save the static buffer that was originally recorded, received - save the buffer(s) received by the last call to lrs_receive.
buff | Depends on the type of buffer data specified in the type parameter. For user - the pointer to the user buffer, For static - the descriptor of the buffer in the data file, For received - the buff parameter is ignored.
offset | The offset of the parameter in the buffer.
length | The parameter length.
encoding | Used when saving user type buffer data to specify the encoding of the user buffer. Possible values: ascii or ebcdic. A NULL value specifies ascii. The encoding parameter is ignored for static or received type buffer data; it uses the original client format.
param | The parameter name.

The lrs_save_param_ex function saves a buffer or part of a buffer to a parameter. The type parameter specifies which type of buffer data to save: the user buffer, the recorded buffer or the last received buffer. This function overwrites the user data area.

When you specify ascii type encoding, buff is expected to be in printable ASCII format, just as it appears in the data file, for example "AAA\x00\xffBBB\r\nCCC". The lrs_save_param_ex function saves the data in ASCII format to a parameter. When the data is used, (e.g., sent) it is translated to ebcdic.

When you specify ebcdic encoding, the function assumes that no translation is required and that the buffer is already in binary ebcdic format. No translation is performed on this buffer when it is used at a later time.

For example:

unsigned char i = 10;

To store the value 10 to a parameter, you must specify ebcdic encoding, to ensure that no translation will be performed.

Note that lrs_save_param_ex does not support parameters in the user buffer. For example, if your buffer contains "A<my_param>A" the value of <my_param> will not be calculated or stored.

For any type of binary data, the WinSock script should call these functions rather than the general lr_save_string or lr_save_var.

Note: This function supersedes lrs_save_param.

## Return Values

Windows Sockets Return Values

## Parameterization

You cannot use standard parameterization for any arguments in this function.

## Example

In this example, we want to send a packet containing information about the host, port and packet size in the following format:

((hostname=...)(port=...)(size=...))

The size argument is the length of the next packet in binary representation, but this parameter is optional, so it wasn't recorded.The recorded buffer is:

buff11 = "\x00\x00((hostname=...)(port=...))

We want to add a packet size for special cases:

    char *ParamBuf = "(size=\x05)"

If it is a special case, save the size of the buffer to the parameter size_param.

Copy code

    if (TheSpecialCase == 1) {
            lrs_save_param_ex("socket0", "user", ParamBuf, 0, strlen(ParamBuf),"ascii", "size_param");
            }
    else {
            lrs_save_param_ex("socket0", "user", "", 0, 0, "ascii", "size_param");
                }

In the data file, add the size parameter to the buffer buff11:

buff11 = "\x00\x00((hostname=...)(port=...)(<size_param>)"

For additional examples of using parameters, see lrs_save_param.

Tips to improve your search results... VuGen Function Reference Version 26.1-26.3 Function Reference 26.1-26.3 All View Local Help Center View Online Help Center Version: