rpc_server/srv_echo.c

説明を見る。
00001 /* 
00002  *  Unix SMB/CIFS implementation.
00003  *  RPC Pipe client / server routines for rpcecho
00004  *  Copyright (C) Tim Potter                   2003.
00005  *  
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *  
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *  
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019  */
00020 
00021 /* This is the interface to the rpcecho pipe. */
00022 
00023 #include "includes.h"
00024 #include "nterr.h"
00025 
00026 #ifdef DEVELOPER
00027 
00028 #undef DBGC_CLASS
00029 #define DBGC_CLASS DBGC_RPC_SRV
00030 
00031 static BOOL api_add_one(pipes_struct *p)
00032 {
00033         ECHO_Q_ADD_ONE q_u;
00034         ECHO_R_ADD_ONE r_u;
00035 
00036         prs_struct *data = &p->in_data.data;
00037         prs_struct *rdata = &p->out_data.rdata;
00038 
00039         ZERO_STRUCT(q_u);
00040         ZERO_STRUCT(r_u);
00041         
00042         if(!echo_io_q_add_one("", &q_u, data, 0))
00043                 return False;
00044         
00045         _echo_add_one(p, &q_u, &r_u);
00046         
00047         if(!echo_io_r_add_one("", &r_u, rdata, 0))
00048                 return False;
00049 
00050         return True;
00051 }
00052 
00053 static BOOL api_echo_data(pipes_struct *p)
00054 {
00055         ECHO_Q_ECHO_DATA q_u;
00056         ECHO_R_ECHO_DATA r_u;
00057 
00058         prs_struct *data = &p->in_data.data;
00059         prs_struct *rdata = &p->out_data.rdata;
00060 
00061         ZERO_STRUCT(q_u);
00062         ZERO_STRUCT(r_u);
00063         
00064         if(!echo_io_q_echo_data("", &q_u, data, 0))
00065                 return False;
00066         
00067         _echo_data(p, &q_u, &r_u);
00068         
00069         if(!echo_io_r_echo_data("", &r_u, rdata, 0))
00070                 return False;
00071 
00072         return True;
00073 }
00074 
00075 static BOOL api_source_data(pipes_struct *p)
00076 {
00077         ECHO_Q_SOURCE_DATA q_u;
00078         ECHO_R_SOURCE_DATA r_u;
00079 
00080         prs_struct *data = &p->in_data.data;
00081         prs_struct *rdata = &p->out_data.rdata;
00082 
00083         ZERO_STRUCT(q_u);
00084         ZERO_STRUCT(r_u);
00085         
00086         if(!echo_io_q_source_data("", &q_u, data, 0))
00087                 return False;
00088         
00089         _source_data(p, &q_u, &r_u);
00090         
00091         if(!echo_io_r_source_data("", &r_u, rdata, 0))
00092                 return False;
00093 
00094         return True;
00095 }
00096 
00097 static BOOL api_sink_data(pipes_struct *p)
00098 {
00099         ECHO_Q_SINK_DATA q_u;
00100         ECHO_R_SINK_DATA r_u;
00101 
00102         prs_struct *data = &p->in_data.data;
00103         prs_struct *rdata = &p->out_data.rdata;
00104 
00105         ZERO_STRUCT(q_u);
00106         ZERO_STRUCT(r_u);
00107         
00108         if(!echo_io_q_sink_data("", &q_u, data, 0))
00109                 return False;
00110         
00111         _sink_data(p, &q_u, &r_u);
00112         
00113         if(!echo_io_r_sink_data("", &r_u, rdata, 0))
00114                 return False;
00115 
00116         return True;
00117 }
00118 
00119 /*******************************************************************
00120 \pipe\rpcecho commands
00121 ********************************************************************/
00122 
00123 struct api_struct api_echo_cmds[] = {
00124         {"ADD_ONE",       ECHO_ADD_ONE,     api_add_one },
00125         {"ECHO_DATA",     ECHO_DATA,        api_echo_data },
00126         {"SOURCE_DATA",   ECHO_SOURCE_DATA, api_source_data },
00127         {"SINK_DATA",     ECHO_SINK_DATA,   api_sink_data },
00128 };
00129 
00130 
00131 void echo_get_pipe_fns( struct api_struct **fns, int *n_fns )
00132 {
00133         *fns = api_echo_cmds;
00134         *n_fns = sizeof(api_echo_cmds) / sizeof(struct api_struct);
00135 }
00136 
00137 NTSTATUS rpc_echo_init(void)
00138 {
00139         return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION,
00140                 "rpcecho", "rpcecho", api_echo_cmds,
00141                 sizeof(api_echo_cmds) / sizeof(struct api_struct));
00142 }
00143 
00144 #else /* DEVELOPER */
00145 
00146 NTSTATUS rpc_echo_init(void)
00147 {
00148         return NT_STATUS_OK;
00149 }
00150 #endif /* DEVELOPER */

Sambaに対してSat Aug 29 21:23:19 2009に生成されました。  doxygen 1.4.7