From ffae01d432c715961c44e499258ee2a9f7e3d5f1 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 6 Mar 2005 17:02:14 +0000 Subject: r5672: Use switch_type() and the token storage mechanism for unions: - Makes union handling less special - Allows unions in arrays, etc - Compatible with midl - Pidl will warn about switch_type() and the type of the switch_is() variable being different (This used to be commit dc6b4ffc82a191631bc16a4b93a4916a39183ec6) --- source4/librpc/ndr/ndr.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'source4/librpc/ndr/ndr.c') diff --git a/source4/librpc/ndr/ndr.c b/source4/librpc/ndr/ndr.c index 549230bb29..2e350aa0da 100644 --- a/source4/librpc/ndr/ndr.c +++ b/source4/librpc/ndr/ndr.c @@ -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 -- cgit