uint32_t offset;
struct ndr_token_list *relative_list;
+ struct ndr_token_list *array_size_list;
+ struct ndr_token_list *array_length_list;
/* this is used to ensure we generate unique reference IDs
between request and reply */
#define LIBNDR_FLAG_STR_FIXLEN32 (1<<9)
#define LIBNDR_FLAG_STR_CONFORMANT (1<<10)
#define LIBNDR_FLAG_STR_CHARLEN (1<<11)
-#define LIBNDR_STRING_FLAGS (0xFFC)
+#define LIBNDR_FLAG_STR_UTF8 (1<<12)
+#define LIBNDR_FLAG_STR_FIXLEN15 (1<<13)
+#define LIBNDR_STRING_FLAGS (0x3FFC)
#define LIBNDR_FLAG_REF_ALLOC (1<<20)
offset, not base) */
#define LIBNDR_FLAG_RELATIVE_CURRENT (1<<29)
+/* set if an object uuid will be present */
+#define LIBNDR_FLAG_OBJECT_PRESENT (1<<30)
/* useful macro for debugging */
#define NDR_PRINT_DEBUG(type, p) ndr_print_debug((ndr_print_fn_t)ndr_print_ ##type, #p, p)
NDR_ERR_VALIDATE,
NDR_ERR_BUFSIZE,
NDR_ERR_ALLOC,
- NDR_ERR_RANGE
+ NDR_ERR_RANGE,
+ NDR_ERR_TOKEN
};
/*
} \
ndr->offset = (ndr->offset + (n-1)) & ~(n-1); \
} \
- if (ndr->offset >= ndr->data_size) { \
+ if (ndr->offset > ndr->data_size) { \
return ndr_pull_error(ndr, NDR_ERR_BUFSIZE, "Pull align %u", n); \
} \
} while(0)
} \
} while(0)
-#define NDR_SIZE_ALIGN(t, n, flags) ((flags & LIBNDR_FLAG_NOALIGN)?(t):(((t) + (n-1)) & ~(n-1)))
-#define ndr_size_uint8(t, p, flags) (NDR_SIZE_ALIGN(t, 1, flags) + 1)
-#define ndr_size_uint16(t, p, flags) (NDR_SIZE_ALIGN(t, 2, flags) + 2)
-#define ndr_size_uint32(t, p, flags) (NDR_SIZE_ALIGN(t, 4, flags) + 4)
-#define ndr_size_ptr(t, p, flags) (NDR_SIZE_ALIGN(t, 4, flags) + 4)
-
/* these are used to make the error checking on each element in libndr
less tedious, hopefully making the code more readable */
#define NDR_CHECK(call) do { NTSTATUS _status; \
#define NDR_ALLOC_SIZE(ndr, s, size) do { \
- (s) = talloc(ndr, size); \
+ (s) = talloc_size(ndr, size); \
if ((size) && !(s)) return ndr_pull_error(ndr, NDR_ERR_ALLOC, \
"Alloc %u failed\n", \
size); \
#define NDR_ALLOC_N_SIZE(ndr, s, n, elsize) do { \
- if ((n) == 0) { \
- (s) = NULL; \
- } else { \
- (s) = talloc(ndr, (n) * elsize); \
- if (!(s)) return ndr_pull_error(ndr, \
- NDR_ERR_ALLOC, \
- "Alloc %u * %u failed\n", \
- n, elsize); \
- } \
- } while (0)
+ (s) = talloc_array_size(ndr, elsize, n); \
+ if (!(s)) return ndr_pull_error(ndr, NDR_ERR_ALLOC, "Alloc %u * %u failed\n", n, elsize); \
+} while (0)
#define NDR_ALLOC_N(ndr, s, n) NDR_ALLOC_N_SIZE(ndr, s, n, sizeof(*(s)))
#define NDR_PUSH_ALLOC_SIZE(ndr, s, size) do { \
- (s) = talloc(ndr, size); \
- if ((size) && !(s)) return ndr_push_error(ndr, NDR_ERR_ALLOC, \
- "push alloc %u failed\n",\
- size); \
- } while (0)
+ (s) = talloc_size(ndr, size); \
+ if (!(s)) return ndr_push_error(ndr, NDR_ERR_ALLOC, "push alloc %u failed\n", size); \
+} while (0)
#define NDR_PUSH_ALLOC(ndr, s) NDR_PUSH_ALLOC_SIZE(ndr, s, sizeof(*(s)))
-
/* these are used when generic fn pointers are needed for ndr push/pull fns */
typedef NTSTATUS (*ndr_push_fn_t)(struct ndr_push *, void *);
typedef NTSTATUS (*ndr_pull_fn_t)(struct ndr_pull *, void *);