version 1.49, 2012/02/29 12:07:47
|
version 1.60, 2012/10/01 11:05:05
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.1.6 |
RPL/2 (R) version 4.1.11 |
Copyright (C) 1989-2012 Dr. BERTRAND Joël |
Copyright (C) 1989-2012 Dr. BERTRAND Joël |
|
|
This file is part of RPL/2. |
This file is part of RPL/2. |
Line 1031 instruction_open(struct_processus *s_eta
|
Line 1031 instruction_open(struct_processus *s_eta
|
" { \"stty\" { \"stty parameters\" ... } } } OPEN\n"); |
" { \"stty\" { \"stty parameters\" ... } } } OPEN\n"); |
printf(" { \"sockettype\" { \"name\" \"local name\" } } OPEN\n"); |
printf(" { \"sockettype\" { \"name\" \"local name\" } } OPEN\n"); |
printf(" { \"sockettype\" \"socketdomain\" \"protection\" } OPEN\n"); |
printf(" { \"sockettype\" \"socketdomain\" \"protection\" } OPEN\n"); |
printf(" \"/semaphore\" OPEN\n"); |
printf(" \"/semaphore\" OPEN\n\n"); |
|
|
printf(" File type : NEW/OLD/REPLACE/UNKNOWN/SCRATCH\n"); |
printf(" File type : NEW/OLD/REPLACE/UNKNOWN/SCRATCH\n"); |
printf(" File access : SEQUENTIAL/DIRECT/KEYED\n"); |
printf(" File access : SEQUENTIAL/DIRECT/KEYED\n"); |
Line 1069 instruction_open(struct_processus *s_eta
|
Line 1069 instruction_open(struct_processus *s_eta
|
printf(" Port : { \"PORT\" port number }\n"); |
printf(" Port : { \"PORT\" port number }\n"); |
printf(" Protocol : { \"PROTOCOL\" \"protocol\" }\n\n"); |
printf(" Protocol : { \"PROTOCOL\" \"protocol\" }\n\n"); |
|
|
printf(" { { \"NAME\" \"filename\" } } OPEN\n"); |
printf(" { { \"NAME\" \"filename\" } \"SEQUENTIAL\" } OPEN\n"); |
printf(" { \"SCRATCH\" } OPEN\n"); |
printf(" { \"SCRATCH\" } OPEN\n"); |
printf(" { { \"NAME\" \"filename\" } \"UNKNOWN\" \"FORMATTED\" " |
printf(" { { \"NAME\" \"filename\" } \"UNKNOWN\" \"FORMATTED\" " |
"\"DIRECT\" } OPEN\n"); |
"\"DIRECT\" } OPEN\n"); |
Line 2731 instruction_open(struct_processus *s_eta
|
Line 2731 instruction_open(struct_processus *s_eta
|
l_element_courant = (*l_element_courant).suivant; |
l_element_courant = (*l_element_courant).suivant; |
} |
} |
|
|
|
// Si aucun paramètre n'est discriminant, l'instruction ouvre |
|
// par défaut un fichier. |
|
|
|
if (type_arguments == ' ') |
|
{ |
|
type_arguments = 'F'; |
|
} |
|
|
if (type_arguments == 'F') |
if (type_arguments == 'F') |
{ |
{ |
/* |
/* |
Line 3651 instruction_open(struct_processus *s_eta
|
Line 3659 instruction_open(struct_processus *s_eta
|
unsigned char *vitesses[] = |
unsigned char *vitesses[] = |
{ "0", "50", "75", "110", "134", "150", |
{ "0", "50", "75", "110", "134", "150", |
"200", "300", "600", "1200", "1800", "2400", |
"200", "300", "600", "1200", "1800", "2400", |
"4800", "9600", "19200", "38400", "57600", |
"4800", "9600", "19200", "38400", |
"115200", "230400", NULL }; |
#ifdef B57600 |
|
"57600", |
|
#endif |
|
#ifdef B115200 |
|
"115200", |
|
#endif |
|
#ifdef B230400 |
|
"230400", |
|
#endif |
|
NULL }; |
int vitesses_constantes[] = |
int vitesses_constantes[] = |
{ B0, B50, B75, B110, B134, B150, B200, B300, B600, |
{ B0, B50, B75, B110, B134, B150, B200, B300, B600, |
B1200, B1800, B2400, B4800, B9600, B19200, B38400, |
B1200, B1800, B2400, B4800, B9600, B19200, B38400, |
B57600, B115200, B230400, 0 }; |
#ifdef B57600 |
|
B57600, |
|
#endif |
|
#ifdef B115200 |
|
B115200, |
|
#endif |
|
#ifdef B230400 |
|
B230400, |
|
#endif |
|
0 }; |
unsigned int vitesse_courante; |
unsigned int vitesse_courante; |
|
|
vitesse_courante = 0; |
vitesse_courante = 0; |
Line 3669 instruction_open(struct_processus *s_eta
|
Line 3695 instruction_open(struct_processus *s_eta
|
if (position[strlen(vitesses[vitesse_courante])] == |
if (position[strlen(vitesses[vitesse_courante])] == |
d_code_espace) |
d_code_espace) |
{ |
{ |
|
#ifdef CBAUD |
tc.c_cflag &= ~CBAUD; |
tc.c_cflag &= ~CBAUD; |
tc.c_cflag |= vitesses_constantes[vitesse_courante]; |
tc.c_cflag |= vitesses_constantes[vitesse_courante]; |
|
#else // POSIX |
|
cfsetispeed(&tc, |
|
vitesses_constantes[vitesse_courante]); |
|
cfsetospeed(&tc, |
|
vitesses_constantes[vitesse_courante]); |
|
#endif |
position += strlen(vitesses[vitesse_courante]); |
position += strlen(vitesses[vitesse_courante]); |
|
|
break; |
break; |
Line 3914 instruction_open(struct_processus *s_eta
|
Line 3947 instruction_open(struct_processus *s_eta
|
unsigned char *fonctions[] = |
unsigned char *fonctions[] = |
{ "IGNBRK", "BRKINT", "IGNPAR", "PARMRK", |
{ "IGNBRK", "BRKINT", "IGNPAR", "PARMRK", |
"INPCK", "ISTRIP", "INLCR", "IGNCR", "ICRNL", |
"INPCK", "ISTRIP", "INLCR", "IGNCR", "ICRNL", |
"IXON", "IXANY", "IXOFF", "OPOST", |
"IXON", |
|
#ifdef IXANY |
|
"IXANY", |
|
#endif |
|
"IXOFF", "OPOST", |
"ONLCR", "OCRNL", "ONOCR", "ONLRET", |
"ONLCR", "OCRNL", "ONOCR", "ONLRET", |
"OFILL", "HUPCL", "CLOCAL", "CRTSCTS", |
#ifdef OFILL |
|
"OFILL", |
|
#endif |
|
"HUPCL", "CLOCAL", |
|
#ifdef CRTSCTS |
|
"CRTSCTS", |
|
#endif |
"ISIG", "ICANON", "ECHO", "ECHOE", "ECHOK", |
"ISIG", "ICANON", "ECHO", "ECHOE", "ECHOK", |
"ECHONL", "NOFLSH", "TOSTOP", "IEXTEN", NULL }; |
"ECHONL", "NOFLSH", "TOSTOP", "IEXTEN", NULL }; |
int fonctions_constantes[] = |
int fonctions_constantes[] = |
{ /* c_iflag */ |
{ /* c_iflag */ |
1, IGNBRK, 1, BRKINT, 1, IGNPAR, 1, PARMRK, |
1, IGNBRK, 1, BRKINT, 1, IGNPAR, 1, PARMRK, |
1, INPCK, 1, ISTRIP, 1, INLCR, 1, IGNCR, 1, ICRNL, |
1, INPCK, 1, ISTRIP, 1, INLCR, 1, IGNCR, 1, ICRNL, |
1, IXON, 1, IXANY, 1, IXOFF, |
1, IXON, |
|
#ifdef IXANY |
|
1, IXANY, |
|
#endif |
|
1, IXOFF, |
/* c_oflag */ |
/* c_oflag */ |
2 , OPOST, 2, ONLCR, 2, OCRNL, 2, ONOCR, 2, ONLRET, |
2 , OPOST, 2, ONLCR, 2, OCRNL, 2, ONOCR, 2, ONLRET, |
2, OFILL, 2, HUPCL, |
#ifdef OFILL |
|
2, OFILL, |
|
#endif |
|
2, HUPCL, |
/* c_cflag */ |
/* c_cflag */ |
3, CLOCAL, 3, CRTSCTS, |
3, CLOCAL, |
|
#ifdef CRTSCTS |
|
3, CRTSCTS, |
|
#endif |
/* c_lfkag */ |
/* c_lfkag */ |
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 }; |
Line 4682 instruction_open(struct_processus *s_eta
|
Line 4735 instruction_open(struct_processus *s_eta
|
if (strcmp(protocole_socket, "IPV4") == 0) |
if (strcmp(protocole_socket, "IPV4") == 0) |
{ |
{ |
protocole_socket[2] = d_code_fin_chaine; |
protocole_socket[2] = d_code_fin_chaine; |
|
protocole_numerique = 0; |
} |
} |
|
else |
if ((s_protocole = getprotobyname(protocole_socket)) == NULL) |
|
{ |
{ |
liberation(s_etat_processus, s_objet_argument); |
if ((s_protocole = getprotobyname(protocole_socket)) |
|
== NULL) |
|
{ |
|
liberation(s_etat_processus, s_objet_argument); |
|
|
(*s_etat_processus).erreur_execution = |
(*s_etat_processus).erreur_execution = |
d_ex_erreur_parametre_fichier; |
d_ex_erreur_parametre_fichier; |
return; |
return; |
} |
} |
|
|
protocole_numerique = (*s_protocole).p_proto; |
protocole_numerique = (*s_protocole).p_proto; |
|
} |
} |
} |
|
|
if ((s_objet_resultat = allocation(s_etat_processus, SCK)) |
if ((s_objet_resultat = allocation(s_etat_processus, SCK)) |
Line 4715 instruction_open(struct_processus *s_eta
|
Line 4772 instruction_open(struct_processus *s_eta
|
= protection; |
= protection; |
(*(*((struct_socket *) (*s_objet_resultat).objet)) |
(*(*((struct_socket *) (*s_objet_resultat).objet)) |
.format).objet = NULL; |
.format).objet = NULL; |
|
(*((struct_socket *) (*s_objet_resultat).objet)).adresse = NULL; |
|
|
switch(type_socket) |
switch(type_socket) |
{ |
{ |
Line 4978 instruction_open(struct_processus *s_eta
|
Line 5036 instruction_open(struct_processus *s_eta
|
return; |
return; |
} |
} |
|
|
|
free((*((struct_socket *) (*s_objet_resultat) |
|
.objet)).adresse); |
|
|
if (((*((struct_socket *) (*s_objet_resultat) |
if (((*((struct_socket *) (*s_objet_resultat) |
.objet)).adresse = malloc(22 * |
.objet)).adresse = malloc(22 * |
sizeof(unsigned char))) == NULL) |
sizeof(unsigned char))) == NULL) |
Line 5082 instruction_open(struct_processus *s_eta
|
Line 5143 instruction_open(struct_processus *s_eta
|
return; |
return; |
} |
} |
|
|
|
free((*((struct_socket *) (*s_objet_resultat) |
|
.objet)).adresse); |
|
|
if (((*((struct_socket *) (*s_objet_resultat) |
if (((*((struct_socket *) (*s_objet_resultat) |
.objet)).adresse = malloc(55 * |
.objet)).adresse = malloc(55 * |
sizeof(unsigned char))) == NULL) |
sizeof(unsigned char))) == NULL) |
Line 5113 instruction_open(struct_processus *s_eta
|
Line 5177 instruction_open(struct_processus *s_eta
|
printf("+++Warning : IPv6 support " |
printf("+++Warning : IPv6 support " |
"unavailable\n"); |
"unavailable\n"); |
} |
} |
|
|
|
liberation(s_etat_processus, s_objet_argument); |
|
liberation(s_etat_processus, s_objet_resultat); |
|
|
|
freeaddrinfo(resolution); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_instruction_indisponible; |
|
return; |
# endif |
# endif |
} |
} |
|
|
Line 5127 instruction_open(struct_processus *s_eta
|
Line 5200 instruction_open(struct_processus *s_eta
|
{ // Hôte défini par une adresse |
{ // Hôte défini par une adresse |
if (strcmp(protocole, "IPV4") == 0) |
if (strcmp(protocole, "IPV4") == 0) |
{ // Accès en IPv4 |
{ // Accès en IPv4 |
|
free((*((struct_socket *) (*s_objet_resultat) |
|
.objet)).adresse); |
|
|
if (((*((struct_socket *) (*s_objet_resultat) |
if (((*((struct_socket *) (*s_objet_resultat) |
.objet)).adresse = malloc(22 * |
.objet)).adresse = malloc(22 * |
sizeof(unsigned char))) == NULL) |
sizeof(unsigned char))) == NULL) |
Line 5202 instruction_open(struct_processus *s_eta
|
Line 5278 instruction_open(struct_processus *s_eta
|
else |
else |
{ // Accès en IPv6 |
{ // Accès en IPv6 |
# ifdef IPV6 |
# ifdef IPV6 |
|
free((*((struct_socket *) (*s_objet_resultat) |
|
.objet)).adresse); |
|
|
if (((*((struct_socket *) (*s_objet_resultat) |
if (((*((struct_socket *) (*s_objet_resultat) |
.objet)).adresse = malloc(55 * |
.objet)).adresse = malloc(55 * |
sizeof(unsigned char))) == NULL) |
sizeof(unsigned char))) == NULL) |
Line 5283 instruction_open(struct_processus *s_eta
|
Line 5362 instruction_open(struct_processus *s_eta
|
printf("+++Warning : IPv6 support " |
printf("+++Warning : IPv6 support " |
"unavailable\n"); |
"unavailable\n"); |
} |
} |
|
|
|
liberation(s_etat_processus, s_objet_argument); |
|
liberation(s_etat_processus, s_objet_resultat); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_instruction_indisponible; |
|
return; |
# endif |
# endif |
} |
} |
} |
} |
Line 5516 instruction_open(struct_processus *s_eta
|
Line 5602 instruction_open(struct_processus *s_eta
|
.socket_en_ecoute = 'N'; |
.socket_en_ecoute = 'N'; |
} |
} |
|
|
|
free((*((struct_socket *) (*s_objet_resultat) |
|
.objet)).adresse); |
|
|
if (((*((struct_socket *) (*s_objet_resultat) |
if (((*((struct_socket *) (*s_objet_resultat) |
.objet)).adresse = malloc(22 * |
.objet)).adresse = malloc(22 * |
sizeof(unsigned char))) == NULL) |
sizeof(unsigned char))) == NULL) |
Line 5622 instruction_open(struct_processus *s_eta
|
Line 5711 instruction_open(struct_processus *s_eta
|
.socket_en_ecoute = 'N'; |
.socket_en_ecoute = 'N'; |
} |
} |
|
|
|
free((*((struct_socket *) (*s_objet_resultat) |
|
.objet)).adresse); |
|
|
if (((*((struct_socket *) (*s_objet_resultat) |
if (((*((struct_socket *) (*s_objet_resultat) |
.objet)).adresse = malloc(55 * |
.objet)).adresse = malloc(55 * |
sizeof(unsigned char))) == NULL) |
sizeof(unsigned char))) == NULL) |
Line 5653 instruction_open(struct_processus *s_eta
|
Line 5745 instruction_open(struct_processus *s_eta
|
printf("+++Warning : IPv6 support " |
printf("+++Warning : IPv6 support " |
"unavailable\n"); |
"unavailable\n"); |
} |
} |
|
|
|
liberation(s_etat_processus, s_objet_argument); |
|
liberation(s_etat_processus, s_objet_resultat); |
|
|
|
freeaddrinfo(resolution); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_instruction_indisponible; |
|
return; |
# endif |
# endif |
} |
} |
|
|
Line 5669 instruction_open(struct_processus *s_eta
|
Line 5770 instruction_open(struct_processus *s_eta
|
{ // Accès en IPv4 |
{ // Accès en IPv4 |
if (type_adresse == '4') |
if (type_adresse == '4') |
{ |
{ |
|
free((*((struct_socket *) (*s_objet_resultat) |
|
.objet)).adresse); |
|
|
if (((*((struct_socket *) (*s_objet_resultat) |
if (((*((struct_socket *) (*s_objet_resultat) |
.objet)).adresse = malloc(22 * |
.objet)).adresse = malloc(22 * |
sizeof(unsigned char))) == NULL) |
sizeof(unsigned char))) == NULL) |
Line 5698 instruction_open(struct_processus *s_eta
|
Line 5802 instruction_open(struct_processus *s_eta
|
} |
} |
else |
else |
{ |
{ |
|
free((*((struct_socket *) (*s_objet_resultat) |
|
.objet)).adresse); |
|
|
if (((*((struct_socket *) (*s_objet_resultat) |
if (((*((struct_socket *) (*s_objet_resultat) |
.objet)).adresse = malloc( |
.objet)).adresse = malloc( |
sizeof(unsigned char))) == NULL) |
sizeof(unsigned char))) == NULL) |
Line 5765 instruction_open(struct_processus *s_eta
|
Line 5872 instruction_open(struct_processus *s_eta
|
# ifdef IPV6 |
# ifdef IPV6 |
if (type_adresse == '6') |
if (type_adresse == '6') |
{ |
{ |
|
free((*((struct_socket *) (*s_objet_resultat) |
|
.objet)).adresse); |
|
|
if (((*((struct_socket *) (*s_objet_resultat) |
if (((*((struct_socket *) (*s_objet_resultat) |
.objet)).adresse = malloc(55 * |
.objet)).adresse = malloc(55 * |
sizeof(unsigned char))) == NULL) |
sizeof(unsigned char))) == NULL) |
Line 5795 instruction_open(struct_processus *s_eta
|
Line 5905 instruction_open(struct_processus *s_eta
|
} |
} |
else |
else |
{ |
{ |
|
free((*((struct_socket *) (*s_objet_resultat) |
|
.objet)).adresse); |
|
|
if (((*((struct_socket *) (*s_objet_resultat) |
if (((*((struct_socket *) (*s_objet_resultat) |
.objet)).adresse = malloc( |
.objet)).adresse = malloc( |
sizeof(unsigned char))) == NULL) |
sizeof(unsigned char))) == NULL) |
Line 5865 instruction_open(struct_processus *s_eta
|
Line 5978 instruction_open(struct_processus *s_eta
|
printf("+++Warning : IPv6 support " |
printf("+++Warning : IPv6 support " |
"unavailable\n"); |
"unavailable\n"); |
} |
} |
|
|
|
liberation(s_etat_processus, s_objet_argument); |
|
liberation(s_etat_processus, s_objet_resultat); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_instruction_indisponible; |
|
return; |
# endif |
# endif |
} |
} |
else |
else |
{ // Socket UNIX |
{ // Socket UNIX |
|
free((*((struct_socket *) (*s_objet_resultat) |
|
.objet)).adresse); |
|
|
if (((*((struct_socket *) (*s_objet_resultat) |
if (((*((struct_socket *) (*s_objet_resultat) |
.objet)).adresse = malloc( |
.objet)).adresse = malloc( |
sizeof(unsigned char))) == NULL) |
sizeof(unsigned char))) == NULL) |