15
CS 603 DCOM April 5, 2002

CS 603 DCOM April 5, 2002. DCOM – What is it? Start with COM – Component Object Model –Language-independent object interface Add interprocess communication

Embed Size (px)

Citation preview

Page 1: CS 603 DCOM April 5, 2002. DCOM – What is it? Start with COM – Component Object Model –Language-independent object interface Add interprocess communication

CS 603DCOM

April 5, 2002

Page 2: CS 603 DCOM April 5, 2002. DCOM – What is it? Start with COM – Component Object Model –Language-independent object interface Add interprocess communication

DCOM – What is it?

• Start with COM – Component Object Model– Language-independent object interface

• Add interprocess communication

Page 3: 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

Page 4: CS 603 DCOM April 5, 2002. DCOM – What is it? Start with COM – Component Object Model –Language-independent object interface Add interprocess communication

DCOM Architecture

Page 5: CS 603 DCOM April 5, 2002. DCOM – What is it? Start with COM – Component Object Model –Language-independent object interface Add interprocess communication

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

Page 6: CS 603 DCOM April 5, 2002. DCOM – What is it? Start with COM – Component Object Model –Language-independent object interface Add interprocess communication

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.

Page 7: CS 603 DCOM April 5, 2002. DCOM – What is it? Start with COM – Component Object Model –Language-independent object interface Add interprocess communication

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

Page 8: CS 603 DCOM April 5, 2002. DCOM – What is it? Start with COM – Component Object Model –Language-independent object interface Add interprocess communication

Moniker ExampleHRESULT 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();

}

Page 9: CS 603 DCOM April 5, 2002. DCOM – What is it? Start with COM – Component Object Model –Language-independent object interface Add interprocess communication

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

Page 10: CS 603 DCOM April 5, 2002. DCOM – What is it? Start with COM – Component Object Model –Language-independent object interface Add interprocess communication

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

Page 11: CS 603 DCOM April 5, 2002. DCOM – What is it? Start with COM – Component Object Model –Language-independent object interface Add interprocess communication

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

Page 12: CS 603 DCOM April 5, 2002. DCOM – What is it? Start with COM – Component Object Model –Language-independent object interface Add interprocess communication

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()

Page 13: CS 603 DCOM April 5, 2002. DCOM – What is it? Start with COM – Component Object Model –Language-independent object interface Add interprocess communication

Delegation

Page 14: CS 603 DCOM April 5, 2002. DCOM – What is it? Start with COM – Component Object Model –Language-independent object interface Add interprocess communication

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

Page 15: CS 603 DCOM April 5, 2002. DCOM – What is it? Start with COM – Component Object Model –Language-independent object interface Add interprocess communication

DCOM vs. CORBA

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