summaryrefslogtreecommitdiff
path: root/librpc
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2016-09-13 17:03:47 +0200
committerAndreas Schneider <asn@cryptomilk.org>2016-10-26 11:20:18 +0200
commite2f2250456e811ae7af3f81c4e2f65ecb58418e6 (patch)
treeac48fceef07b93f5e25ab6681a6d53742622ba4f /librpc
parenta9be262daaa25264e7a15d055066a3eed0a95002 (diff)
downloadsamba-e2f2250456e811ae7af3f81c4e2f65ecb58418e6.tar.gz
dcerpc.idl: set LIBNDR_FLAG_* flags based on DCERPC_PFC_FLAG_OBJECT_UUID and DCERPC_DREP_LE
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'librpc')
-rw-r--r--librpc/idl/dcerpc.idl8
-rw-r--r--librpc/ndr/ndr_dcerpc.c82
2 files changed, 86 insertions, 4 deletions
diff --git a/librpc/idl/dcerpc.idl b/librpc/idl/dcerpc.idl
index f746fabb4e3..92e189fa482 100644
--- a/librpc/idl/dcerpc.idl
+++ b/librpc/idl/dcerpc.idl
@@ -469,7 +469,7 @@ interface dcerpc
dcerpc_rts_cmd Commands[NumberOfCommands];
} dcerpc_rts;
- typedef [enum8bit] enum {
+ typedef [public,enum8bit] enum {
DCERPC_PKT_REQUEST = 0, /* Ordinary request. */
DCERPC_PKT_PING = 1, /* Connectionless is server alive ? */
DCERPC_PKT_RESPONSE = 2, /* Ordinary reply. */
@@ -493,7 +493,7 @@ interface dcerpc
DCERPC_PKT_RTS = 20 /* RTS packets used in ncacn_http */
} dcerpc_pkt_type;
- typedef [nodiscriminant] union {
+ typedef [public,nodiscriminant] union {
[case(DCERPC_PKT_REQUEST)] dcerpc_request request;
[case(DCERPC_PKT_PING)] dcerpc_ping ping;
[case(DCERPC_PKT_RESPONSE)] dcerpc_response response;
@@ -518,7 +518,7 @@ interface dcerpc
} dcerpc_payload;
/* pfc_flags values */
- typedef [bitmap8bit] bitmap {
+ typedef [public,bitmap8bit] bitmap {
DCERPC_PFC_FLAG_FIRST = 0x01, /* First fragment */
DCERPC_PFC_FLAG_LAST = 0x02, /* Last fragment */
DCERPC_PFC_FLAG_PENDING_CANCEL_OR_HDR_SIGNING = 0x04, /* depends on the pdu type */
@@ -562,7 +562,7 @@ interface dcerpc
/* little-endian flag */
const uint8 DCERPC_DREP_LE = 0x10;
- typedef [public] struct {
+ typedef [public,nopush,nopull,noprint] struct {
uint8 rpc_vers; /* RPC version */
uint8 rpc_vers_minor; /* Minor version */
dcerpc_pkt_type ptype; /* Packet type */
diff --git a/librpc/ndr/ndr_dcerpc.c b/librpc/ndr/ndr_dcerpc.c
index 0224b2cc30d..ccb3af59546 100644
--- a/librpc/ndr/ndr_dcerpc.c
+++ b/librpc/ndr/ndr_dcerpc.c
@@ -24,6 +24,88 @@
#include "librpc/gen_ndr/ndr_dcerpc.h"
#include "librpc/gen_ndr/ndr_misc.h"
+_PUBLIC_ enum ndr_err_code ndr_push_ncacn_packet(struct ndr_push *ndr, int ndr_flags, const struct ncacn_packet *r)
+{
+ NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->rpc_vers));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->rpc_vers_minor));
+ NDR_CHECK(ndr_push_dcerpc_pkt_type(ndr, NDR_SCALARS, r->ptype));
+ NDR_CHECK(ndr_push_dcerpc_pfc_flags(ndr, NDR_SCALARS, r->pfc_flags));
+ NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->drep, 4));
+ if (r->pfc_flags & DCERPC_PFC_FLAG_OBJECT_UUID) {
+ ndr->flags |= LIBNDR_FLAG_OBJECT_PRESENT;
+ }
+ if (!(r->drep[0] & DCERPC_DREP_LE)) {
+ ndr->flags |= LIBNDR_FLAG_BIGENDIAN;
+ }
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->frag_length));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->auth_length));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->call_id));
+ NDR_CHECK(ndr_push_set_switch_value(ndr, &r->u, r->ptype));
+ NDR_CHECK(ndr_push_dcerpc_payload(ndr, NDR_SCALARS, &r->u));
+ NDR_CHECK(ndr_push_trailer_align(ndr, 4));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_ncacn_packet(struct ndr_pull *ndr, int ndr_flags, struct ncacn_packet *r)
+{
+ uint32_t size_drep_0 = 0;
+ NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->rpc_vers));
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->rpc_vers_minor));
+ NDR_CHECK(ndr_pull_dcerpc_pkt_type(ndr, NDR_SCALARS, &r->ptype));
+ NDR_CHECK(ndr_pull_dcerpc_pfc_flags(ndr, NDR_SCALARS, &r->pfc_flags));
+ size_drep_0 = 4;
+ NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->drep, size_drep_0));
+ if (r->pfc_flags & DCERPC_PFC_FLAG_OBJECT_UUID) {
+ ndr->flags |= LIBNDR_FLAG_OBJECT_PRESENT;
+ }
+ if (!(r->drep[0] & DCERPC_DREP_LE)) {
+ ndr->flags |= LIBNDR_FLAG_BIGENDIAN;
+ }
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->frag_length));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->auth_length));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->call_id));
+ NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->u, r->ptype));
+ NDR_CHECK(ndr_pull_dcerpc_payload(ndr, NDR_SCALARS, &r->u));
+ NDR_CHECK(ndr_pull_trailer_align(ndr, 4));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_ncacn_packet(struct ndr_print *ndr, const char *name, const struct ncacn_packet *r)
+{
+ ndr_print_struct(ndr, name, "ncacn_packet");
+ if (r == NULL) { ndr_print_null(ndr); return; }
+ ndr->depth++;
+ ndr_print_uint8(ndr, "rpc_vers", r->rpc_vers);
+ ndr_print_uint8(ndr, "rpc_vers_minor", r->rpc_vers_minor);
+ ndr_print_dcerpc_pkt_type(ndr, "ptype", r->ptype);
+ ndr_print_dcerpc_pfc_flags(ndr, "pfc_flags", r->pfc_flags);
+ ndr_print_array_uint8(ndr, "drep", r->drep, 4);
+ if (r->pfc_flags & DCERPC_PFC_FLAG_OBJECT_UUID) {
+ ndr->flags |= LIBNDR_FLAG_OBJECT_PRESENT;
+ }
+ if (!(r->drep[0] & DCERPC_DREP_LE)) {
+ ndr->flags |= LIBNDR_FLAG_BIGENDIAN;
+ }
+ ndr_print_uint16(ndr, "frag_length", r->frag_length);
+ ndr_print_uint16(ndr, "auth_length", r->auth_length);
+ ndr_print_uint32(ndr, "call_id", r->call_id);
+ ndr_print_set_switch_value(ndr, &r->u, r->ptype);
+ ndr_print_dcerpc_payload(ndr, "u", &r->u);
+ ndr->depth--;
+}
+
/*
* This function was generated by pidl and
* has been extended by the (_available == 0) check.