summaryrefslogtreecommitdiff
path: root/source/include/lib_smb_proto.h
blob: 0b092fbf2d2d1d5b052ea350d1f49f2c0b56b990 (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
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
#ifndef _LIB_SMB_PROTO_H_
#define _LIB_SMB_PROTO_H_
/* This file is automatically generated with "make proto". DO NOT EDIT */


/*The following definitions come from  lib/crc32.c  */

uint32 crc32_calc_buffer( uint32 count, char *buffer);

/*The following definitions come from  lib/hmacmd5.c  */

void hmac_md5_init_rfc2104(uchar*  key, int key_len, HMACMD5Context *ctx);
void hmac_md5_init_limK_to_64(const uchar* key, int key_len,
			HMACMD5Context *ctx);
void hmac_md5_update(const uchar* text, int text_len, HMACMD5Context *ctx);
void hmac_md5_final(uchar *digest, HMACMD5Context *ctx);
void hmac_md5( uchar key[16], uchar* data, int data_len, uchar* digest);

/*The following definitions come from  lib/md5.c  */

void MD5Init(struct MD5Context *ctx);
void MD5Update(struct MD5Context *ctx, uchar const *buf, unsigned len);
void MD5Final(uchar digest[16], struct MD5Context *ctx);
void MD5Transform(uint32 buf[4], const uchar inext[64]);

/*The following definitions come from  libsmb/clientgen.c  */

int cli_set_port(struct cli_state *cli, int port);
char *cli_errstr(struct cli_state *cli);
void cli_safe_smb_errstr(struct cli_state *cli, char *msg, size_t len);
BOOL get_safe_rap_errstr(int rap_error, char *err_msg, size_t msglen);
void cli_safe_errstr(struct cli_state *cli, char *err_msg, size_t msglen);
BOOL cli_send_trans(struct cli_state *cli, int trans, 
                           char *name, int pipe_name_len, 
                           int fid, int flags,
                           uint16 *setup, int lsetup, int msetup,
                           char *param, int lparam, int mparam,
                           char *data, int ldata, int mdata);
BOOL cli_api_pipe(struct cli_state *cli, char *pipe_name, int pipe_name_len,
                  uint16 *setup, uint32 setup_count, uint32 max_setup_count,
                  char *params, uint32 param_count, uint32 max_param_count,
                  char *data, uint32 data_count, uint32 max_data_count,
                  char **rparam, uint32 *rparam_count,
                  char **rdata, uint32 *rdata_count);
BOOL cli_api(struct cli_state *cli,
	     char *param, int prcnt, int mprcnt,
	     char *data, int drcnt, int mdrcnt,
	     char **rparam, int *rprcnt,
	     char **rdata, int *rdrcnt);
BOOL cli_NetWkstaUserLogon(struct cli_state *cli,char *user, char *workstation);
BOOL cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *, uint32, const char *));
BOOL cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
		       void (*fn)(const char *, uint32, const char *));
BOOL cli_session_setup_x(struct cli_state *cli, 
				char *user, 
				char *pass, int passlen,
				char *ntpass, int ntpasslen,
				char *user_domain);
BOOL cli_session_setup(struct cli_state *cli, 
				char *myhostname, char *user,
				char *pass, int passlen,
				char *ntpass, int ntpasslen,
				char *user_domain);
BOOL cli_ulogoff(struct cli_state *cli);
BOOL cli_send_tconX(struct cli_state *cli, 
		    char *share, char *dev, char *pass, int passlen);
BOOL cli_tdis(struct cli_state *cli);
BOOL cli_rename(struct cli_state *cli, char *fname_src, char *fname_dst);
BOOL cli_unlink(struct cli_state *cli, char *fname);
BOOL cli_mkdir(struct cli_state *cli, char *dname);
BOOL cli_rmdir(struct cli_state *cli, char *dname);
int cli_nt_create(struct cli_state *cli, const char *fname);
int cli_open(struct cli_state *cli, const char *fname,
				int flags, int share_mode);
BOOL cli_close(struct cli_state *cli, int fnum);
BOOL cli_lock(struct cli_state *cli, int fnum, uint32 offset, uint32 len, int timeout);
BOOL cli_unlock(struct cli_state *cli, int fnum, uint32 offset, uint32 len, int timeout);
size_t cli_read_one(struct cli_state *cli, int fnum, char *buf, off_t offset, size_t size);
size_t cli_read(struct cli_state *cli, int fnum, char *buf, off_t offset, size_t size, BOOL overlap);
ssize_t cli_write(struct cli_state *cli,
		  int fnum, uint16 write_mode,
		  char *buf, off_t offset, size_t size, size_t bytes_left);
