lrs_get_user_buffer_size

Buffer Functions

Retrieves the size of the user data buffer.

long lrs_get_user_buffer_size( char *s_desc );
s_desc A descriptor identifying a socket.

The lrs_get_user_buffer_size function retrieves the size of the user data buffer for the specified socket.

Return Values

If this function fails, it returns NULL. If it succeeds, it returns a pointer to the converted buffer. You can also retrieve the converted buffer using lrs_get_user_buffer.

Parameterization

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

Example

In the following example, lrs_get_user_buffer_size retrieves the size of the user buffer, "buf10", received on "socket1", containing "\x17\x01X-AUTHENTICATION-1".

char *UserBuf, *StrToLog;
int LenOfUserBuf;
lrs_get_static_buffer("socket1", "buf10", 0, -1, NULL);
UserBuf = lrs_get_user_buffer("socket1");
LenOfUserBuf = lrs_get_user_buffer_size("socket1");
StrToLog = (char*)malloc(LenOfUserBuf + 1);
/* Copy user buffer and skip two unprintable characters at the beginning */
strncpy(StrToLog, UserBuf+2, LenOfUserBuf-2); 
lr_output_message("UserBuf = \"%s\"", StrToLog);
lr_output_message("The buffer size = \"%d\"", LenOfUserBuf);
The output generated by the above code, as seen in the VuGen Execution log is:
Message from run.c(52): UserBuf = "X-AUTHENTICATION-1"
Message from run.c(52): The buffer size = 20