source: branches/samba-3.0/source/rpc_server/srv_ntsvcs.c

Last change on this file was 1, checked in by Paul Smedley, 18 years ago

Initial code import

File size: 6.4 KB
Line 
1/*
2 * Unix SMB/CIFS implementation.
3 * RPC Pipe client / server routines
4 * Copyright (C) Gerald Carter 2005.
5 *
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.
10 *
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.
15 *
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.
19 */
20
21#include "includes.h"
22
23#undef DBGC_CLASS
24#define DBGC_CLASS DBGC_RPC_SRV
25
26/*******************************************************************
27 ********************************************************************/
28
29static BOOL api_ntsvcs_get_version(pipes_struct *p)
30{
31 NTSVCS_Q_GET_VERSION q_u;
32 NTSVCS_R_GET_VERSION r_u;
33 prs_struct *data = &p->in_data.data;
34 prs_struct *rdata = &p->out_data.rdata;
35
36 ZERO_STRUCT(q_u);
37 ZERO_STRUCT(r_u);
38
39 if(!ntsvcs_io_q_get_version("", &q_u, data, 0))
40 return False;
41
42 r_u.status = _ntsvcs_get_version(p, &q_u, &r_u);
43
44 if(!ntsvcs_io_r_get_version("", &r_u, rdata, 0))
45 return False;
46
47 return True;
48}
49
50/*******************************************************************
51 ********************************************************************/
52
53static BOOL api_ntsvcs_get_device_list_size(pipes_struct *p)
54{
55 NTSVCS_Q_GET_DEVICE_LIST_SIZE q_u;
56 NTSVCS_R_GET_DEVICE_LIST_SIZE r_u;
57 prs_struct *data = &p->in_data.data;
58 prs_struct *rdata = &p->out_data.rdata;
59
60 ZERO_STRUCT(q_u);
61 ZERO_STRUCT(r_u);
62
63 if(!ntsvcs_io_q_get_device_list_size("", &q_u, data, 0))
64 return False;
65
66 r_u.status = _ntsvcs_get_device_list_size(p, &q_u, &r_u);
67
68 if(!ntsvcs_io_r_get_device_list_size("", &r_u, rdata, 0))
69 return False;
70
71 return True;
72}
73
74/*******************************************************************
75 ********************************************************************/
76
77static BOOL api_ntsvcs_get_device_list(pipes_struct *p)
78{
79 NTSVCS_Q_GET_DEVICE_LIST q_u;
80 NTSVCS_R_GET_DEVICE_LIST r_u;
81 prs_struct *data = &p->in_data.data;
82 prs_struct *rdata = &p->out_data.rdata;
83
84 ZERO_STRUCT(q_u);
85 ZERO_STRUCT(r_u);
86
87 if(!ntsvcs_io_q_get_device_list("", &q_u, data, 0))
88 return False;
89
90 r_u.status = _ntsvcs_get_device_list(p, &q_u, &r_u);
91
92 if(!ntsvcs_io_r_get_device_list("", &r_u, rdata, 0))
93 return False;
94
95 return True;
96}
97
98/*******************************************************************
99 ********************************************************************/
100
101static BOOL api_ntsvcs_validate_device_instance(pipes_struct *p)
102{
103 NTSVCS_Q_VALIDATE_DEVICE_INSTANCE q_u;
104 NTSVCS_R_VALIDATE_DEVICE_INSTANCE r_u;
105 prs_struct *data = &p->in_data.data;
106 prs_struct *rdata = &p->out_data.rdata;
107
108 ZERO_STRUCT(q_u);
109 ZERO_STRUCT(r_u);
110
111 if(!ntsvcs_io_q_validate_device_instance("", &q_u, data, 0))
112 return False;
113
114 r_u.status = _ntsvcs_validate_device_instance(p, &q_u, &r_u);
115
116 if(!ntsvcs_io_r_validate_device_instance("", &r_u, rdata, 0))
117 return False;
118
119 return True;
120}
121
122/*******************************************************************
123 ********************************************************************/
124
125static BOOL api_ntsvcs_get_device_reg_property(pipes_struct *p)
126{
127 NTSVCS_Q_GET_DEVICE_REG_PROPERTY q_u;
128 NTSVCS_R_GET_DEVICE_REG_PROPERTY r_u;
129 prs_struct *data = &p->in_data.data;
130 prs_struct *rdata = &p->out_data.rdata;
131
132 ZERO_STRUCT(q_u);
133 ZERO_STRUCT(r_u);
134
135 if(!ntsvcs_io_q_get_device_reg_property("", &q_u, data, 0))
136 return False;
137
138 r_u.status = _ntsvcs_get_device_reg_property(p, &q_u, &r_u);
139
140 if(!ntsvcs_io_r_get_device_reg_property("", &r_u, rdata, 0))
141 return False;
142
143 return True;
144}
145
146/*******************************************************************
147 ********************************************************************/
148
149static BOOL api_ntsvcs_get_hw_profile_info(pipes_struct *p)
150{
151 NTSVCS_Q_GET_HW_PROFILE_INFO q_u;
152 NTSVCS_R_GET_HW_PROFILE_INFO r_u;
153 prs_struct *data = &p->in_data.data;
154 prs_struct *rdata = &p->out_data.rdata;
155
156 ZERO_STRUCT(q_u);
157 ZERO_STRUCT(r_u);
158
159 if(!ntsvcs_io_q_get_hw_profile_info("", &q_u, data, 0))
160 return False;
161
162 r_u.status = _ntsvcs_get_hw_profile_info(p, &q_u, &r_u);
163
164 if(!ntsvcs_io_r_get_hw_profile_info("", &r_u, rdata, 0))
165 return False;
166
167 return True;
168}
169
170/*******************************************************************
171 ********************************************************************/
172
173static BOOL api_ntsvcs_hw_profile_flags(pipes_struct *p)
174{
175 NTSVCS_Q_HW_PROFILE_FLAGS q_u;
176 NTSVCS_R_HW_PROFILE_FLAGS r_u;
177 prs_struct *data = &p->in_data.data;
178 prs_struct *rdata = &p->out_data.rdata;
179
180 ZERO_STRUCT(q_u);
181 ZERO_STRUCT(r_u);
182
183 if(!ntsvcs_io_q_hw_profile_flags("", &q_u, data, 0))
184 return False;
185
186 r_u.status = _ntsvcs_hw_profile_flags(p, &q_u, &r_u);
187
188 if(!ntsvcs_io_r_hw_profile_flags("", &r_u, rdata, 0))
189 return False;
190
191 return True;
192}
193
194/*******************************************************************
195 \PIPE\svcctl commands
196 ********************************************************************/
197
198static struct api_struct api_ntsvcs_cmds[] =
199{
200 { "NTSVCS_GET_VERSION" , NTSVCS_GET_VERSION , api_ntsvcs_get_version },
201 { "NTSVCS_GET_DEVICE_LIST_SIZE" , NTSVCS_GET_DEVICE_LIST_SIZE , api_ntsvcs_get_device_list_size },
202 { "NTSVCS_GET_DEVICE_LIST" , NTSVCS_GET_DEVICE_LIST , api_ntsvcs_get_device_list },
203 { "NTSVCS_VALIDATE_DEVICE_INSTANCE" , NTSVCS_VALIDATE_DEVICE_INSTANCE , api_ntsvcs_validate_device_instance },
204 { "NTSVCS_GET_DEVICE_REG_PROPERTY" , NTSVCS_GET_DEVICE_REG_PROPERTY , api_ntsvcs_get_device_reg_property },
205 { "NTSVCS_GET_HW_PROFILE_INFO" , NTSVCS_GET_HW_PROFILE_INFO , api_ntsvcs_get_hw_profile_info },
206 { "NTSVCS_HW_PROFILE_FLAGS" , NTSVCS_HW_PROFILE_FLAGS , api_ntsvcs_hw_profile_flags }
207};
208
209
210void ntsvcs_get_pipe_fns( struct api_struct **fns, int *n_fns )
211{
212 *fns = api_ntsvcs_cmds;
213 *n_fns = sizeof(api_ntsvcs_cmds) / sizeof(struct api_struct);
214}
215
216NTSTATUS rpc_ntsvcs_init(void)
217{
218 return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "ntsvcs", "ntsvcs", api_ntsvcs_cmds,
219 sizeof(api_ntsvcs_cmds) / sizeof(struct api_struct));
220}
Note: See TracBrowser for help on using the repository browser.