BOOL cli_getattrE(struct cli_state *cli, int fd, 
		  uint16 *attr, size_t *size, 
		  time_t *c_time, time_t *a_time, time_t *m_time);
BOOL cli_getatr(struct cli_state *cli, char *fname, 
		uint16 *attr, size_t *size, time_t *t);
BOOL cli_setatr(struct cli_state *cli, char *fname, uint16 attr, time_t t);
BOOL cli_qpathinfo(struct cli_state *cli, const char *fname, 
		   time_t *c_time, time_t *a_time, time_t *m_time, 
		   size_t *size, uint16 *mode);
BOOL cli_qpathinfo2(struct cli_state *cli, const char *fname, 
		    time_t *c_time, time_t *a_time, time_t *m_time, 
		    time_t *w_time, size_t *size, uint16 *mode,
		    SMB_INO_T *ino);
BOOL cli_qfileinfo(struct cli_state *cli, int fnum, 
		   uint16 *mode, size_t *size,
		   time_t *c_time, time_t *a_time, time_t *m_time, 
		   time_t *w_time, SMB_INO_T *ino);
int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute, 
	     void (*fn)(file_info *, const char *));
BOOL cli_oem_change_password(struct cli_state *cli, const char *user, const char *new_password,
                             const char *old_password);
BOOL cli_negprot(struct cli_state *cli);
BOOL cli_session_request(struct cli_state *cli,
			 struct nmb_name *calling, struct nmb_name *called);
BOOL cli_connect(struct cli_state *cli, const char *host, struct in_addr *ip);
void cli_init_creds(struct cli_state *cli, const struct ntuser_creds *usr);
struct cli_state *cli_initialise(struct cli_state *cli);
void cli_close_socket(struct cli_state *cli);
void cli_shutdown(struct cli_state *cli);
int cli_error(struct cli_state *cli, uint8 *eclass, uint32 *num);
void cli_sockopt(struct cli_state *cli, char *options);
uint16 cli_setpid(struct cli_state *cli, uint16 pid);
BOOL cli_reestablish_connection(struct cli_state *cli);
BOOL cli_establish_connection(struct cli_state *cli, 
				const char *dest_host, struct in_addr *dest_ip,
				struct nmb_name *calling, struct nmb_name *called,
				char *service, char *service_type,
				BOOL do_shutdown, BOOL do_tcon);
BOOL cli_connect_auth(struct cli_state *cli,
				const char* desthost,
				struct in_addr *dest_ip,
				const struct ntuser_creds *usr);
BOOL cli_connect_servers_auth(struct cli_state *cli,
				char *p,
				const struct ntuser_creds *usr);
BOOL cli_connect_serverlist(struct cli_state *cli, char *p);
int cli_printjob_del(struct cli_state *cli, int job);
int cli_print_queue(struct cli_state *cli, 
		    void (*fn)(struct print_job_info *));
BOOL cli_chkpath(struct cli_state *cli, char *path);
BOOL cli_message_start(struct cli_state *cli, char *host, char *username, 
			      int *grp);
BOOL cli_message_text(struct cli_state *cli, char *msg, int len, int grp);
BOOL cli_message_end(struct cli_state *cli, int grp);
BOOL cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
BOOL get_any_dc_name(const char *domain, char *srv_name);

/*The following definitions come from  libsmb/credentials.c  */

char *credstr(const uchar *cred);
void cred_session_key(DOM_CHAL *clnt_chal, DOM_CHAL *srv_chal, const char *pass,
		      uchar session_key[8]);
void cred_create(uchar session_key[8], DOM_CHAL *stor_cred, UTIME timestamp, 
		 DOM_CHAL *cred);
int cred_assert(const DOM_CHAL *cred, uchar session_key[8],
		DOM_CHAL *stored_cred, UTIME timestamp);
BOOL clnt_deal_with_creds(uchar sess_key[8],
			  DOM_CRED *sto_clnt_cred, DOM_CRED *rcv_srv_cred);
