tsocket: Fixed documentation for tsocket_address_bsd_sockaddr().
[Samba/nascimento.git] / source3 / include / rpc_dce.h
blob3fd833c0bdadec99a836b12772c838f72801d6fe
1 /*
2 Unix SMB/CIFS implementation.
3 SMB parameters and setup
4 Copyright (C) Andrew Tridgell 1992-1997
5 Copyright (C) Luke Kenneth Casson Leighton 1996-1997
6 Copyright (C) Paul Ashton 1997
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef _DCE_RPC_H /* _DCE_RPC_H */
23 #define _DCE_RPC_H
25 #define RPC_AUTH_SCHANNEL_SIGN_OR_SEAL_CHK_LEN 0x20
27 /* Maximum size of the signing data in a fragment. */
28 #define RPC_MAX_SIGN_SIZE 0x38 /* 56 */
30 /* Maximum PDU fragment size. */
31 /* #define MAX_PDU_FRAG_LEN 0x1630 this is what wnt sets */
32 #define RPC_MAX_PDU_FRAG_LEN 0x10b8 /* this is what w2k sets */
34 #define RPC_IFACE_LEN (UUID_SIZE + 4)
36 /* RPC_HDR - dce rpc header */
37 typedef struct rpc_hdr_info {
38 uint8 major; /* 5 - RPC major version */
39 uint8 minor; /* 0 - RPC minor version */
40 uint8 pkt_type; /* dcerpc_pkt_type - RPC response packet */
41 uint8 flags; /* DCE/RPC flags */
42 uint8 pack_type[4]; /* 0x1000 0000 - little-endian packed data representation */
43 uint16 frag_len; /* fragment length - data size (bytes) inc header and tail. */
44 uint16 auth_len; /* 0 - authentication length */
45 uint32 call_id; /* call identifier. matches 12th uint32 of incoming RPC data. */
46 } RPC_HDR;
48 #define RPC_HEADER_LEN 16
50 /* RPC_HDR_REQ - ms request rpc header */
51 typedef struct rpc_hdr_req_info {
52 uint32 alloc_hint; /* allocation hint - data size (bytes) minus header and tail. */
53 uint16 context_id; /* presentation context identifier */
54 uint16 opnum; /* opnum */
55 } RPC_HDR_REQ;
57 #define RPC_HDR_REQ_LEN 8
59 /* RPC_HDR_RESP - ms response rpc header */
60 typedef struct rpc_hdr_resp_info {
61 uint32 alloc_hint; /* allocation hint - data size (bytes) minus header and tail. */
62 uint16 context_id; /* 0 - presentation context identifier */
63 uint8 cancel_count; /* 0 - cancel count */
64 uint8 reserved; /* 0 - reserved. */
65 } RPC_HDR_RESP;
67 #define RPC_HDR_RESP_LEN 8
69 /* RPC_HDR_FAULT - fault rpc header */
70 typedef struct rpc_hdr_fault_info {
71 NTSTATUS status;
72 uint32 reserved; /* 0x0000 0000 */
73 } RPC_HDR_FAULT;
75 #define RPC_HDR_FAULT_LEN 8
77 /* this seems to be the same string name depending on the name of the pipe,
78 * but is more likely to be linked to the interface name
79 * "srvsvc", "\\PIPE\\ntsvcs"
80 * "samr", "\\PIPE\\lsass"
81 * "wkssvc", "\\PIPE\\wksvcs"
82 * "NETLOGON", "\\PIPE\\NETLOGON"
84 /* RPC_ADDR_STR */
85 typedef struct rpc_addr_info {
86 uint16 len; /* length of the string including null terminator */
87 fstring str; /* the string above in single byte, null terminated form */
88 } RPC_ADDR_STR;
90 /* RPC_HDR_BBA - bind acknowledge, and alter context response. */
91 typedef struct rpc_hdr_bba_info {
92 uint16 max_tsize; /* maximum transmission fragment size (0x1630) */
93 uint16 max_rsize; /* max receive fragment size (0x1630) */
94 uint32 assoc_gid; /* associated group id (0x0) */
95 } RPC_HDR_BBA;
97 #define RPC_HDR_BBA_LEN 8
99 /* RPC_HDR_AUTH */
100 typedef struct rpc_hdr_auth_info {
101 uint8 auth_type; /* See XXX_AUTH_TYPE above. */
102 uint8 auth_level; /* See RPC_PIPE_AUTH_XXX_LEVEL above. */
103 uint8 auth_pad_len;
104 uint8 auth_reserved;
105 uint32 auth_context_id;
106 } RPC_HDR_AUTH;
108 #define RPC_HDR_AUTH_LEN 8
110 typedef struct rpc_context {
111 uint16 context_id; /* presentation context identifier. */
112 uint8 num_transfer_syntaxes; /* the number of syntaxes */
113 struct ndr_syntax_id abstract; /* num and vers. of interface client is using */
114 struct ndr_syntax_id *transfer; /* Array of transfer interfaces. */
115 } RPC_CONTEXT;
117 /* RPC_BIND_REQ - ms req bind */
118 typedef struct rpc_bind_req_info {
119 RPC_HDR_BBA bba;
120 uint8 num_contexts; /* the number of contexts */
121 RPC_CONTEXT *rpc_context;
122 } RPC_HDR_RB;
125 * The following length is 8 bytes RPC_HDR_BBA_LEN +
126 * 4 bytes size of context count +
127 * (context_count * (4 bytes of context_id, size of transfer syntax count + RPC_IFACE_LEN bytes +
128 * (transfer_syntax_count * RPC_IFACE_LEN bytes)))
131 #define RPC_HDR_RB_LEN(rpc_hdr_rb) (RPC_HDR_BBA_LEN + 4 + \
132 ((rpc_hdr_rb)->num_contexts) * (4 + RPC_IFACE_LEN + (((rpc_hdr_rb)->rpc_context->num_transfer_syntaxes)*RPC_IFACE_LEN)))
134 /* RPC_RESULTS - can only cope with one reason, right now... */
135 typedef struct rpc_results_info {
136 /* uint8[] # 4-byte alignment padding, against SMB header */
138 uint8 num_results; /* the number of results (0x01) */
140 /* uint8[] # 4-byte alignment padding, against SMB header */
142 uint16 result; /* result (0x00 = accept) */
143 uint16 reason; /* reason (0x00 = no reason specified) */
144 } RPC_RESULTS;
146 /* RPC_HDR_BA */
147 typedef struct rpc_hdr_ba_info {
148 RPC_HDR_BBA bba;
150 RPC_ADDR_STR addr ; /* the secondary address string, as described earlier */
151 RPC_RESULTS res ; /* results and reasons */
152 struct ndr_syntax_id transfer; /* the transfer syntax from the request */
153 } RPC_HDR_BA;
155 #endif /* _DCE_RPC_H */