2003-11-23 09:28:12 +03:00
#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
2003-11-26 07:32:39 +03:00
see http://www.opengroup.org/onlinepubs/9629399/chap12.htm for packet
layouts
2003-11-23 09:28:12 +03:00
*/
2005-02-13 02:03:26 +03:00
[
pointer_default(unique)
]
2003-11-23 09:28:12 +03:00
interface dcerpc
{
2003-11-28 06:47:45 +03:00
typedef [public] struct {
2003-11-23 09:28:12 +03:00
GUID uuid;
2003-12-16 12:02:58 +03:00
uint32 if_version;
2003-11-23 09:28:12 +03:00
} 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;
2003-12-16 12:02:58 +03:00
uint8 num_contexts;
2003-11-23 09:28:12 +03:00
dcerpc_ctx_list ctx_list[num_contexts];
[flag(NDR_ALIGN8)] DATA_BLOB _pad;
2003-11-26 04:16:41 +03:00
[flag(NDR_REMAINING)] DATA_BLOB auth_info;
2003-11-23 09:28:12 +03:00
} dcerpc_bind;
2003-11-26 06:36:17 +03:00
const uint8 DCERPC_REQUEST_LENGTH = 24;
2003-12-14 15:21:21 +03:00
const uint8 DCERPC_MAX_SIGN_SIZE = 32;
2003-11-26 06:36:17 +03:00
2004-11-08 05:12:15 +03:00
typedef struct {
} dcerpc_empty;
typedef [nodiscriminant] union {
[default] dcerpc_empty empty;
[case(LIBNDR_FLAG_OBJECT_PRESENT)] GUID object;
} dcerpc_object;
2003-11-23 09:28:12 +03:00
typedef struct {
uint32 alloc_hint;
uint16 context_id;
uint16 opnum;
2004-11-08 05:12:15 +03:00
[switch_is(ndr->flags & LIBNDR_FLAG_OBJECT_PRESENT)] dcerpc_object object;
2003-11-23 09:28:12 +03:00
[flag(NDR_ALIGN8)] DATA_BLOB _pad;
[flag(NDR_REMAINING)] DATA_BLOB stub_and_verifier;
} dcerpc_request;
2003-12-12 09:12:41 +03:00
const int DCERPC_BIND_PROVIDER_REJECT = 2;
const int DCERPC_BIND_REASON_ASYNTAX = 1;
2003-11-23 09:28:12 +03:00
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];
2003-11-26 04:16:41 +03:00
[flag(NDR_REMAINING)] DATA_BLOB auth_info;
2003-11-23 09:28:12 +03:00
} dcerpc_bind_ack;
typedef struct {
uint16 reject_reason;
uint32 num_versions;
uint32 versions[num_versions];
} dcerpc_bind_nak;
2003-11-26 06:36:17 +03:00
const uint8 DCERPC_RESPONSE_LENGTH = 24;
2003-11-23 09:28:12 +03:00
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;
2003-11-27 08:34:28 +03:00
2003-12-13 05:20:40 +03:00
const int DCERPC_FAULT_OP_RNG_ERROR = 0x1c010002;
2004-05-11 19:39:23 +04:00
const int DCERPC_FAULT_UNK_IF = 0x1c010003;
2003-12-13 05:20:40 +03:00
const int DCERPC_FAULT_NDR = 0x000006f7;
2004-04-21 10:21:38 +04:00
const int DCERPC_FAULT_INVALID_TAG = 0x1c000006;
2003-12-13 05:20:40 +03:00
const int DCERPC_FAULT_CONTEXT_MISMATCH = 0x1c00001a;
const int DCERPC_FAULT_OTHER = 0x00000001;
2005-04-30 12:17:13 +04:00
const int DCERPC_FAULT_ACCESS_DENIED = 0x00000005;
2004-10-12 09:06:40 +04:00
const int DCERPC_FAULT_CANT_PERFORM = 0x000006d8;
2003-11-27 08:34:28 +03:00
2003-12-12 06:59:09 +03:00
/* we return this fault when we haven't yet run the test
to see what fault w2k3 returns in this case */
const int DCERPC_FAULT_TODO = 0x00000042;
2003-11-23 09:28:12 +03:00
typedef struct {
2003-11-27 08:34:28 +03:00
uint32 alloc_hint;
uint16 context_id;
uint8 cancel_count;
2003-11-23 09:28:12 +03:00
uint32 status;
} dcerpc_fault;
2005-01-24 17:44:15 +03:00
/* the auth types we know about
2004-02-10 13:22:12 +03:00
const uint8 DCERPC_AUTH_TYPE_NONE = 0;
2005-01-24 17:44:15 +03:00
/* this seems to be not krb5! */
const uint8 DCERPC_AUTH_TYPE_KRB5_1 = 1;
2004-05-11 04:43:46 +04:00
const uint8 DCERPC_AUTH_TYPE_SPNEGO = 9;
2004-02-10 13:22:12 +03:00
const uint8 DCERPC_AUTH_TYPE_NTLMSSP = 10;
2004-07-13 22:10:11 +04:00
/* I'm not 100% sure but type 16(0x10)
* seems to be raw krb5 --metze
*/
2005-01-24 17:44:15 +03:00
const uint8 DCERPC_AUTH_TYPE_KRB5 = 16;
2004-02-10 13:22:12 +03:00
const uint8 DCERPC_AUTH_TYPE_SCHANNEL = 68;
2005-01-24 17:44:15 +03:00
const uint8 DCERPC_AUTH_TYPE_MSMQ = 100;
2004-11-05 02:57:49 +03:00
const uint8 DCERPC_AUTH_LEVEL_DEFAULT = DCERPC_AUTH_LEVEL_CONNECT;
2003-11-26 04:16:41 +03:00
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;
2005-01-09 12:38:16 +03:00
typedef [enum8bit] enum {
2003-11-26 04:16:41 +03:00
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,
2005-01-09 14:32:12 +03:00
DCERPC_PKT_ALTER_RESP = 15,
2003-11-26 04:16:41 +03:00
DCERPC_PKT_AUTH3 = 16,
DCERPC_PKT_SHUTDOWN = 17,
DCERPC_PKT_CO_CANCEL = 18,
DCERPC_PKT_ORPHANED = 19
2003-11-23 09:28:12 +03:00
} dcerpc_pkt_type;
typedef [nodiscriminant] union {
2005-01-09 14:32:12 +03:00
[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_RESP)] dcerpc_bind_ack alter_resp;
[case(DCERPC_PKT_FAULT)] dcerpc_fault fault;
[case(DCERPC_PKT_AUTH3)] dcerpc_auth3 auth3;
[case(DCERPC_PKT_BIND_NAK)] dcerpc_bind_nak bind_nak;
2003-11-23 09:28:12 +03:00
} dcerpc_payload;
/* pfc_flags values */
2003-11-23 10:14:17 +03:00
const uint8 DCERPC_PFC_FLAG_FIRST = 0x01;
const uint8 DCERPC_PFC_FLAG_LAST = 0x02;
2003-11-23 09:28:12 +03:00
const uint8 DCERPC_PFC_FLAG_NOCALL = 0x20;
2004-09-27 16:57:59 +04:00
const uint8 DCERPC_PFC_FLAG_ORPC = 0x80;
2003-11-23 09:28:12 +03:00
2003-11-26 06:36:17 +03:00
/* these offsets are needed by the signing code */
2003-12-16 12:02:58 +03:00
const uint8 DCERPC_DREP_OFFSET = 4;
2003-11-26 06:36:17 +03:00
const uint8 DCERPC_FRAG_LEN_OFFSET = 8;
const uint8 DCERPC_AUTH_LEN_OFFSET = 10;
2003-12-16 14:24:28 +03:00
/* little-endian flag */
const uint8 DCERPC_DREP_LE = 0x10;
2003-11-23 09:28:12 +03:00
typedef [public] struct {
2005-01-09 12:38:16 +03:00
uint8 rpc_vers; /* RPC version */
uint8 rpc_vers_minor; /* Minor version */
dcerpc_pkt_type 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 */
2003-11-23 09:28:12 +03:00
[switch_is(ptype)] dcerpc_payload u;
} dcerpc_packet;
}