Add bind nak to dcerpc_payload.
[ira/wip.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                 uint16 major_version;
14                 uint16 minor_version;
15         } dcerpc_syntax_id;
16
17         typedef struct {
18                 uint16 context_id;
19                 uint8 num_transfer_syntaxes;
20                 dcerpc_syntax_id abstract_syntax;
21                 dcerpc_syntax_id transfer_syntaxes[num_transfer_syntaxes];
22         } dcerpc_ctx_list;
23
24         typedef struct {
25                 uint16 max_xmit_frag;
26                 uint16 max_recv_frag;
27                 uint32 assoc_group_id;
28                 uint8 num_contexts;
29                 dcerpc_ctx_list ctx_list[num_contexts];
30                 [flag(NDR_ALIGN8)]    DATA_BLOB _pad;
31                 [flag(NDR_REMAINING)] DATA_BLOB auth_info;
32         } dcerpc_bind;
33
34
35         const uint8 DCERPC_REQUEST_LENGTH = 24;
36
37         typedef struct {
38                 uint32 alloc_hint;
39                 uint16 context_id;
40                 uint16 opnum;
41                 [flag(NDR_ALIGN8)]    DATA_BLOB _pad;
42                 [flag(NDR_REMAINING)] DATA_BLOB stub_and_verifier;
43         } dcerpc_request;
44
45         typedef struct {
46                 uint16 result;
47                 uint16 reason;
48                 dcerpc_syntax_id syntax;
49         } dcerpc_ack_ctx;
50
51         typedef struct {
52                 uint16 max_xmit_frag;
53                 uint16 max_recv_frag;
54                 uint32 assoc_group_id;
55                 ascstr3 secondary_address;
56                 [flag(NDR_ALIGN4)]    DATA_BLOB _pad1;
57                 uint8 num_results;
58                 dcerpc_ack_ctx ctx_list[num_results];
59                 [flag(NDR_REMAINING)] DATA_BLOB auth_info;
60         } dcerpc_bind_ack;
61
62         typedef struct {
63                 uint16 reject_reason;
64                 uint32 num_versions;
65                 uint32 versions[num_versions];
66         } dcerpc_bind_nak;
67
68         const uint8 DCERPC_RESPONSE_LENGTH = 24;
69
70         typedef struct {
71                 uint32 alloc_hint;
72                 uint16 context_id;
73                 uint8 cancel_count;
74                 [flag(NDR_ALIGN8)]    DATA_BLOB _pad;
75                 [flag(NDR_REMAINING)] DATA_BLOB stub_and_verifier;
76         } dcerpc_response;
77
78         typedef struct {
79                 uint32 status;
80         } dcerpc_fault;
81
82
83         const uint8 DCERPC_AUTH_TYPE_NONE    = 0;
84         const uint8 DCERPC_AUTH_TYPE_KRB5    = 1;
85         const uint8 DCERPC_AUTH_TYPE_NTLMSSP = 10;
86         
87         const uint8 DCERPC_AUTH_LEVEL_NONE      = 1;
88         const uint8 DCERPC_AUTH_LEVEL_CONNECT   = 2;
89         const uint8 DCERPC_AUTH_LEVEL_CALL      = 3;
90         const uint8 DCERPC_AUTH_LEVEL_PACKET    = 4;
91         const uint8 DCERPC_AUTH_LEVEL_INTEGRITY = 5;
92         const uint8 DCERPC_AUTH_LEVEL_PRIVACY   = 6;
93
94         typedef [public] struct {
95                 uint8  auth_type; 
96                 uint8  auth_level;
97                 uint8  auth_pad_length;
98                 uint8  auth_reserved;
99                 uint32 auth_context_id;
100                 [flag(NDR_REMAINING)] DATA_BLOB credentials;
101         } dcerpc_auth;
102
103         typedef [public] struct {
104                 uint32 _pad;
105                 [flag(NDR_REMAINING)] DATA_BLOB auth_info;
106         } dcerpc_auth3;
107
108         typedef enum {
109                 DCERPC_PKT_REQUEST     =  0,
110                 DCERPC_PKT_PING        =  1,
111                 DCERPC_PKT_RESPONSE    =  2,
112                 DCERPC_PKT_FAULT       =  3,
113                 DCERPC_PKT_WORKING     =  4,
114                 DCERPC_PKT_NOCALL      =  5,
115                 DCERPC_PKT_REJECT      =  6,
116                 DCERPC_PKT_ACK         =  7,
117                 DCERPC_PKT_CL_CANCEL   =  8,
118                 DCERPC_PKT_FACK        =  9,
119                 DCERPC_PKT_CANCEL_ACK  = 10,
120                 DCERPC_PKT_BIND        = 11,
121                 DCERPC_PKT_BIND_ACK    = 12,
122                 DCERPC_PKT_BIND_NAK    = 13,
123                 DCERPC_PKT_ALTER       = 14,
124                 DCERPC_PKT_ALTER_ACK   = 15,
125                 DCERPC_PKT_AUTH3       = 16,
126                 DCERPC_PKT_SHUTDOWN    = 17,
127                 DCERPC_PKT_CO_CANCEL   = 18,
128                 DCERPC_PKT_ORPHANED    = 19
129         } dcerpc_pkt_type;
130
131         typedef [nodiscriminant] union {
132                 [case(DCERPC_PKT_REQUEST)]   dcerpc_request  request;
133                 [case(DCERPC_PKT_RESPONSE)]  dcerpc_response response;
134                 [case(DCERPC_PKT_BIND)]      dcerpc_bind     bind;
135                 [case(DCERPC_PKT_BIND_ACK)]  dcerpc_bind_ack bind_ack;
136                 [case(DCERPC_PKT_ALTER)]     dcerpc_bind     alter;
137                 [case(DCERPC_PKT_ALTER_ACK)] dcerpc_bind_ack alter_ack;
138                 [case(DCERPC_PKT_FAULT)]     dcerpc_fault    fault;
139                 [case(DCERPC_PKT_AUTH3)]     dcerpc_auth3    auth;
140                 [case(DCERPC_PKT_BIND_NAK)]  dcerpc_bind_nak nak;
141         } dcerpc_payload;
142
143
144         /* pfc_flags values */
145         const uint8 DCERPC_PFC_FLAG_FIRST  = 0x01;
146         const uint8 DCERPC_PFC_FLAG_LAST   = 0x02;
147         const uint8 DCERPC_PFC_FLAG_NOCALL = 0x20;
148
149         /* these offsets are needed by the signing code */
150         const uint8 DCERPC_FRAG_LEN_OFFSET =  8;
151         const uint8 DCERPC_AUTH_LEN_OFFSET = 10;
152
153         typedef [public] struct {
154                 uint8 rpc_vers;         /* RPC version */
155                 uint8 rpc_vers_minor;   /* Minor version */
156                 uint8 ptype;            /* Packet type */
157                 uint8 pfc_flags;        /* Fragmentation flags */
158                 uint8 drep[4];          /* NDR data representation */
159                 uint16 frag_length;     /* Total length of fragment */
160                 uint16 auth_length;     /* authenticator length */
161                 uint32 call_id;         /* Call identifier */
162                 
163                 [switch_is(ptype)] dcerpc_payload u;
164         } dcerpc_packet;
165 }