BOOL deal_with_creds(uchar sess_key[8],
		     DOM_CRED *sto_clnt_cred, 
		     const DOM_CRED *rcv_clnt_cred, DOM_CRED *rtn_srv_cred);

/*The following definitions come from  libsmb/nterr.c  */

BOOL get_safe_nt_error_msg(uint32 nt_code, char *msg, size_t len);
const char *get_nt_error_msg(uint32 nt_code);

/*The following definitions come from  libsmb/pwd_cache.c  */

void pwd_init(struct pwd_info *pwd);
BOOL pwd_is_nullpwd(const struct pwd_info *pwd);
void pwd_obfuscate_key(struct pwd_info *pwd, uint32 int_key, char *str_key);
BOOL pwd_compare(const struct pwd_info *_pwd1, const struct pwd_info *_pwd2);
void pwd_read(struct pwd_info *pwd, char *passwd_report, BOOL do_encrypt);
void pwd_set_nullpwd(struct pwd_info *pwd);
void pwd_set_cleartext(struct pwd_info *pwd, char *clr);
void pwd_get_cleartext(struct pwd_info *pwd, char *clr);
void pwd_set_lm_nt_16(struct pwd_info *pwd,
				const uchar lm_pwd[16],
				const uchar nt_pwd[16]);
void pwd_get_lm_nt_16(const struct pwd_info *pwd, uchar lm_pwd[16], uchar nt_pwd[16]);
void pwd_make_lm_nt_16(struct pwd_info *pwd, char *clr);
void pwd_make_lm_nt_owf2(struct pwd_info *pwd, const uchar srv_key[8],
		const char *user, const char *server, const char *domain,
					uchar sess_key[16]);
void pwd_make_lm_nt_owf(struct pwd_info *pwd, uchar cryptkey[8],
				uchar sess_key[16]);
void pwd_get_lm_nt_owf(struct pwd_info *pwd, uchar lm_owf[24],
				uchar *nt_owf, size_t *nt_owf_len);

/*The following definitions come from  libsmb/smbdes.c  */

void smbhash(uchar *out, const uchar *in, const uchar *key, int forw);
void E_P16(uchar *p14,uchar *p16);
void E_P24(const uchar *p21, const uchar *c8, uchar *p24);
void D_P16(const uchar *p14, const uchar *in, uchar *out);
void E_old_pw_hash( const uchar *p14, const uchar *in, uchar *out);
void cred_hash1(uchar *out, const uchar *in, const uchar *key);
void cred_hash2(uchar *out,uchar *in,uchar *key);
void cred_hash3(uchar *out, const uchar *in,uchar *key, int forw);
void SamOEMhash( uchar *data, const uchar *key, int val);
void sam_pwd_hash(uint32 rid, const uchar *in, uchar *out, int forw);

/*The following definitions come from  libsmb/smbencrypt.c  */

void SMBencrypt(uchar * pwrd, uchar * c8, uchar * p24);
void SMBNTencrypt(uchar * pwrd, uchar * c8, uchar * p24);
void E_md4hash(uchar * pwrd, uchar * p16);
void lm_owf_genW(const UNISTR2 * pwd, uchar p16[16]);
void lm_owf_gen(const char *pwd, uchar p16[16]);
void nt_owf_genW(const UNISTR2 * pwd, uchar nt_p16[16]);
void nt_owf_gen(const char *pwd, uchar nt_p16[16]);
void nt_lm_owf_genW(const UNISTR2 * pwd, uchar nt_p16[16], uchar lm_p16[16]);
void nt_lm_owf_gen(const char *pwd, uchar nt_p16[16], uchar lm_p16[16]);
void SMBOWFencrypt(const uchar pwrd[16], const uchar * c8, uchar p24[24]);
void SMBOWFencrypt_ntv2(const uchar kr[16],
			const uchar * srv_chal, int srv_chal_len,
			const uchar * cli_chal, int cli_chal_len,
			char resp_buf[16]);
void SMBsesskeygen_ntv2(const uchar kr[16],
			const uchar * nt_resp, char sess_key[16]);
void SMBsesskeygen_ntv1(const uchar kr[16],
			const uchar * nt_resp, char sess_key[16]);
void SMBgenclientchals(char *lm_cli_chal,
		       char *nt_cli_chal, int *nt_cli_chal_len,
		       const char *srv, const char *dom);
