diff options
author | Andrew Tridgell <tridge@samba.org> | 2003-11-23 06:28:12 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2003-11-23 06:28:12 +0000 |
commit | 800d3e0134b72135fa359fa5a239f1c68adf4ca1 (patch) | |
tree | 1f0e6cafab8f1d62dee9a3796443ab18b6394fe1 /source4/librpc/idl | |
parent | 02dc7536dd625e0cdee23a96e66cb41b407cdba8 (diff) | |
download | samba-800d3e0134b72135fa359fa5a239f1c68adf4ca1.tar.gz samba-800d3e0134b72135fa359fa5a239f1c68adf4ca1.tar.bz2 samba-800d3e0134b72135fa359fa5a239f1c68adf4ca1.zip |
ooh, this is fun!
I have recoded the core dcerpc packet structures (all the PDUs etc) in
terms of IDL, which means we now use pidl to generate all the code for
handling the most basic dcerpc packets. This is not normally possible
as it isn't completely valid NDR, but pidl has a number of extensions
that make it quite easy.
This also means we get the server side dcerpc
marshalling/unmarshalling code for free.
(This used to be commit 92bcad02587c3c1b31b523ee9fa46658a6cef9ff)
Diffstat (limited to 'source4/librpc/idl')
-rw-r--r-- | source4/librpc/idl/dcerpc.idl | 112 | ||||
-rw-r--r-- | source4/librpc/idl/idl_types.h | 13 |
2 files changed, 124 insertions, 1 deletions
diff --git a/source4/librpc/idl/dcerpc.idl b/source4/librpc/idl/dcerpc.idl new file mode 100644 index 0000000000..14518d6c3d --- /dev/null +++ b/source4/librpc/idl/dcerpc.idl @@ -0,0 +1,112 @@ +#include "idl_types.h" + +/* + the base dcerpc packet definitions - not traditionally coded as IDL, + but given that pidl can handle it nicely it simplifies things a lot + to do it this way +*/ +[] +interface dcerpc +{ + typedef struct { + GUID uuid; + uint32 if_version; + } dcerpc_syntax_id; + + typedef struct { + uint16 context_id; + uint8 num_transfer_syntaxes; + dcerpc_syntax_id abstract_syntax; + dcerpc_syntax_id transfer_syntaxes[num_transfer_syntaxes]; + } dcerpc_ctx_list; + + typedef struct { + uint16 max_xmit_frag; + uint16 max_recv_frag; + uint32 assoc_group_id; + uint8 num_contexts; + dcerpc_ctx_list ctx_list[num_contexts]; + [flag(NDR_ALIGN8)] DATA_BLOB _pad; + [flag(NDR_REMAINING)] DATA_BLOB auth_verifier; + } dcerpc_bind; + + typedef struct { + uint32 alloc_hint; + uint16 context_id; + uint16 opnum; + [flag(NDR_ALIGN8)] DATA_BLOB _pad; + [flag(NDR_REMAINING)] DATA_BLOB stub_and_verifier; + } dcerpc_request; + + typedef struct { + uint16 result; + uint16 reason; + dcerpc_syntax_id syntax; + } dcerpc_ack_ctx; + + typedef struct { + uint16 max_xmit_frag; + uint16 max_recv_frag; + uint32 assoc_group_id; + ascstr3 secondary_address; + [flag(NDR_ALIGN4)] DATA_BLOB _pad1; + uint8 num_results; + dcerpc_ack_ctx ctx_list[num_results]; + [flag(NDR_ALIGN8)] DATA_BLOB _pad2; + [flag(NDR_REMAINING)] DATA_BLOB auth_verifier; + } dcerpc_bind_ack; + + typedef struct { + uint16 reject_reason; + uint32 num_versions; + uint32 versions[num_versions]; + } dcerpc_bind_nak; + + typedef struct { + uint32 alloc_hint; + uint16 context_id; + uint8 cancel_count; + [flag(NDR_ALIGN8)] DATA_BLOB _pad; + [flag(NDR_REMAINING)] DATA_BLOB stub_and_verifier; + } dcerpc_response; + + typedef struct { + uint32 status; + } dcerpc_fault; + + typedef enum { + DCERPC_PKT_REQUEST=0, + DCERPC_PKT_RESPONSE=2, + DCERPC_PKT_FAULT=3, + DCERPC_PKT_BIND=11, + DCERPC_PKT_BIND_ACK=12, + DCERPC_PKT_BIND_NAK=13 + } dcerpc_pkt_type; + + typedef [nodiscriminant] union { + [case(DCERPC_PKT_REQUEST)] dcerpc_request request; + [case(DCERPC_PKT_RESPONSE)] dcerpc_response response; + [case(DCERPC_PKT_BIND)] dcerpc_bind bind; + [case(DCERPC_PKT_BIND_ACK)] dcerpc_bind_ack bind_ack; + [case(DCERPC_PKT_FAULT)] dcerpc_fault fault; + } dcerpc_payload; + + + /* pfc_flags values */ + const uint8 DCERPC_PFC_FLAG_FIRST = 0x01; + const uint8 DCERPC_PFC_FLAG_LAST = 0x02; + const uint8 DCERPC_PFC_FLAG_NOCALL = 0x20; + + typedef [public] struct { + uint8 rpc_vers; /* RPC version */ + uint8 rpc_vers_minor; /* Minor version */ + uint8 ptype; /* Packet type */ + uint8 pfc_flags; /* Fragmentation flags */ + uint8 drep[4]; /* NDR data representation */ + uint16 frag_length; /* Total length of fragment */ + uint16 auth_length; /* authenticator length */ + uint32 call_id; /* Call identifier */ + + [switch_is(ptype)] dcerpc_payload u; + } dcerpc_packet; +} diff --git a/source4/librpc/idl/idl_types.h b/source4/librpc/idl/idl_types.h index ba4e8ab14d..d2bbe1ab45 100644 --- a/source4/librpc/idl/idl_types.h +++ b/source4/librpc/idl/idl_types.h @@ -1,6 +1,7 @@ #define STR_ASCII LIBNDR_FLAG_STR_ASCII #define STR_LEN4 LIBNDR_FLAG_STR_LEN4 #define STR_SIZE4 LIBNDR_FLAG_STR_SIZE4 +#define STR_SIZE2 LIBNDR_FLAG_STR_SIZE2 #define STR_NOTERM LIBNDR_FLAG_STR_NOTERM #define STR_NULLTERM LIBNDR_FLAG_STR_NULLTERM @@ -37,5 +38,15 @@ */ #define ascstr2 [flag(STR_ASCII|STR_LEN4)] string +/* + an ascii string prefixed with [size], 16 bits + null terminated +*/ +#define ascstr3 [flag(STR_ASCII|STR_SIZE2)] string + -#define NDR_NOALIGN LIBNDR_FLAG_NOALIGN +#define NDR_NOALIGN LIBNDR_FLAG_NOALIGN +#define NDR_REMAINING LIBNDR_FLAG_REMAINING +#define NDR_ALIGN2 LIBNDR_FLAG_ALIGN2 +#define NDR_ALIGN4 LIBNDR_FLAG_ALIGN4 +#define NDR_ALIGN8 LIBNDR_FLAG_ALIGN8 |