Added first functionality to client

This commit is contained in:
elvis
2022-04-16 21:21:04 +02:00
parent 68d3051c4f
commit 6eb723ce6b
4 changed files with 321 additions and 22 deletions

67
lib/api/api.c Normal file
View File

@ -0,0 +1,67 @@
#include <api.h>
// -----------------------------------------------------------------------------
/* funzioni ausiliarie */
// -----------------------------------------------------------------------------
int openConnection(const char* sockname, int msec, const struct timespec abstime){
return 1;
}
int closeConnection(const char* sockname){
return 1;
}
int openFile(const char* pathname, int flags){
return 1;
}
int readFile(const char* pathname, void** buf, size_t* size){
return 1;
}
int readNFiles(int N, const char* dirname){
return 1;
}
int writeFile(const char* pathname, const char* dirname){
return 1;
}
int appendToFile(const char* pathname, void* buf, size_t size, const char* dirname){
return 1;
}
int lockFile(const char* pathname){
return 1;
}
int unlockFile(const char* pathname){
return 1;
}
int closeFile(const char *pathname){
return 1;
}
int removeFile(const char* pathname){
return 1;
}
int setDirectory(char* Dir, int rw){
return 1;
}
void printInfo(int p){
return;
}

40
lib/api/api.h Normal file
View File

@ -0,0 +1,40 @@
#pragma once
#ifndef _API_CLIENT
#define _API_CLIENT
#include <time.h>
// struttura dati per la lista dei file aperti
typedef struct openFile_s {
char *filename; // nome del file
struct openFile_s *next; // puntatore al prossimo elemento nella lista
} openFile_t;
int openConnection(const char* sockname, int msec, const struct timespec abstime);
int closeConnection(const char* sockname);
int openFile(const char* pathname, int flags);
int readFile(const char* pathname, void** buf, size_t* size);
int readNFiles(int N, const char* dirname);
int writeFile(const char* pathname, const char* dirname);
int appendToFile(const char* pathname, void* buf, size_t size, const char* dirname);
int lockFile(const char* pathname);
int unlockFile(const char* pathname);
int closeFile(const char *pathname);
int removeFile(const char* pathname);
int setDirectory(char* Dir, int rw);
void printInfo(int p);
#endif /* _API_CLIENT */