void ntv2_owf_gen(const uchar owf[16],
		  const char *user_n, const char *domain_n, uchar kr_buf[16]);
void NTLMSSPOWFencrypt(const uchar pwrd[8], const uchar * ntlmchalresp,
				uchar p24[24]);
BOOL make_oem_passwd_hash(uchar data[516],
			  const char *pwrd, int new_pw_len,
			  const uchar old_pw_hash[16], BOOL unicode);
BOOL nt_encrypt_string2(STRING2 * out, const STRING2 * in, const uchar * key);
BOOL nt_decrypt_string2(STRING2 * out, const STRING2 * in, const uchar * key);
void create_ntlmssp_resp(struct pwd_info *pwd,
			 char *domain, char *user_name, char *my_name,
			 uint32 ntlmssp_cli_flgs, prs_struct * auth_resp);
BOOL decode_pw_buffer(const char buffer[516], char *new_pwrd,
		      int new_pwrd_size, uint32 * new_pw_len);
BOOL encode_pw_buffer(char buffer[516], const char *new_pass,
		      int new_pw_len, BOOL nt_pass_set);

/*The following definitions come from  libsmb/smberr.c  */

char *smb_err_msg(uint8 class, uint32 num);
BOOL smb_safe_err_msg(uint8 class, uint32 num, char *ret, size_t len);
BOOL smb_safe_errstr(char *inbuf, char *msg, size_t len);
char *smb_errstr(char *inbuf);

/*The following definitions come from  lib/util_hnd.c  */

struct policy_cache *get_global_hnd_cache(void);
struct policy_cache *init_policy_cache(int num_pol_hnds);
void free_policy_cache(struct policy_cache *cache);
BOOL policy_hnd_set_name(struct policy_cache *cache,
			 POLICY_HND *hnd, const char *name);
const char *policy_hnd_get_name(struct policy_cache *cache,
				const POLICY_HND *hnd);
BOOL dup_policy_hnd(struct policy_cache *cache,
				POLICY_HND *hnd,
				const POLICY_HND *from);
BOOL register_policy_hnd(struct policy_cache *cache,
				const vuser_key *key,
				POLICY_HND *hnd,
				uint32 access_mask);
BOOL open_policy_hnd(struct policy_cache *cache, 
				const vuser_key *key,
				POLICY_HND *hnd,
				uint32 access_mask);
BOOL open_policy_hnd_link(struct policy_cache *cache, 
				const POLICY_HND *parent_hnd,
				POLICY_HND *hnd,
				uint32 access_mask);
int find_policy_by_hnd(struct policy_cache *cache, const POLICY_HND *hnd);
BOOL set_policy_state(struct policy_cache *cache, POLICY_HND *hnd, 
				void(*fn)(void*), void *dev);
void *get_policy_state_info(struct policy_cache *cache, const POLICY_HND *hnd);
BOOL policy_hnd_set_state_type(struct policy_cache *cache,
			       POLICY_HND *hnd, int type);
int policy_hnd_get_state_type(struct policy_cache *cache,
			      const POLICY_HND *hnd);
BOOL policy_hnd_check_state_type(struct policy_cache *cache,
				 const POLICY_HND *hnd, int type);
BOOL close_policy_hnd(struct policy_cache *cache, POLICY_HND *hnd);
BOOL policy_link_key(struct policy_cache *cache, const POLICY_HND *hnd,
				POLICY_HND *to);
const vuser_key *get_policy_vuser_key(struct policy_cache *cache,
				const POLICY_HND *hnd);
BOOL pol_get_usr_sesskey(struct policy_cache *cache, const POLICY_HND *hnd,
				uchar usr_sess_key[16]);

/*The following definitions come from  lib/vuser.c  */

BOOL is_valid_user_struct(const vuser_key * key);
user_struct *get_valid_user_struct(const vuser_key * key);
void invalidate_vuid(vuser_key * key);
BOOL validated_username(vuser_key * key, char *name, size_t len);
uint16 create_vuid(pid_t pid,
		   uid_t uid, gid_t gid,
		   int n_groups, gid_t * groups,
		   const char *unix_name,
		   const char *requested_name,
		   const char *real_name,
		   BOOL guest, const NET_USER_INFO_3 * info3);
