version 1.76, 2014/04/25 07:37:32
|
version 1.106, 2022/09/07 13:40:37
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.1.18 |
RPL/2 (R) version 4.1.34 |
Copyright (C) 1989-2014 Dr. BERTRAND Joël |
Copyright (C) 1989-2021 Dr. BERTRAND Joël |
|
|
This file is part of RPL/2. |
This file is part of RPL/2. |
|
|
Line 114 instruction_over(struct_processus *s_eta
|
Line 114 instruction_over(struct_processus *s_eta
|
" %s, %s, %s, %s, %s,\n" |
" %s, %s, %s, %s, %s,\n" |
" %s, %s, %s, %s, %s,\n" |
" %s, %s, %s, %s, %s,\n" |
" %s, %s, %s, %s,\n" |
" %s, %s, %s, %s,\n" |
" %s, %s\n", |
" %s, %s, %s\n", |
d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX, |
d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX, |
d_TAB, d_BIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SCK, |
d_TAB, d_BIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SCK, |
d_SQL, d_SLB, d_PRC, d_MTX); |
d_SQL, d_SLB, d_PRC, d_MTX, d_REC); |
printf(" 1: %s, %s, %s, %s, %s, %s,\n" |
printf(" 1: %s, %s, %s, %s, %s, %s,\n" |
" %s, %s, %s, %s, %s,\n" |
" %s, %s, %s, %s, %s,\n" |
" %s, %s, %s, %s, %s,\n" |
" %s, %s, %s, %s, %s,\n" |
" %s, %s, %s, %s,\n" |
" %s, %s, %s, %s,\n" |
" %s, %s\n", |
" %s, %s, %s\n", |
d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX, |
d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX, |
d_TAB, d_BIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SCK, |
d_TAB, d_BIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SCK, |
d_SQL, d_SLB, d_PRC, d_MTX); |
d_SQL, d_SLB, d_PRC, d_MTX, d_REC); |
printf("-> 3: %s, %s, %s, %s, %s, %s,\n" |
printf("-> 3: %s, %s, %s, %s, %s, %s,\n" |
" %s, %s, %s, %s, %s,\n" |
" %s, %s, %s, %s, %s,\n" |
" %s, %s, %s, %s, %s,\n" |
" %s, %s, %s, %s, %s,\n" |
" %s, %s, %s, %s,\n" |
" %s, %s, %s, %s,\n" |
" %s, %s\n", |
" %s, %s, %s\n", |
d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX, |
d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX, |
d_TAB, d_BIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SCK, |
d_TAB, d_BIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SCK, |
d_SQL, d_SLB, d_PRC, d_MTX); |
d_SQL, d_SLB, d_PRC, d_MTX, d_REC); |
printf(" ...\n"); |
printf(" ...\n"); |
printf(" 1: %s, %s, %s, %s, %s, %s,\n" |
printf(" 1: %s, %s, %s, %s, %s, %s,\n" |
" %s, %s, %s, %s, %s,\n" |
" %s, %s, %s, %s, %s,\n" |
" %s, %s, %s, %s, %s,\n" |
" %s, %s, %s, %s, %s,\n" |
" %s, %s, %s, %s,\n" |
" %s, %s, %s, %s,\n" |
" %s, %s\n", |
" %s, %s, %s\n", |
d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX, |
d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX, |
d_TAB, d_BIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SCK, |
d_TAB, d_BIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SCK, |
d_SQL, d_SLB, d_PRC, d_MTX); |
d_SQL, d_SLB, d_PRC, d_MTX, d_REC); |
|
|
return; |
return; |
} |
} |
Line 869 instruction_or(struct_processus *s_etat_
|
Line 869 instruction_or(struct_processus *s_etat_
|
================================================================================ |
================================================================================ |
*/ |
*/ |
|
|
|
|
|
static inline logical1 |
|
options_socket(struct_processus *s_etat_processus, |
|
struct_objet *s_objet_resultat, unsigned char *options, |
|
unsigned char *peripherique, int *priorite, |
|
int *buffer_emission, int *buffer_reception, |
|
int *timeout_emission, int *timeout_reception) |
|
{ |
|
int drapeau; |
|
|
|
/* |
|
* Options des sockets |
|
*/ |
|
|
|
drapeau = -1; |
|
|
|
# define WARNING(message) { \ |
|
if ((*s_etat_processus).langue != 'F') \ |
|
printf("+++Warning : %s unavailable on host system\n", message); \ |
|
else \ |
|
printf("+++Attention : %s non disponible sur le système hôte\n", \ |
|
message); } while(0) |
|
|
|
if (options[d_BIND_TO_DEVICE] == 'Y') |
|
{ |
|
# ifdef SO_BINDTODEVICE |
|
if (setsockopt((*((struct_socket *) (*s_objet_resultat).objet)) |
|
.socket, SOL_SOCKET, SO_BINDTODEVICE, peripherique, |
|
(socklen_t) strlen(peripherique)) != 0) |
|
{ |
|
(*s_etat_processus).erreur_execution = |
|
d_ex_erreur_parametre_fichier; |
|
return(d_erreur); |
|
} |
|
|
|
(*((struct_socket *) (*s_objet_resultat).objet)).options |= |
|
((integer8) 1) << d_BIND_TO_DEVICE; |
|
# else |
|
WARNING("BIND TO DEVICE"); |
|
# endif |
|
} |
|
|
|
if (options[d_BROADCAST] == 'Y') |
|
{ |
|
if (setsockopt((*((struct_socket *) (*s_objet_resultat).objet)).socket, |
|
SOL_SOCKET, SO_BROADCAST, &drapeau, sizeof(drapeau)) != 0) |
|
{ |
|
(*s_etat_processus).erreur_execution = |
|
d_ex_erreur_parametre_fichier; |
|
return(d_erreur); |
|
} |
|
|
|
(*((struct_socket *) (*s_objet_resultat).objet)).options |= |
|
((integer8) 1) << d_BROADCAST; |
|
} |
|
|
|
if (options[d_DONT_ROUTE] == 'Y') |
|
{ |
|
if (setsockopt((*((struct_socket *) (*s_objet_resultat).objet)).socket, |
|
SOL_SOCKET, SO_DONTROUTE, &drapeau, sizeof(drapeau)) != 0) |
|
{ |
|
(*s_etat_processus).erreur_execution = |
|
d_ex_erreur_parametre_fichier; |
|
return(d_erreur); |
|
} |
|
|
|
(*((struct_socket *) (*s_objet_resultat).objet)).options |= |
|
((integer8) 1) << d_DONT_ROUTE; |
|
} |
|
|
|
if (options[d_KEEP_ALIVE] == 'Y') |
|
{ |
|
if (setsockopt((*((struct_socket *) (*s_objet_resultat).objet)).socket, |
|
SOL_SOCKET, SO_KEEPALIVE, &drapeau, sizeof(drapeau)) != 0) |
|
{ |
|
(*s_etat_processus).erreur_execution = |
|
d_ex_erreur_parametre_fichier; |
|
return(d_erreur); |
|
} |
|
} |
|
|
|
if (options[d_PRIORITY] == 'Y') |
|
{ |
|
# ifdef SO_PRIORITY |
|
if (setsockopt((*((struct_socket *) (*s_objet_resultat).objet)) |
|
.socket, SOL_SOCKET, SO_PRIORITY, priorite, |
|
sizeof((*priorite))) != 0) |
|
{ |
|
(*s_etat_processus).erreur_execution = |
|
d_ex_erreur_parametre_fichier; |
|
return(d_erreur); |
|
} |
|
|
|
(*((struct_socket *) (*s_objet_resultat).objet)).options |= |
|
((integer8) 1) << d_PRIORITY; |
|
(*((struct_socket *) (*s_objet_resultat).objet)).priorite = |
|
(*priorite); |
|
# else |
|
WARNING("PRIORITY"); |
|
# endif |
|
} |
|
|
|
if (options[d_RECEIVE_BUFFER] == 'Y') |
|
{ |
|
if (setsockopt((*((struct_socket *) (*s_objet_resultat).objet)).socket, |
|
SOL_SOCKET, SO_RCVBUF, buffer_reception, |
|
sizeof((*buffer_reception))) != 0) |
|
{ |
|
(*s_etat_processus).erreur_execution = |
|
d_ex_erreur_parametre_fichier; |
|
return(d_erreur); |
|
} |
|
|
|
(*((struct_socket *) (*s_objet_resultat).objet)).options |= |
|
((integer8) 1) << d_RECEIVE_BUFFER; |
|
(*((struct_socket *) (*s_objet_resultat).objet)).buffer_reception = |
|
(*buffer_reception); |
|
} |
|
|
|
if (options[d_FORCE_RECEIVE_BUFFER] == 'Y') |
|
{ |
|
# ifdef SO_RCVBUFFORCE |
|
if (setsockopt((*((struct_socket *) (*s_objet_resultat).objet)) |
|
.socket, SOL_SOCKET, SO_RCVBUFFORCE, |
|
buffer_reception, sizeof((*buffer_reception))) != 0) |
|
{ |
|
(*s_etat_processus).erreur_execution = |
|
d_ex_erreur_parametre_fichier; |
|
return(d_erreur); |
|
} |
|
|
|
(*((struct_socket *) (*s_objet_resultat).objet)).options |= |
|
((integer8) 1) << d_FORCE_RECEIVE_BUFFER; |
|
(*((struct_socket *) (*s_objet_resultat).objet)).buffer_reception = |
|
(*buffer_reception); |
|
# else |
|
WARNING("FORCE_RECEIVE_BUFFER"); |
|
# endif |
|
} |
|
|
|
if (options[d_SEND_BUFFER] == 'Y') |
|
{ |
|
if (setsockopt((*((struct_socket *) (*s_objet_resultat).objet)).socket, |
|
SOL_SOCKET, SO_SNDBUF, buffer_emission, |
|
sizeof((*buffer_emission))) != 0) |
|
{ |
|
(*s_etat_processus).erreur_execution = |
|
d_ex_erreur_parametre_fichier; |
|
return(d_erreur); |
|
} |
|
|
|
(*((struct_socket *) (*s_objet_resultat).objet)).options |= |
|
((integer8) 1) << d_SEND_BUFFER; |
|
(*((struct_socket *) (*s_objet_resultat).objet)).buffer_emission = |
|
(*buffer_emission); |
|
} |
|
|
|
if (options[d_FORCE_SEND_BUFFER] == 'Y') |
|
{ |
|
# ifdef SO_SNDBUFFORCE |
|
if (setsockopt((*((struct_socket *) (*s_objet_resultat).objet)) |
|
.socket, SOL_SOCKET, SO_SNDBUFFORCE, buffer_emission, |
|
sizeof((*buffer_emission))) != 0) |
|
{ |
|
(*s_etat_processus).erreur_execution = |
|
d_ex_erreur_parametre_fichier; |
|
return(d_erreur); |
|
} |
|
|
|
(*((struct_socket *) (*s_objet_resultat).objet)).options |= |
|
((integer8) 1) << d_FORCE_SEND_BUFFER; |
|
(*((struct_socket *) (*s_objet_resultat).objet)).buffer_emission = |
|
(*buffer_emission); |
|
# else |
|
WARNING("FORCE_SEND_BUFFER"); |
|
# endif |
|
} |
|
|
|
if (options[d_RECEIVING_TIMEOUT] == 'Y') |
|
{ |
|
if (setsockopt((*((struct_socket *) (*s_objet_resultat).objet)).socket, |
|
SOL_SOCKET, SO_RCVTIMEO, |
|
timeout_reception, sizeof((*timeout_reception))) != 0) |
|
{ |
|
(*s_etat_processus).erreur_execution = |
|
d_ex_erreur_parametre_fichier; |
|
return(d_erreur); |
|
} |
|
|
|
(*((struct_socket *) (*s_objet_resultat).objet)).options |= |
|
((integer8) 1) << d_RECEIVING_TIMEOUT; |
|
(*((struct_socket *) (*s_objet_resultat).objet)).timeout_reception = |
|
(*timeout_reception); |
|
} |
|
|
|
if (options[d_SENDING_TIMEOUT] == 'Y') |
|
{ |
|
if (setsockopt((*((struct_socket *) (*s_objet_resultat).objet)).socket, |
|
SOL_SOCKET, SO_SNDTIMEO, |
|
timeout_emission, sizeof((*timeout_emission))) != 0) |
|
{ |
|
(*s_etat_processus).erreur_execution = |
|
d_ex_erreur_parametre_fichier; |
|
return(d_erreur); |
|
} |
|
|
|
(*((struct_socket *) (*s_objet_resultat).objet)).options |= |
|
((integer8) 1) << d_SENDING_TIMEOUT; |
|
(*((struct_socket *) (*s_objet_resultat).objet)).timeout_emission = |
|
(*timeout_emission); |
|
} |
|
|
|
if (options[d_REUSE_ADDRESS] == 'Y') |
|
{ |
|
if (setsockopt((*((struct_socket *) (*s_objet_resultat).objet)).socket, |
|
SOL_SOCKET, SO_REUSEADDR, &drapeau, sizeof(drapeau)) != 0) |
|
{ |
|
(*s_etat_processus).erreur_execution = |
|
d_ex_erreur_parametre_fichier; |
|
return(d_erreur); |
|
} |
|
|
|
(*((struct_socket *) (*s_objet_resultat).objet)).options |= |
|
((integer8) 1) << d_REUSE_ADDRESS; |
|
} |
|
|
|
return(d_absence_erreur); |
|
# undef WARNING |
|
} |
|
|
|
|
void |
void |
instruction_open(struct_processus *s_etat_processus) |
instruction_open(struct_processus *s_etat_processus) |
{ |
{ |
Line 905 instruction_open(struct_processus *s_eta
|
Line 1136 instruction_open(struct_processus *s_eta
|
|
|
int buffer_emission; |
int buffer_emission; |
int buffer_reception; |
int buffer_reception; |
int drapeau; |
|
int priorite; |
int priorite; |
int prochain_descripteur; |
int prochain_descripteur; |
int protocole_numerique; |
int protocole_numerique; |
Line 976 instruction_open(struct_processus *s_eta
|
Line 1206 instruction_open(struct_processus *s_eta
|
unsigned long nombre_elements; |
unsigned long nombre_elements; |
unsigned long unite; |
unsigned long unite; |
|
|
# define d_BIND_TO_DEVICE 0 |
|
# define d_BROADCAST 1 |
|
# define d_DONT_ROUTE 2 |
|
# define d_KEEP_ALIVE 3 |
|
# define d_PRIORITY 4 |
|
# define d_RECEIVE_BUFFER 5 |
|
# define d_FORCE_RECEIVE_BUFFER 6 |
|
# define d_SEND_BUFFER 7 |
|
# define d_FORCE_SEND_BUFFER 8 |
|
# define d_RECEIVING_TIMEOUT 9 |
|
# define d_SENDING_TIMEOUT 10 |
|
# define d_REUSE_ADDRESS 11 |
|
|
|
/* |
/* |
* Argument : { "ouverture" "accès" "format" [ { "nom" } 'protection' ] } |
* Argument : { "ouverture" "accès" "format" [ { "nom" } 'protection' ] } |
*/ |
*/ |
Line 1048 instruction_open(struct_processus *s_eta
|
Line 1265 instruction_open(struct_processus *s_eta
|
printf(" IMAXBEL, OPOST, ONLCR, OCRNL, ONOCR, ONLRET,\n"); |
printf(" IMAXBEL, OPOST, ONLCR, OCRNL, ONOCR, ONLRET,\n"); |
printf(" OFILL, HUPCL, CLOCAL, CRTSCTS, ISIG, ICANON,\n"); |
printf(" OFILL, HUPCL, CLOCAL, CRTSCTS, ISIG, ICANON,\n"); |
printf(" ECHO, ECHOE, ECHOK, ECHONL, NOFLSH, TOSTOP,\n"); |
printf(" ECHO, ECHOE, ECHOK, ECHONL, NOFLSH, TOSTOP,\n"); |
printf(" IEXTEN\n"); |
printf(" IEXTEN, RAW\n"); |
|
|
printf(" Address : { \"ADDRESS\" [ 127 0 0 1 ] }\n"); |
printf(" Address : { \"ADDRESS\" [ 127 0 0 1 ] }\n"); |
printf(" { \"HOST\" \"hostname\" }\n"); |
printf(" { \"HOST\" \"hostname\" }\n"); |
Line 1140 instruction_open(struct_processus *s_eta
|
Line 1357 instruction_open(struct_processus *s_eta
|
buffer_reception = 0; |
buffer_reception = 0; |
timeout_emission = 0; |
timeout_emission = 0; |
timeout_reception = 0; |
timeout_reception = 0; |
drapeau = -1; |
|
s_parametres_tty = NULL; |
s_parametres_tty = NULL; |
|
|
for(i = 0; i < 12; options[i++] = 'N'); |
for(i = 0; i < 12; options[i++] = 'N'); |
Line 1149 instruction_open(struct_processus *s_eta
|
Line 1365 instruction_open(struct_processus *s_eta
|
{ |
{ |
if ((*(*l_element_courant).donnee).type == CHN) |
if ((*(*l_element_courant).donnee).type == CHN) |
{ |
{ |
if ((argument_majuscule = conversion_majuscule((unsigned char *) |
if ((argument_majuscule = conversion_majuscule(s_etat_processus, |
(*(*l_element_courant).donnee).objet)) == NULL) |
(unsigned char *) (*(*l_element_courant).donnee).objet)) |
|
== NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
d_es_allocation_memoire; |
d_es_allocation_memoire; |
Line 1764 instruction_open(struct_processus *s_eta
|
Line 1981 instruction_open(struct_processus *s_eta
|
if ((*(*l_element_courant_sous_objet).donnee).type == CHN) |
if ((*(*l_element_courant_sous_objet).donnee).type == CHN) |
{ |
{ |
if ((argument_majuscule = conversion_majuscule( |
if ((argument_majuscule = conversion_majuscule( |
(unsigned char *) |
s_etat_processus, (unsigned char *) |
(*(*l_element_courant_sous_objet) |
(*(*l_element_courant_sous_objet) |
.donnee).objet)) == NULL) |
.donnee).objet)) == NULL) |
{ |
{ |
Line 1830 instruction_open(struct_processus *s_eta
|
Line 2047 instruction_open(struct_processus *s_eta
|
free(argument_majuscule); |
free(argument_majuscule); |
|
|
if ((argument_majuscule = conversion_majuscule( |
if ((argument_majuscule = conversion_majuscule( |
(unsigned char *) |
s_etat_processus, (unsigned char *) |
(*(*l_element_courant_sous_objet) |
(*(*l_element_courant_sous_objet) |
.donnee).objet)) == NULL) |
.donnee).objet)) == NULL) |
{ |
{ |
Line 2144 instruction_open(struct_processus *s_eta
|
Line 2361 instruction_open(struct_processus *s_eta
|
{ |
{ |
type_arguments = 'S'; |
type_arguments = 'S'; |
} |
} |
|
else if (type_arguments == 'F') |
{ |
{ |
liberation(s_etat_processus, |
liberation(s_etat_processus, |
s_objet_argument); |
s_objet_argument); |
Line 2320 instruction_open(struct_processus *s_eta
|
Line 2538 instruction_open(struct_processus *s_eta
|
if ((*(*l_element_courant_sous_objet).donnee).type == CHN) |
if ((*(*l_element_courant_sous_objet).donnee).type == CHN) |
{ |
{ |
if ((argument_majuscule = conversion_majuscule( |
if ((argument_majuscule = conversion_majuscule( |
(unsigned char *) |
s_etat_processus, (unsigned char *) |
(*(*l_element_courant_sous_objet) |
(*(*l_element_courant_sous_objet) |
.donnee).objet)) == NULL) |
.donnee).objet)) == NULL) |
{ |
{ |
Line 2361 instruction_open(struct_processus *s_eta
|
Line 2579 instruction_open(struct_processus *s_eta
|
} |
} |
|
|
if ((argument_majuscule = conversion_majuscule( |
if ((argument_majuscule = conversion_majuscule( |
(unsigned char *) |
s_etat_processus, (unsigned char *) |
(*(*l_element_courant_sous_objet) |
(*(*l_element_courant_sous_objet) |
.donnee).objet)) == NULL) |
.donnee).objet)) == NULL) |
{ |
{ |
Line 3622 instruction_open(struct_processus *s_eta
|
Line 3840 instruction_open(struct_processus *s_eta
|
} |
} |
|
|
if ((parametre_courant_majuscule = conversion_majuscule( |
if ((parametre_courant_majuscule = conversion_majuscule( |
(*(*parametre_courant).donnee).objet)) == NULL) |
s_etat_processus, (*(*parametre_courant).donnee).objet)) |
|
== NULL) |
{ |
{ |
liberation(s_etat_processus, s_objet_argument); |
liberation(s_etat_processus, s_objet_argument); |
liberation(s_etat_processus, s_objet_resultat); |
liberation(s_etat_processus, s_objet_resultat); |
Line 3671 instruction_open(struct_processus *s_eta
|
Line 3890 instruction_open(struct_processus *s_eta
|
#ifdef B230400 |
#ifdef B230400 |
"230400", |
"230400", |
#endif |
#endif |
|
#ifdef B460800 |
|
"460800", |
|
#endif |
|
#ifdef B500000 |
|
"500000", |
|
#endif |
|
#ifdef B576000 |
|
"576000", |
|
#endif |
|
#ifdef B921600 |
|
"921600", |
|
#endif |
|
#ifdef B1000000 |
|
"1000000", |
|
#endif |
|
#ifdef B1152000 |
|
"1152000", |
|
#endif |
NULL }; |
NULL }; |
tcflag_t vitesses_constantes[] = |
tcflag_t vitesses_constantes[] = |
{ B50, B75, B110, B134, B150, B200, B300, B600, |
{ B50, B75, B110, B134, B150, B200, B300, B600, |
Line 3684 instruction_open(struct_processus *s_eta
|
Line 3921 instruction_open(struct_processus *s_eta
|
#ifdef B230400 |
#ifdef B230400 |
B230400, |
B230400, |
#endif |
#endif |
|
#ifdef B460800 |
|
B460800, |
|
#endif |
|
#ifdef B500000 |
|
B500000, |
|
#endif |
|
#ifdef B576000 |
|
B576000, |
|
#endif |
|
#ifdef B921600 |
|
B921600, |
|
#endif |
|
#ifdef B1000000 |
|
B1000000, |
|
#endif |
|
#ifdef B1152000 |
|
B1152000, |
|
#endif |
0 }; |
0 }; |
unsigned int vitesse_courante; |
unsigned int vitesse_courante; |
|
|
Line 3936 instruction_open(struct_processus *s_eta
|
Line 4191 instruction_open(struct_processus *s_eta
|
} |
} |
|
|
if ((parametre_courant_majuscule = conversion_majuscule( |
if ((parametre_courant_majuscule = conversion_majuscule( |
(*(*parametre_courant).donnee).objet)) == NULL) |
s_etat_processus, (*(*parametre_courant).donnee) |
|
.objet)) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
d_es_allocation_memoire; |
d_es_allocation_memoire; |
Line 3953 instruction_open(struct_processus *s_eta
|
Line 4209 instruction_open(struct_processus *s_eta
|
#ifdef IXANY |
#ifdef IXANY |
"IXANY", |
"IXANY", |
#endif |
#endif |
"IXOFF", "OPOST", |
"IXOFF", |
"ONLCR", "OCRNL", "ONOCR", "ONLRET", |
"OPOST", "ONLCR", "OCRNL", "ONOCR", "ONLRET", |
#ifdef OFILL |
#ifdef OFILL |
"OFILL", |
"OFILL", |
#endif |
#endif |
Line 3963 instruction_open(struct_processus *s_eta
|
Line 4219 instruction_open(struct_processus *s_eta
|
"CRTSCTS", |
"CRTSCTS", |
#endif |
#endif |
"ISIG", "ICANON", "ECHO", "ECHOE", "ECHOK", |
"ISIG", "ICANON", "ECHO", "ECHOE", "ECHOK", |
"ECHONL", "NOFLSH", "TOSTOP", "IEXTEN", NULL }; |
"ECHONL", "NOFLSH", "TOSTOP", "IEXTEN", |
|
|
|
"RAW", |
|
|
|
NULL }; |
tcflag_t fonctions_constantes[] = |
tcflag_t fonctions_constantes[] = |
{ /* c_iflag */ |
{ /* c_iflag */ |
1, IGNBRK, 1, BRKINT, 1, IGNPAR, 1, PARMRK, |
1, IGNBRK, 1, BRKINT, 1, IGNPAR, 1, PARMRK, |
Line 3984 instruction_open(struct_processus *s_eta
|
Line 4244 instruction_open(struct_processus *s_eta
|
#ifdef CRTSCTS |
#ifdef CRTSCTS |
3, CRTSCTS, |
3, CRTSCTS, |
#endif |
#endif |
/* c_lfkag */ |
/* c_lflag */ |
4, ISIG, 4, ICANON, 4, ECHO, 4, ECHOE, 4, ECHOK, |
4, ISIG, 4, ICANON, 4, ECHO, 4, ECHOE, 4, ECHOK, |
4, ECHONL, 4, NOFLSH, 4, TOSTOP, 4, IEXTEN }; |
4, ECHONL, 4, NOFLSH, 4, TOSTOP, 4, IEXTEN, |
|
|
|
/* RAW */ |
|
5, 0 }; |
unsigned int fonction_courante; |
unsigned int fonction_courante; |
|
|
// On vient de trouver quelque chose à interpréter. |
// On vient de trouver quelque chose à interpréter. |
Line 4036 instruction_open(struct_processus *s_eta
|
Line 4299 instruction_open(struct_processus *s_eta
|
[(fonction_courante * 2) + 1]; |
[(fonction_courante * 2) + 1]; |
break; |
break; |
} |
} |
|
|
|
case 5: |
|
{ |
|
// RAW ne peut être négatif |
|
break; |
|
} |
} |
} |
} |
} |
else |
else |
Line 4070 instruction_open(struct_processus *s_eta
|
Line 4339 instruction_open(struct_processus *s_eta
|
[(fonction_courante * 2) + 1]; |
[(fonction_courante * 2) + 1]; |
break; |
break; |
} |
} |
|
|
|
case 5: |
|
{ |
|
// no ignbrk |
|
tc.c_iflag &= ~(tcflag_t) IGNBRK; |
|
// no brkint |
|
tc.c_iflag &= ~(tcflag_t) BRKINT; |
|
// no ignpar |
|
tc.c_iflag &= ~(tcflag_t) IGNPAR; |
|
// no parmrk |
|
tc.c_iflag &= ~(tcflag_t) PARMRK; |
|
// no inpck |
|
tc.c_iflag &= ~(tcflag_t) INPCK; |
|
// no istrip |
|
tc.c_iflag &= ~(tcflag_t) ISTRIP; |
|
// no inlcr |
|
tc.c_iflag &= ~(tcflag_t) INLCR; |
|
// no icrnl |
|
tc.c_iflag &= ~(tcflag_t) ICRNL; |
|
// no ixon |
|
tc.c_iflag &= ~(tcflag_t) IXON; |
|
// no ixoff |
|
tc.c_iflag &= ~(tcflag_t) IXOFF; |
|
#ifdef IXANY |
|
// no ixany |
|
tc.c_iflag &= ~(tcflag_t) IXANY; |
|
#endif |
|
// no opost |
|
tc.c_oflag &= ~(tcflag_t) OPOST; |
|
// no isig |
|
tc.c_lflag &= ~(tcflag_t) ISIG; |
|
// no icanon |
|
tc.c_lflag &= ~(tcflag_t) ICANON; |
|
// no echo |
|
tc.c_lflag &= ~(tcflag_t) ECHO; |
|
// no echoe |
|
tc.c_lflag &= ~(tcflag_t) ECHOE; |
|
// no echok |
|
tc.c_lflag &= ~(tcflag_t) ECHOK; |
|
} |
} |
} |
} |
} |
|
|
break; |
// On sort si on a trouvé un paramètre |
|
// correct et donc différent de "NO RAW". |
|
|
|
if (!((negation == d_vrai) && |
|
(fonctions_constantes[fonction_courante * 2] |
|
== 5))) |
|
{ |
|
break; |
|
} |
} |
} |
} |
} |
|
|
if (fonctions[fonction_courante] == NULL) |
if (fonctions[fonction_courante] == NULL) |
{ |
{ |
|
// Paramètre inconnu |
free(parametre_courant_majuscule); |
free(parametre_courant_majuscule); |
liberation(s_etat_processus, s_objet_argument); |
liberation(s_etat_processus, s_objet_argument); |
liberation(s_etat_processus, s_objet_resultat); |
liberation(s_etat_processus, s_objet_resultat); |
Line 4379 instruction_open(struct_processus *s_eta
|
Line 4697 instruction_open(struct_processus *s_eta
|
* Traitement des sockets |
* Traitement des sockets |
*/ |
*/ |
|
|
|
|
inline logical1 options_socket() |
|
{ |
|
/* |
|
* Options des sockets |
|
*/ |
|
|
|
# define WARNING(message) \ |
|
if ((*s_etat_processus).langue != 'F') \ |
|
printf("+++Warning : %s unavailable on host system\n", \ |
|
message); \ |
|
else \ |
|
printf("+++Attention : %s non disponible sur le système " \ |
|
"hôte\n", message) |
|
|
|
if (options[d_BIND_TO_DEVICE] == 'Y') |
|
{ |
|
# ifdef SO_BINDTODEVICE |
|
if (setsockopt((*((struct_socket *) (*s_objet_resultat) |
|
.objet)).socket, SOL_SOCKET, SO_BINDTODEVICE, |
|
peripherique, (socklen_t) strlen(peripherique)) |
|
!= 0) |
|
{ |
|
liberation(s_etat_processus, s_objet_argument); |
|
liberation(s_etat_processus, s_objet_resultat); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_erreur_parametre_fichier; |
|
return(d_erreur); |
|
} |
|
# else |
|
WARNING("BIND TO DEVICE"); |
|
# endif |
|
} |
|
|
|
if (options[d_BROADCAST] == 'Y') |
|
{ |
|
if (setsockopt((*((struct_socket *) (*s_objet_resultat) |
|
.objet)).socket, SOL_SOCKET, SO_BROADCAST, |
|
&drapeau, sizeof(drapeau)) != 0) |
|
{ |
|
liberation(s_etat_processus, s_objet_argument); |
|
liberation(s_etat_processus, s_objet_resultat); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_erreur_parametre_fichier; |
|
return(d_erreur); |
|
} |
|
} |
|
|
|
if (options[d_DONT_ROUTE] == 'Y') |
|
{ |
|
if (setsockopt((*((struct_socket *) (*s_objet_resultat) |
|
.objet)).socket, SOL_SOCKET, SO_DONTROUTE, |
|
&drapeau, sizeof(drapeau)) != 0) |
|
{ |
|
liberation(s_etat_processus, s_objet_argument); |
|
liberation(s_etat_processus, s_objet_resultat); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_erreur_parametre_fichier; |
|
return(d_erreur); |
|
} |
|
} |
|
|
|
if (options[d_KEEP_ALIVE] == 'Y') |
|
{ |
|
if (setsockopt((*((struct_socket *) (*s_objet_resultat) |
|
.objet)).socket, SOL_SOCKET, SO_KEEPALIVE, |
|
&drapeau, sizeof(drapeau)) != 0) |
|
{ |
|
liberation(s_etat_processus, s_objet_argument); |
|
liberation(s_etat_processus, s_objet_resultat); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_erreur_parametre_fichier; |
|
return(d_erreur); |
|
} |
|
} |
|
|
|
if (options[d_PRIORITY] == 'Y') |
|
{ |
|
# ifdef SO_PRIORITY |
|
if (setsockopt((*((struct_socket *) (*s_objet_resultat) |
|
.objet)).socket, SOL_SOCKET, SO_PRIORITY, |
|
&priorite, sizeof(priorite)) != 0) |
|
{ |
|
liberation(s_etat_processus, s_objet_argument); |
|
liberation(s_etat_processus, s_objet_resultat); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_erreur_parametre_fichier; |
|
return(d_erreur); |
|
} |
|
# else |
|
WARNING("PRIORITY"); |
|
# endif |
|
} |
|
|
|
if (options[d_RECEIVE_BUFFER] == 'Y') |
|
{ |
|
if (setsockopt((*((struct_socket *) (*s_objet_resultat) |
|
.objet)).socket, SOL_SOCKET, SO_RCVBUF, |
|
&buffer_reception, sizeof(buffer_reception)) != 0) |
|
{ |
|
liberation(s_etat_processus, s_objet_argument); |
|
liberation(s_etat_processus, s_objet_resultat); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_erreur_parametre_fichier; |
|
return(d_erreur); |
|
} |
|
} |
|
|
|
if (options[d_FORCE_RECEIVE_BUFFER] == 'Y') |
|
{ |
|
# ifdef SO_RCVBUFFORCE |
|
if (setsockopt((*((struct_socket *) (*s_objet_resultat) |
|
.objet)).socket, SOL_SOCKET, SO_RCVBUFFORCE, |
|
&buffer_reception, sizeof(buffer_reception)) |
|
!= 0) |
|
{ |
|
liberation(s_etat_processus, s_objet_argument); |
|
liberation(s_etat_processus, s_objet_resultat); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_erreur_parametre_fichier; |
|
return(d_erreur); |
|
} |
|
# else |
|
WARNING("FORCE_RECEIVE_BUFFER"); |
|
# endif |
|
} |
|
|
|
if (options[d_SEND_BUFFER] == 'Y') |
|
{ |
|
if (setsockopt((*((struct_socket *) (*s_objet_resultat) |
|
.objet)).socket, SOL_SOCKET, SO_SNDBUF, |
|
&buffer_emission, sizeof(buffer_emission)) != 0) |
|
{ |
|
liberation(s_etat_processus, s_objet_argument); |
|
liberation(s_etat_processus, s_objet_resultat); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_erreur_parametre_fichier; |
|
return(d_erreur); |
|
} |
|
} |
|
|
|
if (options[d_FORCE_SEND_BUFFER] == 'Y') |
|
{ |
|
# ifdef SO_SNDBUFFORCE |
|
if (setsockopt((*((struct_socket *) (*s_objet_resultat) |
|
.objet)).socket, SOL_SOCKET, SO_SNDBUFFORCE, |
|
&buffer_emission, sizeof(buffer_emission)) != 0) |
|
{ |
|
liberation(s_etat_processus, s_objet_argument); |
|
liberation(s_etat_processus, s_objet_resultat); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_erreur_parametre_fichier; |
|
return(d_erreur); |
|
} |
|
# else |
|
WARNING("FORCE_SEND_BUFFER"); |
|
# endif |
|
} |
|
|
|
if (options[d_RECEIVING_TIMEOUT] == 'Y') |
|
{ |
|
if (setsockopt((*((struct_socket *) (*s_objet_resultat) |
|
.objet)).socket, SOL_SOCKET, SO_RCVTIMEO, |
|
&timeout_reception, sizeof(timeout_reception)) != 0) |
|
{ |
|
liberation(s_etat_processus, s_objet_argument); |
|
liberation(s_etat_processus, s_objet_resultat); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_erreur_parametre_fichier; |
|
return(d_erreur); |
|
} |
|
} |
|
|
|
if (options[d_SENDING_TIMEOUT] == 'Y') |
|
{ |
|
if (setsockopt((*((struct_socket *) (*s_objet_resultat) |
|
.objet)).socket, SOL_SOCKET, SO_SNDTIMEO, |
|
&timeout_emission, sizeof(timeout_emission)) != 0) |
|
{ |
|
liberation(s_etat_processus, s_objet_argument); |
|
liberation(s_etat_processus, s_objet_resultat); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_erreur_parametre_fichier; |
|
return(d_erreur); |
|
} |
|
} |
|
|
|
if (options[d_REUSE_ADDRESS] == 'Y') |
|
{ |
|
if (setsockopt((*((struct_socket *) (*s_objet_resultat) |
|
.objet)).socket, SOL_SOCKET, SO_REUSEADDR, |
|
&drapeau, sizeof(drapeau)) != 0) |
|
{ |
|
liberation(s_etat_processus, s_objet_argument); |
|
liberation(s_etat_processus, s_objet_resultat); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_erreur_parametre_fichier; |
|
return(d_erreur); |
|
} |
|
} |
|
|
|
return(d_absence_erreur); |
|
#undef WARNING |
|
} |
|
|
|
/* |
/* |
* Vérification de la cohérence des arguments et traitement |
* Vérification de la cohérence des arguments et traitement |
* des valeurs par défaut. |
* des valeurs par défaut. |
Line 4873 instruction_open(struct_processus *s_eta
|
Line 4974 instruction_open(struct_processus *s_eta
|
= 'Y'; |
= 'Y'; |
(*((struct_socket *) (*s_objet_resultat).objet)).socket_connectee |
(*((struct_socket *) (*s_objet_resultat).objet)).socket_connectee |
= d_faux; |
= d_faux; |
|
(*((struct_socket *) (*s_objet_resultat).objet)).options = 0; |
|
|
if (type_domaine == 'L') |
if (type_domaine == 'L') |
{ // Socket serveur |
{ // Socket serveur |
Line 4912 instruction_open(struct_processus *s_eta
|
Line 5014 instruction_open(struct_processus *s_eta
|
strncpy(socket_unix.sun_path, pointeur, UNIX_PATH_MAX); |
strncpy(socket_unix.sun_path, pointeur, UNIX_PATH_MAX); |
socket_unix.sun_path[UNIX_PATH_MAX - 1] = d_code_fin_chaine; |
socket_unix.sun_path[UNIX_PATH_MAX - 1] = d_code_fin_chaine; |
|
|
if (options_socket() == d_erreur) |
if (options_socket(s_etat_processus, s_objet_resultat, |
|
options, peripherique, &priorite, |
|
&buffer_emission, &buffer_reception, |
|
&timeout_emission, &timeout_reception) == d_erreur) |
{ |
{ |
liberation(s_etat_processus, s_objet_argument); |
liberation(s_etat_processus, s_objet_argument); |
liberation(s_etat_processus, s_objet_resultat); |
liberation(s_etat_processus, s_objet_resultat); |
Line 5016 instruction_open(struct_processus *s_eta
|
Line 5121 instruction_open(struct_processus *s_eta
|
(*resolution_courante).ai_addr)) |
(*resolution_courante).ai_addr)) |
.sin_addr.s_addr; |
.sin_addr.s_addr; |
|
|
if (options_socket() == d_erreur) |
if (options_socket(s_etat_processus, |
|
s_objet_resultat, |
|
options, peripherique, &priorite, |
|
&buffer_emission, &buffer_reception, |
|
&timeout_emission, &timeout_reception) |
|
== d_erreur) |
{ |
{ |
liberation(s_etat_processus, s_objet_argument); |
liberation(s_etat_processus, s_objet_argument); |
liberation(s_etat_processus, s_objet_resultat); |
liberation(s_etat_processus, s_objet_resultat); |
Line 5043 instruction_open(struct_processus *s_eta
|
Line 5153 instruction_open(struct_processus *s_eta
|
.objet)).adresse); |
.objet)).adresse); |
|
|
if (((*((struct_socket *) (*s_objet_resultat) |
if (((*((struct_socket *) (*s_objet_resultat) |
.objet)).adresse = malloc(22 * |
.objet)).adresse = malloc(23 * |
sizeof(unsigned char))) == NULL) |
sizeof(unsigned char))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
Line 5052 instruction_open(struct_processus *s_eta
|
Line 5162 instruction_open(struct_processus *s_eta
|
} |
} |
|
|
sprintf((*((struct_socket *) (*s_objet_resultat) |
sprintf((*((struct_socket *) (*s_objet_resultat) |
.objet)).adresse, "%d.%d.%d.%d", |
.objet)).adresse, "%d.%d.%d.%d(%u)", |
(ntohl((*((struct sockaddr_in *) |
(ntohl((*((struct sockaddr_in *) |
(*resolution_courante).ai_addr)).sin_addr |
(*resolution_courante).ai_addr)).sin_addr |
.s_addr) >> 24) & 0xFF, |
.s_addr) >> 24) & 0xFF, |
Line 5064 instruction_open(struct_processus *s_eta
|
Line 5174 instruction_open(struct_processus *s_eta
|
.s_addr) >> 8) & 0xFF, |
.s_addr) >> 8) & 0xFF, |
ntohl((*((struct sockaddr_in *) |
ntohl((*((struct sockaddr_in *) |
(*resolution_courante).ai_addr)).sin_addr |
(*resolution_courante).ai_addr)).sin_addr |
.s_addr) & 0xFF); |
.s_addr) & 0xFF, |
|
(unsigned int) port); |
} |
} |
else |
else |
{ // Accès en IPv6 |
{ // Accès en IPv6 |
Line 5123 instruction_open(struct_processus *s_eta
|
Line 5234 instruction_open(struct_processus *s_eta
|
(*resolution_courante).ai_addr)) |
(*resolution_courante).ai_addr)) |
.sin6_addr.s6_addr[i], i++); |
.sin6_addr.s6_addr[i], i++); |
|
|
if (options_socket() == d_erreur) |
if (options_socket(s_etat_processus, |
|
s_objet_resultat, |
|
options, peripherique, &priorite, |
|
&buffer_emission, &buffer_reception, |
|
&timeout_emission, &timeout_reception) |
|
== d_erreur) |
{ |
{ |
liberation(s_etat_processus, s_objet_argument); |
liberation(s_etat_processus, s_objet_argument); |
liberation(s_etat_processus, s_objet_resultat); |
liberation(s_etat_processus, s_objet_resultat); |
Line 5149 instruction_open(struct_processus *s_eta
|
Line 5265 instruction_open(struct_processus *s_eta
|
free((*((struct_socket *) (*s_objet_resultat) |
free((*((struct_socket *) (*s_objet_resultat) |
.objet)).adresse); |
.objet)).adresse); |
|
|
|
/* |
|
* Longueur de la chaîne : |
|
* Adresse IPv6 : 16 octets soit 128 bits. |
|
* => 32 chiffres en hexadécimal |
|
* Par groupe de 4, 8 groupes |
|
* => 7 ":" |
|
* Port : (%u) |
|
* => 7 |
|
* ==> 32 + 7 + 7 + 1 = 47 |
|
*/ |
|
|
if (((*((struct_socket *) (*s_objet_resultat) |
if (((*((struct_socket *) (*s_objet_resultat) |
.objet)).adresse = malloc(55 * |
.objet)).adresse = malloc(47 * |
sizeof(unsigned char))) == NULL) |
sizeof(unsigned char))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
Line 5158 instruction_open(struct_processus *s_eta
|
Line 5285 instruction_open(struct_processus *s_eta
|
return; |
return; |
} |
} |
|
|
for(i = 0; i < 16; i++) |
sprintf((*((struct_socket *) (*s_objet_resultat) |
{ |
.objet)).adresse, |
sprintf((*((struct_socket *) (*s_objet_resultat) |
"%02X%02X:%02X%02X:%02X%02X:%02X%02X:" |
.objet)).adresse, |
"%02X%02X:%02X%02X:%02X%02X:%02X%02X(%u)", |
(i == 0) ? "%s%X" : "%s:%X", |
(*((struct sockaddr_in6 *) |
(*((struct_socket *) (*s_objet_resultat) |
(*resolution_courante).ai_addr)).sin6_addr |
.objet)).adresse, |
.s6_addr[0], |
(*((struct sockaddr_in6 *) |
(*((struct sockaddr_in6 *) |
(*resolution_courante).ai_addr)) |
(*resolution_courante).ai_addr)).sin6_addr |
.sin6_addr.s6_addr[i]); |
.s6_addr[1], |
} |
(*((struct sockaddr_in6 *) |
|
(*resolution_courante).ai_addr)).sin6_addr |
|
.s6_addr[2], |
|
(*((struct sockaddr_in6 *) |
|
(*resolution_courante).ai_addr)).sin6_addr |
|
.s6_addr[3], |
|
(*((struct sockaddr_in6 *) |
|
(*resolution_courante).ai_addr)).sin6_addr |
|
.s6_addr[4], |
|
(*((struct sockaddr_in6 *) |
|
(*resolution_courante).ai_addr)).sin6_addr |
|
.s6_addr[5], |
|
(*((struct sockaddr_in6 *) |
|
(*resolution_courante).ai_addr)).sin6_addr |
|
.s6_addr[6], |
|
(*((struct sockaddr_in6 *) |
|
(*resolution_courante).ai_addr)).sin6_addr |
|
.s6_addr[7], |
|
(*((struct sockaddr_in6 *) |
|
(*resolution_courante).ai_addr)).sin6_addr |
|
.s6_addr[8], |
|
(*((struct sockaddr_in6 *) |
|
(*resolution_courante).ai_addr)).sin6_addr |
|
.s6_addr[9], |
|
(*((struct sockaddr_in6 *) |
|
(*resolution_courante).ai_addr)).sin6_addr |
|
.s6_addr[10], |
|
(*((struct sockaddr_in6 *) |
|
(*resolution_courante).ai_addr)).sin6_addr |
|
.s6_addr[11], |
|
(*((struct sockaddr_in6 *) |
|
(*resolution_courante).ai_addr)).sin6_addr |
|
.s6_addr[12], |
|
(*((struct sockaddr_in6 *) |
|
(*resolution_courante).ai_addr)).sin6_addr |
|
.s6_addr[13], |
|
(*((struct sockaddr_in6 *) |
|
(*resolution_courante).ai_addr)).sin6_addr |
|
.s6_addr[14], |
|
(*((struct sockaddr_in6 *) |
|
(*resolution_courante).ai_addr)).sin6_addr |
|
.s6_addr[15], |
|
(unsigned int) port); |
# else |
# else |
if ((*s_etat_processus).langue == 'F') |
if ((*s_etat_processus).langue == 'F') |
{ |
{ |
Line 5193 instruction_open(struct_processus *s_eta
|
Line 5362 instruction_open(struct_processus *s_eta
|
} |
} |
|
|
freeaddrinfo(resolution); |
freeaddrinfo(resolution); |
|
|
sprintf((*((struct_socket *) (*s_objet_resultat) |
|
.objet)).adresse, "%s(%u)", |
|
(*((struct_socket *) (*s_objet_resultat) |
|
.objet)).adresse, (unsigned int) port); |
|
} |
} |
else |
else |
{ // Hôte défini par une adresse |
{ // Hôte défini par une adresse |
Line 5207 instruction_open(struct_processus *s_eta
|
Line 5371 instruction_open(struct_processus *s_eta
|
.objet)).adresse); |
.objet)).adresse); |
|
|
if (((*((struct_socket *) (*s_objet_resultat) |
if (((*((struct_socket *) (*s_objet_resultat) |
.objet)).adresse = malloc(22 * |
.objet)).adresse = malloc(23 * |
sizeof(unsigned char))) == NULL) |
sizeof(unsigned char))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
Line 5215 instruction_open(struct_processus *s_eta
|
Line 5379 instruction_open(struct_processus *s_eta
|
return; |
return; |
} |
} |
|
|
(*((struct_socket *) (*s_objet_resultat).objet)) |
|
.adresse[0] = d_code_fin_chaine; |
|
|
|
for(i = 0; i < 4; i++) |
|
{ |
|
sprintf((*((struct_socket *) (*s_objet_resultat) |
|
.objet)).adresse, |
|
(i == 0) ? "%s%d" : "%s.%d", |
|
(*((struct_socket *) (*s_objet_resultat) |
|
.objet)).adresse, (int) adresse[i]); |
|
} |
|
|
|
sprintf((*((struct_socket *) (*s_objet_resultat) |
sprintf((*((struct_socket *) (*s_objet_resultat) |
.objet)).adresse, "%s(%u)", |
.objet)).adresse, "%d.%d.%d.%d(%u)", |
(*((struct_socket *) (*s_objet_resultat) |
(int) adresse[0], (int) adresse[1], |
.objet)).adresse, (unsigned int) port); |
(int) adresse[2], (int) adresse[3], |
|
(unsigned int) port); |
|
|
if (((*((struct_socket *) |
if (((*((struct_socket *) |
(*s_objet_resultat).objet)) |
(*s_objet_resultat).objet)) |
Line 5259 instruction_open(struct_processus *s_eta
|
Line 5412 instruction_open(struct_processus *s_eta
|
|
|
socket_ipv4.sin_addr.s_addr = htonl(adresse_ipv4); |
socket_ipv4.sin_addr.s_addr = htonl(adresse_ipv4); |
|
|
if (options_socket() == d_erreur) |
if (options_socket(s_etat_processus, |
|
s_objet_resultat, |
|
options, peripherique, &priorite, |
|
&buffer_emission, &buffer_reception, |
|
&timeout_emission, &timeout_reception) |
|
== d_erreur) |
{ |
{ |
liberation(s_etat_processus, s_objet_argument); |
liberation(s_etat_processus, s_objet_argument); |
liberation(s_etat_processus, s_objet_resultat); |
liberation(s_etat_processus, s_objet_resultat); |
Line 5286 instruction_open(struct_processus *s_eta
|
Line 5444 instruction_open(struct_processus *s_eta
|
.objet)).adresse); |
.objet)).adresse); |
|
|
if (((*((struct_socket *) (*s_objet_resultat) |
if (((*((struct_socket *) (*s_objet_resultat) |
.objet)).adresse = malloc(55 * |
.objet)).adresse = malloc(47 * |
sizeof(unsigned char))) == NULL) |
sizeof(unsigned char))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
Line 5294 instruction_open(struct_processus *s_eta
|
Line 5452 instruction_open(struct_processus *s_eta
|
return; |
return; |
} |
} |
|
|
(*((struct_socket *) (*s_objet_resultat).objet)) |
|
.adresse[0] = d_code_fin_chaine; |
|
|
|
for(i = 0; i < 16; i++) |
|
{ |
|
sprintf((*((struct_socket *) (*s_objet_resultat) |
|
.objet)).adresse, |
|
(i == 0) ? "%s%X" : "%s:%X", |
|
(*((struct_socket *) (*s_objet_resultat) |
|
.objet)).adresse, (unsigned int) |
|
adresse[i]); |
|
} |
|
|
|
sprintf((*((struct_socket *) (*s_objet_resultat) |
sprintf((*((struct_socket *) (*s_objet_resultat) |
.objet)).adresse, "%s(%u)", |
.objet)).adresse, |
(*((struct_socket *) (*s_objet_resultat) |
"%02X%02X:%02X%02X:%02X%02X:%02X%02X:" |
.objet)).adresse, (unsigned int) port); |
"%02X%02X:%02X%02X:%02X%02X:%02X%02X(%u)", |
|
(unsigned int) adresse[0], |
|
(unsigned int) adresse[1], |
|
(unsigned int) adresse[2], |
|
(unsigned int) adresse[3], |
|
(unsigned int) adresse[4], |
|
(unsigned int) adresse[5], |
|
(unsigned int) adresse[6], |
|
(unsigned int) adresse[7], |
|
(unsigned int) adresse[8], |
|
(unsigned int) adresse[9], |
|
(unsigned int) adresse[10], |
|
(unsigned int) adresse[11], |
|
(unsigned int) adresse[12], |
|
(unsigned int) adresse[13], |
|
(unsigned int) adresse[14], |
|
(unsigned int) adresse[15], |
|
(unsigned int) port); |
|
|
if (((*((struct_socket *) |
if (((*((struct_socket *) |
(*s_objet_resultat).objet)) |
(*s_objet_resultat).objet)) |
Line 5336 instruction_open(struct_processus *s_eta
|
Line 5498 instruction_open(struct_processus *s_eta
|
socket_ipv6.sin6_addr.s6_addr[i] = |
socket_ipv6.sin6_addr.s6_addr[i] = |
(unsigned char) (adresse[i]), i++); |
(unsigned char) (adresse[i]), i++); |
|
|
if (options_socket() == d_erreur) |
if (options_socket(s_etat_processus, |
|
s_objet_resultat, |
|
options, peripherique, &priorite, |
|
&buffer_emission, &buffer_reception, |
|
&timeout_emission, &timeout_reception) |
|
== d_erreur) |
{ |
{ |
liberation(s_etat_processus, s_objet_argument); |
liberation(s_etat_processus, s_objet_argument); |
liberation(s_etat_processus, s_objet_resultat); |
liberation(s_etat_processus, s_objet_resultat); |
Line 5610 instruction_open(struct_processus *s_eta
|
Line 5777 instruction_open(struct_processus *s_eta
|
.objet)).adresse); |
.objet)).adresse); |
|
|
if (((*((struct_socket *) (*s_objet_resultat) |
if (((*((struct_socket *) (*s_objet_resultat) |
.objet)).adresse = malloc(22 * |
.objet)).adresse = malloc(23 * |
sizeof(unsigned char))) == NULL) |
sizeof(unsigned char))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
Line 5619 instruction_open(struct_processus *s_eta
|
Line 5786 instruction_open(struct_processus *s_eta
|
} |
} |
|
|
sprintf((*((struct_socket *) (*s_objet_resultat) |
sprintf((*((struct_socket *) (*s_objet_resultat) |
.objet)).adresse, "%d.%d.%d.%d", |
.objet)).adresse, "%d.%d.%d.%d(%u)", |
(ntohl((*((struct sockaddr_in *) |
(ntohl((*((struct sockaddr_in *) |
(*resolution_courante).ai_addr)).sin_addr |
(*resolution_courante).ai_addr)).sin_addr |
.s_addr) >> 24) & 0xFF, |
.s_addr) >> 24) & 0xFF, |
Line 5631 instruction_open(struct_processus *s_eta
|
Line 5798 instruction_open(struct_processus *s_eta
|
.s_addr) >> 8) & 0xFF, |
.s_addr) >> 8) & 0xFF, |
ntohl((*((struct sockaddr_in *) |
ntohl((*((struct sockaddr_in *) |
(*resolution_courante).ai_addr)).sin_addr |
(*resolution_courante).ai_addr)).sin_addr |
.s_addr) & 0xFF); |
.s_addr) & 0xFF, |
|
(unsigned int) port); |
} |
} |
else |
else |
{ // Accès en IPv6 |
{ // Accès en IPv6 |
Line 5719 instruction_open(struct_processus *s_eta
|
Line 5887 instruction_open(struct_processus *s_eta
|
.objet)).adresse); |
.objet)).adresse); |
|
|
if (((*((struct_socket *) (*s_objet_resultat) |
if (((*((struct_socket *) (*s_objet_resultat) |
.objet)).adresse = malloc(55 * |
.objet)).adresse = malloc(47 * |
sizeof(unsigned char))) == NULL) |
sizeof(unsigned char))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
Line 5727 instruction_open(struct_processus *s_eta
|
Line 5895 instruction_open(struct_processus *s_eta
|
return; |
return; |
} |
} |
|
|
for(i = 0; i < 16; i++) |
sprintf((*((struct_socket *) (*s_objet_resultat) |
{ |
.objet)).adresse, |
sprintf((*((struct_socket *) (*s_objet_resultat) |
"%02X%02X:%02X%02X:%02X%02X:%02X%02X:" |
.objet)).adresse, |
"%02X%02X:%02X%02X:%02X%02X:%02X%02X(%u)", |
(i == 0) ? "%s%X" : "%s:%X", |
(*((struct sockaddr_in6 *) |
(*((struct_socket *) (*s_objet_resultat) |
(*resolution_courante).ai_addr)).sin6_addr |
.objet)).adresse, |
.s6_addr[0], |
(*((struct sockaddr_in6 *) |
(*((struct sockaddr_in6 *) |
(*resolution_courante).ai_addr)) |
(*resolution_courante).ai_addr)).sin6_addr |
.sin6_addr.s6_addr[i]); |
.s6_addr[1], |
} |
(*((struct sockaddr_in6 *) |
|
(*resolution_courante).ai_addr)).sin6_addr |
|
.s6_addr[2], |
|
(*((struct sockaddr_in6 *) |
|
(*resolution_courante).ai_addr)).sin6_addr |
|
.s6_addr[3], |
|
(*((struct sockaddr_in6 *) |
|
(*resolution_courante).ai_addr)).sin6_addr |
|
.s6_addr[4], |
|
(*((struct sockaddr_in6 *) |
|
(*resolution_courante).ai_addr)).sin6_addr |
|
.s6_addr[5], |
|
(*((struct sockaddr_in6 *) |
|
(*resolution_courante).ai_addr)).sin6_addr |
|
.s6_addr[6], |
|
(*((struct sockaddr_in6 *) |
|
(*resolution_courante).ai_addr)).sin6_addr |
|
.s6_addr[7], |
|
(*((struct sockaddr_in6 *) |
|
(*resolution_courante).ai_addr)).sin6_addr |
|
.s6_addr[8], |
|
(*((struct sockaddr_in6 *) |
|
(*resolution_courante).ai_addr)).sin6_addr |
|
.s6_addr[9], |
|
(*((struct sockaddr_in6 *) |
|
(*resolution_courante).ai_addr)).sin6_addr |
|
.s6_addr[10], |
|
(*((struct sockaddr_in6 *) |
|
(*resolution_courante).ai_addr)).sin6_addr |
|
.s6_addr[11], |
|
(*((struct sockaddr_in6 *) |
|
(*resolution_courante).ai_addr)).sin6_addr |
|
.s6_addr[12], |
|
(*((struct sockaddr_in6 *) |
|
(*resolution_courante).ai_addr)).sin6_addr |
|
.s6_addr[13], |
|
(*((struct sockaddr_in6 *) |
|
(*resolution_courante).ai_addr)).sin6_addr |
|
.s6_addr[14], |
|
(*((struct sockaddr_in6 *) |
|
(*resolution_courante).ai_addr)).sin6_addr |
|
.s6_addr[15], |
|
(unsigned int) port); |
# else |
# else |
if ((*s_etat_processus).langue == 'F') |
if ((*s_etat_processus).langue == 'F') |
{ |
{ |
Line 5762 instruction_open(struct_processus *s_eta
|
Line 5972 instruction_open(struct_processus *s_eta
|
} |
} |
|
|
freeaddrinfo(resolution); |
freeaddrinfo(resolution); |
|
|
sprintf((*((struct_socket *) (*s_objet_resultat) |
|
.objet)).adresse, "%s(%u)", |
|
(*((struct_socket *) (*s_objet_resultat) |
|
.objet)).adresse, (unsigned int) port); |
|
} |
} |
else |
else |
{ // Hôte défini par une adresse |
{ // Hôte défini par une adresse |
Line 5778 instruction_open(struct_processus *s_eta
|
Line 5983 instruction_open(struct_processus *s_eta
|
.objet)).adresse); |
.objet)).adresse); |
|
|
if (((*((struct_socket *) (*s_objet_resultat) |
if (((*((struct_socket *) (*s_objet_resultat) |
.objet)).adresse = malloc(22 * |
.objet)).adresse = malloc(23 * |
sizeof(unsigned char))) == NULL) |
sizeof(unsigned char))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
Line 5786 instruction_open(struct_processus *s_eta
|
Line 5991 instruction_open(struct_processus *s_eta
|
return; |
return; |
} |
} |
|
|
(*((struct_socket *) (*s_objet_resultat).objet)) |
|
.adresse[0] = d_code_fin_chaine; |
|
|
|
for(i = 0; i < 4; i++) |
|
{ |
|
sprintf((*((struct_socket *) |
|
(*s_objet_resultat).objet)).adresse, |
|
(i == 0) ? "%s%d" : "%s.%d", |
|
(*((struct_socket *) |
|
(*s_objet_resultat) |
|
.objet)).adresse, (int) adresse[i]); |
|
} |
|
|
|
sprintf((*((struct_socket *) (*s_objet_resultat) |
sprintf((*((struct_socket *) (*s_objet_resultat) |
.objet)).adresse, "%s(%u)", |
.objet)).adresse, "%d.%d.%d.%d(%u)", |
(*((struct_socket *) (*s_objet_resultat) |
(int) adresse[0], (int) adresse[1], |
.objet)).adresse, (unsigned int) port); |
(int) adresse[2], (int) adresse[3], |
|
(unsigned int) port); |
} |
} |
else |
else |
{ |
{ |
Line 5881 instruction_open(struct_processus *s_eta
|
Line 6074 instruction_open(struct_processus *s_eta
|
.objet)).adresse); |
.objet)).adresse); |
|
|
if (((*((struct_socket *) (*s_objet_resultat) |
if (((*((struct_socket *) (*s_objet_resultat) |
.objet)).adresse = malloc(55 * |
.objet)).adresse = malloc(47 * |
sizeof(unsigned char))) == NULL) |
sizeof(unsigned char))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
Line 5889 instruction_open(struct_processus *s_eta
|
Line 6082 instruction_open(struct_processus *s_eta
|
return; |
return; |
} |
} |
|
|
(*((struct_socket *) (*s_objet_resultat).objet)) |
|
.adresse[0] = d_code_fin_chaine; |
|
|
|
for(i = 0; i < 16; i++) |
|
{ |
|
sprintf((*((struct_socket *) |
|
(*s_objet_resultat).objet)).adresse, |
|
(i == 0) ? "%s%X" : "%s:%X", |
|
(*((struct_socket *) |
|
(*s_objet_resultat) |
|
.objet)).adresse, (unsigned int) |
|
adresse[i]); |
|
} |
|
|
|
sprintf((*((struct_socket *) (*s_objet_resultat) |
sprintf((*((struct_socket *) (*s_objet_resultat) |
.objet)).adresse, "%s(%u)", |
.objet)).adresse, |
(*((struct_socket *) (*s_objet_resultat) |
"%02X%02X:%02X%02X:%02X%02X:%02X%02X:" |
.objet)).adresse, (unsigned int) port); |
"%02X%02X:%02X%02X:%02X%02X:%02X%02X" |
|
"(%u)", |
|
(unsigned int) adresse[0], |
|
(unsigned int) adresse[1], |
|
(unsigned int) adresse[2], |
|
(unsigned int) adresse[3], |
|
(unsigned int) adresse[4], |
|
(unsigned int) adresse[5], |
|
(unsigned int) adresse[6], |
|
(unsigned int) adresse[7], |
|
(unsigned int) adresse[8], |
|
(unsigned int) adresse[9], |
|
(unsigned int) adresse[10], |
|
(unsigned int) adresse[11], |
|
(unsigned int) adresse[12], |
|
(unsigned int) adresse[13], |
|
(unsigned int) adresse[14], |
|
(unsigned int) adresse[15], |
|
(unsigned int) port); |
} |
} |
else |
else |
{ |
{ |