fixed the handling of value() attributes on scalars in IDL that
[jelmer/samba4-debian.git] / source / librpc / idl / dcerpc.idl
1 #include "idl_types.h"
2
3 /*
4   the base dcerpc packet definitions - not traditionally coded as IDL,
5   but given that pidl can handle it nicely it simplifies things a lot
6   to do it this way
7 */
8 [] 
9 interface dcerpc
10 {
11         typedef struct {
12                 GUID uuid;
13                 uint32 if_version;
14         } dcerpc_syntax_id;
15
16         typedef struct {
17                 uint16 context_id;
18                 uint8 num_transfer_syntaxes;
19                 dcerpc_syntax_id abstract_syntax;
20                 dcerpc_syntax_id transfer_syntaxes[num_transfer_syntaxes];
21         } dcerpc_ctx_list;
22
23         typedef struct {
24                 uint16 max_xmit_frag;
25                 uint16 max_recv_frag;
26                 uint32 assoc_group_id;
27                 uint8 num_contexts;
28                 dcerpc_ctx_list ctx_list[num_contexts];
29                 [flag(NDR_ALIGN8)]    DATA_BLOB _pad;
30                 [flag(NDR_REMAINING)] DATA_BLOB auth_verifier;
31         } dcerpc_bind;
32
33         typedef struct {
34                 uint32 alloc_hint;
35                 uint16 context_id;
36                 uint16 opnum;
37                 [flag(NDR_ALIGN8)]    DATA_BLOB _pad;
38                 [flag(NDR_REMAINING)] DATA_BLOB stub_and_verifier;
39         } dcerpc_request;
40
41         typedef struct {
42                 uint16 result;
43                 uint16 reason;
44                 dcerpc_syntax_id syntax;
45         } dcerpc_ack_ctx;
46
47         typedef struct {
48                 uint16 max_xmit_frag;
49                 uint16 max_recv_frag;
50                 uint32 assoc_group_id;
51                 ascstr3 secondary_address;
52                 [flag(NDR_ALIGN4)]    DATA_BLOB _pad1;
53                 uint8 num_results;
54                 dcerpc_ack_ctx ctx_list[num_results];
55                 [flag(NDR_ALIGN8)]    DATA_BLOB _pad2;
56                 [flag(NDR_REMAINING)] DATA_BLOB auth_verifier;
57         } dcerpc_bind_ack;
58
59         typedef struct {
60                 uint16 reject_reason;
61                 uint32 num_versions;
62                 uint32 versions[num_versions];
63         } dcerpc_bind_nak;
64
65         typedef struct {
66                 uint32 alloc_hint;
67                 uint16 context_id;
68                 uint8 cancel_count;
69                 [flag(NDR_ALIGN8)]    DATA_BLOB _pad;
70                 [flag(NDR_REMAINING)] DATA_BLOB stub_and_verifier;
71         } dcerpc_response;
72
73         typedef struct {
74                 uint32 status;
75         } dcerpc_fault;
76
77         typedef enum {
78                 DCERPC_PKT_REQUEST=0,
79                 DCERPC_PKT_RESPONSE=2,
80                 DCERPC_PKT_FAULT=3,
81                 DCERPC_PKT_BIND=11,
82                 DCERPC_PKT_BIND_ACK=12,
83                 DCERPC_PKT_BIND_NAK=13
84         } dcerpc_pkt_type;
85
86         typedef [nodiscriminant] union {
87                 [case(DCERPC_PKT_REQUEST)]  dcerpc_request  request;
88                 [case(DCERPC_PKT_RESPONSE)] dcerpc_response response;
89                 [case(DCERPC_PKT_BIND)]     dcerpc_bind     bind;
90                 [case(DCERPC_PKT_BIND_ACK)] dcerpc_bind_ack bind_ack;
91                 [case(DCERPC_PKT_FAULT)]    dcerpc_fault    fault;
92         } dcerpc_payload;
93
94
95         /* pfc_flags values */
96         const uint8 DCERPC_PFC_FLAG_FIRST  = 0x01;
97         const uint8 DCERPC_PFC_FLAG_LAST   = 0x02;
98         const uint8 DCERPC_PFC_FLAG_NOCALL = 0x20;
99
100         typedef [public] struct {
101                 uint8 rpc_vers;         /* RPC version */
102                 uint8 rpc_vers_minor;   /* Minor version */
103                 uint8 ptype;            /* Packet type */
104                 uint8 pfc_flags;        /* Fragmentation flags */
105                 uint8 drep[4];          /* NDR data representation */
106                 uint16 frag_length;     /* Total length of fragment */
107                 uint16 auth_length;     /* authenticator length */
108                 uint32 call_id;         /* Call identifier */
109                 
110                 [switch_is(ptype)] dcerpc_payload u;
111         } dcerpc_packet;
112 }