view ie-docker.h @ 19:fe7095c365cf

WIP: Cleanup source code
author atton
date Tue, 24 Nov 2015 17:22:12 +0900
parents c64a640558ba
children 8a086917cf1a
line wrap: on
line source

/* Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License */
#ifndef IE_DOCKER

#define base_exec_command "/usr/bin/docker"
#define ps_exec_command   "/usr/bin/docker ps -a"

#define run_command "run"
#define build_command ""
#define attach_command "attach"
// #define pull_command "pull" /* download docker image command */
#define images_command "" /* list images command */
#define commit_command "" /* make image command */
#define rm_command "rm" /* remove container command */
#define rmi_command "rmi" /* remove image command */
#define start_command "start"
#define stop_command "stop"
#define exec_command "exec"
#define cp_command "cp"
#define ps_command "ps"

#define create_command ""

/* Define global variables */

const char *guests[] = {"mata"};
const char *managers[] = {"taira"};
const char students_sym[] = "students";
const char managers_sym[] = "managers";
const char guests_sym[] = "guests";
const char delimiter[] = "_";
const char portlist_file[] = "/etc/iedocker/iedockerport.list";

enum {
    NAME_LENGTH = 50,
    PS_NAME_LENGTH = 50,
    RUN_COMMAND_LENGTH = 1024,
    PORT_LENGTH = 16,
    BUFF_SIZE = 50
};

enum {
    STUDENTS,
    GUESTS,
    MANAGERS
};

#define PSNAME_MAX (512)

typedef struct pslist {
    char name[PSNAME_MAX];
    struct pslist *next;
} PSLIST, *PSLISTPTR;

#define NEW(type)  ((type*)malloc(sizeof(type)))

/* docker run option
 * -t tty
 * --name [process name]
 * -v volume
 * -m memory
 * image name
 * -i skeep open tdin
 */

enum {
    FALSE = 0,
    TRUE = 1
};

typedef struct exec_command_opt_t {
    int tty; // true = 1; false = 0
    int dettach; // true = 1; false = 0
    int interactive; // true = 1; false = 0
    char ps_name[64]; // user decide name
    char exec_ps_command[64];
} exec_command_opt;

typedef struct run_command_opt_t {
    char memory[16];
    char innerport[PORT_LENGTH];
    char outerport[PORT_LENGTH]; // system decide port number
    int tty; // true = 1; false = 0
    int dettach; // true = 1; false = 0
    int interactive; // true = 1; false = 0
    char ps_name[64]; // user decide name
    char exec_ps_command[64]; //
    char volume[128];
    char image_name[16];
} run_command_opt;


#endif /* IE_DOCKER */