lrt_tpacall

Communication Functions

Sends a service request.

int lrt_tpacall( char *svc, char *data, long len, long flags );

svc The requested service
data Data sent with the request.
len Length of the data.
Flags Reserved for future use. Should be set to 0.

    The lrt_tpacall function sends a request message to the specified service. This is one of the few functions where you can print debugging information in brief mode.

Return Values

If the function ends with an error, it returns -1 and sets the error code in tperrno.

Parameterization

The following argument(s) can be parameterized using standard parameterization: svc

Example

In the following example, the lrt_tpacall function requests the service TOUPPER for the string contained in data_0.

vuser_init()

Copy code
{
char* data_0;
char* data_1;
long buflen;
int cd;
char string[] = "This is a string.";
data_0 = lrt_tpalloc("STRING", "", sizeof(string));
// Send a request, but cancel it afterwards
lrt_strcpy(data_0, string);
cd = lrt_tpacall("TOUPPER", data_0, 0, 0);
lrt_tpcancel(cd);
// Send a request, and look at reply
data_1 = lrt_tpalloc("STRING", "", 1024);
lrt_tpgetrply(&cd, &data_1, &olen, 0);
buflen = lrt_tptypes(data_1, type, NULL);
lr_output_message("The reply buffer type is %s, size is %lu.", type, buflen);
    return 0;