-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathipc.h
64 lines (51 loc) · 1.72 KB
/
ipc.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/**
* ipc.h -- interprocess communication between UI, daemon processes
*/
#ifndef __IPC_H__
#define __IPC_H__
#include <stdio.h>
#include <glib.h>
#include <unistd.h>
typedef enum {
/* UI process sends... */
UNLINK_DAEMON_FILE, /* no arg */
CLEAR_ANALYSIS_QUEUE, /* no arg */
QUEUE_FILE, /* str arg */
QUIT_IF_ATTACHED, /* no arg */
ATTACH, /* no arg */
DETACH, /* no arg */
/* Daemon process sends... */
STATUS_PERCENT, /* int arg */
STATUS_TEXT, /* str arg */
ADDED_FILE, /* int arg -- seek */
ANIMATE_START, /* str arg */
ANIMATE_STOP, /* no arg */
/* Both may send... */
REQ_ACK, /* no arg */
ACK /* no arg */
} ipc_type;
/* Pipes are named by the sending process */
#define DAEMON_PIPE_FILE "gjay_daemon"
#define UI_PIPE_FILE "gjay_ui"
#define GJAY_PIPE_DIR_TEMPLATE "/tmp/gjay-"
extern char * daemon_pipe;
extern char * ui_pipe;
extern char * gjay_pipe_dir;
/* The UI will send a message to an attached daemon at least every
* UI_PING ms. If an attached daemon hasn't heard from the UI in
* FREAKOUT sec it quits.
*/
#define UI_PING 5000
#define DAEMON_ATTACH_FREAKOUT 20
extern int daemon_pipe_fd;
extern int ui_pipe_fd;
gboolean ui_pipe_input (GIOChannel *source,
GIOCondition condition,
gpointer data);
gboolean daemon_pipe_input (GIOChannel *source,
GIOCondition condition,
gpointer data);
void send_ipc (int fd, ipc_type type );
void send_ipc_text (int fd, ipc_type type, char * text);
void send_ipc_int (int fd, ipc_type type, int val);
#endif /* __IPC_H__ */