r5672: Use switch_type() and the token storage mechanism for unions:
[samba.git] / source4 / librpc / ndr / ndr.c
index 549230bb29cd2285608ea5d0a141f17aada80e62..2e350aa0da7e72a880ecc17c2d63f40fa77d5c3f 100644 (file)
@@ -641,6 +641,32 @@ NTSTATUS ndr_check_array_length(struct ndr_pull *ndr, void *p, uint32_t length)
        return NT_STATUS_OK;
 }
 
+/*
+  store a switch value
+ */
+NTSTATUS ndr_push_set_switch_value(struct ndr_push *ndr, void *p, uint32_t val)
+{
+       return ndr_token_store(ndr, &ndr->switch_list, p, val);
+}
+
+NTSTATUS ndr_pull_set_switch_value(struct ndr_pull *ndr, void *p, uint32_t val)
+{
+       return ndr_token_store(ndr, &ndr->switch_list, p, val);
+}
+
+/*
+  retrieve a switch value
+ */
+uint32_t ndr_push_get_switch_value(struct ndr_push *ndr, void *p)
+{
+       return ndr_token_peek(&ndr->switch_list, p);
+}
+
+uint32_t ndr_pull_get_switch_value(struct ndr_pull *ndr, void *p)
+{
+       return ndr_token_peek(&ndr->switch_list, p);
+}
+
 /*
   pull a relative object - stage1
   called during SCALARS processing