summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorLaxmikant Rashinkar <LK.Rashinkar@gmail.com>2013-03-08 15:37:30 -0800
committerLaxmikant Rashinkar <LK.Rashinkar@gmail.com>2013-03-08 15:37:30 -0800
commit78d4e19258388d547c5760578df5f59ec36c8824 (patch)
tree29bef3f3f29b5be81412543e2b1d90aa699bd94c /common
parentb53cefbea45575ab3772a2705d67c2a293437401 (diff)
downloadxrdp-proprietary-78d4e19258388d547c5760578df5f59ec36c8824.tar.gz
xrdp-proprietary-78d4e19258388d547c5760578df5f59ec36c8824.zip
o early checkin for drive redirection
o basic drive redirection is working o functions currently supported: open: read, write, create, get/set attribute o requires latest NeutrinoRDP to work o note: clipboard is broken because of the move from linked lists to inodes in the FUSE code
Diffstat (limited to 'common')
-rw-r--r--common/parse.h99
1 files changed, 98 insertions, 1 deletions
diff --git a/common/parse.h b/common/parse.h
index deee7845..be01a3f1 100644
--- a/common/parse.h
+++ b/common/parse.h
@@ -101,7 +101,6 @@ struct stream
#define s_mark_end(s) \
(s)->end = (s)->p
-/******************************************************************************/
#define in_sint8(s, v) do \
{ \
(v) = *((signed char*)((s)->p)); \
@@ -303,4 +302,102 @@ struct stream
(s)->p += (n); \
} while (0)
+/*
+ * @brief allocate a new stream
+ *
+ * @param _s opaque handle to the new stream
+ * @param _l length of new stream
+ ******************************************************************************/
+#define stream_new(_s, _l) \
+do \
+{ \
+ make_stream((_s)); \
+ init_stream((_s), (_l)); \
+} while (0)
+
+/**
+ * @brief release a previously allocated stream
+ *
+ * @param _s opaque handle returned by stream_new()
+ *****************************************************************************/
+#define stream_free(_s) free_stream(_s)
+
+#define stream_rd_u8(_s, _var) in_uint8(_s, _var)
+#define stream_rd_u16_le(_s, _var) in_uint16_le(_s, _var)
+#define stream_rd_u32_le(_s, _var) in_uint32_le(_s, _var)
+
+#define stream_rd_s8_le(_s, _var) in_sint8(_s, _var)
+#define stream_rd_s16_le(_s, _var) in_sint16_le(_s, _var)
+#define stream_rd_s32_le(_s, _var) TODO
+
+#define stream_wr_u8(_s, _var) out_uint8(_s, _var)
+#define stream_wr_u16_le(_s, _var) out_uint16_le(_s, _var)
+#define stream_wr_u32_le(_s, _var) out_uint32_le(_s, _var)
+
+#define stream_wr_s8(_s, _var) TODO
+#define stream_wr_s16_le(_s, _var) TODO
+#define stream_wr_s32_le(_s, _var) TODO
+
+#define stream_rd_u64_le(_s, _v) \
+do \
+{ \
+ _v = \
+ (tui64)(*((unsigned char *)_s->p)) | \
+ (((tui64) (*(((unsigned char *)_s->p) + 1))) << 8) | \
+ (((tui64) (*(((unsigned char *)_s->p) + 2))) << 16) | \
+ (((tui64) (*(((unsigned char *)_s->p) + 3))) << 24) | \
+ (((tui64) (*(((unsigned char *)_s->p) + 4))) << 32) | \
+ (((tui64) (*(((unsigned char *)_s->p) + 5))) << 40) | \
+ (((tui64) (*(((unsigned char *)_s->p) + 6))) << 48) | \
+ (((tui64) (*(((unsigned char *)_s->p) + 7))) << 56); \
+ _s->p += 8; \
+} while (0)
+
+#define stream_wr_u64_le(_s, _v) \
+do \
+{ \
+ *(((unsigned char *) _s->p) + 0) = (unsigned char) ((_v >> 0) & 0xff); \
+ *(((unsigned char *) _s->p) + 1) = (unsigned char) ((_v >> 8) & 0xff); \
+ *(((unsigned char *) _s->p) + 2) = (unsigned char) ((_v >> 16) & 0xff); \
+ *(((unsigned char *) _s->p) + 3) = (unsigned char) ((_v >> 24) & 0xff); \
+ *(((unsigned char *) _s->p) + 4) = (unsigned char) ((_v >> 32) & 0xff); \
+ *(((unsigned char *) _s->p) + 5) = (unsigned char) ((_v >> 40) & 0xff); \
+ *(((unsigned char *) _s->p) + 6) = (unsigned char) ((_v >> 48) & 0xff); \
+ *(((unsigned char *) _s->p) + 7) = (unsigned char) ((_v >> 56) & 0xff); \
+ _s->p += 8; \
+} while (0)
+
+/* copy data into stream */
+#define stream_copyin(_s, _dest, _len) \
+do \
+{ \
+ memcpy((_s)->p, (_dest), (_len)); \
+ (_s)->p += (_len); \
+} while (0)
+
+/* copy data out of stream */
+#define stream_copyout(_dest, _s, _len) \
+{ \
+do \
+ memcpy((_dest), (_s)->p, (_len)); \
+ (_s)->p += (_len); \
+} while (0)
+
+#define stream_rd_string(_dest, _s, _len) \
+do \
+{ \
+ memcpy((_dest), (_s)->p, (_len)); \
+ (_s)->p += (_len); \
+} while (0)
+
+#define stream_wr_string(_s, _src, _len) \
+do \
+{ \
+ memcpy((_s)->p, (_src), (_len)); \
+ (_s)->p += (_len); \
+} while (0)
+
+#define stream_len(_s) (int) ((_s)->p - (_s)->data)
+#define stream_seek(_s, _len) (_s)->p += (_len)
+
#endif