Skip to content
Marios Fragkoulis edited this page Dec 6, 2016 · 3 revisions

Dgsh negotiation API for compatible programs

/* Each tool in the sgsh graph calls dgsh_negotiate() to take part in
 * peer-to-peer negotiation.
 * The function's return value signifies success (0) or failure (4) of the
 * negotiation phase.
 */
enum prot_state
dgsh_negotiate(const char *tool_name, /* Input variable: the program's name */
                    int *n_input_fds, /* Input/Output variable:
                                       * number of input file descriptors
                                       * required. The number may be changed
                                       * by the API and will reflect the size
                                       * of the input file descriptor array.
                                       * If NULL is provided, then 0 or 1
                                       * is implied and no file descriptor
                                       * array is returned. The input file
                                       * descriptor to return (in case of 1)
                                       * substitutes stdin.
                                       */
                    int *n_output_fds,/* Input/Output variable:
                                       * number of output file descriptors
                                       * provided. The semantics for n_input_fds
                                       * apply here respectively.
                                       */
                    int **input_fds,  /* Output variable:
                                       * input file descriptor array
                                       * The caller has the responsbility
                                       * to free the array.
                                       */
                    int **output_fds);/* Output variable:
                                       * output file descriptor array
                                       * The caller has the responsbility
                                       * to free the array.
                                       */