-
Notifications
You must be signed in to change notification settings - Fork 1
/
clientHeader.h
74 lines (68 loc) · 1.64 KB
/
clientHeader.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#ifndef _CLIENTHEADER_H_
#define _CLIENTHEADER_H_
//libraries to import
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <string.h>
#include <dirent.h>
#include <limits.h>
#include <time.h>
#include <math.h>
#include <netdb.h>
#include <pthread.h>
#include <signal.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <openssl/sha.h>
#include <linux/limits.h>
#define TRUE 1
#define FALSE 0
#define strMax 999
#define hashLen 40
//struct declarations, this one is for the contents of the manifest
struct entry {
char filePath[PATH_MAX];
int fileVer;
char fileHash[hashLen+1];
char tag;
struct entry * next;
struct entry * prev;
};
//global variables
int port;
char IP[100];
int sfd;
//global variables used when editing manifests
struct entry * servManHead;
struct entry * clienManHead;
//functions
int configure(char *, char *);
int checkout(char *);
int readConf();
int readFile(int, char **);
int populateManifest(char *, struct entry **);
int update(char *);
int charComparator (char *, char *);
void insertionSortHelper(struct entry**,struct entry*, int(*comparator)(char *, char *));
int insertionSort(struct entry **, int(*comparator)(char *, char *));
int upgrade(char *);
int commit(char *);
void freeLL(struct entry *);
void rewriteManifest(struct entry *, char *, int);
int add(char *, char *);
int connectToServer();
int writeFile(char *);
int connectToServer();
int removeMan(char *, char *);
int create(char *);
int history(char *);
int push(char *);
int currentversion(char *);
#endif