version 1.70, 2013/02/27 17:11:44
|
version 1.71, 2013/03/01 09:29:30
|
Line 851 instruction_read(struct_processus *s_eta
|
Line 851 instruction_read(struct_processus *s_eta
|
int c; |
int c; |
int ios; |
int ios; |
|
|
integer8 ancienne_longueur_effective; |
|
integer8 element; |
integer8 element; |
integer8 i; |
integer8 i; |
integer8 id; |
integer8 id; |
Line 878 instruction_read(struct_processus *s_eta
|
Line 877 instruction_read(struct_processus *s_eta
|
|
|
struct flock lock; |
struct flock lock; |
|
|
struct pollfd poll_fd; |
|
|
|
struct sockaddr_un adresse_unix; |
struct sockaddr_un adresse_unix; |
struct sockaddr_in adresse_ipv4; |
struct sockaddr_in adresse_ipv4; |
# ifdef IPV6 |
# ifdef IPV6 |
struct sockaddr_in6 adresse_ipv6; |
struct sockaddr_in6 adresse_ipv6; |
# endif |
# endif |
|
|
|
struct pollfd poll_fd; |
|
|
struct timespec attente; |
struct timespec attente; |
|
|
struct_descripteur_fichier *descripteur; |
struct_descripteur_fichier *descripteur; |
Line 906 instruction_read(struct_processus *s_eta
|
Line 905 instruction_read(struct_processus *s_eta
|
unsigned char *clef_utf8; |
unsigned char *clef_utf8; |
unsigned char *commande; |
unsigned char *commande; |
unsigned char *format_chaine; |
unsigned char *format_chaine; |
unsigned char poubelle[256]; |
|
unsigned char *ptr; |
unsigned char *ptr; |
unsigned char *tampon_lecture; |
unsigned char *tampon_lecture; |
unsigned char *tampon; |
unsigned char *tampon; |
Line 2355 printf("L=%d\n", longueur_enregistrement
|
Line 2353 printf("L=%d\n", longueur_enregistrement
|
|
|
if ((*((struct_socket *) (*s_objet_argument_1).objet)).binaire == 'N') |
if ((*((struct_socket *) (*s_objet_argument_1).objet)).binaire == 'N') |
{ // Socket formatée |
{ // Socket formatée |
longueur_questure = 256; |
longueur_questure = 4096; |
longueur_effective = 0; |
longueur_effective = 0; |
tampon_lecture = NULL; |
tampon_lecture = NULL; |
|
|
Line 2398 printf("L=%d\n", longueur_enregistrement
|
Line 2396 printf("L=%d\n", longueur_enregistrement
|
{ |
{ |
ios = recvfrom((*((struct_socket *) |
ios = recvfrom((*((struct_socket *) |
(*s_objet_argument_1).objet)).socket, |
(*s_objet_argument_1).objet)).socket, |
tampon_lecture + longueur_effective, |
tampon_lecture, |
longueur_questure, |
longueur_effective + longueur_questure, |
MSG_PEEK | MSG_DONTWAIT, (struct sockaddr *) |
MSG_PEEK | MSG_DONTWAIT, (struct sockaddr *) |
&adresse_unix, &longueur_adresse); |
&adresse_unix, &longueur_adresse); |
} while((ios == -1) && (errno == EINTR)); |
} while((ios == -1) && (errno == EINTR)); |
Line 2413 printf("L=%d\n", longueur_enregistrement
|
Line 2411 printf("L=%d\n", longueur_enregistrement
|
{ |
{ |
ios = recvfrom((*((struct_socket *) |
ios = recvfrom((*((struct_socket *) |
(*s_objet_argument_1).objet)).socket, |
(*s_objet_argument_1).objet)).socket, |
tampon_lecture + longueur_effective, |
tampon_lecture, |
longueur_questure, |
longueur_effective + longueur_questure, |
MSG_PEEK | MSG_DONTWAIT, (struct sockaddr *) |
MSG_PEEK | MSG_DONTWAIT, (struct sockaddr *) |
&adresse_ipv4, &longueur_adresse); |
&adresse_ipv4, &longueur_adresse); |
} while((ios == -1) && (errno == EINTR)); |
} while((ios == -1) && (errno == EINTR)); |
Line 2429 printf("L=%d\n", longueur_enregistrement
|
Line 2427 printf("L=%d\n", longueur_enregistrement
|
{ |
{ |
ios = recvfrom((*((struct_socket *) |
ios = recvfrom((*((struct_socket *) |
(*s_objet_argument_1).objet)).socket, |
(*s_objet_argument_1).objet)).socket, |
tampon_lecture + longueur_effective, |
tampon_lecture, |
longueur_questure, |
longueur_effective + longueur_questure, |
MSG_PEEK | MSG_DONTWAIT, (struct sockaddr *) |
MSG_PEEK | MSG_DONTWAIT, (struct sockaddr *) |
&adresse_ipv6, &longueur_adresse); |
&adresse_ipv6, &longueur_adresse); |
} while((ios == -1) && (errno == EINTR)); |
} while((ios == -1) && (errno == EINTR)); |
Line 2499 printf("L=%d\n", longueur_enregistrement
|
Line 2497 printf("L=%d\n", longueur_enregistrement
|
|
|
if (ios >= 0) |
if (ios >= 0) |
{ |
{ |
ancienne_longueur_effective = longueur_effective; |
|
longueur_effective += ios; |
longueur_effective += ios; |
position_initiale = 0; |
position_initiale = 0; |
presence_indicateur = d_faux; |
presence_indicateur = d_faux; |
Line 2570 printf("L=%d\n", longueur_enregistrement
|
Line 2567 printf("L=%d\n", longueur_enregistrement
|
} |
} |
} |
} |
|
|
// On retire du buffer position_finale - |
// On retire une trame du buffer. |
// ancienne_longueur_effective octets. |
|
|
|
if ((*((struct_socket *) (*s_objet_argument_1).objet)) |
if (trame_complete == d_vrai) |
.domaine == PF_UNIX) |
|
{ |
{ |
longueur_adresse = sizeof(adresse_unix); |
if ((*((struct_socket *) (*s_objet_argument_1).objet)) |
|
.domaine == PF_UNIX) |
do |
|
{ |
|
ios = recvfrom((*((struct_socket *) |
|
(*s_objet_argument_1).objet)).socket, |
|
poubelle, position_finale |
|
- ancienne_longueur_effective, |
|
MSG_DONTWAIT, (struct sockaddr *) |
|
&adresse_unix, &longueur_adresse); |
|
} while((ios == -1) && (errno == EINTR)); |
|
} |
|
else if ((*((struct_socket *) (*s_objet_argument_1) |
|
.objet)).domaine == PF_INET) |
|
{ |
|
longueur_adresse = sizeof(adresse_ipv4); |
|
|
|
do |
|
{ |
|
ios = recvfrom((*((struct_socket *) |
|
(*s_objet_argument_1).objet)).socket, |
|
poubelle, position_finale |
|
- ancienne_longueur_effective, |
|
MSG_DONTWAIT, (struct sockaddr *) |
|
&adresse_ipv4, &longueur_adresse); |
|
} while((ios == -1) && (errno == EINTR)); |
|
} |
|
else if ((*((struct_socket *) (*s_objet_argument_1) |
|
.objet)) .domaine == PF_INET6) |
|
{ |
|
# ifdef IPV6 |
|
longueur_adresse = sizeof(adresse_ipv6); |
|
|
|
do |
|
{ |
{ |
ios = recvfrom((*((struct_socket *) |
do |
(*s_objet_argument_1).objet)).socket, |
{ |
poubelle, position_finale |
longueur_adresse = sizeof(adresse_unix); |
- ancienne_longueur_effective, |
recvfrom((*((struct_socket *) |
MSG_DONTWAIT, (struct sockaddr *) |
(*s_objet_argument_1).objet)).socket, |
&adresse_ipv6, &longueur_adresse); |
tampon_lecture, longueur_effective, |
} while((ios == -1) && (errno == EINTR)); |
0, (struct sockaddr *) |
# else |
&adresse_unix, &longueur_adresse); |
if ((*s_etat_processus).langue == 'F') |
} while((ios == -1) && (errno == EINTR)); |
|
} |
|
else if ((*((struct_socket *) (*s_objet_argument_1) |
|
.objet)).domaine == PF_INET) |
{ |
{ |
printf("+++Attention : Support du protocole" |
do |
" IPv6 indisponible\n"); |
{ |
|
longueur_adresse = sizeof(adresse_ipv4); |
|
recvfrom((*((struct_socket *) |
|
(*s_objet_argument_1).objet)).socket, |
|
tampon_lecture, longueur_effective, |
|
0, (struct sockaddr *) |
|
&adresse_ipv4, &longueur_adresse); |
|
} while((ios == -1) && (errno == EINTR)); |
} |
} |
else |
else if ((*((struct_socket *) (*s_objet_argument_1) |
|
.objet)) .domaine == PF_INET6) |
{ |
{ |
printf("+++Warning : IPv6 support " |
# ifdef IPV6 |
"unavailable\n"); |
do |
|
{ |
|
longueur_adresse = sizeof(adresse_ipv6); |
|
recvfrom((*((struct_socket *) |
|
(*s_objet_argument_1).objet)).socket, |
|
tampon_lecture, longueur_effective, |
|
0, (struct sockaddr *) |
|
&adresse_ipv6, &longueur_adresse); |
|
} while((ios == -1) && (errno == EINTR)); |
|
# else |
|
if ((*s_etat_processus).langue == 'F') |
|
{ |
|
printf("+++Attention : Support du protocole" |
|
" IPv6 indisponible\n"); |
|
} |
|
else |
|
{ |
|
printf("+++Warning : IPv6 support " |
|
"unavailable\n"); |
|
} |
|
|
|
# endif |
} |
} |
|
|
longueur_adresse = 0; |
longueur_effective = ios; |
# endif |
|
} |
} |
|
else |
if (presence_indicateur == d_faux) |
|
{ |
{ |
|
// Installation d'un timeout pour sortir de |
|
// l'instruction dans le cas où la transmission serait |
|
// invalide et que la trame reçue serait erronée. |
|
|
poll_fd.fd = (*((struct_socket *) |
poll_fd.fd = (*((struct_socket *) |
(*s_objet_argument_1).objet)).socket; |
(*s_objet_argument_1).objet)).socket; |
poll_fd.events = POLLIN; |
poll_fd.events = POLLIN; |
|
|
while((ios = poll(&poll_fd, 1, 10000)) <= 0) |
while((ios = poll(&poll_fd, 1, 10000)) <= 0) |
{ |
{ |
// La fin de la trame n'est pas atteinte |
// La fin de la trame n'est pas atteinte. |
// et il reste quelque chose à lire. |
|
|
|
switch(ios) |
switch(ios) |
{ |
{ |
Line 2717 printf("L=%d\n", longueur_enregistrement
|
Line 2713 printf("L=%d\n", longueur_enregistrement
|
|
|
tampon_lecture[++position_finale] = d_code_fin_chaine; |
tampon_lecture[++position_finale] = d_code_fin_chaine; |
tampon = (*s_etat_processus).instruction_courante; |
tampon = (*s_etat_processus).instruction_courante; |
(*s_etat_processus).instruction_courante = &(tampon_lecture |
(*s_etat_processus).instruction_courante = tampon_lecture; |
[position_initiale]); |
|
|
|
indicateur_48 = test_cfsf(s_etat_processus, 48); |
indicateur_48 = test_cfsf(s_etat_processus, 48); |
cf(s_etat_processus, 48); |
cf(s_etat_processus, 48); |