summaryrefslogtreecommitdiff
path: root/source3/librpc/gen_ndr/ndr_messaging.c
blob: 3e2aa1f3b0ff191f06eff3b99703ef8cb69791b8 (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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
/* parser auto-generated by pidl */

#include "includes.h"
#include "librpc/gen_ndr/ndr_messaging.h"

_PUBLIC_ enum ndr_err_code ndr_push_messaging_type(struct ndr_push *ndr, int ndr_flags, enum messaging_type r)
{
	NDR_CHECK(ndr_push_enum_uint32(ndr, NDR_SCALARS, r));
	return NDR_ERR_SUCCESS;
}

_PUBLIC_ enum ndr_err_code ndr_pull_messaging_type(struct ndr_pull *ndr, int ndr_flags, enum messaging_type *r)
{
	uint32_t v;
	NDR_CHECK(ndr_pull_enum_uint32(ndr, NDR_SCALARS, &v));
	*r = v;
	return NDR_ERR_SUCCESS;
}

_PUBLIC_ void ndr_print_messaging_type(struct ndr_print *ndr, const char *name, enum messaging_type r)
{
	const char *val = NULL;

	switch (r) {
		case MSG_DEBUG: val = "MSG_DEBUG"; break;
		case MSG_PING: val = "MSG_PING"; break;
		case MSG_PONG: val = "MSG_PONG"; break;
		case MSG_PROFILE: val = "MSG_PROFILE"; break;
		case MSG_REQ_DEBUGLEVEL: val = "MSG_REQ_DEBUGLEVEL"; break;
		case MSG_DEBUGLEVEL: val = "MSG_DEBUGLEVEL"; break;
		case MSG_REQ_PROFILELEVEL: val = "MSG_REQ_PROFILELEVEL"; break;
		case MSG_PROFILELEVEL: val = "MSG_PROFILELEVEL"; break;
		case MSG_REQ_POOL_USAGE: val = "MSG_REQ_POOL_USAGE"; break;
		case MSG_POOL_USAGE: val = "MSG_POOL_USAGE"; break;
		case MSG_REQ_DMALLOC_MARK: val = "MSG_REQ_DMALLOC_MARK"; break;
		case MSG_REQ_DMALLOC_LOG_CHANGED: val = "MSG_REQ_DMALLOC_LOG_CHANGED"; break;
		case MSG_SHUTDOWN: val = "MSG_SHUTDOWN"; break;
		case MSG_FORCE_ELECTION: val = "MSG_FORCE_ELECTION"; break;
		case MSG_WINS_NEW_ENTRY: val = "MSG_WINS_NEW_ENTRY"; break;
		case MSG_SEND_PACKET: val = "MSG_SEND_PACKET"; break;
		case MSG_PRINTER_NOTIFY: val = "MSG_PRINTER_NOTIFY"; break;
		case MSG_PRINTER_NOTIFY2: val = "MSG_PRINTER_NOTIFY2"; break;
		case MSG_PRINTER_DRVUPGRADE: val = "MSG_PRINTER_DRVUPGRADE"; break;
		case MSG_PRINTERDATA_INIT_RESET: val = "MSG_PRINTERDATA_INIT_RESET"; break;
		case MSG_PRINTER_UPDATE: val = "MSG_PRINTER_UPDATE"; break;
		case MSG_PRINTER_MOD: val = "MSG_PRINTER_MOD"; break;
		case MSG_SMB_CONF_UPDATED: val = "MSG_SMB_CONF_UPDATED"; break;
		case MSG_SMB_FORCE_TDIS: val = "MSG_SMB_FORCE_TDIS"; break;
		case MSG_SMB_SAM_SYNC: val = "MSG_SMB_SAM_SYNC"; break;
		case MSG_SMB_SAM_REPL: val = "MSG_SMB_SAM_REPL"; break;
		case MSG_SMB_UNLOCK: val = "MSG_SMB_UNLOCK"; break;
		case MSG_SMB_BREAK_REQUEST: val = "MSG_SMB_BREAK_REQUEST"; break;
		case MSG_SMB_BREAK_RESPONSE: val = "MSG_SMB_BREAK_RESPONSE"; break;
		case MSG_SMB_ASYNC_LEVEL2_BREAK: val = "MSG_SMB_ASYNC_LEVEL2_BREAK"; break;
		case MSG_SMB_OPEN_RETRY: val = "MSG_SMB_OPEN_RETRY"; break;
		case MSG_SMB_KERNEL_BREAK: val = "MSG_SMB_KERNEL_BREAK"; break;
		case MSG_SMB_FILE_RENAME: val = "MSG_SMB_FILE_RENAME"; break;
		case MSG_SMB_INJECT_FAULT: val = "MSG_SMB_INJECT_FAULT"; break;
		case MSG_SMB_BLOCKING_LOCK_CANCEL: val = "MSG_SMB_BLOCKING_LOCK_CANCEL"; break;
		case MSG_SMB_NOTIFY: val = "MSG_SMB_NOTIFY"; break;
		case MSG_SMB_STAT_CACHE_DELETE: val = "MSG_SMB_STAT_CACHE_DELETE"; break;
		case MSG_PVFS_NOTIFY: val = "MSG_PVFS_NOTIFY"; break;
		case MSG_SMB_BRL_VALIDATE: val = "MSG_SMB_BRL_VALIDATE"; break;
		case MSG_SMB_RELEASE_IP: val = "MSG_SMB_RELEASE_IP"; break;
		case MSG_SMB_CLOSE_FILE: val = "MSG_SMB_CLOSE_FILE"; break;
		case MSG_WINBIND_FINISHED: val = "MSG_WINBIND_FINISHED"; break;
		case MSG_WINBIND_FORGET_STATE: val = "MSG_WINBIND_FORGET_STATE"; break;
		case MSG_WINBIND_ONLINE: val = "MSG_WINBIND_ONLINE"; break;
		case MSG_WINBIND_OFFLINE: val = "MSG_WINBIND_OFFLINE"; break;
		case MSG_WINBIND_ONLINESTATUS: val = "MSG_WINBIND_ONLINESTATUS"; break;
		case MSG_WINBIND_TRY_TO_GO_ONLINE: val = "MSG_WINBIND_TRY_TO_GO_ONLINE"; break;
		case MSG_WINBIND_FAILED_TO_GO_ONLINE: val = "MSG_WINBIND_FAILED_TO_GO_ONLINE"; break;
		case MSG_WINBIND_VALIDATE_CACHE: val = "MSG_WINBIND_VALIDATE_CACHE"; break;
		case MSG_WINBIND_DUMP_DOMAIN_LIST: val = "MSG_WINBIND_DUMP_DOMAIN_LIST"; break;
		case MSG_DUMP_EVENT_LIST: val = "MSG_DUMP_EVENT_LIST"; break;
		case MSG_DBWRAP_TDB2_CHANGES: val = "MSG_DBWRAP_TDB2_CHANGES"; break;
	}
	ndr_print_enum(ndr, name, "ENUM", val, r);
}

_PUBLIC_ enum ndr_err_code ndr_push_messaging_rec(struct ndr_push *ndr, int ndr_flags, const struct messaging_rec *r)
{
	if (ndr_flags & NDR_SCALARS) {
		NDR_CHECK(ndr_push_align(ndr, 4));
		NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->msg_version));
		NDR_CHECK(ndr_push_messaging_type(ndr, NDR_SCALARS, r->msg_type));
		NDR_CHECK(ndr_push_server_id(ndr, NDR_SCALARS, &r->dest));
		NDR_CHECK(ndr_push_server_id(ndr, NDR_SCALARS, &r->src));
		NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->buf));
		NDR_CHECK(ndr_push_trailer_align(ndr, 4));
	}
	if (ndr_flags & NDR_BUFFERS) {
		NDR_CHECK(ndr_push_server_id(ndr, NDR_BUFFERS, &r->dest));
		NDR_CHECK(ndr_push_server_id(ndr, NDR_BUFFERS, &r->src));
	}
	return NDR_ERR_SUCCESS;
}

