2022-04-08 21:32:52 +02:00
# include <strings.h>
2022-04-09 00:37:56 +02:00
# include <errno.h>
2022-04-08 21:32:52 +02:00
2022-04-09 00:37:56 +02:00
# include <conn.h>
2022-03-18 20:49:28 +01:00
# include <apiFile.h>
2022-04-09 00:37:56 +02:00
# include <fileQueue.h>
2022-03-31 22:26:44 +02:00
# include <taglialegna.h>
# define MAXLENMESS 512
# define MEOK "20" //OK
# define MEHE "21" // help message
// #define ME "22" // not used
# define MEFP "25" // file purged
// #define ME "40" // not used
// #define ME "41" // not used
# define MESD "42" // shutting down
# define MENT "45" // requested file action not taken
# define MESY "50" // syntax error
// #define ME "51" // not used
// #define ME "52" // not used
# define MESE "55" // server error
2022-04-04 18:58:40 +02:00
// -----------------------------------------------------------------------------
/* funzioni ausiliarie */
2022-04-08 21:32:52 +02:00
// invio il messaggio al client e poi l'errno
void serror ( char * m , long fd_c , taglia_t * taglia , char * mlog ) {
if ( ! m ) {
errno = EINVAL ;
m = MESY ;
}
if ( writen ( fd_c , m , strnlen ( m , MAXLENMESS ) + 1 ) < 0 ) {
perror ( " writen " ) ;
goto _serror_cleanup ;
}
if ( writen ( fd_c , & errno , sizeof ( errno ) ) < 0 ) {
perror ( " writen " ) ;
goto _serror_cleanup ;
}
if ( taglia_write ( taglia , mlog ) < 0 )
goto _serror_cleanup ;
return ;
_serror_cleanup :
return ;
}
2022-04-04 18:58:40 +02:00
// invio il messaggio al client
void sendMessage ( char * m , long fd_c , taglia_t * taglia , char * mlog ) {
if ( ! m ) {
m = MEOK ;
}
if ( writen ( fd_c , m , strnlen ( m , MAXLENMESS ) + 1 ) < 0 ) {
perror ( " writen " ) ;
goto _sendM_cleanup ;
}
if ( taglia_write ( taglia , mlog ) < 0 )
goto _sendM_cleanup ;
return ;
_sendM_cleanup :
return ;
}
// invio il messaggio al client e poi il file
void sendMessageFile ( char * m , fileT * f , long fd_c , taglia_t * taglia , char * mlog ) {
if ( ! f ) {
errno = EINVAL ;
2022-04-08 21:32:52 +02:00
char errmlog [ 2048 ] = " Errore negli argomenti alla funzione sendMessagefile (fileT == NULL). Messaggio originale: \n \t " ;
strncat ( errmlog , mlog , sizeof ( errmlog ) - strlen ( errmlog ) - 1 ) ;
serror ( MESY , fd_c , taglia , errmlog ) ;
2022-04-04 18:58:40 +02:00
goto _sendMF_cleanup ;
}
if ( ! m ) {
2022-04-08 21:32:52 +02:00
m = MEFP ;
2022-04-04 18:58:40 +02:00
}
if ( writen ( fd_c , m , strnlen ( m , MAXLENMESS ) + 1 ) < 0 ) {
perror ( " writen " ) ;
goto _sendMF_cleanup ;
}
if ( sendFile ( f , fd_c , taglia ) < 0 ) {
perror ( " sendFile " ) ;
goto _sendMF_cleanup ;
}
if ( taglia_write ( taglia , mlog ) < 0 )
goto _sendMF_cleanup ;
return ;
_sendMF_cleanup :
return ;
}
// invio il messaggio al client e poi n file
2022-04-08 21:32:52 +02:00
void sendMessageFileN ( char * m , fileT * * f , int n , long fd_c , taglia_t * taglia , char * mlog ) {
2022-04-04 18:58:40 +02:00
if ( ! f ) {
errno = EINVAL ;
2022-04-08 21:32:52 +02:00
char errmlog [ 2048 ] = " Errore negli argomenti alla funzione sendMessagefile (fileT == NULL). Messaggio originale: \n \t " ;
strncat ( errmlog , mlog , sizeof ( errmlog ) - strlen ( errmlog ) - 1 ) ;
serror ( MESY , fd_c , taglia , errmlog ) ;
2022-04-04 18:58:40 +02:00
goto _sendMFN_cleanup ;
}
if ( ! m ) {
2022-04-08 21:32:52 +02:00
m = MEFP ;
2022-04-04 18:58:40 +02:00
}
if ( writen ( fd_c , m , strnlen ( m , MAXLENMESS ) + 1 ) < 0 ) {
perror ( " writen " ) ;
2022-04-08 21:32:52 +02:00
goto _sendMFN_cleanup ;
2022-04-04 18:58:40 +02:00
}
for ( int i = 0 ; i < n & & ( f [ i ] ! = NULL ) ; + + i ) {
if ( sendFile ( f [ i ] , fd_c , taglia ) < 0 ) {
perror ( " sendFile " ) ;
2022-04-08 21:32:52 +02:00
goto _sendMFN_cleanup ;
2022-04-04 18:58:40 +02:00
}
}
if ( taglia_write ( taglia , mlog ) < 0 )
2022-04-08 21:32:52 +02:00
goto _sendMFN_cleanup ;
2022-04-04 18:58:40 +02:00
return ;
_sendMFN_cleanup :
return ;
}
// -----------------------------------------------------------------------------
2022-03-31 22:26:44 +02:00
void openFile ( char * filepath , int flags , queueT * q , long fd_c , taglia_t * taglia ) {
// messaggio da scrivere sul logfile
char tmp_buf [ 2048 ] ;
int n = 0 ;
size_t m = sizeof ( tmp_buf ) ;
if ( ! filepath | | ! q | | ! taglia ) {
n + = snprintf ( tmp_buf + n , m - n , " Client %ld ha richiesto una openFile (flags = %x) sul file \" %s \" e' terminata con errore \n " , fd_c , flags , filepath ) ;
errno = EINVAL ;
serror ( MESY , fd_c , taglia , tmp_buf ) ;
return ;
}
int found = searchFile ( q , filepath ) ; // cerco il file nella queue
int create = flags & 0x1 ; // also %2
int lock = flags > > 1 & 0x1 ; // also >>1%2
fileT * removed = NULL ; // file che è stato rimosso
if ( found & & create ) { // si vuole creare il file ma esiste già
n + = snprintf ( tmp_buf + n , m - n , " Client %ld ha richiesto una openFile (flags = %x) sul file \" %s \" e' terminata con errore \n " , fd_c , flags , filepath ) ;
errno = EEXIST ;
serror ( MENT , fd_c , taglia , tmp_buf ) ;
return ;
}
if ( ! found & & ! create ) { // si vuole aprire e non creare un file inesistente
n + = snprintf ( tmp_buf + n , m - n , " Client %ld ha richiesto una openFile (flags = %x) sul file \" %s \" e' terminato con errore \n " , fd_c , flags , filepath ) ;
errno = ENOENT ;
serror ( MENT , fd_c , taglia , tmp_buf ) ;
return ;
}
if ( found & & ! create ) {
2022-04-08 21:32:52 +02:00
if ( openFileInQueue ( q , filepath , lock , fd_c ) = = - 1 ) {
2022-03-31 22:26:44 +02:00
n + = snprintf ( tmp_buf + n , m - n , " Client %ld ha richiesto una openFile (flags = %x) sul file \" %s \" e' terminato con errore \n " , fd_c , flags , filepath ) ;
perror ( " openFileInQueue " ) ;
serror ( MESE , fd_c , taglia , tmp_buf ) ;
return ;
}
n + = snprintf ( tmp_buf + n , m - n , " Client %ld ha richiesto una openFile (flags = %x) sul file \" %s \" e' terminata con successo \n " , fd_c , flags , filepath ) ;
sendMessage ( MEOK , fd_c , taglia , tmp_buf ) ;
return ;
}
if ( ! found & & create ) { // not found and creating new file
2022-04-08 21:32:52 +02:00
if ( getLen ( q ) = = q - > maxLen ) { // capacity miss
2022-03-31 22:26:44 +02:00
removed = dequeue ( q ) ;
if ( ! removed ) {
n + = snprintf ( tmp_buf + n , m - n , " Client %ld ha richiesto una openFile (flags = %x) sul file \" %s \" e' terminato con errore \n " , fd_c , flags , filepath ) ;
perror ( " dequeue " ) ;
serror ( MESE , fd_c , taglia , tmp_buf ) ;
return ;
}
fileT * f = createFileT ( filepath , lock , fd_c , 1 ) ; // create new file
if ( ! f ) {
n + = snprintf ( tmp_buf + n , m - n , " Client %ld ha richiesto una openFile (flags = %x) sul file \" %s \" e' terminato con errore del server \n " , fd_c , flags , filepath ) ;
perror ( " createFileT " ) ;
2022-04-08 21:32:52 +02:00
serror ( MESE , fd_c , taglia , tmp_buf ) ;
2022-03-31 22:26:44 +02:00
return ;
}
if ( enqueue ( q , f ) ! = 0 ) {
n + = snprintf ( tmp_buf + n , m - n , " Client %ld ha richiesto una openFile (flags = %x) sul file \" %s \" e' terminato con errore del server \n " , fd_c , flags , filepath ) ;
perror ( " enqueue " ) ;
2022-04-08 21:32:52 +02:00
serror ( MESE , fd_c , taglia , tmp_buf ) ;
2022-03-31 22:26:44 +02:00
return ;
}
taglia_update ( taglia , q , 1 ) ; // removed only one file
n + = snprintf ( tmp_buf + n , m - n , " Client %ld ha richiesto una openFile (flags = %x) sul file \" %s \" ha causato una capacity miss. File espulso \" %s \" \n " , fd_c , flags , filepath , removed - > filepath ) ;
sendMessageFile ( MEFP , removed , fd_c , taglia , tmp_buf ) ;
free ( removed ) ;
return ;
}
fileT * f = createFileT ( filepath , lock , fd_c , 1 ) ;
if ( ! f ) {
n + = snprintf ( tmp_buf + n , m - n , " Client %ld ha richiesto una openFile (flags = %x) sul file \" %s \" e' terminato con errore del server \n " , fd_c , flags , filepath ) ;
perror ( " createFileT " ) ;
2022-04-08 21:32:52 +02:00
serror ( MESE , fd_c , taglia , tmp_buf ) ;
2022-03-31 22:26:44 +02:00
return ;
}
if ( enqueue ( q , f ) ! = 0 ) {
n + = snprintf ( tmp_buf + n , m - n , " Client %ld ha richiesto una openFile (flags = %x) sul file \" %s \" e' terminato con errore del server \n " , fd_c , flags , filepath ) ;
perror ( " enqueue " ) ;
2022-04-08 21:32:52 +02:00
serror ( MESE , fd_c , taglia , tmp_buf ) ;
2022-03-31 22:26:44 +02:00
return ;
}
// abbiamo aggiunto un file quindi il numero di file è cambiato
// quindi bisogna fare un update del log
taglia_update ( taglia , q , 0 ) ;
n + = snprintf ( tmp_buf + n , m - n , " Client %ld ha richiesto una openFile (flags = %x) sul file \" %s \" e' terminato con successo \n " , fd_c , flags , filepath ) ;
sendMessage ( MEOK , fd_c , taglia , tmp_buf ) ;
return ;
}
2022-04-09 01:11:46 +02:00
// codice non raggiungibile
return ;
2022-03-31 22:26:44 +02:00
}
2022-04-04 18:58:40 +02:00
void readFile ( char * filepath , queueT * q , long fd_c , taglia_t * taglia ) {
// messaggio da scrivere sul logfile
char tmp_buf [ 2048 ] ;
int n = 0 ;
size_t m = sizeof ( tmp_buf ) ;
if ( ! filepath | | ! q | | ! taglia ) {
2022-04-08 21:32:52 +02:00
n + = snprintf ( tmp_buf + n , m - n , " Client %ld ha richiesto una readFile sul file \" %s \" e' terminata con errore \n " , fd_c , filepath ) ;
2022-04-04 18:58:40 +02:00
errno = EINVAL ;
serror ( MESY , fd_c , taglia , tmp_buf ) ;
return ;
2022-03-31 22:26:44 +02:00
}
2022-04-04 18:58:40 +02:00
fileT * f = NULL ;
f = find ( q , filepath ) ;
if ( ! f ) {
2022-04-08 21:32:52 +02:00
n + = snprintf ( tmp_buf + n , m - n , " Client %ld ha richiesto una readFile sul file \" %s \" e' terminata con errore \n " , fd_c , filepath ) ;
2022-04-04 18:58:40 +02:00
errno = ENOENT ;
serror ( MESE , fd_c , taglia , tmp_buf ) ;
return ;
}
2022-03-31 22:26:44 +02:00
2022-04-04 18:58:40 +02:00
if ( f - > open ! = 0 ) { // file already open
2022-04-08 21:32:52 +02:00
n + = snprintf ( tmp_buf + n , m - n , " Client %ld ha richiesto una readFile sul file \" %s \" e' terminata con errore \n " , fd_c , filepath ) ;
2022-04-04 18:58:40 +02:00
errno = EPERM ;
serror ( MENT , fd_c , taglia , tmp_buf ) ;
destroyFile ( f ) ; // f is a copy so we need to cleen up
return ;
}
2022-03-31 22:26:44 +02:00
2022-04-08 21:32:52 +02:00
n + = snprintf ( tmp_buf + n , m - n , " Client %ld ha richiesto una readFile sul file \" %s \" e' terminata con successo \n " , fd_c , filepath ) ;
2022-04-04 18:58:40 +02:00
sendMessageFile ( MEOK , f , fd_c , taglia , tmp_buf ) ;
destroyFile ( f ) ; // f is a copy so we need to cleen up
2022-03-31 22:26:44 +02:00
return ;
}
2022-04-04 18:58:40 +02:00
2022-04-04 22:31:14 +02:00
void readNFiles ( char * numStr , queueT * q , long fd_c , taglia_t * taglia ) {
// TODO
return ;
}
2022-04-04 18:58:40 +02:00
void writeFile ( char * filepath , size_t size , queueT * q , long fd_c , taglia_t * taglia , int append ) {
// messaggio da scrivere sul logfile
char tmp_buf [ 2048 ] ;
int n = 0 ;
size_t m = sizeof ( tmp_buf ) ;
if ( ! filepath | | ! q | | ! taglia ) {
n + = snprintf ( tmp_buf + n , m - n , " Client %ld ha richiesto una writeFile (append = %x) sul file \" %s \" e' terminata con errore \n " , fd_c , append , filepath ) ;
2022-03-31 22:26:44 +02:00
errno = EINVAL ;
2022-04-04 18:58:40 +02:00
serror ( MESY , fd_c , taglia , tmp_buf ) ;
return ;
2022-03-31 22:26:44 +02:00
}
2022-04-09 01:11:46 +02:00
// cerco il file
2022-04-04 18:58:40 +02:00
fileT * f = NULL ;
f = find ( q , filepath ) ;
if ( ! f ) { // file is not present
n + = snprintf ( tmp_buf + n , m - n , " Client %ld ha richiesto una writeFile (append = %x) sul file \" %s \" , dimensione = %ld, e' terminata con errore \n " , fd_c , append , filepath , size ) ;
errno = ENOENT ;
serror ( MENT , fd_c , taglia , tmp_buf ) ;
destroyFile ( f ) ;
return ;
2022-03-31 22:26:44 +02:00
}
2022-03-18 20:49:28 +01:00
2022-04-04 18:58:40 +02:00
// file non aperto || !append => locked || lock ma non si è proprietari
if ( ! f - > open | | ( append | | f - > O_LOCK ) | | ( f - > O_LOCK & & f - > owner ! = fd_c ) ) {
n + = snprintf ( tmp_buf + n , m - n , " Client %ld ha richiesto una writeFile (append = %x) sul file \" %s \" , dimensione = %ld, e' terminata con errore \n " , fd_c , append , filepath , size ) ;
errno = EPERM ;
serror ( MENT , fd_c , taglia , tmp_buf ) ;
destroyFile ( f ) ;
return ;
2022-03-31 22:26:44 +02:00
}
2022-04-04 18:58:40 +02:00
int trueSizeAdded = 0 ; // we may have alredy some space allocated
if ( append ) {
trueSizeAdded = size - f - > size + f - > valid ;
} else {
trueSizeAdded = ( size > f - > size ) ? size - f - > size : 0 ;
}
destroyFile ( f ) ; // not needed anymore
2022-03-18 20:49:28 +01:00
2022-04-04 18:58:40 +02:00
fileT * * removed = NULL ; // array that may (worst case) hold all files to be sent to the client
2022-03-18 20:49:28 +01:00
2022-04-04 18:58:40 +02:00
if ( trueSizeAdded + getSize ( q ) > q - > maxSize ) { // writing would be more than capacity
removed = dequeueN ( q , filepath , trueSizeAdded ) ;
if ( ! removed ) { // internal error
n + = snprintf ( tmp_buf + n , m - n , " Client %ld ha richiesto una writeFile (append = %x) sul file \" %s \" , dimensione = %ld, e' terminata con errore \n " , fd_c , append , filepath , size ) ;
errno = ENOENT ;
serror ( MESY , fd_c , taglia , tmp_buf ) ;
return ;
}
int ln = 0 ;
fileT * tmp = removed [ ln ] ;
n + = snprintf ( tmp_buf + n , m - n , " Client %ld ha richiesto una writeFile (append = %x) sul file \" %s \" , dimensione = %ld, e' terminata con successo. Ha causato una capacity miss e ha fatto espellere i seguenti file: " , fd_c , append , filepath , size ) ;
while ( tmp ! = NULL ) {
n + = snprintf ( tmp_buf + n , m - n , " \" %s \" " , tmp - > filepath ) ;
+ + ln ;
tmp = removed [ ln ] ;
}
n + = snprintf ( tmp_buf + n , m - n , " \n " ) ;
taglia_update ( taglia , q , ln ) ;
2022-03-18 20:49:28 +01:00
2022-04-04 18:58:40 +02:00
sendMessageFileN ( MEFP , removed , ln , fd_c , taglia , tmp_buf ) ;
for ( int i = 0 ; i < ln & & ( removed [ i ] ! = NULL ) ; + + i ) {
destroyFile ( removed [ i ] ) ;
}
free ( removed ) ;
// now we can write the actual file
2022-03-18 20:49:28 +01:00
2022-04-04 18:58:40 +02:00
void * content = NULL ;
content = malloc ( size ) ;
if ( ! content ) {
perror ( " malloc " ) ;
return ;
}
if ( ( readn ( fd_c , content , size ) ) = = - 1 ) {
perror ( " readn " ) ;
return ;
}
2022-03-18 20:49:28 +01:00
2022-04-04 18:58:40 +02:00
if ( append ) {
if ( appendFileInQueue ( q , filepath , content , size , fd_c ) = = - 1 ) {
perror ( " appendFileInQueue " ) ;
2022-04-08 21:32:52 +02:00
free ( content ) ;
2022-04-04 18:58:40 +02:00
return ;
}
} else {
if ( writeFileInQueue ( q , filepath , content , size , fd_c ) = = - 1 ) {
perror ( " writeFileInQueue " ) ;
2022-04-08 21:32:52 +02:00
free ( content ) ;
2022-04-04 18:58:40 +02:00
return ;
}
}
2022-03-18 20:49:28 +01:00
2022-04-04 18:58:40 +02:00
taglia_update ( taglia , q , 0 ) ;
2022-04-08 21:32:52 +02:00
free ( content ) ;
2022-04-04 18:58:40 +02:00
return ;
}
2022-03-18 20:49:28 +01:00
2022-04-04 18:58:40 +02:00
// non c'è ancora bisogno di rimuovere file
void * content = NULL ;
content = malloc ( size ) ;
if ( ! content ) {
perror ( " malloc " ) ;
return ;
}
if ( readn ( fd_c , content , size ) = = - 1 ) {
perror ( " readn " ) ;
return ;
}
2022-03-18 20:49:28 +01:00
2022-04-04 18:58:40 +02:00
n + = snprintf ( tmp_buf + n , m - n , " Client %ld ha richiesto una writeFile (append = %x) sul file \" %s \" , dimensione = %ld, e' terminata con successo \n " , fd_c , append , filepath , size ) ;
2022-03-18 20:49:28 +01:00
2022-04-04 18:58:40 +02:00
if ( append ) {
if ( appendFileInQueue ( q , filepath , content , size , fd_c ) = = - 1 ) {
perror ( " appendFileInQueue " ) ;
2022-04-08 21:32:52 +02:00
free ( content ) ;
2022-04-04 18:58:40 +02:00
return ;
}
} else {
if ( writeFileInQueue ( q , filepath , content , size , fd_c ) = = - 1 ) {
perror ( " writeFileInQueue " ) ;
2022-04-08 21:32:52 +02:00
free ( content ) ;
2022-04-04 18:58:40 +02:00
return ;
}
}
2022-03-18 20:49:28 +01:00
2022-04-08 21:32:52 +02:00
taglia_write ( taglia , tmp_buf ) ;
2022-03-18 20:49:28 +01:00
2022-04-04 18:58:40 +02:00
taglia_update ( taglia , q , 0 ) ;
2022-03-18 20:49:28 +01:00
2022-04-08 21:32:52 +02:00
free ( content ) ;
2022-04-04 18:58:40 +02:00
return ;
}
2022-03-18 20:49:28 +01:00
2022-04-08 21:32:52 +02:00
void lockFile ( char * filepath , queueT * q , long fd_c , taglia_t * taglia , pthread_mutex_t * lock , waiting_t * * waiting ) {
2022-04-09 01:11:46 +02:00
// messaggio da scrivere sul logfile
char tmp_buf [ 2048 ] ;
int n = 0 ;
size_t m = sizeof ( tmp_buf ) ;
if ( ! filepath | | ! q | | ! taglia | | ! lock | | ! waiting ) {
n + = snprintf ( tmp_buf + n , m - n , " Client %ld ha richiesto una lockFile sul file \" %s \" e' terminata con errore. \n " , fd_c , filepath ) ;
errno = EINVAL ;
serror ( MESY , fd_c , taglia , tmp_buf ) ;
return ;
}
// cerco il file da impostare in modalita' locked
fileT * f = NULL ;
f = find ( q , filepath ) ;
if ( ! f ) { // file is not present
n + = snprintf ( tmp_buf + n , m - n , " Client %ld ha richiesto una lockFile sul file \" %s \" ma risulta assente. \n " , fd_c , filepath ) ;
errno = ENOENT ;
serror ( MENT , fd_c , taglia , tmp_buf ) ;
destroyFile ( f ) ;
return ;
}
// provo a prendere la lock
if ( openFileInQueue ( q , filepath , 1 , fd_c ) = = - 1 ) {
// non siamo riusciti a prendere la lock al file, quindi aspettiamo che
// venga rilasciata mettendoci in attesa nella waiting list
if ( errno = = EPERM ) {
if ( pthread_mutex_lock ( lock ) = = - 1 ) { // begin ME
perror ( " lock " ) ;
destroyFile ( f ) ;
return ;
}
if ( addWaiting ( waiting , filepath , fd_c ) = = - 1 ) {
perror ( " addWaiting " ) ;
pthread_mutex_unlock ( lock ) ;
destroyFile ( f ) ;
return ;
}
if ( pthread_mutex_unlock ( lock ) = = - 1 ) { // end ME
perror ( " unlock " ) ;
}
destroyFile ( f ) ;
return ;
}
n + = snprintf ( tmp_buf + n , m - n , " Client %ld ha richiesto una lockFile sul file \" %s \" e' terminata con errore. \n " , fd_c , filepath ) ;
errno = ENOLCK ;
serror ( MESE , fd_c , taglia , tmp_buf ) ;
destroyFile ( f ) ;
return ;
}
n + = snprintf ( tmp_buf + n , m - n , " Client %ld ha richiesto una lockFile sul file \" %s \" e' terminata con successo \n " , fd_c , filepath ) ;
sendMessage ( MEOK , fd_c , taglia , tmp_buf ) ;
destroyFile ( f ) ;
2022-04-04 22:31:14 +02:00
return ;
}
2022-03-18 20:49:28 +01:00
2022-04-08 21:32:52 +02:00
void unlockFile ( char * filepath , queueT * q , long fd_c , taglia_t * taglia , pthread_mutex_t * lock , waiting_t * * waiting ) {
2022-04-04 22:31:14 +02:00
return ;
}
2022-03-18 20:49:28 +01:00
2022-03-31 22:26:44 +02:00
2022-04-08 21:32:52 +02:00
void closeFile ( char * filepath , queueT * q , long fd_c , taglia_t * taglia , pthread_mutex_t * lock , waiting_t * * waiting ) {
2022-04-04 22:31:14 +02:00
return ;
}
2022-03-31 22:26:44 +02:00
2022-04-08 21:32:52 +02:00
void removeFile ( char * filepath , queueT * q , long fd_c , taglia_t * taglia , pthread_mutex_t * lock , waiting_t * * waiting ) {
2022-04-04 22:31:14 +02:00
return ;
}
2022-03-31 22:26:44 +02:00
2022-04-04 22:31:14 +02:00
int sendFile ( fileT * f , long fd_c , taglia_t * taglia ) {
2022-04-08 21:32:52 +02:00
return 0 ;
2022-04-04 22:31:14 +02:00
}
2022-03-18 20:49:28 +01:00
2022-04-08 21:32:52 +02:00
int addWaiting ( waiting_t * * waiting , char * file , int fd ) {
return 0 ;
2022-04-04 22:31:14 +02:00
}
2022-03-18 20:49:28 +01:00
2022-04-08 21:32:52 +02:00
int removeFirstWaiting ( waiting_t * * waiting , char * file ) {
return 0 ;
2022-04-04 22:31:14 +02:00
}
2022-03-18 20:49:28 +01:00
2022-04-08 21:32:52 +02:00
void clearWaiting ( waiting_t * * waiting ) {
2022-04-04 22:31:14 +02:00
return ;
}