r10909: Give better shutdown messages
[Samba/nascimento.git] / source3 / rpc_server / srv_dfs.c
blob42be7c5a35776d6cc8d31786f07eb00f25c5f36f
1 /*
2 * Unix SMB/CIFS implementation.
3 * RPC Pipe client / server routines for Dfs
4 * Copyright (C) Andrew Tridgell 1992-1997,
5 * Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
6 * Copyright (C) Shirish Kalele 2000,
7 * Copyright (C) Jeremy Allison 2001,
8 * Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2003.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 /* This is the interface to the dfs pipe. */
27 #include "includes.h"
28 #include "nterr.h"
30 #undef DBGC_CLASS
31 #define DBGC_CLASS DBGC_MSDFS
33 /**********************************************************************
34 api_dfs_exist
35 **********************************************************************/
37 static BOOL api_dfs_exist(pipes_struct *p)
39 DFS_Q_DFS_EXIST q_u;
40 DFS_R_DFS_EXIST r_u;
41 prs_struct *data = &p->in_data.data;
42 prs_struct *rdata = &p->out_data.rdata;
44 if(!dfs_io_q_dfs_exist("", &q_u, data, 0))
45 return False;
47 r_u.status = _dfs_exist(p, &q_u, &r_u);
49 if (!dfs_io_r_dfs_exist("", &r_u, rdata, 0))
50 return False;
52 return True;
55 /*****************************************************************
56 api_dfs_add
57 *****************************************************************/
59 static BOOL api_dfs_add(pipes_struct *p)
61 DFS_Q_DFS_ADD q_u;
62 DFS_R_DFS_ADD r_u;
63 prs_struct *data = &p->in_data.data;
64 prs_struct *rdata = &p->out_data.rdata;
66 ZERO_STRUCT(q_u);
67 ZERO_STRUCT(r_u);
69 if(!dfs_io_q_dfs_add("", &q_u, data, 0))
70 return False;
72 r_u.status = _dfs_add(p, &q_u, &r_u);
74 if (!dfs_io_r_dfs_add("", &r_u, rdata, 0))
75 return False;
77 return True;
80 /*****************************************************************
81 api_dfs_remove
82 *****************************************************************/
84 static BOOL api_dfs_remove(pipes_struct *p)
86 DFS_Q_DFS_REMOVE q_u;
87 DFS_R_DFS_REMOVE r_u;
88 prs_struct *data = &p->in_data.data;
89 prs_struct *rdata = &p->out_data.rdata;
91 ZERO_STRUCT(q_u);
92 ZERO_STRUCT(r_u);
94 if(!dfs_io_q_dfs_remove("", &q_u, data, 0))
95 return False;
97 r_u.status = _dfs_remove(p, &q_u, &r_u);
99 if (!dfs_io_r_dfs_remove("", &r_u, rdata, 0))
100 return False;
102 return True;
105 /*******************************************************************
106 api_dfs_get_info
107 *******************************************************************/
109 static BOOL api_dfs_get_info(pipes_struct *p)
111 DFS_Q_DFS_GET_INFO q_u;
112 DFS_R_DFS_GET_INFO r_u;
113 prs_struct *data = &p->in_data.data;
114 prs_struct *rdata = &p->out_data.rdata;
116 ZERO_STRUCT(q_u);
117 ZERO_STRUCT(r_u);
119 if(!dfs_io_q_dfs_get_info("", &q_u, data, 0))
120 return False;
122 r_u.status = _dfs_get_info(p, &q_u, &r_u);
124 if(!dfs_io_r_dfs_get_info("", &r_u, rdata, 0))
125 return False;
127 return True;
130 /*******************************************************************
131 api_dfs_enum
132 *******************************************************************/
134 static BOOL api_dfs_enum(pipes_struct *p)
136 DFS_Q_DFS_ENUM q_u;
137 DFS_R_DFS_ENUM r_u;
138 prs_struct *data = &p->in_data.data;
139 prs_struct *rdata = &p->out_data.rdata;
141 ZERO_STRUCT(q_u);
142 ZERO_STRUCT(r_u);
144 if(!dfs_io_q_dfs_enum("", &q_u, data, 0))
145 return False;
147 r_u.status = _dfs_enum(p, &q_u, &r_u);
149 if(!dfs_io_r_dfs_enum("", &r_u, rdata, 0))
150 return False;
152 return True;
155 /*******************************************************************
156 \pipe\netdfs commands
157 ********************************************************************/
158 static struct api_struct api_netdfs_cmds[] =
160 {"DFS_EXIST", DFS_EXIST, api_dfs_exist },
161 {"DFS_ADD", DFS_ADD, api_dfs_add },
162 {"DFS_REMOVE", DFS_REMOVE, api_dfs_remove },
163 {"DFS_GET_INFO", DFS_GET_INFO, api_dfs_get_info },
164 {"DFS_ENUM", DFS_ENUM, api_dfs_enum }
167 void netdfs_get_pipe_fns( struct api_struct **fns, int *n_fns )
169 *fns = api_netdfs_cmds;
170 *n_fns = sizeof(api_netdfs_cmds) / sizeof(struct api_struct);
173 NTSTATUS rpc_dfs_init(void)
175 return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "netdfs", "netdfs", api_netdfs_cmds,
176 sizeof(api_netdfs_cmds) / sizeof(struct api_struct));