summaryrefslogtreecommitdiff
path: root/source4/librpc/ndr/ndr_basic.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-11-11 04:04:36 +0000
committerAndrew Tridgell <tridge@samba.org>2003-11-11 04:04:36 +0000
commitcecbf0cd8b99f7019a83def88baec889d6a06e6f (patch)
tree108181e24bac1a4fa10a55de40547d9177b488e8 /source4/librpc/ndr/ndr_basic.c
parenta934f89549b3d23199d68b7dc3fc3ad16e86b9ad (diff)
downloadsamba-cecbf0cd8b99f7019a83def88baec889d6a06e6f.tar.gz
samba-cecbf0cd8b99f7019a83def88baec889d6a06e6f.tar.bz2
samba-cecbf0cd8b99f7019a83def88baec889d6a06e6f.zip
automatically generate ndr_print_*() functions for every IDL
structure. This allows easy debug and test tool writing without having to write functions that print every element of complex structures. (This used to be commit 81d6181172e36c6fbae0907550a29511ce708574)
Diffstat (limited to 'source4/librpc/ndr/ndr_basic.c')
-rw-r--r--source4/librpc/ndr/ndr_basic.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/source4/librpc/ndr/ndr_basic.c b/source4/librpc/ndr/ndr_basic.c
index b6c5a0cd53..11f3bb5e23 100644
--- a/source4/librpc/ndr/ndr_basic.c
+++ b/source4/librpc/ndr/ndr_basic.c
@@ -373,3 +373,48 @@ NTSTATUS ndr_pull_NTTIME(struct ndr_pull *ndr, NTTIME *t)
NDR_CHECK(ndr_pull_uint32(ndr, &t->high));
return NT_STATUS_OK;
}
+
+
+void ndr_print_struct(struct ndr_print *ndr, const char *name)
+{
+ ndr->print(ndr, "%s:", name);
+}
+
+void ndr_print_uint8(struct ndr_print *ndr, const char *name, uint8 v)
+{
+ ndr->print(ndr, "%-25s: 0x%02x (%u)", name, v, v);
+}
+
+void ndr_print_uint16(struct ndr_print *ndr, const char *name, uint16 v)
+{
+ ndr->print(ndr, "%-25s: 0x%04x (%u)", name, v, v);
+}
+
+void ndr_print_uint32(struct ndr_print *ndr, const char *name, uint32 v)
+{
+ ndr->print(ndr, "%-25s: 0x%08x (%u)", name, v, v);
+}
+
+void ndr_print_ptr(struct ndr_print *ndr, const char *name, const void *p)
+{
+ if (p) {
+ ndr->print(ndr, "%-25s: *", name);
+ } else {
+ ndr->print(ndr, "%-25s: NULL", name);
+ }
+}
+
+void ndr_print_unistr_noterm(struct ndr_print *ndr, const char *name, const char *s)
+{
+ ndr->print(ndr, "%-25s: '%s'", name, s);
+}
+
+void ndr_print_unistr(struct ndr_print *ndr, const char *name, const char *s)
+{
+ ndr->print(ndr, "%-25s: '%s'", name, s);
+}
+
+void ndr_print_NTTIME(struct ndr_print *ndr, const char *name, NTTIME t)
+{
+ ndr->print(ndr, "%-25s: %s", name, nt_time_string(ndr->mem_ctx, &t));
+}