Share this page

# lrs_save_searched_string

Correlating Statements Functions

Searches for an occurrence of strings in a static or received buffer and saves a portion of the buffer, relative to the string occurrence, to a parameter.

    int lrs_save_searched_string ( char* s_desc, char* buf_desc, char* param_name, char* left_boundary, char* right_boundary, int ordinal, int offset, int param_len );

s_desc | A descriptor identifying a connected socket.
buf_desc | A descriptor identifying a buffer.
param_name | The name of a parameter to hold the buffer value.
left_boundary | A string defining the left boundary of the buffer portion to save. Must begin with a prefix of LB.
right_boundary | A string defining the right boundary of the buffer portion to save. Must begin with a prefix of RB.
ordinal | The occurrence number of the left_boundary. If you specify a left_boundary, then the ordinal must be greater than 0. Otherwise, set ordinal to -1.
offset | The offset (in bytes) relative to the end of the left_boundary where you want to begin saving. to the parameter. If there is no left_boundary, then it is the offset relative to the beginning of the buffer.
param_len | The length of the data to be saved to the parameter (in bytes). This is required for cases where there is no right boundary, otherwise its value is -1.

The lrs_save_searched_string function saves a portion of a buffer to a parameter. This function is used for correlating or linking statements within a script. This function extends the functionality of lrs_save_param.

The first two parameters specify which buffer to use:

Use a specific buffer from the data file: | Use the last received buffer:
The buffer descriptor has the form: "bufxx" | The socket descriptor is not NULL and the buffer descriptor is NULLLRS_LAST_RECEIVED is specified as the buf_desc parameter

The left_boundary and right_boundary specify which portion of the buffer to save. Specify /BIN after the boundary to specify binary data. For example, "LB/BIN=\\x00\\x01abc

There are five ways to combine this function's parameters:

1. Constant offset and length (identical to lrs_save_param).

2. Left boundary, ordinal and right boundary.

3. Left boundary, ordinal and length.

4. Left boundary, ordinal, offset from the left boundary and right boundary.

5. Left boundary, ordinal, offset from the left boundary and length.

6. Offset and right boundary.

## Return Values

Windows Sockets Return Values

## Parameterization

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

## Example 1

If you specify a constant offset and length, with left_boundary and right_boundary set to NULL, then lrs_save_search_string is identical to lrs_save_param.

For example:

Copy code

    int offset = 2;
    int length = 8;
    lrs_save_searched_string ("socket0", NULL, "param_x", NULL, NULL, -1, offset, length);

## Example 2

Suppose that data.ws contains the following buffer, buf1:

"\x00\x01\x85\x80\x00\x01\x00\x01\x00\x00\x00\x00\x07"
"ABC"
"\x02"
"co"
"\x02"
"il"
"\x00\x00\x01\x00\x01\xc0"

Suppose that the value of Param1 in the parameter list is "\x01", a string indicating the group name. The example below saves the string appearing at offset 3 from the second occurrence of \x00\x01 into a parameter called "correlation".

Example: lrs_save_searched_string ("socket0", "buf1", "correlation", "LB/BIN=\\x00{Param1}", "RB/BIN=\\x02", 2, 3, -1); /*

After this call, the "correlation" parameter will contain:

\x00\x00\x00\x07ABC

The left boundary is `\x00\x01` which appears 5 times in the buffer.

The second ordinal is `\x00\x01\x85\x80\x00\x01`. An offset of 3 from this boundary is:

"\x00\x01\x85\x80\x00\x01\x00\x01\x00".

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: