Files
progettoso/lib/api/api.h

44 lines
1000 B
C
Raw Normal View History

2022-04-16 21:21:04 +02:00
#pragma once
#ifndef _API_CLIENT
#define _API_CLIENT
#include <time.h>
2022-04-20 22:34:06 +02:00
#define O_CREATE 1
#define O_LOCK 2
2022-04-16 21:21:04 +02:00
// 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);
2022-04-21 20:08:22 +02:00
void printInfo(int p, FILE *stream);
2022-04-16 21:21:04 +02:00
#endif /* _API_CLIENT */