2 * Unix SMB/CIFS implementation.
3 * RPC Pipe client / server routines for rpcecho
4 * Copyright (C) Tim Potter 2003.
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 2 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, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 /* This is the interface to the rpcecho pipe. */
29 #define DBGC_CLASS DBGC_RPC_SRV
31 static BOOL
api_add_one(pipes_struct
*p
)
36 prs_struct
*data
= &p
->in_data
.data
;
37 prs_struct
*rdata
= &p
->out_data
.rdata
;
42 if(!echo_io_q_add_one("", &q_u
, data
, 0))
45 _echo_add_one(p
, &q_u
, &r_u
);
47 if(!echo_io_r_add_one("", &r_u
, rdata
, 0))
53 static BOOL
api_echo_data(pipes_struct
*p
)
58 prs_struct
*data
= &p
->in_data
.data
;
59 prs_struct
*rdata
= &p
->out_data
.rdata
;
64 if(!echo_io_q_echo_data("", &q_u
, data
, 0))
67 _echo_data(p
, &q_u
, &r_u
);
69 if(!echo_io_r_echo_data("", &r_u
, rdata
, 0))
75 static BOOL
api_source_data(pipes_struct
*p
)
77 ECHO_Q_SOURCE_DATA q_u
;
78 ECHO_R_SOURCE_DATA r_u
;
80 prs_struct
*data
= &p
->in_data
.data
;
81 prs_struct
*rdata
= &p
->out_data
.rdata
;
86 if(!echo_io_q_source_data("", &q_u
, data
, 0))
89 _source_data(p
, &q_u
, &r_u
);
91 if(!echo_io_r_source_data("", &r_u
, rdata
, 0))
97 static BOOL
api_sink_data(pipes_struct
*p
)
100 ECHO_R_SINK_DATA r_u
;
102 prs_struct
*data
= &p
->in_data
.data
;
103 prs_struct
*rdata
= &p
->out_data
.rdata
;
108 if(!echo_io_q_sink_data("", &q_u
, data
, 0))
111 _sink_data(p
, &q_u
, &r_u
);
113 if(!echo_io_r_sink_data("", &r_u
, rdata
, 0))
119 /*******************************************************************
120 \pipe\rpcecho commands
121 ********************************************************************/
123 struct api_struct api_echo_cmds
[] = {
124 {"ADD_ONE", ECHO_ADD_ONE
, api_add_one
},
125 {"ECHO_DATA", ECHO_DATA
, api_echo_data
},
126 {"SOURCE_DATA", ECHO_SOURCE_DATA
, api_source_data
},
127 {"SINK_DATA", ECHO_SINK_DATA
, api_sink_data
},
131 void echo_get_pipe_fns( struct api_struct
**fns
, int *n_fns
)
133 *fns
= api_echo_cmds
;
134 *n_fns
= sizeof(api_echo_cmds
) / sizeof(struct api_struct
);
137 NTSTATUS
rpc_echo_init(void)
139 return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION
,
140 "rpcecho", "rpcecho", api_echo_cmds
,
141 sizeof(api_echo_cmds
) / sizeof(struct api_struct
));
144 #else /* DEVELOPER */
146 NTSTATUS
rpc_echo_init(void)
150 #endif /* DEVELOPER */