summaryrefslogtreecommitdiff
path: root/source4/librpc/idl/dcerpc.idl
blob: 978bc5640c6e87568e9415aef60df9760ba25eee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#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;
		uint16 major_version;
		uint16 minor_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_info;
	} 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_REMAINING)] DATA_BLOB auth_info;
	} 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;


	const uint8 DCERPC_AUTH_TYPE_NONE    = 0;
	const uint8 DCERPC_AUTH_TYPE_KRB5    = 1;
	const uint8 DCERPC_AUTH_TYPE_NTLMSSP = 10;
	
	const uint8 DCERPC_AUTH_LEVEL_NONE      = 1;
	const uint8 DCERPC_AUTH_LEVEL_CONNECT   = 2;
	const uint8 DCERPC_AUTH_LEVEL_CALL      = 3;
	const uint8 DCERPC_AUTH_LEVEL_PACKET    = 4;
	const uint8 DCERPC_AUTH_LEVEL_INTEGRITY = 5;
	const uint8 DCERPC_AUTH_LEVEL_PRIVACY   = 6;

	typedef [public] struct {
		uint8  auth_type; 
		uint8  auth_level;
		uint8  auth_pad_length;
		uint8  auth_reserved;
		uint32 auth_context_id;
		[flag(NDR_REMAINING)] DATA_BLOB credentials;
	} dcerpc_auth;

	typedef [public] struct {
		uint32 _pad;
		[flag(NDR_REMAINING)] DATA_BLOB auth_info;
	} dcerpc_auth3;

	typedef enum {
		DCERPC_PKT_REQUEST     =  0,
		DCERPC_PKT_PING        =  1,
		DCERPC_PKT_RESPONSE    =  2,
		DCERPC_PKT_FAULT       =  3,
		DCERPC_PKT_WORKING     =  4,
		DCERPC_PKT_NOCALL      =  5,
		DCERPC_PKT_REJECT      =  6,
		DCERPC_PKT_ACK         =  7,
		DCERPC_PKT_CL_CANCEL   =  8,
		DCERPC_PKT_FACK        =  9,
		DCERPC_PKT_CANCEL_ACK  = 10,
		DCERPC_PKT_BIND        = 11,
		DCERPC_PKT_BIND_ACK    = 12,
		DCERPC_PKT_BIND_NAK    = 13,
		DCERPC_PKT_ALTER       = 14,
		DCERPC_PKT_ALTER_ACK   = 15,
		DCERPC_PKT_AUTH3       = 16,
		DCERPC_PKT_SHUTDOWN    = 17,
		DCERPC_PKT_CO_CANCEL   = 18,
		DCERPC_PKT_ORPHANED    = 19
	} 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_ALTER)]     dcerpc_bind     alter;
		[case(DCERPC_PKT_ALTER_ACK)] dcerpc_bind_ack alter_ack;
		[case(DCERPC_PKT_FAULT)]     dcerpc_fault    fault;
		[case(DCERPC_PKT_AUTH3)]     dcerpc_auth3    auth;
	} 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;
}