diff options
author | Eamon Walsh <ewalsh@tycho.nsa.gov> | 2011-07-29 16:21:26 -0400 |
---|---|---|
committer | Eamon Walsh <ewalsh@tycho.nsa.gov> | 2011-07-29 16:21:26 -0400 |
commit | 1dabf5f303b0cf12199790915551ecd2f90a329b (patch) | |
tree | baaf16f848b6d8d3cc6fdb22800fd9f87f4eb4e5 /src | |
parent | f51d7cd07430dc708b91f87b53748f4fd8d1c271 (diff) |
Add client_send_message() API for sending track protocol to a client.
Diffstat (limited to 'src')
-rw-r--r-- | src/client.c | 11 | ||||
-rw-r--r-- | src/client.h | 5 | ||||
-rw-r--r-- | src/xen_server.c | 1 |
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); |