talloc: use the system pytalloc-util for python3 as well
[sfrench/samba-autobuild/.git] / lib / tdr / tdr.h
index c983cd35c14ed3e941858f8c20946ac3ee27d23b..fa0a4d7a77a0add388f1dd3cb7d479308ce2df67 100644 (file)
@@ -2,17 +2,17 @@
    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 3 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, see <http://www.gnu.org/licenses/>.
 */
@@ -33,13 +33,11 @@ struct tdr_pull {
        DATA_BLOB data;
        uint32_t offset;
        int flags;
-       struct smb_iconv_convenience *iconv_convenience;
 };
 
 struct tdr_push {
        DATA_BLOB data;
        int flags;
-       struct smb_iconv_convenience *iconv_convenience;
 };
 
 struct tdr_print {
@@ -55,13 +53,48 @@ struct tdr_print {
                         } while (0)
 
 #define TDR_ALLOC(ctx, s, n) do { \
-                              (s) = talloc_array_size(ctx, sizeof(*(s)), n); \
+                              (s) = talloc_array_ptrtype(ctx, (s), n); \
                            if ((n) && !(s)) return NT_STATUS_NO_MEMORY; \
                            } while (0)
 
 typedef NTSTATUS (*tdr_push_fn_t) (struct tdr_push *, const void *);
 typedef NTSTATUS (*tdr_pull_fn_t) (struct tdr_pull *, TALLOC_CTX *, void *);
 
-#include "lib/tdr/tdr_proto.h"
+NTSTATUS tdr_push_expand(struct tdr_push *tdr, uint32_t size);
+NTSTATUS tdr_pull_uint8(struct tdr_pull *tdr, TALLOC_CTX *ctx, uint8_t *v);
+NTSTATUS tdr_push_uint8(struct tdr_push *tdr, const uint8_t *v);
+NTSTATUS tdr_print_uint8(struct tdr_print *tdr, const char *name, uint8_t *v);
+NTSTATUS tdr_pull_uint16(struct tdr_pull *tdr, TALLOC_CTX *ctx, uint16_t *v);
+NTSTATUS tdr_pull_uint1632(struct tdr_pull *tdr, TALLOC_CTX *ctx, uint16_t *v);
+NTSTATUS tdr_push_uint16(struct tdr_push *tdr, const uint16_t *v);
+NTSTATUS tdr_push_uint1632(struct tdr_push *tdr, const uint16_t *v);
+NTSTATUS tdr_print_uint16(struct tdr_print *tdr, const char *name, uint16_t *v);
+NTSTATUS tdr_pull_uint32(struct tdr_pull *tdr, TALLOC_CTX *ctx, uint32_t *v);
+NTSTATUS tdr_push_uint32(struct tdr_push *tdr, const uint32_t *v);
+NTSTATUS tdr_print_uint32(struct tdr_print *tdr, const char *name, uint32_t *v);
+NTSTATUS tdr_pull_charset(struct tdr_pull *tdr, TALLOC_CTX *ctx, const char **v, uint32_t length, uint32_t el_size, charset_t chset);
+NTSTATUS tdr_push_charset(struct tdr_push *tdr, const char **v, uint32_t length, uint32_t el_size, charset_t chset);
+NTSTATUS tdr_print_charset(struct tdr_print *tdr, const char *name, const char **v, uint32_t length, uint32_t el_size, charset_t chset);
+
+NTSTATUS tdr_pull_hyper(struct tdr_pull *tdr, TALLOC_CTX *ctx, uint64_t *v);
+NTSTATUS tdr_push_hyper(struct tdr_push *tdr, uint64_t *v);
+
+NTSTATUS tdr_push_NTTIME(struct tdr_push *tdr, NTTIME *t);
+NTSTATUS tdr_pull_NTTIME(struct tdr_pull *tdr, TALLOC_CTX *ctx, NTTIME *t);
+NTSTATUS tdr_print_NTTIME(struct tdr_print *tdr, const char *name, NTTIME *t);
+
+NTSTATUS tdr_push_time_t(struct tdr_push *tdr, time_t *t);
+NTSTATUS tdr_pull_time_t(struct tdr_pull *tdr, TALLOC_CTX *ctx, time_t *t);
+NTSTATUS tdr_print_time_t(struct tdr_print *tdr, const char *name, time_t *t);
+
+NTSTATUS tdr_print_DATA_BLOB(struct tdr_print *tdr, const char *name, DATA_BLOB *r);
+NTSTATUS tdr_push_DATA_BLOB(struct tdr_push *tdr, DATA_BLOB *blob);
+NTSTATUS tdr_pull_DATA_BLOB(struct tdr_pull *tdr, TALLOC_CTX *ctx, DATA_BLOB *blob);
+
+struct tdr_push *tdr_push_init(TALLOC_CTX *mem_ctx);
+struct tdr_pull *tdr_pull_init(TALLOC_CTX *mem_ctx);
+
+NTSTATUS tdr_push_to_fd(int fd, tdr_push_fn_t push_fn, const void *p);
+void tdr_print_debug_helper(struct tdr_print *tdr, const char *format, ...) PRINTF_ATTRIBUTE(2,3);
 
 #endif /* __TDR_H__ */