_PUBLIC_ enum ndr_err_code ndr_pull_messaging_rec(struct ndr_pull *ndr, int ndr_flags, struct messaging_rec *r)
{
	if (ndr_flags & NDR_SCALARS) {
		NDR_CHECK(ndr_pull_align(ndr, 4));
		NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->msg_version));
		NDR_CHECK(ndr_pull_messaging_type(ndr, NDR_SCALARS, &r->msg_type));
		NDR_CHECK(ndr_pull_server_id(ndr, NDR_SCALARS, &r->dest));
		NDR_CHECK(ndr_pull_server_id(ndr, NDR_SCALARS, &r->src));
		NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->buf));
		NDR_CHECK(ndr_pull_trailer_align(ndr, 4));
	}
	if (ndr_flags & NDR_BUFFERS) {
		NDR_CHECK(ndr_pull_server_id(ndr, NDR_BUFFERS, &r->dest));
		NDR_CHECK(ndr_pull_server_id(ndr, NDR_BUFFERS, &r->src));
	}
	return NDR_ERR_SUCCESS;
}

_PUBLIC_ void ndr_print_messaging_rec(struct ndr_print *ndr, const char *name, const struct messaging_rec *r)
{
	ndr_print_struct(ndr, name, "messaging_rec");
	ndr->depth++;
	ndr_print_uint32(ndr, "msg_version", r->msg_version);
	ndr_print_messaging_type(ndr, "msg_type", r->msg_type);
	ndr_print_server_id(ndr, "dest", &r->dest);
	ndr_print_server_id(ndr, "src", &r->src);
	ndr_print_DATA_BLOB(ndr, "buf", r->buf);
	ndr->depth--;
}

