-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.h
More file actions
32 lines (29 loc) · 929 Bytes
/
server.h
File metadata and controls
32 lines (29 loc) · 929 Bytes
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
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <errno.h>
#include <unistd.h>
#include <sys/stat.h>
#include <dirent.h>
#include <string.h>
#define MAX_BUF_LEN 512
#define MAX_USERS 32
#define MAX_MSG_LEN 48
struct ConfigData {
int port;
char* work_dir;
char* users[MAX_USERS];
char* passwords[MAX_USERS];
};
int config_socket(struct ConfigData config_data);
void config_parse(struct ConfigData *config_data);
void child_handler(int client, struct ConfigData* config_data);
int validate_credentials(int client, struct ConfigData *config_data);
void recv_header(int client, char *header, int header_size);
void setup_directory(char *user, struct ConfigData *config_data);
void put_routine(int client, char *filename, unsigned int filesize);
void get_routine(int client, char *filename);
void list_routine(int client);