Update 4.2 Roadmap file
[mat/samba.git] / source4 / librpc / rpc / dcerpc_roh.h
1 /*
2    Unix SMB/CIFS implementation.
3
4    [MS-RPCH] - RPC over HTTP
5
6    Copyright (C) 2013 Samuel Cabrero <samuelcabrero@kernevil.me>
7
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.
12
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.
17
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/>.
20 */
21
22 #ifndef DCERPC_ROH_H_
23 #define DCERPC_ROH_H_
24
25 #include "librpc/gen_ndr/misc.h"
26
27 struct tevent_queue;
28 struct tstream_context;
29 struct tstream_tls_params;
30
31 struct roh_channel {
32         /*
33          * The ConnectionTimeout command specifies the desired frequency for
34          * sending keep-alive PDUs (2.2.3.5.3)
35          */
36         unsigned int connection_timeout;
37
38         unsigned int sent_bytes;
39
40         struct GUID channel_cookie;
41
42         struct tevent_queue *send_queue;
43         struct {
44                 struct tstream_context *raw;
45                 struct tstream_context *tls;
46                 struct tstream_context *active;
47         } streams;
48 };
49
50 enum roh_protocol_version {
51         ROH_V1,
52         ROH_V2,
53 };
54
55 enum roh_connection_state {
56         ROH_STATE_OPEN_START,
57         ROH_STATE_OUT_CHANNEL_WAIT,
58         ROH_STATE_WAIT_A3W,
59         ROH_STATE_WAIT_C2,
60         ROH_STATE_OPENED,
61 };
62
63 /*
64  * protocol_version:    A client node should be capable of using v1 and v2,
65  *                      try to use v2 in first place. If it fails, fallback
66  *                      to v1
67  * connection_state:    Tracks the protocol current state
68  * connection_cookie:   Identifies the virtual connection among a client, one
69  *                      or more inbound proxies, one or more outbound proxies,
70  *                      and a server
71  * association_group_id_cookie: Used by higher layer protocols to link
72  *                      multiple virtual connections (2.2.3.1)
73  * default_channel_in:
74  * default_channel_out:
75  * non_default_channel_in:
76  * non_default_channel_out:
77  */
78 struct roh_connection {
79         enum roh_protocol_version protocol_version;
80         enum roh_connection_state connection_state;
81
82         struct GUID connection_cookie;
83         struct GUID association_group_id_cookie;
84
85         struct roh_channel *default_channel_in;
86         struct roh_channel *non_default_channel_in;
87
88         struct roh_channel *default_channel_out;
89         struct roh_channel *non_default_channel_out;
90
91         /* Client role specific fields (3.2.2.1) */
92         bool proxy_use;
93         uint32_t current_keep_alive_time;
94         uint32_t current_keep_alive_interval;
95
96         /* TODO Add timers 3.2.2.2 */
97 };
98
99 /* Command type constants */
100 #define ROH_CMD_TYPE_RECV_WINDOWS_SIZE  0x00000000      /* Section 2.2.3.5.1 */
101 #define ROH_CMD_TYPE_FLOW_CONTROL_ACK   0x00000001      /* Section 2.2.3.5.2 */
102 #define ROH_CMD_TYPE_CONNECTION_TIMEOUT 0x00000002      /* Section 2.2.3.5.3 */
103 #define ROH_CMD_TYPE_COOKIE             0x00000003      /* Section 2.2.3.5.4 */
104 #define ROH_CMD_TYPE_CHANNEL_LIFETIME   0x00000004      /* Section 2.2.3.5.5 */
105 #define ROH_CMD_TYPE_CLIENT_KEEPALIVE   0x00000005      /* Section 2.2.3.5.6 */
106 #define ROH_CMD_TYPE_VERSION            0x00000006      /* Section 2.2.3.5.7 */
107 #define ROH_CMD_TYPE_EMPTY              0x00000007      /* Section 2.2.3.5.8 */
108 #define ROH_CMD_TYPE_PADDING            0x00000008      /* Section 2.2.3.5.9 */
109 #define ROH_CMD_TYPE_NEGATIVE_ANCE      0x00000009      /* Section 2.2.3.5.10 */
110 #define ROH_CMD_TYPE_ANCE               0x0000000A      /* Section 2.2.3.5.11 */
111 #define ROH_CMD_TYPE_CLIENT_ADDRESS     0x0000000B      /* Section 2.2.3.5.12 */
112 #define ROH_CMD_TYPE_ASSOCIATION_GRP_ID 0x0000000C      /* Section 2.2.3.5.13 */
113 #define ROH_CMD_TYPE_DESTINATION        0x0000000D      /* Section 2.2.3.5.14 */
114 #define ROH_CMD_TYPE_PING               0x0000000E      /* Section 2.2.3.5.15 */
115
116 #endif /* DCERPC_ROH_H_ */