summaryrefslogtreecommitdiff
path: root/source3/librpc/ndr/libndr.h
diff options
context:
space:
mode:
authormetze <metze@samba.org>2007-11-09 19:23:40 +0000
committerStefan Metzmacher <metze@samba.org>2007-11-09 21:23:14 +0100
commit427b48a92c8d0da35e551f4469ef10c1cb08061c (patch)
treeef6ff3226066d8fcbf4dd513e11947d18a81fc37 /source3/librpc/ndr/libndr.h
parent1c87d791991c4a8adb839923361e9dfbe50f0603 (diff)
downloadsamba-427b48a92c8d0da35e551f4469ef10c1cb08061c.tar.gz
samba-427b48a92c8d0da35e551f4469ef10c1cb08061c.tar.bz2
samba-427b48a92c8d0da35e551f4469ef10c1cb08061c.zip
ndr: change NTSTAUS into enum ndr_err_code (basic stuff)
librpc/ndr/ metze git-svn-id: svn+ssh://svn.samba.org/data/svn/samba/branches/SAMBA_4_0@25916 0c0555d6-39d7-0310-84fc-f1cc0bd64818 (This used to be commit b1b8088cafa3ebbc94d700c7a029a2b74b7652ed)
Diffstat (limited to 'source3/librpc/ndr/libndr.h')
-rw-r--r--source3/librpc/ndr/libndr.h25
1 files changed, 18 insertions, 7 deletions
diff --git a/source3/librpc/ndr/libndr.h b/source3/librpc/ndr/libndr.h
index 518b4a5a37..6341e20b65 100644
--- a/source3/librpc/ndr/libndr.h
+++ b/source3/librpc/ndr/libndr.h
@@ -160,6 +160,7 @@ struct ndr_print {
#define NDR_BE(ndr) (((ndr)->flags & (LIBNDR_FLAG_BIGENDIAN|LIBNDR_FLAG_LITTLE_ENDIAN)) == LIBNDR_FLAG_BIGENDIAN)
enum ndr_err_code {
+ NDR_ERR_SUCCESS = 0,
NDR_ERR_ARRAY_SIZE,
NDR_ERR_BAD_SWITCH,
NDR_ERR_OFFSET,
@@ -179,6 +180,14 @@ enum ndr_err_code {
NDR_ERR_UNREAD_BYTES
};
+#define NDR_ERR_CODE_IS_SUCCESS(x) (x == NDR_ERR_SUCCESS)
+
+#define NDR_ERR_HAVE_NO_MEMORY(x) do { \
+ if (NULL == (x)) { \
+ return NDR_ERR_ALLOC; \
+ } \
+} while (0)
+
enum ndr_compression_alg {
NDR_COMPRESSION_MSZIP = 2,
NDR_COMPRESSION_XPRESS = 3
@@ -231,11 +240,13 @@ enum ndr_compression_alg {
/* 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; \
- _status = call; \
- if (!NT_STATUS_IS_OK(_status)) \
- return _status; \
- } while (0)
+#define NDR_CHECK(call) do { \
+ enum ndr_err_code _status; \
+ _status = call; \
+ if (!NDR_ERR_CODE_IS_SUCCESS(_status)) { \
+ return _status; \
+ } \
+} while (0)
#define NDR_PULL_GET_MEM_CTX(ndr) (ndr->current_mem_ctx)
@@ -281,8 +292,8 @@ enum ndr_compression_alg {
} while (0)
/* these are used when generic fn pointers are needed for ndr push/pull fns */
-typedef NTSTATUS (*ndr_push_flags_fn_t)(struct ndr_push *, int ndr_flags, const void *);
-typedef NTSTATUS (*ndr_pull_flags_fn_t)(struct ndr_pull *, int ndr_flags, void *);
+typedef enum ndr_err_code (*ndr_push_flags_fn_t)(struct ndr_push *, int ndr_flags, const void *);
+typedef enum ndr_err_code (*ndr_pull_flags_fn_t)(struct ndr_pull *, int ndr_flags, void *);
typedef void (*ndr_print_fn_t)(struct ndr_print *, const char *, const void *);
typedef void (*ndr_print_function_t)(struct ndr_print *, const char *, int, const void *);