summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client.c11
-rw-r--r--src/client.h5
-rw-r--r--src/xen_server.c1
3 files changed, 17 insertions, 0 deletions
diff --git a/src/client.c b/src/client.c
index b748541..9b73fbd 100644
--- a/src/client.c
+++ b/src/client.c
@@ -35,6 +35,8 @@
#include <stdlib.h>
#include <string.h>
+#include "libvchan.h"
+
#include "client.h"
/* head of client list */
@@ -94,3 +96,12 @@ client_remove_all(void)
while (!LIST_EMPTY(&clients))
client_remove(LIST_FIRST(&clients));
}
+
+int
+client_send_message(struct client *c, unsigned char msg)
+{
+ if (!c->vchan)
+ return -1;
+
+ return libvchan_send(c->vchan, &msg, 1);
+}
diff --git a/src/client.h b/src/client.h
index 298c793..33df48c 100644
--- a/src/client.h
+++ b/src/client.h
@@ -33,6 +33,8 @@
#ifndef _LINPICKER_CLIENT_H_
#define _LINPICKER_CLIENT_H_
+#include "libvchan.h"
+
#include "common.h"
#include "buffer.h"
#include "view.h"
@@ -66,6 +68,7 @@ struct client {
struct view *bg; /* background view */
LIST_ENTRY(client) next; /* linked list */
struct XenInput *input; /* Xen input device */
+ struct libvchan *vchan; /* libvchan endpoint */
};
LIST_HEAD(client_list, client);
@@ -84,5 +87,7 @@ client_remove(struct client *c);
void
client_remove_all(void);
+int
+client_send_message(struct client *c, unsigned char msg);
#endif /* _LINPICKER_CLIENT_H_ */
diff --git a/src/xen_server.c b/src/xen_server.c
index a178525..c264544 100644
--- a/src/xen_server.c
+++ b/src/xen_server.c
@@ -153,6 +153,7 @@ vchan_setup(struct xs_handle *xenstore, xc_interface* xen_xc, const char *path)
if (fd_set_handler(d->fd, vchan_update, d) < 0)
goto err;
+ d->client->vchan = ctrl;
vchan_queue(d);
TAILQ_INSERT_TAIL(&vchans, d, next);