push cc8bc80451cc24f4d7cf75168b569f0ebfe19547
[wine/hacks.git] / dlls / rpcrt4 / rpc_defs.h
blob83d2483b035c9760e00ed3da742b25af9de81b4c
1 /*
2 * RPC definitions
4 * Copyright 2001-2002 Ove Kåven, TransGaming Technologies
5 * Copyright 2004 Filip Navara
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #ifndef __WINE_RPC_DEFS_H
23 #define __WINE_RPC_DEFS_H
25 typedef struct
27 unsigned char rpc_ver; /* RPC major version (5) */
28 unsigned char rpc_ver_minor; /* RPC minor version (0) */
29 unsigned char ptype; /* Packet type (PKT_*) */
30 unsigned char flags;
31 unsigned char drep[4]; /* Data representation */
32 unsigned short frag_len; /* Data size in bytes including header and tail. */
33 unsigned short auth_len; /* Authentication length */
34 unsigned long call_id; /* Call identifier. */
35 } RpcPktCommonHdr;
37 typedef struct
39 RpcPktCommonHdr common;
40 unsigned long alloc_hint; /* Data size in bytes excluding header and tail. */
41 unsigned short context_id; /* Presentation context identifier */
42 unsigned short opnum;
43 } RpcPktRequestHdr;
45 typedef struct
47 RpcPktCommonHdr common;
48 unsigned long alloc_hint; /* Data size in bytes excluding header and tail. */
49 unsigned short context_id; /* Presentation context identifier */
50 unsigned char cancel_count;
51 unsigned char reserved;
52 } RpcPktResponseHdr;
54 typedef struct
56 RpcPktCommonHdr common;
57 unsigned long alloc_hint; /* Data size in bytes excluding header and tail. */
58 unsigned short context_id; /* Presentation context identifier */
59 unsigned char cancel_count; /* Received cancel count */
60 unsigned char reserved; /* Force alignment! */
61 unsigned long status; /* Runtime fault code (RPC_STATUS) */
62 unsigned long reserved2;
63 } RpcPktFaultHdr;
65 typedef struct
67 RpcPktCommonHdr common;
68 unsigned short max_tsize; /* Maximum transmission fragment size */
69 unsigned short max_rsize; /* Maximum receive fragment size */
70 unsigned long assoc_gid; /* Associated group id */
71 unsigned char num_elements; /* Number of elements */
72 unsigned char padding[3]; /* Force alignment! */
73 unsigned short context_id; /* Presentation context identifier */
74 unsigned char num_syntaxes; /* Number of syntaxes */
75 RPC_SYNTAX_IDENTIFIER abstract;
76 RPC_SYNTAX_IDENTIFIER transfer;
77 } RpcPktBindHdr;
79 #include "pshpack1.h"
80 typedef struct
82 unsigned short length; /* Length of the string including null terminator */
83 char string[1]; /* String data in single byte, null terminated form */
84 } RpcAddressString;
85 #include "poppack.h"
87 typedef struct
89 unsigned char num_results; /* Number of results */
90 unsigned char reserved[3]; /* Force alignment! */
91 struct {
92 unsigned short result;
93 unsigned short reason;
94 } results[1];
95 } RpcResults;
97 typedef struct
99 RpcPktCommonHdr common;
100 unsigned short max_tsize; /* Maximum transmission fragment size */
101 unsigned short max_rsize; /* Maximum receive fragment size */
102 unsigned long assoc_gid; /* Associated group id */
104 * Following this header are these fields:
105 * RpcAddressString server_address;
106 * [0 - 3 bytes of padding so that results is 4-byte aligned]
107 * RpcResults results;
108 * RPC_SYNTAX_IDENTIFIER transfer;
110 } RpcPktBindAckHdr;
112 typedef struct
114 RpcPktCommonHdr common;
115 unsigned short reject_reason;
116 unsigned char protocols_count;
117 struct {
118 unsigned char rpc_ver;
119 unsigned char rpc_ver_minor;
120 } protocols[1];
121 } RpcPktBindNAckHdr;
123 /* undocumented packet sent during RPC over HTTP */
124 typedef struct
126 RpcPktCommonHdr common;
127 unsigned short flags;
128 unsigned short num_data_items;
129 } RpcPktHttpHdr;
131 /* Union representing all possible packet headers */
132 typedef union
134 RpcPktCommonHdr common;
135 RpcPktRequestHdr request;
136 RpcPktResponseHdr response;
137 RpcPktFaultHdr fault;
138 RpcPktBindHdr bind;
139 RpcPktBindAckHdr bind_ack;
140 RpcPktBindNAckHdr bind_nack;
141 RpcPktHttpHdr http;
142 } RpcPktHdr;
144 typedef struct
146 unsigned char auth_type; /* authentication scheme in use */
147 unsigned char auth_level; /* RPC_C_AUTHN_LEVEL* */
148 unsigned char auth_pad_length; /* length of padding to restore n % 4 alignment */
149 unsigned char auth_reserved; /* reserved, must be zero */
150 unsigned long auth_context_id; /* unique value for the authenticated connection */
151 } RpcAuthVerifier;
153 #define RPC_AUTH_VERIFIER_LEN(common_hdr) \
154 ((common_hdr)->auth_len ? (common_hdr)->auth_len + sizeof(RpcAuthVerifier) : 0)
156 #define RPC_VER_MAJOR 5
157 #define RPC_VER_MINOR 0
159 #define RPC_FLG_FIRST 1
160 #define RPC_FLG_LAST 2
161 #define RPC_FLG_OBJECT_UUID 0x80
163 #define RPC_MIN_PACKET_SIZE 0x1000
164 #define RPC_MAX_PACKET_SIZE 0x16D0
166 #define PKT_REQUEST 0
167 #define PKT_PING 1
168 #define PKT_RESPONSE 2
169 #define PKT_FAULT 3
170 #define PKT_WORKING 4
171 #define PKT_NOCALL 5
172 #define PKT_REJECT 6
173 #define PKT_ACK 7
174 #define PKT_CL_CANCEL 8
175 #define PKT_FACK 9
176 #define PKT_CANCEL_ACK 10
177 #define PKT_BIND 11
178 #define PKT_BIND_ACK 12
179 #define PKT_BIND_NACK 13
180 #define PKT_ALTER_CONTEXT 14
181 #define PKT_ALTER_CONTEXT_RESP 15
182 #define PKT_AUTH3 16
183 #define PKT_SHUTDOWN 17
184 #define PKT_CO_CANCEL 18
185 #define PKT_ORPHANED 19
186 #define PKT_HTTP 20
188 #define RESULT_ACCEPT 0
189 #define RESULT_USER_REJECTION 1
190 #define RESULT_PROVIDER_REJECTION 2
192 #define REASON_NONE 0
193 #define REASON_ABSTRACT_SYNTAX_NOT_SUPPORTED 1
194 #define REASON_TRANSFER_SYNTAXES_NOT_SUPPORTED 2
195 #define REASON_LOCAL_LIMIT_EXCEEDED 3
197 #define REJECT_REASON_NOT_SPECIFIED 0
198 #define REJECT_TEMPORARY_CONGESTION 1
199 #define REJECT_LOCAL_LIMIT_EXCEEDED 2
200 #define REJECT_CALLED_PADDR_UNKNOWN 3 /* not used */
201 #define REJECT_PROTOCOL_VERSION_NOT_SUPPORTED 4
202 #define REJECT_DEFAULT_CONTEXT_NOT_SUPPORTED 5 /* not used */
203 #define REJECT_USER_DATA_NOT_READABLE 6 /* not used */
204 #define REJECT_NO_PSAP_AVAILABLE 7 /* not used */
205 #define REJECT_UNKNOWN_AUTHN_SERVICE 8
206 #define REJECT_INVALID_CHECKSUM 9
208 #define NCADG_IP_UDP 0x08
209 #define NCACN_IP_TCP 0x07
210 #define NCADG_IPX 0x0E
211 #define NCACN_SPX 0x0C
212 #define NCACN_NB_NB 0x12
213 #define NCACN_NB_IPX 0x0D
214 #define NCACN_DNET_NSP 0x04
215 #define NCACN_HTTP 0x1F
217 /* FreeDCE: TWR_C_FLR_PROT_ID_IP */
218 #define TWR_IP 0x09
220 #endif /* __WINE_RPC_DEFS_H */