Revert "[fix] pour l'incompetence des dev java"
This reverts commit c5b0056f67
.
This commit is contained in:
parent
e270e47bc1
commit
ecb49e1117
|
@ -40,7 +40,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#define BINDHDR_LEN ( sizeof(char)*(1+INET_ADDRSTRLEN)+sizeof(int) )
|
#define BINDHDR_LEN ( sizeof(char)*(1+INET_ADDRSTRLEN)+sizeof(unsigned short) )
|
||||||
#define BINDHEAD_CTL 0x01 // is command terminal (else: view terminal)
|
#define BINDHEAD_CTL 0x01 // is command terminal (else: view terminal)
|
||||||
#define BINDHEAD_SCK 0x02 // ask for com socket
|
#define BINDHEAD_SCK 0x02 // ask for com socket
|
||||||
#define BINDHEAD_TCP 0x04 // ask TCP instead of UDP
|
#define BINDHEAD_TCP 0x04 // ask TCP instead of UDP
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
struct bind_header{
|
struct bind_header{
|
||||||
char flags;
|
char flags;
|
||||||
char addr[INET_ADDRSTRLEN];
|
char addr[INET_ADDRSTRLEN];
|
||||||
int port;
|
unsigned short port;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -75,7 +75,7 @@
|
||||||
|
|
||||||
struct listen_arg{
|
struct listen_arg{
|
||||||
const char addr[16]; // socket address
|
const char addr[16]; // socket address
|
||||||
const int port; // socket port
|
const unsigned short port; // socket port
|
||||||
int (*middleware)(struct middleware_arg*); // middleware function
|
int (*middleware)(struct middleware_arg*); // middleware function
|
||||||
void* (*handler)(void*); // management function (thread)
|
void* (*handler)(void*); // management function (thread)
|
||||||
};
|
};
|
||||||
|
|
|
@ -42,7 +42,7 @@ int multicastPlanes(struct middleware_arg* arg){
|
||||||
/* 1. On parse la requête */
|
/* 1. On parse la requête */
|
||||||
memcpy(&request.flags, buffer, sizeof(char));
|
memcpy(&request.flags, buffer, sizeof(char));
|
||||||
memcpy(&request.addr, buffer+sizeof(char), sizeof(char)*15);
|
memcpy(&request.addr, buffer+sizeof(char), sizeof(char)*15);
|
||||||
memcpy(&request.port, buffer+sizeof(char)*16, sizeof(int));
|
memcpy(&request.port, buffer+sizeof(char)*16, sizeof(unsigned short));
|
||||||
printf("{%s} received: bind_header{flag = %d; addr = '%s'; port = %d}\n", arg->entity, (int) request.flags, request.addr, request.port);
|
printf("{%s} received: bind_header{flag = %d; addr = '%s'; port = %d}\n", arg->entity, (int) request.flags, request.addr, request.port);
|
||||||
|
|
||||||
/* (1) Envoi socket de communication (TCP)
|
/* (1) Envoi socket de communication (TCP)
|
||||||
|
@ -62,7 +62,7 @@ int multicastPlanes(struct middleware_arg* arg){
|
||||||
bzero(buffer, MAX_BUF_LEN);
|
bzero(buffer, MAX_BUF_LEN);
|
||||||
memcpy(buffer, &request.flags, sizeof(char));
|
memcpy(buffer, &request.flags, sizeof(char));
|
||||||
memcpy(buffer+sizeof(char), &request.addr, sizeof(char)*INET_ADDRSTRLEN);
|
memcpy(buffer+sizeof(char), &request.addr, sizeof(char)*INET_ADDRSTRLEN);
|
||||||
memcpy(buffer+sizeof(char)*(1+INET_ADDRSTRLEN), &request.port, sizeof(int));
|
memcpy(buffer+sizeof(char)*(1+INET_ADDRSTRLEN), &request.port, sizeof(unsigned short));
|
||||||
|
|
||||||
/* 2. On envoie la réponse*/
|
/* 2. On envoie la réponse*/
|
||||||
len = sizeof(struct sockaddr_in);
|
len = sizeof(struct sockaddr_in);
|
||||||
|
@ -117,7 +117,7 @@ int multicastTerminal(struct middleware_arg* arg){
|
||||||
/* 1. On parse la requête */
|
/* 1. On parse la requête */
|
||||||
memcpy(&request.flags, buffer, sizeof(char));
|
memcpy(&request.flags, buffer, sizeof(char));
|
||||||
memcpy(&request.addr, buffer+sizeof(char), sizeof(char)*15);
|
memcpy(&request.addr, buffer+sizeof(char), sizeof(char)*15);
|
||||||
memcpy(&request.port, buffer+sizeof(char)*16, sizeof(int));
|
memcpy(&request.port, buffer+sizeof(char)*16, sizeof(unsigned short));
|
||||||
printf("{%s} received: bind_header{flag = %d; addr = '%s'; port = %d}\n", arg->entity, (int) request.flags, request.addr, request.port);
|
printf("{%s} received: bind_header{flag = %d; addr = '%s'; port = %d}\n", arg->entity, (int) request.flags, request.addr, request.port);
|
||||||
|
|
||||||
/* (1) Création socket de communication (si demandé)
|
/* (1) Création socket de communication (si demandé)
|
||||||
|
@ -169,7 +169,7 @@ int multicastTerminal(struct middleware_arg* arg){
|
||||||
bzero(buffer, MAX_BUF_LEN);
|
bzero(buffer, MAX_BUF_LEN);
|
||||||
memcpy(buffer, &request.flags, sizeof(char));
|
memcpy(buffer, &request.flags, sizeof(char));
|
||||||
memcpy(buffer+sizeof(char), &request.addr, sizeof(char)*15);
|
memcpy(buffer+sizeof(char), &request.addr, sizeof(char)*15);
|
||||||
memcpy(buffer+sizeof(char)*16, &request.port, sizeof(int));
|
memcpy(buffer+sizeof(char)*16, &request.port, sizeof(unsigned short));
|
||||||
|
|
||||||
/* 2. On envoie la réponse*/
|
/* 2. On envoie la réponse*/
|
||||||
len = sizeof(struct sockaddr_in);
|
len = sizeof(struct sockaddr_in);
|
||||||
|
|
|
@ -51,7 +51,7 @@ int open_communication(){
|
||||||
request.port = 0;
|
request.port = 0;
|
||||||
memcpy(buffer+sizeof(char)*0, &request.flags, sizeof(char));
|
memcpy(buffer+sizeof(char)*0, &request.flags, sizeof(char));
|
||||||
memcpy(buffer+sizeof(char)*1, &request.addr, sizeof(char)*INET_ADDRSTRLEN);
|
memcpy(buffer+sizeof(char)*1, &request.addr, sizeof(char)*INET_ADDRSTRLEN);
|
||||||
memcpy(buffer+sizeof(char)*(1+INET_ADDRSTRLEN), &request.port, sizeof(int));
|
memcpy(buffer+sizeof(char)*(1+INET_ADDRSTRLEN), &request.port, sizeof(unsigned short));
|
||||||
|
|
||||||
/* 2. Envoi séquence */
|
/* 2. Envoi séquence */
|
||||||
if( sendto(mcast_socket, buffer, BINDHDR_LEN/sizeof(char) +1, 0, (struct sockaddr*) &udp, sizeof(struct sockaddr_in)) < 0 ){
|
if( sendto(mcast_socket, buffer, BINDHDR_LEN/sizeof(char) +1, 0, (struct sockaddr*) &udp, sizeof(struct sockaddr_in)) < 0 ){
|
||||||
|
@ -82,7 +82,7 @@ int open_communication(){
|
||||||
|
|
||||||
memcpy(&request.addr, buffer, sizeof(char) );
|
memcpy(&request.addr, buffer, sizeof(char) );
|
||||||
memcpy(&request.addr, buffer+sizeof(char), sizeof(char)*INET_ADDRSTRLEN );
|
memcpy(&request.addr, buffer+sizeof(char), sizeof(char)*INET_ADDRSTRLEN );
|
||||||
memcpy(&request.port, buffer+sizeof(char)*(1+INET_ADDRSTRLEN), sizeof(int) );
|
memcpy(&request.port, buffer+sizeof(char)*(1+INET_ADDRSTRLEN), sizeof(unsigned short) );
|
||||||
|
|
||||||
printf("bind_header{flags = %d; addr = %s; port = %d;}\n\n", request.flags, request.addr, request.port);
|
printf("bind_header{flags = %d; addr = %s; port = %d;}\n\n", request.flags, request.addr, request.port);
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
int spd;
|
int spd;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define BINDHDR_LEN ( sizeof(char)*(1+INET_ADDRSTRLEN)+sizeof(int) )
|
#define BINDHDR_LEN ( sizeof(char)*(1+INET_ADDRSTRLEN)+sizeof(unsigned short) )
|
||||||
#define BINDHEAD_CTL 0x01 // is command terminal (else: view terminal)
|
#define BINDHEAD_CTL 0x01 // is command terminal (else: view terminal)
|
||||||
#define BINDHEAD_SCK 0x02 // ask for com socket
|
#define BINDHEAD_SCK 0x02 // ask for com socket
|
||||||
#define BINDHEAD_TCP 0x04 // ask TCP instead of UDP
|
#define BINDHEAD_TCP 0x04 // ask TCP instead of UDP
|
||||||
|
@ -57,7 +57,7 @@
|
||||||
struct bind_header{
|
struct bind_header{
|
||||||
char flags;
|
char flags;
|
||||||
char addr[INET_ADDRSTRLEN];
|
char addr[INET_ADDRSTRLEN];
|
||||||
int port;
|
unsigned short port;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Reference in New Issue