2005-06-05 06:53:07 +00:00
/*
Unix SMB / CIFS implementation .
Samba internal rpc code - header
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
2007-07-10 02:07:03 +00:00
the Free Software Foundation ; either version 3 of the License , or
2005-06-05 06:53:07 +00:00
( 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
2007-07-10 02:07:03 +00:00
along with this program . If not , see < http : //www.gnu.org/licenses/>.
2005-06-05 06:53:07 +00:00
*/
2008-03-29 00:31:37 +01:00
# ifndef IRPC_H
# define IRPC_H
2009-09-18 18:05:55 -07:00
# include "lib/messaging/messaging.h"
2005-09-25 13:01:26 +00:00
# include "librpc/gen_ndr/irpc.h"
2005-06-05 06:53:07 +00:00
/*
an incoming irpc message
*/
struct irpc_message {
2007-01-10 10:52:09 +00:00
struct server_id from ;
2009-02-01 00:03:47 +01:00
void * private_data ;
2005-09-25 13:01:26 +00:00
struct irpc_header header ;
struct ndr_pull * ndr ;
2007-08-27 18:10:19 +00:00
bool defer_reply ;
2010-09-12 10:02:02 +10:00
bool no_reply ;
2011-05-03 10:40:33 +10:00
struct imessaging_context * msg_ctx ;
2005-09-25 13:01:26 +00:00
struct irpc_list * irpc ;
void * data ;
2005-06-05 06:53:07 +00:00
} ;
/* don't allow calls to take too long */
2010-09-15 14:22:27 +03:00
# define IRPC_CALL_TIMEOUT 10
/* wait for the calls as long as it takes */
# define IRPC_CALL_TIMEOUT_INF 0
2005-06-05 06:53:07 +00:00
/* the server function type */
typedef NTSTATUS ( * irpc_function_t ) ( struct irpc_message * , void * r ) ;
/* register a server function with the irpc messaging system */
2009-01-31 23:57:02 +01:00
# define IRPC_REGISTER(msg_ctx, pipename, funcname, function, private_data) \
2007-08-19 21:23:03 +00:00
irpc_register ( msg_ctx , & ndr_table_ # # pipename , \
2007-08-19 22:09:21 +00:00
NDR_ # # funcname , \
2009-01-31 23:57:02 +01:00
( irpc_function_t ) function , private_data )
2005-06-05 06:53:07 +00:00
2010-09-03 16:05:38 +02:00
struct ndr_interface_table ;
2005-06-05 06:53:07 +00:00
2011-05-03 10:40:33 +10:00
NTSTATUS irpc_register ( struct imessaging_context * msg_ctx ,
2007-08-19 20:46:45 +00:00
const struct ndr_interface_table * table ,
2009-01-31 23:57:02 +01:00
int call , irpc_function_t fn , void * private_data ) ;
2005-06-05 06:53:07 +00:00
2010-08-30 13:44:01 +02:00
struct dcerpc_binding_handle * irpc_binding_handle ( TALLOC_CTX * mem_ctx ,
2014-05-05 16:27:59 +12:00
struct imessaging_context * msg_ctx ,
struct server_id server_id ,
const struct ndr_interface_table * table ) ;
2010-08-30 13:44:41 +02:00
struct dcerpc_binding_handle * irpc_binding_handle_by_name ( TALLOC_CTX * mem_ctx ,
2014-05-05 16:27:59 +12:00
struct imessaging_context * msg_ctx ,
const char * dest_task ,
const struct ndr_interface_table * table ) ;
2010-09-26 17:04:43 -07:00
void irpc_binding_handle_add_security_token ( struct dcerpc_binding_handle * h ,
struct security_token * token ) ;
2010-08-30 13:44:01 +02:00
2011-05-03 10:40:33 +10:00
NTSTATUS irpc_add_name ( struct imessaging_context * msg_ctx , const char * name ) ;
2014-07-17 15:05:30 +00:00
NTSTATUS irpc_servers_byname ( struct imessaging_context * msg_ctx ,
TALLOC_CTX * mem_ctx , const char * name ,
unsigned * num_servers ,
struct server_id * * servers ) ;
2012-10-29 15:32:21 +11:00
struct irpc_name_records * irpc_all_servers ( struct imessaging_context * msg_ctx ,
TALLOC_CTX * mem_ctx ) ;
2011-05-03 10:40:33 +10:00
void irpc_remove_name ( struct imessaging_context * msg_ctx , const char * name ) ;
2005-09-25 13:17:03 +00:00
NTSTATUS irpc_send_reply ( struct irpc_message * m , NTSTATUS status ) ;
2005-09-25 13:01:26 +00:00
2008-03-29 00:31:37 +01:00
# endif
2005-07-10 04:54:21 +00:00