stéphane frenot - département télécommunication - sid - stephane.frenot@insa- lyon.fr ii - dcom...
TRANSCRIPT
![Page 1: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa- lyon.fr II - Dcom 295 De DCOM à.Net](https://reader036.vdocuments.fr/reader036/viewer/2022082502/551d9d8d497959293b8c2f2c/html5/thumbnails/1.jpg)
Stéphane Frenot - Département Télécommunication - SID - [email protected]
II - Dcom 1
De DCOM à .Net
![Page 2: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa- lyon.fr II - Dcom 295 De DCOM à.Net](https://reader036.vdocuments.fr/reader036/viewer/2022082502/551d9d8d497959293b8c2f2c/html5/thumbnails/2.jpg)
Stéphane Frenot - Département Télécommunication - SID - [email protected]
II - Dcom 2
DCOM : Solution microsoft
• Propriétaire– Intégrée avec d'autres produits Microsoft (architecture DNA :
Distributed Network Architecture)• COM
• ActiveX
• MTS
• MQS
– Fonctionne sur plusieurs plates-formes• NT/95
• Unix
![Page 3: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa- lyon.fr II - Dcom 295 De DCOM à.Net](https://reader036.vdocuments.fr/reader036/viewer/2022082502/551d9d8d497959293b8c2f2c/html5/thumbnails/3.jpg)
Stéphane Frenot - Département Télécommunication - SID - [email protected]
II - Dcom 3
Le document
• DDE : Dynamic Data Exchange– Service de transmission de messages pour faire communiquer
deux applications (1992)– Complexe uniquement implanté sur Excel
• OLE1 : Object Linking & Embedding– Repose sur DDE– Copier/coller
• OLE2 (1993)– Activation In-Situ
![Page 4: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa- lyon.fr II - Dcom 295 De DCOM à.Net](https://reader036.vdocuments.fr/reader036/viewer/2022082502/551d9d8d497959293b8c2f2c/html5/thumbnails/4.jpg)
Stéphane Frenot - Département Télécommunication - SID - [email protected]
II - Dcom 4
DCOM : Motivations
• Développement et évolution d'applications réparties sur des machines hétérogènes– Mécanismes "transparents" d'appel à distance
• Réutilisation de code– Réutilisation de composants binaires exécutables
• Pas d'accès au code source• Association d'interfaces multiple à un composant binaire
– Mécanisme de composition• Construction de composants à partir de composants existants
• Evolution dynamique– Remplacement de composants (sans recompilation ou édition de liens)
– Association de nouvelles interfaces
– Capacité d'auto-description
![Page 5: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa- lyon.fr II - Dcom 295 De DCOM à.Net](https://reader036.vdocuments.fr/reader036/viewer/2022082502/551d9d8d497959293b8c2f2c/html5/thumbnails/5.jpg)
Stéphane Frenot - Département Télécommunication - SID - [email protected]
II - Dcom 5
DCOM: Distributed Component Object Model
• DCE : Architecture distribuée
• COM (Component Object Model) le modèle d'objet composant (1996)
• Active-X: élément graphique actif que l'on peut assembler ou inclure
dans des documents
• DCOM: utilisation d’un modèle RPC de DCE pour les communications
entre objets (1997)
• (Ms)IDL: langage de définition d'interfaces
• .net / DNA / Hailstorm
![Page 6: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa- lyon.fr II - Dcom 295 De DCOM à.Net](https://reader036.vdocuments.fr/reader036/viewer/2022082502/551d9d8d497959293b8c2f2c/html5/thumbnails/6.jpg)
Stéphane Frenot - Département Télécommunication - SID - [email protected]
II - Dcom 6
COM
• Approche binaire des objets
• Un objet COM :– publie une et une série d'interfaces
– possède au moins une interface IUnknown• qui possède une méthode QueryInterface
• qui possède des méthode de gestion du cycle de vie (Addref(), Release())
– chaque interface présente un GUID
• 3 familles de composants– in-process, local, distant
![Page 7: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa- lyon.fr II - Dcom 295 De DCOM à.Net](https://reader036.vdocuments.fr/reader036/viewer/2022082502/551d9d8d497959293b8c2f2c/html5/thumbnails/7.jpg)
Stéphane Frenot - Département Télécommunication - SID - [email protected]
II - Dcom 7
COM est une fondation simple
• Instanciation / Publication• Appels RPC• Contrôle de fonctionnement mémoire
+• Nommage (moniker)• Stockage persistant• Transfert uniforme de données (flux)• Automation
![Page 8: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa- lyon.fr II - Dcom 295 De DCOM à.Net](https://reader036.vdocuments.fr/reader036/viewer/2022082502/551d9d8d497959293b8c2f2c/html5/thumbnails/8.jpg)
Stéphane Frenot - Département Télécommunication - SID - [email protected]
II - Dcom 8
La bibliothèque COM
• Elle fournit une API pour la gestion des composants– Initialisation et terminaison– Allocation et libération de la mémoire– Génération des GUID (identificateurs uniques)– Accès à la base de registres (GUID <--> Noms)– Création des composants– Enregistrement des fabriques de classes– Bibliothèque pour emballage et déballage des paramètres
![Page 9: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa- lyon.fr II - Dcom 295 De DCOM à.Net](https://reader036.vdocuments.fr/reader036/viewer/2022082502/551d9d8d497959293b8c2f2c/html5/thumbnails/9.jpg)
Stéphane Frenot - Département Télécommunication - SID - [email protected]
II - Dcom 9
La base de registre
• Base de donées permettant d'associer noms et GUID– CLSID -> Nom de fichier contenant le code d'implantation
• {0003DF…098} --> C:\ProgramFiles\Internet\iexplore.exe
– Nom familier(Progid)-->CLSID• Explorer.Appli_2-->{0003DF…098}
• Autres fonctions de désignation et recherche– Informations sur configuration, usagers, etc…– Informations utiles pour la répartition (cf. DCOM)
![Page 10: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa- lyon.fr II - Dcom 295 De DCOM à.Net](https://reader036.vdocuments.fr/reader036/viewer/2022082502/551d9d8d497959293b8c2f2c/html5/thumbnails/10.jpg)
Stéphane Frenot - Département Télécommunication - SID - [email protected]
II - Dcom 10
COM, ActiveX et OLE
Documents
Contrôles
Mise en script
Activation in situ
Liaison
Incorporation
Glisserrelâcher
Transfert uniformede données
Stockage persistant
Monikers
Automation
Modèle d'objet composant
COM
ActiveX
OLE
Documentscomposites
![Page 11: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa- lyon.fr II - Dcom 295 De DCOM à.Net](https://reader036.vdocuments.fr/reader036/viewer/2022082502/551d9d8d497959293b8c2f2c/html5/thumbnails/11.jpg)
Stéphane Frenot - Département Télécommunication - SID - [email protected]
II - Dcom 11
DCOM
ApplicationCliente
Proxy objetCOM distant
Proxy objetCOM local
SoucheCOM
ComposantCOM
SoucheCOM
ComposantCOM
Exécutable COM
Composant
Sécurité
DCERPC
Protocole de comm
CLIENT SERVEUR
Processus Client
Processus serveur
![Page 12: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa- lyon.fr II - Dcom 295 De DCOM à.Net](https://reader036.vdocuments.fr/reader036/viewer/2022082502/551d9d8d497959293b8c2f2c/html5/thumbnails/12.jpg)
Stéphane Frenot - Département Télécommunication - SID - [email protected]
II - Dcom 12
CInsideDCOM
•AddRef
•Release
•QueryInterface
•Sum
Cfactory
ISum
IClassFactory
IUnknown
Sum
CreateInstanceLockServer
AddRefReleaseQueryInterface
![Page 13: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa- lyon.fr II - Dcom 295 De DCOM à.Net](https://reader036.vdocuments.fr/reader036/viewer/2022082502/551d9d8d497959293b8c2f2c/html5/thumbnails/13.jpg)
Stéphane Frenot - Département Télécommunication - SID - [email protected]
II - Dcom 13
Exemple de code
import "unknwn.idl";
[object, uuid(10000001-0000-0000-0000-000000000001]
interface Isum:Iunknown{
HRESULT Sum([in] int x, [in] int y, [out, retval]int * retval);
};
![Page 14: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa- lyon.fr II - Dcom 295 De DCOM à.Net](https://reader036.vdocuments.fr/reader036/viewer/2022082502/551d9d8d497959293b8c2f2c/html5/thumbnails/14.jpg)
Stéphane Frenot - Département Télécommunication - SID - [email protected]
II - Dcom 14
Les étapes d'appel d'un service
• 1) Créer un composant (CLSID)
• 2) Obtenir un pointeur d'interface (IID)
• 3) Appel d'une méthode – fonction de l'interface
• 4) Terminer– Gestion de la mémoire
![Page 15: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa- lyon.fr II - Dcom 295 De DCOM à.Net](https://reader036.vdocuments.fr/reader036/viewer/2022082502/551d9d8d497959293b8c2f2c/html5/thumbnails/15.jpg)
Stéphane Frenot - Département Télécommunication - SID - [email protected]
II - Dcom 15
Exemple de code client
void main(){ Iunknown * pUnknown; Isum * pISum; HRESULT hr=CoInitialize(NULL); if(FAILED(hr)) cout << "CoInitialize failed."<<endl; const CLSID CLSID_InsideDCOM= {0x10000002,0x0000,0x0000,{0x00,0x00,0x00, 0x00,0x00,0x00,0x01}}; /*1*/ hr=CoCreateInstance(CLSID_InsideDCOM, NULL, CLSCTX_INPROC_SERVER, IID_Iunknown, (void**)&pUnknown); if (FAILED(hr)) cout << "CoCreateInstance failed."<<endl; /*2*/ hr=pUnknown->QueryInterface(IID_Isum, (void**)&pSum); if (FAILED(hr)) cout << "IID_Isum not supported."<<endl; pUnknown->Released(); int sum; /*3*/ hr=pSum->Sum(2,3,&sum); if(SUCCEED(hr)) cout << "Client: Calling Sum(2,3)= » << sum << endl; /*4*/ pSum->Released(); CoUninitialize();}
![Page 16: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa- lyon.fr II - Dcom 295 De DCOM à.Net](https://reader036.vdocuments.fr/reader036/viewer/2022082502/551d9d8d497959293b8c2f2c/html5/thumbnails/16.jpg)
Stéphane Frenot - Département Télécommunication - SID - [email protected]
II - Dcom 16
Conclusion sur DCOM
• Produit "propriétaire"– Lié à l'environnent Microsoft
• Environnement de développement spécifique (Visual…)
• Intégration aux autres outils– Office, Serveur Web IIS, IE, etc…
• Interconnexion possible sur CORBA
– Outil puissant, mais concepts difficiles à appréhender• Spécifications opaques
• Héritage d'OLE
– Nombreux composants diffusés• Windows / VB ...
![Page 17: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa- lyon.fr II - Dcom 295 De DCOM à.Net](https://reader036.vdocuments.fr/reader036/viewer/2022082502/551d9d8d497959293b8c2f2c/html5/thumbnails/17.jpg)
Stéphane Frenot - Département Télécommunication - SID - [email protected]
II - Dcom 17
Références
• G. Eddon, H. Eddon, Au cœur de Distributed COM, Microsoft Press France, 1998
• R. Grimes, Professional DCOM Programming, Wrox Press, Canada, 1997
• Pointeurs– Microsoft
– http://www.sente.ch/cetus/OO_ole.html
– http://research.microsoft.com/~ymwang/papers/HTML/DCOMnCORBA/S.html
– http://www.execpc.com/~gopalan/misc/compare.html