author | viric@llimona |
Mon, 02 Apr 2007 17:53:52 +0200 | |
changeset 74 | bb1b20d79acf |
parent 66 | f70a27afd92e |
child 110 | 2726c92a5cb3 |
child 111 | d6bc62904b5a |
permissions | -rw-r--r-- |
1 | 1 |
extern int server_socket; |
2 |
||
3 | 3 |
enum |
4 |
{ |
|
5 | 5 |
CMD_LEN=500, |
4 | 6 |
LINE_LEN=500 |
3 | 7 |
}; |
8 |
||
1 | 9 |
enum msg_types |
10 |
{ |
|
31 | 11 |
KILL_SERVER, |
3 | 12 |
NEWJOB, |
13 |
NEWJOB_OK, |
|
14 |
RUNJOB, |
|
22 | 15 |
RUNJOB_OK, |
3 | 16 |
ENDJOB, |
17 |
LIST, |
|
4 | 18 |
LIST_LINE, |
32 | 19 |
CLEAR_FINISHED, |
20 |
ASK_OUTPUT, |
|
41 | 21 |
ANSWER_OUTPUT, |
22 |
REMOVEJOB, |
|
42 | 23 |
REMOVEJOB_OK, |
24 |
WAITJOB, |
|
53 | 25 |
WAITJOB_OK, |
26 |
URGENT, |
|
63 | 27 |
URGENT_OK, |
28 |
GET_STATE, |
|
66
f70a27afd92e
Adding "swap jobs" with -U. Fixed a big problem with fds 0, 1, 2.
viric@mandarina
parents:
63
diff
changeset
|
29 |
ANSWER_STATE, |
f70a27afd92e
Adding "swap jobs" with -U. Fixed a big problem with fds 0, 1, 2.
viric@mandarina
parents:
63
diff
changeset
|
30 |
SWAP_JOBS, |
f70a27afd92e
Adding "swap jobs" with -U. Fixed a big problem with fds 0, 1, 2.
viric@mandarina
parents:
63
diff
changeset
|
31 |
SWAP_JOBS_OK |
63 | 32 |
}; |
33 |
||
34 |
enum Jobstate |
|
35 |
{ |
|
36 |
QUEUED, |
|
37 |
RUNNING, |
|
38 |
FINISHED |
|
1 | 39 |
}; |
40 |
||
41 |
struct msg |
|
42 |
{ |
|
2 | 43 |
enum msg_types type; |
1 | 44 |
|
2 | 45 |
union |
46 |
{ |
|
18 | 47 |
struct { |
48 |
int command_size; |
|
22 | 49 |
int store_output; |
55
678ca291d545
Now the '-nf' doesn't leave a job in 'finished' state.
viric@llimona
parents:
53
diff
changeset
|
50 |
int should_keep_finished; |
18 | 51 |
} newjob; |
22 | 52 |
struct { |
53 |
int ofilename_size; |
|
54 |
int store_output; |
|
35 | 55 |
int pid; |
32 | 56 |
} output; |
3 | 57 |
int jobid; |
58 |
int errorlevel; |
|
21 | 59 |
int line_size; |
63 | 60 |
enum Jobstate state; |
66
f70a27afd92e
Adding "swap jobs" with -U. Fixed a big problem with fds 0, 1, 2.
viric@mandarina
parents:
63
diff
changeset
|
61 |
struct { |
f70a27afd92e
Adding "swap jobs" with -U. Fixed a big problem with fds 0, 1, 2.
viric@mandarina
parents:
63
diff
changeset
|
62 |
int jobid1; |
f70a27afd92e
Adding "swap jobs" with -U. Fixed a big problem with fds 0, 1, 2.
viric@mandarina
parents:
63
diff
changeset
|
63 |
int jobid2; |
f70a27afd92e
Adding "swap jobs" with -U. Fixed a big problem with fds 0, 1, 2.
viric@mandarina
parents:
63
diff
changeset
|
64 |
} swap; |
2 | 65 |
} u; |
1 | 66 |
}; |
67 |
||
63 | 68 |
/* msg.c */ |
18 | 69 |
void send_bytes(const int fd, const char *data, const int bytes); |
70 |
int recv_bytes(const int fd, char *data, const int bytes); |
|
71 |
void send_msg(const int fd, const struct msg *m); |
|
72 |
int recv_msg(const int fd, struct msg *m); |
|
44 | 73 |
|
63 | 74 |
/* jobs.c */ |
75 |
const char * jstate2string(enum Jobstate s); |
|
76 |
||
77 |
/* msgdump.c */ |
|
44 | 78 |
void msgdump(const struct msg *m); |