_PUBLIC_ enum ndr_err_code ndr_push_messaging_array(struct ndr_push *ndr, int ndr_flags, const struct messaging_array *r)
{
	uint32_t cntr_messages_0;
	if (ndr_flags & NDR_SCALARS) {
		NDR_CHECK(ndr_push_align(ndr, 4));
		NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_messages));
		for (cntr_messages_0 = 0; cntr_messages_0 < r->num_messages; cntr_messages_0++) {
			NDR_CHECK(ndr_push_messaging_rec(ndr, NDR_SCALARS, &r->messages[cntr_messages_0]));
		}
		NDR_CHECK(ndr_push_trailer_align(ndr, 4));
	}
	if (ndr_flags & NDR_BUFFERS) {
		for (cntr_messages_0 = 0; cntr_messages_0 < r->num_messages; cntr_messages_0++) {
			NDR_CHECK(ndr_push_messaging_rec(ndr, NDR_BUFFERS, &r->messages[cntr_messages_0]));
		}
	}
	return NDR_ERR_SUCCESS;
}

_PUBLIC_ enum ndr_err_code ndr_pull_messaging_array(struct ndr_pull *ndr, int ndr_flags, struct messaging_array *r)
{
	uint32_t cntr_messages_0;
	TALLOC_CTX *_mem_save_messages_0;
	if (ndr_flags & NDR_SCALARS) {
		NDR_CHECK(ndr_pull_align(ndr, 4));
		NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_messages));
		NDR_PULL_ALLOC_N(ndr, r->messages, r->num_messages);
		_mem_save_messages_0 = NDR_PULL_GET_MEM_CTX(ndr);
		NDR_PULL_SET_MEM_CTX(ndr, r->messages, 0);
		for (cntr_messages_0 = 0; cntr_messages_0 < r->num_messages; cntr_messages_0++) {
			NDR_CHECK(ndr_pull_messaging_rec(ndr, NDR_SCALARS, &r->messages[cntr_messages_0]));
		}
		NDR_PULL_SET_MEM_CTX(ndr, _mem_save_messages_0, 0);
		NDR_CHECK(ndr_pull_trailer_align(ndr, 4));
	}
	if (ndr_flags & NDR_BUFFERS) {
		_mem_save_messages_0 = NDR_PULL_GET_MEM_CTX(ndr);
		NDR_PULL_SET_MEM_CTX(ndr, r->messages, 0);
		for (cntr_messages_0 = 0; cntr_messages_0 < r->num_messages; cntr_messages_0++) {
			NDR_CHECK(ndr_pull_messaging_rec(ndr, NDR_BUFFERS, &r->messages[cntr_messages_0]));
		}
		NDR_PULL_SET_MEM_CTX(ndr, _mem_save_messages_0, 0);
	}
	return NDR_ERR_SUCCESS;
}

_PUBLIC_ void ndr_print_messaging_array(struct ndr_print *ndr, const char *name, const struct messaging_array *r)
{
	uint32_t cntr_messages_0;
	ndr_print_struct(ndr, name, "messaging_array");
	ndr->depth++;
	ndr_print_uint32(ndr, "num_messages", r->num_messages);
	ndr->print(ndr, "%s: ARRAY(%d)", "messages", (int)r->num_messages);
	ndr->depth++;
	for (cntr_messages_0=0;cntr_messages_0<r->num_messages;cntr_messages_0++) {
		char *idx_0=NULL;
		if (asprintf(&idx_0, "[%d]", cntr_messages_0) != -1) {
			ndr_print_messaging_rec(ndr, "messages", &r->messages[cntr_messages_0]);
			free(idx_0);
		}
	}
	ndr->depth--;
	ndr->depth--;
}

