Mercurial > hg > Applications > docker-wrapper
diff ie-docker.h @ 13:8e1f57c91210
add port manager to ie-docker.
author | taira |
---|---|
date | Tue, 03 Feb 2015 16:49:48 +0900 |
parents | |
children | 855a5e399f6e |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ie-docker.h Tue Feb 03 16:49:48 2015 +0900 @@ -0,0 +1,83 @@ +/* Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License */ +#ifndef IE_DOCKER + +#define command "/usr/bin/docker" +#define ps_command "/usr/bin/docker ps -a" +#define run_command "run" +#define build_command "build" +#define attach_command "attach" +#define dettach_command "dettach" +// #define pull_command "pull" /* download docker image command */ +#define images_command "images" /* list images command */ +#define commit_command "commit" /* 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 create_command "create" + +/* Define global variables */ + +static char bad_name[] = "Bad process name. Try students_e11_e115711_01 or teachers_kono_02\n"; + +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[] = "/crhome/taira/hg/docker-wrapper/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 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 */