uint16 register_vuid(pid_t pid, uid_t uid, gid_t gid,
		     const char *unix_name,
		     const char *requested_name,
		     BOOL guest, const NET_USER_INFO_3 * info3);
BOOL check_vuser_ok(struct uid_cache *cache, user_struct * vuser, int snum);

/*The following definitions come from  lib/vuser_db.c  */

BOOL tdb_delete_vuid( const vuser_key *uk);
BOOL tdb_lookup_vuid( const vuser_key *uk, user_struct **usr);
BOOL tdb_store_vuid( const vuser_key *uk, user_struct *usr);
BOOL vuid_init_db(void);

/*The following definitions come from  rpc_parse/parse_creds.c  */

BOOL make_creds_unix(CREDS_UNIX *r_u, const char* user_name,
				const char* requested_name,
				const char* real_name,
				BOOL guest);
BOOL creds_io_unix(char *desc, CREDS_UNIX *r_u, prs_struct *ps, int depth);
void creds_free_unix(CREDS_UNIX *r_u);
BOOL make_creds_unix_sec(CREDS_UNIX_SEC *r_u,
		uint32 uid, uint32 gid, uint32 num_grps, gid_t *grps);
BOOL creds_io_unix_sec(char *desc, CREDS_UNIX_SEC *r_u, prs_struct *ps, int depth);
void creds_free_unix_sec(CREDS_UNIX_SEC *r_u);
BOOL creds_io_pwd_info(char *desc, struct pwd_info *pwd, prs_struct *ps, int depth);
BOOL creds_io_nt(char *desc, CREDS_NT *r_u, prs_struct *ps, int depth);
void creds_free_nt(CREDS_NT *r_u);
BOOL creds_io_hybrid(char *desc, CREDS_HYBRID *r_u, prs_struct *ps, int depth);
void copy_unix_creds(CREDS_UNIX *to, const CREDS_UNIX *from);
void copy_unix_sec_creds(CREDS_UNIX_SEC *to, const CREDS_UNIX_SEC *from);
void copy_nt_creds(struct ntuser_creds *to,
				const struct ntuser_creds *from);
void copy_user_creds(struct user_creds *to,
				const struct user_creds *from);
void free_user_creds(struct user_creds *creds);
BOOL creds_io_cmd(char *desc, CREDS_CMD *r_u, prs_struct *ps, int depth);
BOOL create_ntuser_creds( prs_struct *ps,
				const char* name, 
				uint16 version, uint16 command,
				const vuser_key *key,
				const struct ntuser_creds *ntu,
				BOOL reuse);
BOOL create_user_creds( prs_struct *ps,
				const char* name, 
				uint16 version, uint16 command,
				const vuser_key *key,
				const struct user_creds *usr);

/*The following definitions come from  rpc_parse/parse_net.c  */

BOOL make_q_logon_ctrl2(NET_Q_LOGON_CTRL2 *q_l, 
				const char* srv_name,
				uint32 function_code,
				uint32 query_level,
				uint32 switch_value);
BOOL net_io_q_logon_ctrl2(char *desc,  NET_Q_LOGON_CTRL2 *q_l, prs_struct *ps, int depth);
BOOL make_r_logon_ctrl2(NET_R_LOGON_CTRL2 *r_l, 
				uint32 switch_value,
				NETLOGON_INFO *logon_info,
				uint32 status);
BOOL net_io_r_logon_ctrl2(char *desc,  NET_R_LOGON_CTRL2 *r_l, prs_struct *ps, int depth);
BOOL net_io_r_trust_dom(char *desc,  NET_R_TRUST_DOM_LIST *r_t, prs_struct *ps, int depth);
BOOL net_io_q_trust_dom(char *desc,  NET_Q_TRUST_DOM_LIST *q_l, prs_struct *ps, int depth);
BOOL make_q_req_chal(NET_Q_REQ_CHAL *q_c,
				const char *logon_srv, const char *logon_clnt,
				DOM_CHAL *clnt_chal);
BOOL net_io_q_req_chal(char *desc,  NET_Q_REQ_CHAL *q_c, prs_struct *ps, int depth);
BOOL net_io_r_req_chal(char *desc,  NET_R_REQ_CHAL *r_c, prs_struct *ps, int depth);
BOOL make_q_auth(NET_Q_AUTH *q_a,
		const char *logon_srv, const char *acct_name,
		uint16 sec_chan, const char *comp_name,
		DOM_CHAL *clnt_chal);
