Defining services

First, declare the service(s) that will be offered5.2. Each service is described by a profile description called diet_profile_desc_t since the service does not specify the sizes of the data. The diet_profile_desc_t type is defined in DIET_server.h, and is very similar to diet_profile_t. The difference is that the prototype is described with the generic parts of diet_data_desc only, whereas the client description uses full diet_data.

file DIET_data.h:
     struct diet_data_generic {
       diet_data_type_t type;
       diet_base_type_t base_type;
     };

file DIET_server.h:
     typedef struct diet_data_generic diet_arg_desc_t;

     typedef struct {
       char*            path;
       int              last_in, last_inout, last_out;
       diet_arg_desc_t* param_desc;
     } diet_profile_desc_t;

diet_profile_desc_t* diet_profile_desc_alloc(const char* path,
                        int last_in, int last_inout, int last_out);
int diet_profile_desc_free(diet_profile_desc_t* desc);

diet_profile_desc_t *diet_profile_desc_alloc(int last_in, int last_inout, int last_out);

int diet_profile_desc_free(diet_profile_desc_t *desc);

Each profile can be allocated with diet_profile_desc_alloc with the same semantics as for diet_profile_alloc. Every argument of the profile will then be set with diet_generic_desc_set defined in DIET_server.h.



The DIET Team - Mer 29 nov 2017 15:09:02 EST