[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC][PATCH 04/15] virtproxy: list look-up functions conns/
From: |
Michael Roth |
Subject: |
[Qemu-devel] [RFC][PATCH 04/15] virtproxy: list look-up functions conns/oforwards/iforwards |
Date: |
Fri, 22 Oct 2010 13:43:20 -0500 |
Signed-off-by: Michael Roth <address@hidden>
---
virtproxy.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/virtproxy.c b/virtproxy.c
index 2f8996c..fa17722 100644
--- a/virtproxy.c
+++ b/virtproxy.c
@@ -149,3 +149,47 @@ static QemuOptsList vp_socket_opts = {
{ /* end if list */ }
},
};
+
+/* get VPConn by fd, "client" denotes whether to look for client or server */
+static VPConn *get_conn(const VPDriver *drv, int fd, bool client)
+{
+ VPConn *c = NULL;
+ int cur_fd;
+
+ QLIST_FOREACH(c, &drv->conns, next) {
+ cur_fd = client ? c->client_fd : c->server_fd;
+ if (cur_fd == fd) {
+ return c;
+ }
+ }
+
+ return NULL;
+}
+
+/* get VPOForward by service_id */
+static VPOForward *get_oforward(const VPDriver *drv, const char *service_id)
+{
+ VPOForward *f = NULL;
+
+ QLIST_FOREACH(f, &drv->oforwards, next) {
+ if (strncmp(f->service_id, service_id, VP_SERVICE_ID_LEN) == 0) {
+ return f;
+ }
+ }
+
+ return NULL;
+}
+
+/* get VPIForward by service_id */
+static VPIForward *get_iforward(const VPDriver *drv, const char *service_id)
+{
+ VPIForward *f = NULL;
+
+ QLIST_FOREACH(f, &drv->iforwards, next) {
+ if (strncmp(f->service_id, service_id, VP_SERVICE_ID_LEN) == 0) {
+ return f;
+ }
+ }
+
+ return NULL;
+}
--
1.7.0.4
- [Qemu-devel] [RFC][PATCH 07/15] virtproxy: add vp_new() VPDriver constructor, (continued)
- [Qemu-devel] [RFC][PATCH 07/15] virtproxy: add vp_new() VPDriver constructor, Michael Roth, 2010/10/22
- [Qemu-devel] [RFC][PATCH 03/15] virtproxy: add debug functions for virtproxy core, Michael Roth, 2010/10/22
- [Qemu-devel] [RFC][PATCH 08/15] virtproxy: interfaces to set/remove/handle VPOForwards, Michael Roth, 2010/10/22
- [Qemu-devel] [RFC][PATCH 09/15] virtproxy: add handler for data packets, Michael Roth, 2010/10/22
- [Qemu-devel] [RFC][PATCH 10/15] virtproxy: add handler for control packet, Michael Roth, 2010/10/22
- [Qemu-devel] [RFC][PATCH 11/15] virtproxy: add vp_handle_packet(), Michael Roth, 2010/10/22
- [Qemu-devel] [RFC][PATCH 12/15] virtproxy: interfaces to set/remove VPIForwards, Michael Roth, 2010/10/22
- [Qemu-devel] [RFC][PATCH 01/15] virtproxy: base data structures and constants, Michael Roth, 2010/10/22
- [Qemu-devel] [RFC][PATCH 13/15] virtproxy: add read handler for proxied connections, Michael Roth, 2010/10/22
- [Qemu-devel] [RFC][PATCH 15/15] virtproxy: qemu-vp, main logic, Michael Roth, 2010/10/22
- [Qemu-devel] [RFC][PATCH 04/15] virtproxy: list look-up functions conns/oforwards/iforwards,
Michael Roth <=
- [Qemu-devel] [RFC][PATCH 14/15] virtproxy: Makefile/configure changes to build qemu-vp, Michael Roth, 2010/10/22
- [Qemu-devel] [RFC][PATCH 05/15] virtproxy: add accept handler for communication channel, Michael Roth, 2010/10/22
- Re: [Qemu-devel] [RFC][PATCH 00/15] virtproxy: host/guest communication layer, Blue Swirl, 2010/10/23