BOOL net_io_q_auth(char *desc,  NET_Q_AUTH *q_a, prs_struct *ps, int depth);
BOOL net_io_r_auth(char *desc,  NET_R_AUTH *r_a, prs_struct *ps, int depth);
BOOL make_q_auth_2(NET_Q_AUTH_2 *q_a,
		const char *logon_srv, const char *acct_name,
		uint16 sec_chan, const char *comp_name,
		DOM_CHAL *clnt_chal, uint32 clnt_flgs);
BOOL net_io_q_auth_2(char *desc,  NET_Q_AUTH_2 *q_a, prs_struct *ps, int depth);
BOOL net_io_r_auth_2(char *desc,  NET_R_AUTH_2 *r_a, prs_struct *ps, int depth);
BOOL make_q_srv_pwset(NET_Q_SRV_PWSET *q_s,
				const char *logon_srv, const char *acct_name, 
                		uint16 sec_chan, const char *comp_name,
				DOM_CRED *cred, char nt_cypher[16]);
BOOL net_io_q_srv_pwset(char *desc,  NET_Q_SRV_PWSET *q_s, prs_struct *ps, int depth);
BOOL net_io_r_srv_pwset(char *desc,  NET_R_SRV_PWSET *r_s, prs_struct *ps, int depth);
BOOL make_id_info1(NET_ID_INFO_1 *id, const char *domain_name,
				uint32 param_ctrl,
				uint32 log_id_low,
				uint32 log_id_high,
				const char *user_name,
				const char *wksta_name,
				const char sess_key[16],
				const uchar lm_cypher[16],
				const uchar nt_cypher[16]);
BOOL make_id_info4(NET_ID_INFO_4 *id, const char *domain_name,
				uint32 param_ctrl,
				uint32 log_id_low, uint32 log_id_high,
				const char *user_name, const char *wksta_name,
				const char *general);
BOOL make_id_info2(NET_ID_INFO_2 *id, const char *domain_name,
				uint32 param_ctrl,
				uint32 log_id_low, uint32 log_id_high,
				const char *user_name, const char *wksta_name,
				const uchar lm_challenge[8],
				const uchar *lm_chal_resp,
				int lm_chal_len,
				const uchar *nt_chal_resp,
				int nt_chal_len);
BOOL make_sam_info(DOM_SAM_INFO *sam,
				const char *logon_srv, const char *comp_name,
				DOM_CRED *clnt_cred,
				DOM_CRED *rtn_cred, uint16 logon_level,
				NET_ID_INFO_CTR *ctr);
BOOL make_net_user_info3W(NET_USER_INFO_3 *usr,

	const NTTIME *logon_time,
	const NTTIME *logoff_time,
	const NTTIME *kickoff_time,
	const NTTIME *pass_last_set_time,
	const NTTIME *pass_can_change_time,
	const NTTIME *pass_must_change_time,

	const UNISTR2 *user_name, 
	const UNISTR2 *full_name,
	const UNISTR2 *log_scr,
	const UNISTR2 *prof_path,
	const UNISTR2 *home_dir,
	const UNISTR2 *dir_drive,

	uint16 logon_count,
	uint16 bad_pw_count,

	uint32 user_id,
	uint32 group_id,
	uint32 num_groups,
	const DOM_GID *gids,
	uint32 user_flgs,

	const char sess_key[16],

	const UNISTR2 *logon_srv,
	const UNISTR2 *logon_dom,

	const char *padding,

	const DOM_SID *dom_sid,
	const char *other_sids);
BOOL make_net_user_info3(NET_USER_INFO_3 *usr,

	NTTIME *logon_time,
	NTTIME *logoff_time,
	NTTIME *kickoff_time,
	NTTIME *pass_last_set_time,
	NTTIME *pass_can_change_time,
	NTTIME *pass_must_change_time,

	char *user_name,
	char *full_name,
	char *logon_script,
	char *profile_path,
	char *home_dir,
	char *dir_drive,

	uint16 logon_count,
	uint16 bad_pw_count,

	uint32 user_id,
	uint32 group_id,
	uint32 num_groups,
	DOM_GID *gids,
	uint32 user_flgs,

	char sess_key[16],

	char *logon_srv,
	char *logon_dom,

	char *padding,

	DOM_SID *dom_sid,
	char *other_sids);
