1 |
/* |
/* |
2 |
rdesktop: A Remote Desktop Protocol client. |
rdesktop: A Remote Desktop Protocol client. |
3 |
Parsing primitives |
Parsing primitives |
4 |
Copyright (C) Matthew Chapman 1999-2000 |
Copyright (C) Matthew Chapman 1999-2005 |
5 |
|
|
6 |
This program is free software; you can redistribute it and/or modify |
This program is free software; you can redistribute it and/or modify |
7 |
it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
31 |
unsigned char *mcs_hdr; |
unsigned char *mcs_hdr; |
32 |
unsigned char *sec_hdr; |
unsigned char *sec_hdr; |
33 |
unsigned char *rdp_hdr; |
unsigned char *rdp_hdr; |
34 |
|
unsigned char *channel_hdr; |
35 |
|
|
36 |
} *STREAM; |
} |
37 |
|
*STREAM; |
38 |
|
|
39 |
#define s_push_layer(s,h,n) { (s)->h = (s)->p; (s)->p += n; } |
#define s_push_layer(s,h,n) { (s)->h = (s)->p; (s)->p += n; } |
40 |
#define s_pop_layer(s,h) (s)->p = (s)->h; |
#define s_pop_layer(s,h) (s)->p = (s)->h; |
70 |
#define out_uint32(s,v) out_uint32_be(s,v) |
#define out_uint32(s,v) out_uint32_be(s,v) |
71 |
|
|
72 |
#else |
#else |
|
#define next_be(s,v) v = ((v) << 8) + *((s)->p++); |
|
73 |
#define in_uint16_be(s,v) { v = *((s)->p++); next_be(s,v); } |
#define in_uint16_be(s,v) { v = *((s)->p++); next_be(s,v); } |
74 |
#define in_uint32_be(s,v) { in_uint16_be(s,v); next_be(s,v); next_be(s,v); } |
#define in_uint32_be(s,v) { in_uint16_be(s,v); next_be(s,v); next_be(s,v); } |
75 |
#define out_uint16_be(s,v) { *((s)->p++) = ((v) >> 8) & 0xff; *((s)->p++) = (v) & 0xff; } |
#define out_uint16_be(s,v) { *((s)->p++) = ((v) >> 8) & 0xff; *((s)->p++) = (v) & 0xff; } |
91 |
#define out_uint8p(s,v,n) { memcpy((s)->p,v,n); (s)->p += n; } |
#define out_uint8p(s,v,n) { memcpy((s)->p,v,n); (s)->p += n; } |
92 |
#define out_uint8a(s,v,n) out_uint8p(s,v,n); |
#define out_uint8a(s,v,n) out_uint8p(s,v,n); |
93 |
#define out_uint8s(s,n) { memset((s)->p,0,n); (s)->p += n; } |
#define out_uint8s(s,n) { memset((s)->p,0,n); (s)->p += n; } |
94 |
|
|
95 |
|
#define next_be(s,v) v = ((v) << 8) + *((s)->p++); |