30e508d65ba5fa1add76e0f8e92988e883e0a4a8
[abartlet/samba.git/.git] / source4 / rpc_server / dcom / remact.c
1 /* 
2    Unix SMB/CIFS implementation.
3
4    endpoint server for the IRemoteActivation pipe
5
6    Copyright (C) Jelmer Vernooij 2004
7    
8    This program is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 2 of the License, or
11    (at your option) any later version.
12    
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17    
18    You should have received a copy of the GNU General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23 #include "includes.h"
24 #include "rpc_server/dcerpc_server.h"
25 #include "rpc_server/common/common.h"
26 #include "librpc/gen_ndr/ndr_remact.h"
27 #include "librpc/gen_ndr/ndr_oxidresolver.h"
28
29 struct dcom_interface_pointer *dcom_interface_pointer_by_ipid(struct GUID *ipid)
30 {
31         /* FIXME */
32         return NULL;
33 }
34
35 /* 
36   RemoteActivation 
37 */
38 static WERROR RemoteActivation(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct RemoteActivation *r)
39 {
40         struct CreateInstance *cr = NULL;
41         /*struct Release *ur;*/
42         struct dcom_interface_p *o = NULL;
43         int i;
44
45         /* FIXME: CoGetClassObject() */
46         /* FIXME: IClassFactory::CreateInstance() */
47         /* FIXME: IUnknown::Release() */
48         
49         ZERO_STRUCT(r->out);
50         r->out.ServerVersion.MajorVersion = COM_MAJOR_VERSION;
51         r->out.ServerVersion.MinorVersion = COM_MINOR_VERSION;
52
53         r->out.AuthnHint = DCERPC_AUTH_LEVEL_DEFAULT;
54         r->out.pdsaOxidBindings = dcom_server_generate_dual_string(mem_ctx, dce_call);
55         
56         /* FIXME: Loop thru given interfaces and set r->out.results and 
57          * r->out.interfaces */
58         r->out.ifaces = talloc_array_p(mem_ctx, struct pMInterfacePointer, r->in.Interfaces);
59         r->out.results = talloc_array_p(mem_ctx, WERROR, r->in.Interfaces);
60         r->out.hr = cr->out.result;
61
62         for (i = 0; i < r->in.Interfaces; i++) {
63                 struct QueryInterface rr;
64                 rr.in.iid = &r->in.pIIDs[i];
65                 dcom_IUnknown_QueryInterface(o, mem_ctx, &rr);
66                 ZERO_STRUCT(r->out.ifaces[i]);  
67                 r->out.results[i] = rr.out.result;
68         }
69
70         /* FIXME: */
71         r->out.pOxid = 0;
72         ZERO_STRUCT(r->out.ipidRemUnknown);
73         
74         return WERR_OK;
75 }
76
77
78 NTSTATUS dcerpc_server_dcom_init(void)
79 {
80         NTSTATUS status;
81         status = dcerpc_server_IOXIDResolver_init();
82         if (NT_STATUS_IS_ERR(status)) {
83                 return status;
84         }
85
86         status = dcerpc_server_IRemoteActivation_init();
87         if (NT_STATUS_IS_ERR(status)) {
88                 return status;
89         }
90
91         return NT_STATUS_OK;
92 }
93
94 /* include the generated boilerplate */
95 #include "librpc/gen_ndr/ndr_remact_s.c"