Branch
Hash :
94046104
Author :
Thomas de Grivel
Date :
2020-02-24T15:19:27
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
#ifdef WIN32
# include "../common/win32.h"
#else
# include <sys/types.h>
# include <sys/socket.h>
#endif
#include <pw13/pw13.h>
#include "../common/type_message.h"
#include "../common/transmit.h"
#include "pw13_server.h"
#include "servlist.h"
#include "broadcast.h"
int pw13_cluster_client_scat_create_path (char * classpath, char * name,
pident id)
{
Pw13_Patch *patch;
printf ("CREATE PATH \n");
send_int (id->server->socket, PW13_CREATE_PATCH );
send_string (id->server->socket, classpath );
send_string (id->server->socket, name );
patch = (Pw13_Patch*) recv_int (id->server->socket);
printf("adresse du patch : %p \n", patch);
if (patch) {
pw13_list_insert_head (&id->list_of_patch, patch);
return 1;
}
return 0;
}
void pw13_cluster_client_scat_destroy_path (Pw13_Patch *p, pident id)
{
send_int(id->server->socket, PW13_DESTROY_PATCH );
send_int(id->server->socket, (int) p);
/* tenir la liste a jour */
}
int pw13_cluster_client_scat_create_path_output (pident id)
{
Pw13_Patch *patch;
printf ("CREATE PATH OUTPUT \n");
send_int (id->server->socket, PW13_CREATE_PATCH_OUTPUT );
patch = (Pw13_Patch*) recv_int (id->server->socket);
printf("adresse du patch_output : %p \n", patch);
if (patch) {
pw13_list_insert_head (&id->list_of_patch, patch);
return 1;
}
return 0;
}
void pw13_cluster_client_scat_connect_path_local (Pw13_Patch *pdout,
Pw13_Patch *pdin,
char *output,
char *input, pident id)
{
send_int(id->server->socket, PW13_CONNECT_PATCH_LOCAL);
send_int(id->server->socket,(int) pdout); /*patch output*/
send_int(id->server->socket,(int) pdin); /*patch input*/
send_string (id->server->socket, output); /*output*/
send_string (id->server->socket, input); /*input*/
}
int pw13_cluster_client_scat_bind_path_input (Pw13_Patch *pd1, Pw13_Patch *pd2,
char * input,
char * output,
char * ip, pident id)
{
send_int(id->server->socket, PW13_BIND_PATCH_INPUT);
send_int(id->server->socket, (int) pd1); /* input patch */
send_int(id->server->socket, (int) pd2); /* output patch */
send_string(id->server->socket, input); /* input */
send_string(id->server->socket, output); /* output */
send_string(id->server->socket, ip); /* ip de l'autre server */
return 1;
}
int pw13_cluster_client_scat_ask_patch_start (Pw13_Patch *pd,
Pw13_Time *tim, pident id)
{
send_int(id->server->socket, PW13_ASK_PATCH_START);
send (id->server->socket, (void*) tim, sizeof(Pw13_Time),0);
send_int(id->server->socket, (int) pd);
return 1;
}
int pw13_cluster_client_scat_ask_patch_stop (Pw13_Patch *pd, pident id)
{
send_int(id->server->socket, PW13_ASK_PATCH_STOP);
send_int(id->server->socket, (int) pd);
return 1;
}
int pw13_cluster_client_scat_ask_patch_pump (Pw13_Patch *pd,
Pw13_Time *tim, pident id)
{
send_int(id->server->socket, PW13_ASK_PATCH_PUMP);
send_int(id->server->socket, (int) pd);
send_int(id->server->socket, (int) tim); /* ptet pas en int... */
/* le time a envoyer aussi ... es-ce que le patch augend est sur le client ou pas aussi...*/
return 1;
}