s3:rpc_server: Store dcesrv context and endpoint in ncacn_conn
[Samba.git] / source3 / rpc_server / rpc_server.h
blob58d5263b641323d6107dbb833299e224adeb2842
1 /*
2 * RPC Server helper headers
3 * Almost completely rewritten by (C) Jeremy Allison 2005 - 2010
4 * Copyright (C) Simo Sorce <idra@samba.org> - 2010
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
20 #ifndef _RPC_SERVER_H_
21 #define _RPC_SERVER_H_
23 #include "librpc/rpc/rpc_common.h" /* For enum dcerpc_transport_t */
25 #include "librpc/rpc/dcesrv_core.h"
27 struct pipes_struct;
28 struct auth_session_info;
29 struct cli_credentials;
31 typedef void (*dcerpc_ncacn_termination_fn)(struct pipes_struct *, void *);
33 struct dcerpc_ncacn_conn {
34 int sock;
36 struct pipes_struct *p;
37 dcerpc_ncacn_termination_fn termination_fn;
38 void *termination_data;
40 struct tevent_context *ev_ctx;
41 struct messaging_context *msg_ctx;
42 struct dcesrv_context *dce_ctx;
43 struct dcesrv_endpoint *endpoint;
45 struct tstream_context *tstream;
46 struct tevent_queue *send_queue;
48 struct tsocket_address *remote_client_addr;
49 char *remote_client_name;
50 struct tsocket_address *local_server_addr;
51 char *local_server_name;
52 struct auth_session_info *session_info;
54 struct iovec *iov;
55 size_t count;
58 NTSTATUS dcerpc_ncacn_conn_init(TALLOC_CTX *mem_ctx,
59 struct tevent_context *ev_ctx,
60 struct messaging_context *msg_ctx,
61 struct dcesrv_context *dce_ctx,
62 struct dcesrv_endpoint *endpoint,
63 dcerpc_ncacn_termination_fn term_fn,
64 void *termination_data,
65 struct dcerpc_ncacn_conn **out);
67 int make_server_pipes_struct(TALLOC_CTX *mem_ctx,
68 struct messaging_context *msg_ctx,
69 const char *pipe_name,
70 enum dcerpc_transport_t transport,
71 const struct tsocket_address *remote_address,
72 const struct tsocket_address *local_address,
73 struct auth_session_info **session_info,
74 struct pipes_struct **_p,
75 int *perrno);
77 void set_incoming_fault(struct pipes_struct *p);
78 void process_complete_pdu(struct pipes_struct *p, struct ncacn_packet *pkt);
79 NTSTATUS dcesrv_create_ncacn_np_socket(struct dcesrv_endpoint *e, int *out_fd);
80 NTSTATUS dcesrv_setup_ncacn_np_socket(struct tevent_context *ev_ctx,
81 struct messaging_context *msg_ctx,
82 struct dcesrv_context *dce_ctx,
83 struct dcesrv_endpoint *e,
84 dcerpc_ncacn_termination_fn term_fn,
85 void *term_data);
87 NTSTATUS dcesrv_create_ncacn_ip_tcp_socket(const struct sockaddr_storage *ifss,
88 uint16_t *port,
89 int *out_fd);
90 NTSTATUS dcesrv_setup_ncacn_ip_tcp_socket(struct tevent_context *ev_ctx,
91 struct messaging_context *msg_ctx,
92 struct dcesrv_context *dce_ctx,
93 struct dcesrv_endpoint *e,
94 const struct sockaddr_storage *ifss,
95 dcerpc_ncacn_termination_fn term_fn,
96 void *term_data);
98 NTSTATUS dcesrv_create_ncalrpc_socket(struct dcesrv_endpoint *e, int *fd);
99 NTSTATUS dcesrv_setup_ncalrpc_socket(struct tevent_context *ev_ctx,
100 struct messaging_context *msg_ctx,
101 struct dcesrv_context *dce_ctx,
102 struct dcesrv_endpoint *e,
103 dcerpc_ncacn_termination_fn term_fn,
104 void *termination_data);
106 void dcerpc_ncacn_accept(struct tevent_context *ev_ctx,
107 struct messaging_context *msg_ctx,
108 struct dcesrv_context *dce_ctx,
109 struct dcesrv_endpoint *e,
110 struct tsocket_address *cli_addr,
111 struct tsocket_address *srv_addr,
112 int s,
113 dcerpc_ncacn_termination_fn termination_fn,
114 void *termination_data);
115 void dcerpc_ncacn_packet_process(struct tevent_req *subreq);
117 NTSTATUS dcesrv_auth_gensec_prepare(TALLOC_CTX *mem_ctx,
118 struct dcesrv_call_state *call,
119 struct gensec_security **out);
120 void dcesrv_log_successful_authz(struct dcesrv_call_state *call);
121 NTSTATUS dcesrv_assoc_group_find(struct dcesrv_call_state *call);
123 NTSTATUS dcesrv_endpoint_by_ncacn_np_name(struct dcesrv_context *dce_ctx,
124 const char *endpoint,
125 struct dcesrv_endpoint **out);
127 #endif /* _PRC_SERVER_H_ */