Download presentation
Presentation is loading. Please wait.
Published byTheodore Wilcox Modified over 9 years ago
1
CS 603 DCOM April 5, 2002
2
DCOM – What is it? Start with COM – Component Object Model –Language-independent object interface Add interprocess communication
3
DCOM: Distributed COM Looks like COM to the client Built on DCE RPC –Extends to support full COM functionality
4
DCOM Architecture
5
Locating Objects: Activation CoCreateInstance(Ex)( ) –Interface pointer to uninitialized instance –Same as COM CoiGetInstanceFromFile, FromStorage –Create new instance CoGetClassObject( ) –Factory object that creates objects of –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\{ }] "RemoteServerName"=" “ Also store information in ActiveDirectory
6
Example: Auction System Registry on Client: REGEDIT4 [HKEY_CLASSES_ROOT\CLSID\{ }] "AppID"="{ }" [HKEY_CLASSES_ROOT \APPID\{ }] "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.
7
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
8
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(); }
9
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
10
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
11
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
12
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()
13
Delegation
14
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
15
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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.