BOOL net_io_user_info3(char *desc,  NET_USER_INFO_3 *usr, prs_struct *ps, int depth);
BOOL net_io_q_sam_logon(char *desc,  NET_Q_SAM_LOGON *q_l, prs_struct *ps, int depth);
BOOL make_r_sam_logon(NET_R_SAM_LOGON *r_s, 
			    const DOM_CRED *srv_creds,
			    uint16 switch_value,
			    NET_USER_INFO_3 *user_info,
			    uint32 status);
BOOL net_io_r_sam_logon(char *desc,  NET_R_SAM_LOGON *r_l, prs_struct *ps, int depth);
BOOL net_io_q_sam_logoff(char *desc,  NET_Q_SAM_LOGOFF *q_l, prs_struct *ps, int depth);
BOOL make_r_sam_logoff(NET_R_SAM_LOGOFF *r_s, 
			    const DOM_CRED *srv_cred,
			    uint32 status);
BOOL net_io_r_sam_logoff(char *desc,  NET_R_SAM_LOGOFF *r_l, prs_struct *ps, int depth);
BOOL make_q_sam_sync(NET_Q_SAM_SYNC *q_s,
				const char *srv_name,
				const char *cli_name,
				DOM_CRED *cli_creds, uint32 database_id);
BOOL net_io_q_sam_sync(char *desc, NET_Q_SAM_SYNC *q_s, prs_struct *ps, int depth);
BOOL make_sam_delta_hdr(SAM_DELTA_HDR *delta, uint16 type, uint32 rid);
BOOL make_sam_account_info(SAM_ACCOUNT_INFO *info,
				const UNISTR2 *user_name,
				const UNISTR2 *full_name,
				uint32 user_rid, uint32 group_rid,
				const UNISTR2 *home_dir,
				const UNISTR2 *dir_drive,
				const UNISTR2 *log_scr,
				const UNISTR2 *desc,
				uint32 acb_info,
				const UNISTR2 *prof_path,
				const UNISTR2 *wkstas,
				const UNISTR2 *unk_str,
				const UNISTR2 *mung_dial);
BOOL make_r_sam_sync(NET_R_SAM_SYNC *r_s, 
			   const DOM_CRED *srv_cred,
			   uint32 sync_context,
			   uint32 num_deltas,
			   uint32 num_deltas2,
			   SAM_DELTA_HDR *hdr_deltas,
			   SAM_DELTA_CTR *deltas,
			   uint32 status);
BOOL net_io_r_sam_sync(char *desc, uint8 sess_key[16],
				NET_R_SAM_SYNC *r_s, prs_struct *ps, int depth);

/*The following definitions come from  rpc_parse/parse_ntlmssp.c  */

BOOL rpc_hdr_ntlmssp_auth_chk(RPC_HDR_AUTH *rai);
BOOL make_rpc_auth_ntlmssp_neg(RPC_AUTH_NTLMSSP_NEG *neg,
				uint32 neg_flgs,
				fstring myname, fstring domain);
BOOL smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_struct *ps, int depth);
BOOL make_rpc_auth_ntlmssp_chal(RPC_AUTH_NTLMSSP_CHAL *chl,
				uint32 neg_flags,
				uint8 challenge[8]);
BOOL smb_io_rpc_auth_ntlmssp_chal(char *desc, RPC_AUTH_NTLMSSP_CHAL *chl, prs_struct *ps, int depth);
BOOL make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp,
				uchar lm_resp[24],
				uchar *nt_resp, size_t nt_len,
				char *domain, char *user, char *wks,
				uint32 neg_flags);
BOOL smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_struct *ps, int depth);
BOOL rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK *chk, uint32 crc32, uint32 seq_num);
BOOL make_rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK *chk,
				uint32 ver, uint32 crc32, uint32 seq_num);
BOOL smb_io_rpc_auth_ntlmssp_chk(char *desc, RPC_AUTH_NTLMSSP_CHK *chk, prs_struct *ps, int depth);

/*The following definitions come from  rpc_parse/parse_prs.c  */

void prs_debug(prs_struct * ps, int depth, const char *desc,
	       const char *fn_name);
void prs_debug_out(const prs_struct * ps, char *msg, int level);
void prs_init(prs_struct * ps, uint32 size, uint8 align, BOOL io);
void prs_set_packtype(prs_struct * ps, const uint8 * pack_type);
void prs_create(prs_struct * ps, char *data, uint32 size, uint8 align,
		BOOL io);
