r15356: Remove unused 'flags' argument from socket_send() and friends.
[bbaumbach/samba-autobuild/.git] / source4 / lib / stream / packet.h
1 /* 
2    Unix SMB/CIFS mplementation.
3
4    helper layer for breaking up streams into discrete requests
5    
6    Copyright (C) Andrew Tridgell  2005
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 2 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, write to the Free Software
20    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21    
22 */
23
24 #include "lib/tls/tls.h"
25
26 typedef NTSTATUS (*packet_full_request_fn_t)(void *private, 
27                                              DATA_BLOB blob, size_t *packet_size);
28 typedef NTSTATUS (*packet_callback_fn_t)(void *private, DATA_BLOB blob);
29 typedef void (*packet_error_handler_fn_t)(void *private, NTSTATUS status);
30
31
32
33 struct packet_context *packet_init(TALLOC_CTX *mem_ctx);
34 void packet_set_callback(struct packet_context *pc, packet_callback_fn_t callback);
35 void packet_set_error_handler(struct packet_context *pc, packet_error_handler_fn_t handler);
36 void packet_set_private(struct packet_context *pc, void *private);
37 void packet_set_full_request(struct packet_context *pc, packet_full_request_fn_t callback);
38 void packet_set_tls(struct packet_context *pc, struct tls_context *tls);
39 void packet_set_socket(struct packet_context *pc, struct socket_context *sock);
40 void packet_set_event_context(struct packet_context *pc, struct event_context *ev);
41 void packet_set_fde(struct packet_context *pc, struct fd_event *fde);
42 void packet_set_serialise(struct packet_context *pc);
43 void packet_set_initial_read(struct packet_context *pc, uint32_t initial_read);
44 void packet_set_nofree(struct packet_context *pc);
45 void packet_recv(struct packet_context *pc);
46 void packet_recv_disable(struct packet_context *pc);
47 void packet_recv_enable(struct packet_context *pc);
48 NTSTATUS packet_send(struct packet_context *pc, DATA_BLOB blob);
49 void packet_queue_run(struct packet_context *pc);
50
51 /*
52   pre-canned handlers
53 */
54 NTSTATUS packet_full_request_nbt(void *private, DATA_BLOB blob, size_t *size);
55 NTSTATUS packet_full_request_u32(void *private, DATA_BLOB blob, size_t *size);
56
57