summaryrefslogtreecommitdiff
path: root/source4/lib/stream/packet.h
blob: 79d4acacd01f136fe62e41f1f403b3aa00ac2ce4 (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
/* 
   Unix SMB/CIFS mplementation.

   helper layer for breaking up streams into discrete requests
   
   Copyright (C) Andrew Tridgell  2005
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.
   
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   
   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
   
*/

#include "lib/tls/tls.h"

typedef NTSTATUS (*packet_full_request_fn_t)(void *private, 
					     DATA_BLOB blob, size_t *packet_size);
typedef NTSTATUS (*packet_callback_fn_t)(void *private, DATA_BLOB blob);
typedef void (*packet_error_handler_fn_t)(void *private, NTSTATUS status);



struct packet_context *packet_init(TALLOC_CTX *mem_ctx);
void packet_set_callback(struct packet_context *pc, packet_callback_fn_t callback);
void packet_set_error_handler(struct packet_context *pc, packet_error_handler_fn_t handler);
void packet_set_private(struct packet_context *pc, void *private);
void packet_set_full_request(struct packet_context *pc, packet_full_request_fn_t callback);
void packet_set_tls(struct packet_context *pc, struct tls_context *tls);
void packet_set_socket(struct packet_context *pc, struct socket_context *sock);
void packet_set_event_context(struct packet_context *pc, struct event_context *ev);
void packet_set_fde(struct packet_context *pc, struct fd_event *fde);
void packet_set_serialise(struct packet_context *pc);
void packet_set_initial_read(struct packet_context *pc, uint32_t initial_read);
void packet_set_nofree(struct packet_context *pc);
void packet_recv(struct packet_context *pc);
void packet_recv_disable(struct packet_context *pc);
void packet_recv_enable(struct packet_context *pc);
NTSTATUS packet_send(struct packet_context *pc, DATA_BLOB blob);
void packet_queue_run(struct packet_context *pc);

/*
  pre-canned handlers
*/
NTSTATUS packet_full_request_nbt(void *private, DATA_BLOB blob, size_t *size);
NTSTATUS packet_full_request_u32(void *private, DATA_BLOB blob, size_t *size);