BOOL prs_copy(prs_struct * ps, const prs_struct * from);
BOOL prs_alloc_data(prs_struct * buf, int size);
BOOL prs_buf_copy(char *copy_into, const prs_struct * buf,
		  uint32 offset, uint32 len);
void prs_struct_free(prs_struct ** buf);
void prs_free_data(prs_struct * buf);
BOOL prs_realloc_data(prs_struct * buf, size_t new_size);
BOOL prs_grow_data(prs_struct * buf, BOOL io, int new_size, BOOL force_grow);
uint32 prs_buf_len(const prs_struct * buf);
char *prs_data(const prs_struct * buf, uint32 offset);
void prs_link(prs_struct * prev, prs_struct * ps, prs_struct * next);
void prs_align(prs_struct * ps);
BOOL prs_grow(prs_struct * ps, uint32 new_size);
BOOL prs_append_data(prs_struct * ps, const char *data, int len);
BOOL prs_add_data(prs_struct * ps, const char *data, int len);
BOOL _prs_uint8(char *name, prs_struct * ps, int depth, uint8 * data8);
BOOL _prs_uint16(char *name, prs_struct * ps, int depth, uint16 * data16);
BOOL _prs_hash1(prs_struct * ps, uint32 offset, uint8 sess_key[16]);
BOOL _prs_uint32(char *name, prs_struct * ps, int depth, uint32 * data32);
BOOL _prs_uint8s(BOOL charmode, char *name, prs_struct * ps, int depth,
		 uint8 * data8s, int len);
BOOL _prs_uint16s(BOOL charmode, char *name, prs_struct * ps, int depth,
		  uint16 * data16s, int len);
BOOL _prs_uint32s(BOOL charmode, char *name, prs_struct * ps, int depth,
		  uint32 * data32s, int len);
BOOL _prs_buffer2(BOOL charmode, char *name, prs_struct * ps, int depth,
		  BUFFER2 * str);
BOOL _prs_string2(BOOL charmode, char *name, prs_struct * ps, int depth,
		  STRING2 * str);
BOOL _prs_unistr2(BOOL charmode, char *name, prs_struct * ps, int depth,
		  UNISTR2 * str);
BOOL _prs_unistr3(BOOL charmode, char *name, UNISTR3 * str, prs_struct * ps,
		  int depth);
BOOL _prs_unistr(char *name, prs_struct * ps, int depth, UNISTR * str);
BOOL _prs_string(char *name, prs_struct * ps, int depth, char *str,
		 uint16 len, uint16 max_buf_size);
BOOL _prs_uint16_pre(char *name, prs_struct * ps, int depth, uint16 * data16,
		     uint32 * offset);
BOOL _prs_uint16_post(char *name, prs_struct * ps, int depth, uint16 * data16,
		      uint32 ptr_uint16, uint32 start_offset);
BOOL _prs_uint32_pre(char *name, prs_struct * ps, int depth, uint32 * data32,
		     uint32 * offset);
BOOL _prs_uint32_post(char *name, prs_struct * ps, int depth, uint32 * data32,
		      uint32 ptr_uint32, uint32 data_size);
int prs_tdb_delete(TDB_CONTEXT * tdb, prs_struct * pk);
int prs_tdb_store(TDB_CONTEXT * tdb, int flgs, prs_struct * pk,
		  prs_struct * pd);
void prs_tdb_fetch(TDB_CONTEXT * tdb, prs_struct * pk, prs_struct * pd);

/*The following definitions come from  rpc_parse/parse_vuid.c  */

BOOL vuid_io_key(char *desc, vuser_key * r_u, prs_struct * ps, int depth);
BOOL make_vuid_user_struct(user_struct * r_u,
			   uid_t uid, gid_t gid,
			   const char *name,
			   const char *requested_name,
			   const char *real_name,
			   BOOL guest,
			   uint32 n_groups, const gid_t * groups,
			   const NET_USER_INFO_3 * usr);
BOOL vuid_io_user_struct(char *desc, user_struct * r_u, prs_struct * ps,
			 int depth);
void vuid_free_user_struct(user_struct * r_u);
#endif /* _LIB_SMB_PROTO_H_ */