rpc_server/srv_ntsvcs.c

説明を見る。
00001 /* 
00002  *  Unix SMB/CIFS implementation.
00003  *  RPC Pipe client / server routines
00004  *  Copyright (C) Gerald Carter                   2005.
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 #include "includes.h"
00022 
00023 #undef DBGC_CLASS
00024 #define DBGC_CLASS DBGC_RPC_SRV
00025 
00026 /*******************************************************************
00027  ********************************************************************/
00028 
00029 static BOOL api_ntsvcs_get_version(pipes_struct *p)
00030 {
00031         NTSVCS_Q_GET_VERSION q_u;
00032         NTSVCS_R_GET_VERSION r_u;
00033         prs_struct *data = &p->in_data.data;
00034         prs_struct *rdata = &p->out_data.rdata;
00035 
00036         ZERO_STRUCT(q_u);
00037         ZERO_STRUCT(r_u);
00038 
00039         if(!ntsvcs_io_q_get_version("", &q_u, data, 0))
00040                 return False;
00041 
00042         r_u.status = _ntsvcs_get_version(p, &q_u, &r_u);
00043 
00044         if(!ntsvcs_io_r_get_version("", &r_u, rdata, 0))
00045                 return False;
00046 
00047         return True;
00048 }
00049 
00050 /*******************************************************************
00051  ********************************************************************/
00052 
00053 static BOOL api_ntsvcs_get_device_list_size(pipes_struct *p)
00054 {
00055         NTSVCS_Q_GET_DEVICE_LIST_SIZE q_u;
00056         NTSVCS_R_GET_DEVICE_LIST_SIZE r_u;
00057         prs_struct *data = &p->in_data.data;
00058         prs_struct *rdata = &p->out_data.rdata;
00059 
00060         ZERO_STRUCT(q_u);
00061         ZERO_STRUCT(r_u);
00062 
00063         if(!ntsvcs_io_q_get_device_list_size("", &q_u, data, 0))
00064                 return False;
00065 
00066         r_u.status = _ntsvcs_get_device_list_size(p, &q_u, &r_u);
00067 
00068         if(!ntsvcs_io_r_get_device_list_size("", &r_u, rdata, 0))
00069                 return False;
00070 
00071         return True;
00072 }
00073 
00074 /*******************************************************************
00075  ********************************************************************/
00076 
00077 static BOOL api_ntsvcs_get_device_list(pipes_struct *p)
00078 {
00079         NTSVCS_Q_GET_DEVICE_LIST q_u;
00080         NTSVCS_R_GET_DEVICE_LIST r_u;
00081         prs_struct *data = &p->in_data.data;
00082         prs_struct *rdata = &p->out_data.rdata;
00083 
00084         ZERO_STRUCT(q_u);
00085         ZERO_STRUCT(r_u);
00086 
00087         if(!ntsvcs_io_q_get_device_list("", &q_u, data, 0))
00088                 return False;
00089 
00090         r_u.status = _ntsvcs_get_device_list(p, &q_u, &r_u);
00091 
00092         if(!ntsvcs_io_r_get_device_list("", &r_u, rdata, 0))
00093                 return False;
00094 
00095         return True;
00096 }
00097 
00098 /*******************************************************************
00099  ********************************************************************/
00100 
00101 static BOOL api_ntsvcs_validate_device_instance(pipes_struct *p)
00102 {
00103         NTSVCS_Q_VALIDATE_DEVICE_INSTANCE q_u;
00104         NTSVCS_R_VALIDATE_DEVICE_INSTANCE r_u;
00105         prs_struct *data = &p->in_data.data;
00106         prs_struct *rdata = &p->out_data.rdata;
00107 
00108         ZERO_STRUCT(q_u);
00109         ZERO_STRUCT(r_u);
00110 
00111         if(!ntsvcs_io_q_validate_device_instance("", &q_u, data, 0))
00112                 return False;
00113 
00114         r_u.status = _ntsvcs_validate_device_instance(p, &q_u, &r_u);
00115 
00116         if(!ntsvcs_io_r_validate_device_instance("", &r_u, rdata, 0))
00117                 return False;
00118 
00119         return True;
00120 }
00121 
00122 /*******************************************************************
00123  ********************************************************************/
00124 
00125 static BOOL api_ntsvcs_get_device_reg_property(pipes_struct *p)
00126 {
00127         NTSVCS_Q_GET_DEVICE_REG_PROPERTY q_u;
00128         NTSVCS_R_GET_DEVICE_REG_PROPERTY r_u;
00129         prs_struct *data = &p->in_data.data;
00130         prs_struct *rdata = &p->out_data.rdata;
00131 
00132         ZERO_STRUCT(q_u);
00133         ZERO_STRUCT(r_u);
00134 
00135         if(!ntsvcs_io_q_get_device_reg_property("", &q_u, data, 0))
00136                 return False;
00137 
00138         r_u.status = _ntsvcs_get_device_reg_property(p, &q_u, &r_u);
00139 
00140         if(!ntsvcs_io_r_get_device_reg_property("", &r_u, rdata, 0))
00141                 return False;
00142 
00143         return True;
00144 }
00145 
00146 /*******************************************************************
00147  ********************************************************************/
00148 
00149 static BOOL api_ntsvcs_get_hw_profile_info(pipes_struct *p)
00150 {
00151         NTSVCS_Q_GET_HW_PROFILE_INFO q_u;
00152         NTSVCS_R_GET_HW_PROFILE_INFO r_u;
00153         prs_struct *data = &p->in_data.data;
00154         prs_struct *rdata = &p->out_data.rdata;
00155 
00156         ZERO_STRUCT(q_u);
00157         ZERO_STRUCT(r_u);
00158 
00159         if(!ntsvcs_io_q_get_hw_profile_info("", &q_u, data, 0))
00160                 return False;
00161 
00162         r_u.status = _ntsvcs_get_hw_profile_info(p, &q_u, &r_u);
00163 
00164         if(!ntsvcs_io_r_get_hw_profile_info("", &r_u, rdata, 0))
00165                 return False;
00166 
00167         return True;
00168 }
00169 
00170 /*******************************************************************
00171  ********************************************************************/
00172 
00173 static BOOL api_ntsvcs_hw_profile_flags(pipes_struct *p)
00174 {
00175         NTSVCS_Q_HW_PROFILE_FLAGS q_u;
00176         NTSVCS_R_HW_PROFILE_FLAGS r_u;
00177         prs_struct *data = &p->in_data.data;
00178         prs_struct *rdata = &p->out_data.rdata;
00179 
00180         ZERO_STRUCT(q_u);
00181         ZERO_STRUCT(r_u);
00182 
00183         if(!ntsvcs_io_q_hw_profile_flags("", &q_u, data, 0))
00184                 return False;
00185 
00186         r_u.status = _ntsvcs_hw_profile_flags(p, &q_u, &r_u);
00187 
00188         if(!ntsvcs_io_r_hw_profile_flags("", &r_u, rdata, 0))
00189                 return False;
00190 
00191         return True;
00192 }
00193 
00194 /*******************************************************************
00195  \PIPE\svcctl commands
00196  ********************************************************************/
00197 
00198 static struct api_struct api_ntsvcs_cmds[] =
00199 {
00200       { "NTSVCS_GET_VERSION"              , NTSVCS_GET_VERSION              , api_ntsvcs_get_version },
00201       { "NTSVCS_GET_DEVICE_LIST_SIZE"     , NTSVCS_GET_DEVICE_LIST_SIZE     , api_ntsvcs_get_device_list_size },
00202       { "NTSVCS_GET_DEVICE_LIST"          , NTSVCS_GET_DEVICE_LIST          , api_ntsvcs_get_device_list },
00203       { "NTSVCS_VALIDATE_DEVICE_INSTANCE" , NTSVCS_VALIDATE_DEVICE_INSTANCE , api_ntsvcs_validate_device_instance },
00204       { "NTSVCS_GET_DEVICE_REG_PROPERTY"  , NTSVCS_GET_DEVICE_REG_PROPERTY  , api_ntsvcs_get_device_reg_property },
00205       { "NTSVCS_GET_HW_PROFILE_INFO"      , NTSVCS_GET_HW_PROFILE_INFO      , api_ntsvcs_get_hw_profile_info },
00206       { "NTSVCS_HW_PROFILE_FLAGS"         , NTSVCS_HW_PROFILE_FLAGS         , api_ntsvcs_hw_profile_flags }
00207 };
00208 
00209 
00210 void ntsvcs_get_pipe_fns( struct api_struct **fns, int *n_fns )
00211 {
00212         *fns = api_ntsvcs_cmds;
00213         *n_fns = sizeof(api_ntsvcs_cmds) / sizeof(struct api_struct);
00214 }
00215 
00216 NTSTATUS rpc_ntsvcs_init(void)
00217 {
00218   return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "ntsvcs", "ntsvcs", api_ntsvcs_cmds,
00219                                     sizeof(api_ntsvcs_cmds) / sizeof(struct api_struct));
00220 }

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