annotate ie-docker.h @ 23:1bb75d2408ae

Support basic commands
author atton
date Thu, 26 Nov 2015 18:16:25 +0900
parents 8a086917cf1a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
1 /* Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License */
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
2 #ifndef IE_DOCKER
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
3
19
fe7095c365cf WIP: Cleanup source code
atton
parents: 16
diff changeset
4 #define base_exec_command "/usr/bin/docker"
23
1bb75d2408ae Support basic commands
atton
parents: 21
diff changeset
5 #define ps_exec_command "/usr/bin/docker ps"
19
fe7095c365cf WIP: Cleanup source code
atton
parents: 16
diff changeset
6
13
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
7 #define run_command "run"
19
fe7095c365cf WIP: Cleanup source code
atton
parents: 16
diff changeset
8 #define build_command ""
13
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
9 #define attach_command "attach"
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
10 // #define pull_command "pull" /* download docker image command */
19
fe7095c365cf WIP: Cleanup source code
atton
parents: 16
diff changeset
11 #define images_command "" /* list images command */
fe7095c365cf WIP: Cleanup source code
atton
parents: 16
diff changeset
12 #define commit_command "" /* make image command */
13
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
13 #define rm_command "rm" /* remove container command */
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
14 #define rmi_command "rmi" /* remove image command */
19
fe7095c365cf WIP: Cleanup source code
atton
parents: 16
diff changeset
15 #define start_command "start"
fe7095c365cf WIP: Cleanup source code
atton
parents: 16
diff changeset
16 #define stop_command "stop"
13
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
17 #define exec_command "exec"
19
fe7095c365cf WIP: Cleanup source code
atton
parents: 16
diff changeset
18 #define cp_command "cp"
fe7095c365cf WIP: Cleanup source code
atton
parents: 16
diff changeset
19 #define ps_command "ps"
13
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
20
19
fe7095c365cf WIP: Cleanup source code
atton
parents: 16
diff changeset
21 #define create_command ""
13
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
22
21
8a086917cf1a WIP: built all commands string
atton
parents: 19
diff changeset
23 #define run_options "-it -u 2015 "
8a086917cf1a WIP: built all commands string
atton
parents: 19
diff changeset
24 #define base_image_name "java-centos"
8a086917cf1a WIP: built all commands string
atton
parents: 19
diff changeset
25 #define run_shell "zsh"
8a086917cf1a WIP: built all commands string
atton
parents: 19
diff changeset
26 #define cp_file_path "/tmp"
8a086917cf1a WIP: built all commands string
atton
parents: 19
diff changeset
27
13
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
28 /* Define global variables */
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
29
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
30 const char *guests[] = {"mata"};
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
31 const char *managers[] = {"taira"};
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
32 const char students_sym[] = "students";
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
33 const char managers_sym[] = "managers";
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
34 const char guests_sym[] = "guests";
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
35 const char delimiter[] = "_";
16
c64a640558ba add remove.py
taiki
parents: 14
diff changeset
36 const char portlist_file[] = "/etc/iedocker/iedockerport.list";
13
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
37
19
fe7095c365cf WIP: Cleanup source code
atton
parents: 16
diff changeset
38 enum {
13
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
39 NAME_LENGTH = 50,
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
40 PS_NAME_LENGTH = 50,
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
41 RUN_COMMAND_LENGTH = 1024,
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
42 PORT_LENGTH = 16,
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
43 BUFF_SIZE = 50
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
44 };
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
45
19
fe7095c365cf WIP: Cleanup source code
atton
parents: 16
diff changeset
46 enum {
13
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
47 STUDENTS,
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
48 GUESTS,
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
49 MANAGERS
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
50 };
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
51
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
52 #define PSNAME_MAX (512)
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
53
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
54 typedef struct pslist {
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
55 char name[PSNAME_MAX];
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
56 struct pslist *next;
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
57 } PSLIST, *PSLISTPTR;
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
58
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
59 #define NEW(type) ((type*)malloc(sizeof(type)))
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
60
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
61 /* docker run option
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
62 * -t tty
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
63 * --name [process name]
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
64 * -v volume
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
65 * -m memory
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
66 * image name
19
fe7095c365cf WIP: Cleanup source code
atton
parents: 16
diff changeset
67 * -i skeep open tdin
13
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
68 */
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
69
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
70 enum {
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
71 FALSE = 0,
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
72 TRUE = 1
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
73 };
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
74
16
c64a640558ba add remove.py
taiki
parents: 14
diff changeset
75 typedef struct exec_command_opt_t {
c64a640558ba add remove.py
taiki
parents: 14
diff changeset
76 int tty; // true = 1; false = 0
c64a640558ba add remove.py
taiki
parents: 14
diff changeset
77 int dettach; // true = 1; false = 0
c64a640558ba add remove.py
taiki
parents: 14
diff changeset
78 int interactive; // true = 1; false = 0
c64a640558ba add remove.py
taiki
parents: 14
diff changeset
79 char ps_name[64]; // user decide name
c64a640558ba add remove.py
taiki
parents: 14
diff changeset
80 char exec_ps_command[64];
c64a640558ba add remove.py
taiki
parents: 14
diff changeset
81 } exec_command_opt;
c64a640558ba add remove.py
taiki
parents: 14
diff changeset
82
13
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
83 typedef struct run_command_opt_t {
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
84 char memory[16];
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
85 char innerport[PORT_LENGTH];
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
86 char outerport[PORT_LENGTH]; // system decide port number
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
87 int tty; // true = 1; false = 0
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
88 int dettach; // true = 1; false = 0
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
89 int interactive; // true = 1; false = 0
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
90 char ps_name[64]; // user decide name
19
fe7095c365cf WIP: Cleanup source code
atton
parents: 16
diff changeset
91 char exec_ps_command[64]; //
13
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
92 char volume[128];
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
93 char image_name[16];
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
94 } run_command_opt;
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
95
16
c64a640558ba add remove.py
taiki
parents: 14
diff changeset
96
13
8e1f57c91210 add port manager to ie-docker.
taira
parents:
diff changeset
97 #endif /* IE_DOCKER */