_PUBLIC_ enum ndr_err_code ndr_push_dbwrap_tdb2_changes(struct ndr_push *ndr, int ndr_flags, const struct dbwrap_tdb2_changes *r)
{
	uint32_t cntr_keys_0;
	if (ndr_flags & NDR_SCALARS) {
		NDR_CHECK(ndr_push_align(ndr, 4));
		NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, "TDB2", 4, sizeof(uint8_t), CH_DOS));
		NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 1));
		NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, ndr_charset_length(r->name, CH_UTF8)));
		NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, 0));
		NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, ndr_charset_length(r->name, CH_UTF8)));
		NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->name, ndr_charset_length(r->name, CH_UTF8), sizeof(uint8_t), CH_UTF8));
		NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->old_seqnum));
		NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->new_seqnum));
		NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_changes));
		NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_keys));
		for (cntr_keys_0 = 0; cntr_keys_0 < r->num_keys; cntr_keys_0++) {
			NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->keys[cntr_keys_0]));
		}
		NDR_CHECK(ndr_push_trailer_align(ndr, 4));
	}
	if (ndr_flags & NDR_BUFFERS) {
	}
	return NDR_ERR_SUCCESS;
}

_PUBLIC_ enum ndr_err_code ndr_pull_dbwrap_tdb2_changes(struct ndr_pull *ndr, int ndr_flags, struct dbwrap_tdb2_changes *r)
{
	uint32_t cntr_keys_0;
	TALLOC_CTX *_mem_save_keys_0;
	if (ndr_flags & NDR_SCALARS) {
		NDR_CHECK(ndr_pull_align(ndr, 4));
		NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->magic_string, 4, sizeof(uint8_t), CH_DOS));
		NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->magic_version));
		NDR_CHECK(ndr_pull_array_size(ndr, &r->name));
		NDR_CHECK(ndr_pull_array_length(ndr, &r->name));
		if (ndr_get_array_length(ndr, &r->name) > ndr_get_array_size(ndr, &r->name)) {
			return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->name), ndr_get_array_length(ndr, &r->name));
		}
		NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->name), sizeof(uint8_t)));
		NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->name, ndr_get_array_length(ndr, &r->name), sizeof(uint8_t), CH_UTF8));
		NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->old_seqnum));
		NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->new_seqnum));
		NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_changes));
		NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_keys));
		NDR_PULL_ALLOC_N(ndr, r->keys, r->num_keys);
		_mem_save_keys_0 = NDR_PULL_GET_MEM_CTX(ndr);
		NDR_PULL_SET_MEM_CTX(ndr, r->keys, 0);
		for (cntr_keys_0 = 0; cntr_keys_0 < r->num_keys; cntr_keys_0++) {
			NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->keys[cntr_keys_0]));
		}
		NDR_PULL_SET_MEM_CTX(ndr, _mem_save_keys_0, 0);
		NDR_CHECK(ndr_pull_trailer_align(ndr, 4));
	}
	if (ndr_flags & NDR_BUFFERS) {
	}
	return NDR_ERR_SUCCESS;
}

_PUBLIC_ void ndr_print_dbwrap_tdb2_changes(struct ndr_print *ndr, const char *name, const struct dbwrap_tdb2_changes *r)
{
	uint32_t cntr_keys_0;
	ndr_print_struct(ndr, name, "dbwrap_tdb2_changes");
	ndr->depth++;
	ndr_print_string(ndr, "magic_string", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?"TDB2":r->magic_string);
	ndr_print_uint32(ndr, "magic_version", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?1:r->magic_version);
	ndr_print_string(ndr, "name", r->name);
	ndr_print_uint32(ndr, "old_seqnum", r->old_seqnum);
	ndr_print_uint32(ndr, "new_seqnum", r->new_seqnum);
	ndr_print_uint32(ndr, "num_changes", r->num_changes);
	ndr_print_uint32(ndr, "num_keys", r->num_keys);
	ndr->print(ndr, "%s: ARRAY(%d)", "keys", (int)r->num_keys);
	ndr->depth++;
	for (cntr_keys_0=0;cntr_keys_0<r->num_keys;cntr_keys_0++) {
		char *idx_0=NULL;
		if (asprintf(&idx_0, "[%d]", cntr_keys_0) != -1) {
			ndr_print_DATA_BLOB(ndr, "keys", r->keys[cntr_keys_0]);
			free(idx_0);
		}
	}
	ndr->depth--;
	ndr->depth--;
}