summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2011-12-24 13:42:15 +0100
committerHans de Goede <hdegoede@redhat.com>2011-12-24 13:42:15 +0100
commit3820ff51d9d7f7875d582b65877c589071b4051f (patch)
tree8b3615744f537ff5f10efcc7c28b86d7dde0b200
parent63133213bc5aaaac0bef20cd72038d027d2fbc6f (diff)
usbredirparser: Add usbredirparser_caps_set_cap helper
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r--usbredirparser/usbredirparser.c5
-rw-r--r--usbredirparser/usbredirparser.h5
2 files changed, 10 insertions, 0 deletions
diff --git a/usbredirparser/usbredirparser.c b/usbredirparser/usbredirparser.c
index aa128b2..c51c7c6 100644
--- a/usbredirparser/usbredirparser.c
+++ b/usbredirparser/usbredirparser.c
@@ -139,6 +139,11 @@ void usbredirparser_destroy(struct usbredirparser *parser_pub)
free(parser);
}
+void usbredirparser_caps_set_cap(uint32_t *caps, int cap)
+{
+ caps[cap / 32] |= 1 << (cap % 32);
+}
+
int usbredirparser_peer_has_cap(struct usbredirparser *parser_pub, int cap)
{
struct usbredirparser_priv *parser =
diff --git a/usbredirparser/usbredirparser.h b/usbredirparser/usbredirparser.h
index e2f5ec7..620c86d 100644
--- a/usbredirparser/usbredirparser.h
+++ b/usbredirparser/usbredirparser.h
@@ -168,6 +168,11 @@ struct usbredirparser {
usbredirparser_init */
struct usbredirparser *usbredirparser_create(void);
+/* Set capability cap in the USB_REDIR_CAPS_SIZE sized caps array,
+ this is a helper function to set capabilities in the caps array
+ passed to usbredirparser_init(). */
+void usbredirparser_caps_set_cap(uint32_t *caps, int cap);
+
/* Init the parser, this will queue an initial usb_redir_hello packet,
sending the version and caps to the peer, as well as configure the parsing
according to the passed in flags. */