diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-08-02 20:12:31 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:30:59 -0500 |
commit | f30eba52225df456e341beac380ab05469bde76b (patch) | |
tree | 9c2f48926ecbac5c09e6a08877ca7535b0676f43 /source4/lib/tdr/tdr.h | |
parent | 1439697d339e5a866589d425d8d1a1e74b553ff3 (diff) | |
download | samba-f30eba52225df456e341beac380ab05469bde76b.tar.gz samba-f30eba52225df456e341beac380ab05469bde76b.tar.bz2 samba-f30eba52225df456e341beac380ab05469bde76b.zip |
r8940: Add TDR (Trivial Data Representation). The aim is to use this later for
NBT/WINS/etc rather then having to depend on NDR.
(This used to be commit 5ee7af26dd220de06f1764cd1683abedeeda5131)
Diffstat (limited to 'source4/lib/tdr/tdr.h')
-rw-r--r-- | source4/lib/tdr/tdr.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/source4/lib/tdr/tdr.h b/source4/lib/tdr/tdr.h new file mode 100644 index 0000000000..604f9d549a --- /dev/null +++ b/source4/lib/tdr/tdr.h @@ -0,0 +1,52 @@ +/* + Unix SMB/CIFS implementation. + TDR definitions + Copyright (C) Jelmer Vernooij 2005 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#define TDR_FLAG_BIGENDIAN 1 + +struct tdr_pull { + uint8_t *data; + uint32_t offset; + uint32_t length; + int flags; +}; + +struct tdr_push { + uint8_t *data; + uint32_t alloc_size; + uint32_t offset; + uint32_t length; + int flags; +}; + +struct tdr_print { + int level; + void (*print)(struct tdr_print *, const char *, ...); +}; + +#define TDR_CHECK(call) do { NTSTATUS _status; \ + _status = call; \ + if (!NT_STATUS_IS_OK(_status)) \ + return _status; \ + } while (0) + +#define TDR_ALLOC(tdr, s, n) do { \ + (s) = talloc_array_size(tdr, sizeof(*(s)), n); \ + if ((n) && !(s)) return NT_STATUS_NO_MEMORY; \ + } while (0) |