Next: Examples
Up: DIET data
Previous: Free functions
Contents
Problem description
For DIET to match the client problem with a service, servers and clients must
``speak the same language'', ie they must use the same problem
description. A unified way to describe problems is to use a name and define its
profile with the type diet_profile_t:
typedef struct {
char* pb_name;
int last_in, last_inout, last_out;
diet_arg_t *parameters;
} diet_profile_t;
The field parameters consists of a diet_arg_t array of size
. Arguments can be
- IN: The data are sent to the server. The memory is allocated
by the user.
- INOUT: The data are allocated by the user as for the IN
arguments, then sent to the server and brought back into the same memory zone
after the computation has completed, without any copy. Thus freeing this
memory at the client while the computation is performed on the
server would result in a segmentation fault when the data are
brought back onto the client.
- OUT: The data are created on the server and brought back into a
newly allocated zone on the client. This allocation is performed by
DIET. After the call has returned, the user can find the result in
the zone pointed at by the value field. Of course, DIET
cannot guess how long the user will need these data, so the
user must free the memory him/herself with diet_free_data.
The fields last_in, last_inout and last_out of the
diet_profile_t structure respectively point at the indexes in the
parameters array of the last IN, INOUT and OUT arguments.
Functions to create and destroy such profiles are defined with the prototypes
below:
diet_profile_t *diet_profile_alloc(char* pb_name, int last_in, int last_inout, int last_out);
int diet_profile_free(diet_profile_t *profile);
The values of last_in, last_inout and last_out
are respectively:
- last_in: + number of input data.
- last_inout: last_in number of inout data.
- last_out: last_inout number of out data.
Next: Examples
Up: DIET data
Previous: Free functions
Contents
DIET Team. 2010-05-26