150 likes | 581 Views
CS 603 DCOM. April 5, 2002. DCOM – What is it?. Start with COM – Component Object Model Language-independent object interface Add interprocess communication. DCOM: Distributed COM. Looks like COM to the client Built on DCE RPC Extends to support full COM functionality. DCOM Architecture.
E N D
CS 603DCOM April 5, 2002
DCOM – What is it? • Start with COM – Component Object Model • Language-independent object interface • Add interprocess communication
DCOM:Distributed COM • Looks like COM to the client • Built on DCE RPC • Extends to support full COM functionality
Locating Objects:Activation • CoCreateInstance(Ex)(<CLSID>) • Interface pointer to uninitialized instance • Same as COM • CoiGetInstanceFromFile, FromStorage • Create new instance • CoGetClassObject(<CLSID>) • Factory object that creates objects of <CLSID> • CoGetClassObjectFromURL • Downloads necessary code from URL and instantiates • Can take server name as parameter • Or default to server specified in DCOM configuration on client machine [HKEY_CLASSES_ROOT\APPID\{<appid-guid>}] "RemoteServerName"="<DNS name>“ • Also store information in ActiveDirectory
Example: Auction System • Registry on Client: REGEDIT4 [HKEY_CLASSES_ROOT\CLSID\{<CLSID_AuctionServer>}] "AppID"="{<APPID_AuctionServer>}" [HKEY_CLASSES_ROOT \APPID\{<APPID_AuctionServer>}] "RemoteServerName"="auctions.r.us.com" ; Note: APPID_AuctionServer can have the same value as CLSID_AuctionServer. • Client Code: IAuction Auction = new AuctionService; // Uses generated AuctionService.class file. Auction.PlaceBid(1324, 100000.00); // Auction object gets garbage collected.
Naming: Monikers • Above examples name classes • What if you want a specific instance? • One option: Each instance at a separate machine • Better: Monikers • Naming object with standard IMoniker interface • Object creates Moniker and registers it with libraries • Monikers have URL as human-readable version
Moniker Example HRESULT hr=S_OK; IBindCtx* pBC=NULL; hr=CreateBindCtx(NULL, &pBC); if (SUCCEEDED(hr)) { DWORD dwEaten; IMoniker* pMoniker=NULL; // Create the moniker object. hr=MkParseDisplayName(pBC, L"file:\\\\dtwmkt\\mkt\\productx1\\salesQ496.xyz!Summary", &dwEaten, &pMoniker); if (SUCCEEDED(hr)) { // Connect, create and initialize if necessary. hr=pMoniker->BindToObject(pBC, NULL, IID_ISalesInfo, &pSales); if (SUCCEEDED(hr)) { // Perform the operation. pSales->Add( 1.1, "http://www/mkt/productx/budget.xyz") pSales->Release(); } pMoniker->Release(); } pBC->Release(); }
Invocation • Marshaling and unmarshaling • Built on top of DCE RPC standard • All parameters defined with IDL • Uses Interface ID to look up stubs / code for class in Registry • DCE extension: Interface Pointers • Pointer to proxy object • Allows callee to invoke parameter • Call returns to source
Additional Issues • Garbage Collection • Reference count on distributed objects • Addref and Release called explicitly • Ping / timeout to handle client failure • Referrals • Interface pointer refers to handling machine • Passing interface pointer “removes” intermediate machine from call
DCOM Security • Access security • Who can call an object? • Launch security • Who can create a new object? • Identity • Who is responsible for an object? • Connection Policy • Integrity • Privacy • Authentication
DCOM Security • Servers/clients can customize security • CoInitializeSecurity API • Starts with default • Access security • COM-provided checks • User-specified checks using COM authentication/etc. • IServerSecurity, IClientSecurity interfaces • Kerberos for delegation • Proxy tickets allow delegation of specific authorities • Also full delegation IServerSecurity::ImpersonateClient()
Threads (Apartments) • Single Threaded • Call blocks • Single Thread apartment • One thread per instance • Multi-Threaded Apartment • Multiple threads in an instance • Combine both • Allows call from single and multi-threaded
CORBA Single interface name Multiple inheritance Dynamic Invocation Interface C++-style Exception Handling Explicit and Implicit reference counts Implemented by ORB with replaceable services DCOM Distinction between Class and Instance Identifier Implement multiple interfaces Type libraries for on-demand marshaling 32 Bit Error Code Explicit reference count only Implemented by many independent services DCOM vs. CORBA