Important Definitions
$ cd /home

Important Definitions

Header File: header.h

Included Libraries

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/stat.h>
#include <dirent.h>
#include <ctype.h>
#include <fcntl.h>
#include <errno.h>

Constants

#define MAX_NUM_PATHS 2000
#define MAX_FILE_PATH 500
#define MAX_FILE_NAME 100
#define MAX_NUM_FILES 10
#define port 5566               // port number for naming server

#define RED "\033[31m"
#define GREEN "\033[32m"
#define YELLOW "\033[33m"
#define PINK "\033[35m"
#define CYAN "\033[36m"
#define RESET "\033[0m"

Struct: TreeNode

typedef struct TreeNode* Tree;
typedef struct TreeNode
{
    char path[MAX_FILE_NAME];
    Tree first_child;
    Tree next_sibling;
    Tree prev_sibling;
    Tree parent;
} TreeNode;

The TreeNode struct represents a node in the tree structure used for managing file paths.

Struct: ss_send

typedef struct ss_send
{
    char ip_addr[20];
    int client_port;
    int server_port;
} ss_send;

The ss_send struct contains information about IP address, client port, and server port for storage server communication.

Struct: storage_servers

typedef struct ss* storage_servers;
typedef struct ss
{
    ss_send *ss_send;
    Tree files_and_dirs;
    storage_servers next;
} ss;

The storage_servers struct represents a linked list of storage servers with their connection details and file directory structure.

External Variables

extern storage_servers storage_server_list;

The storage_server_list variable holds the list of connected storage servers.

Functions Prototypes

$ cd ./functions