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-2002 |
Copyright (C) Matthew Chapman 1999-2007 |
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 |
8 |
the Free Software Foundation; either version 2 of the License, or |
the Free Software Foundation; either version 2 of the License, or |
9 |
(at your option) any later version. |
(at your option) any later version. |
10 |
|
|
11 |
This program is distributed in the hope that it will be useful, |
This program is distributed in the hope that it will be useful, |
12 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
GNU General Public License for more details. |
GNU General Public License for more details. |
15 |
|
|
16 |
You should have received a copy of the GNU General Public License |
You should have received a copy of the GNU General Public License |
17 |
along with this program; if not, write to the Free Software |
along with this program; if not, write to the Free Software |
18 |
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
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++); |