Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:docs:tk:som:interg [2024/12/22 16:50] – prokushev | en:docs:tk:som:interg [2024/12/24 16:37] (current) – prokushev | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Introduction ====== | ====== Introduction ====== | ||
- | somFree supports DSOM technology to produce distributed system. At the present time, somFree confirms CORBA 1.1 C language mapping as published in CORBA 1.1 Specification and IIOP 1.1 as published in CORBA/IIOP Specification ???. This mean you can write client and server application which will interoperable with ORB's which confirm at least IIOP Specification. This document describes practical approaches of interoperability with some know ORBs. | + | somFree supports DSOM technology to produce distributed system. At the present time, somFree confirms CORBA 1.1 C language mapping as published in CORBA 1.1 Specification and IIOP 1.1 as published in CORBA Specification ??? (link here...). This mean you can write client and server application which will interoperable with ORB's which confirm at least CORBA Specification. This document describes practical approaches of interoperability with some known ORBs. |
- | As example base, ORBit2 ORBit Beginners Documentation V1.2 (orbit-docs.tar.gz) was chosen. First, we will create a simple IDL file, compile it and write somFree client which will communicate to corresponding server. | + | As example base, ORBit2 ORBit Beginners Documentation V1.2 (orbit-docs.tar.gz |
====== Defining IDL ====== | ====== Defining IDL ====== | ||
Line 62: | Line 62: | ||
Compiler will produce echo.h, echo.ih files. | Compiler will produce echo.h, echo.ih files. | ||
- | Now, to make DSOM happy and success creation of Echo proxy object, we need to make empty class implementation. In IBM SOM it is enough to create implementation template and compile it. But somFree | + | Now, to make DSOM happy and success creation of Echo proxy object, we need to make empty class implementation. In IBM SOM it is enough to create |
<code c> | <code c> | ||
Line 169: | Line 169: | ||
echo_client = ORB_string_to_object(SOMD_ORBObject, | echo_client = ORB_string_to_object(SOMD_ORBObject, | ||
- | somPrintf(" | ||
abort_if_exception(& | abort_if_exception(& | ||
Line 206: | Line 205: | ||
</ | </ | ||
- | As you see, here just downgraded code to CORBA 1.1 C Language mapping from CORBA 2.x C Language mapping. ORB initialization and finalization replaced by DSOM initialization and finalization. And, this is matter, EchoNew() call added to create Echo class to make it known to DSOM. Now you can compile it and all mostly ready. | + | As you see, here just downgraded code to CORBA 1.1 C Language mapping from CORBA 2.x C Language mapping. ORB initialization and finalization replaced by DSOM initialization and finalization. And, this is matter, EchoNew() call added to create Echo class to make it known to DSOM. Also add SOMSTAR to object variables. Now you can compile it and all mostly ready. |
Now you have SOM client with stub class implementation and interface registered in interface repository. You are ready now. | Now you have SOM client with stub class implementation and interface registered in interface repository. You are ready now. | ||
- | ====== ORBit2 ====== | + | ====== ORBit2 |
- | somFree was tested with the latest available ORBit2 implementation (version 2.14.19). ORBit2 shipped as packages on various operational systems, including various Linux distributions, | + | somFree was tested with the latest available ORBit2 implementation (version 2.14.19). ORBit2 shipped as packages on various operational systems, including various Linux distributions, |
- | Now configure ORBit2 to communicate using IPv4 protocol and disable (optional) ORBit2-specific options. Edit or create / | + | Now configure ORBit2 to communicate using IPv4 protocol and disable (optional) ORBit2-specific options. Edit or create / |
< | < | ||
ORBIIOPIPv4=1 | ORBIIOPIPv4=1 | ||
- | ORBIIOPIPSock=16000 | + | ORBIIOPIPSock=16000 |
ORBIIOPIPName=127.0.0.1 | ORBIIOPIPName=127.0.0.1 | ||
ORBIIOPIPv6=0 | ORBIIOPIPv6=0 | ||
- | ORBLocalOnly=1 | + | ORBLocalOnly=1 |
ORBIIOPUNIX=0 | ORBIIOPUNIX=0 | ||
</ | </ | ||
Line 233: | Line 232: | ||
</ | </ | ||
- | It will produce | + | It will produce: |
* echo.h | * echo.h | ||
Line 241: | Line 240: | ||
* echo-skelimpl.c | * echo-skelimpl.c | ||
- | Some of them not required because it is client implementation. Now compile echo-server.c with echo-common.c and echo-skels.c. Provided Makefile not well works with cygwin, but can be changed easily. Here is our version of Makefile for cygwin: | + | Some of them not required because it is client implementation. Now compile echo-server.c with echo-common.c and echo-skels.c. Provided Makefile not well works with cygwin, but can be changed easily. Here is our version of Makefile for cygwin |
<code makefile> | <code makefile> | ||
Line 268: | Line 267: | ||
Now your server is ready. Execute echo-server and you will have console with waiting echo. To make client know about Echo server copy generated echo.ior to client directory. | Now your server is ready. Execute echo-server and you will have console with waiting echo. To make client know about Echo server copy generated echo.ior to client directory. | ||
+ | |||
+ | ====== omniORB 4.3.2 ====== | ||
+ | |||
+ | Another ORB for testing is a omniORB 4.3.2. Unlike ORBit2 it still maintained and new versions published at 2024 year. So, it was also chosen for testing. It comes in source code so you need to build it. Build process described well, works with cygwin and VS2022. Only required fix is in mk\python.mk is to set line as bellow: | ||
+ | |||
+ | < | ||
+ | PYVERSION := $(shell $(PYTHON) -c ' | ||
+ | </ | ||
+ | |||
+ | We have tested it with Python 2.7 but newer versions also must work good. omniORB also contains echo example, but slightly differ. echoString method returns string back. So, echo.idl was replaced to one from ORBit2 and server skeleton was changed (add sources here). | ||
+ | |||
+ | Same somFree client was executed and all works just fine. IOR file not stored in echo.ior but output to console. So IOR was replaced by this one. somFree client sucessfully connected and works as expected. omniORB is a C++ ORB. | ||
====== Executing somFree client ====== | ====== Executing somFree client ====== | ||
Line 281: | Line 292: | ||
< | < | ||
- | Hello from osFree! | + | Hello from somFree! |
. | . | ||
</ | </ | ||
Line 288: | Line 299: | ||
< | < | ||
- | Hello from osFree! | + | Hello from somFree! |
</ | </ | ||
Line 297: | Line 308: | ||
</ | </ | ||
- | So you will see after compiling, linking and excution: | + | So you will see after compiling, linking and execution: |
< | < | ||
Line 306: | Line 317: | ||
object_key 0000000048a4ca0b334633e33a2115ee1080a940010000008a6ea430 | object_key 0000000048a4ca0b334633e33a2115ee1080a940010000008a6ea430 | ||
} | } | ||
+ | </ | ||
+ | |||
+ | All source code can be found here (cleanup and publish code) | ||
+ | |||
+ | ====== somFree server implementation ====== | ||
+ | |||
+ | (Implement server first, then write chapter) | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | (omniORB and TAX also must be tested as most available OSS. May be some other ORBs?) | ||
+ | |||
+ | ====== C Language Mapping differences ====== | ||
+ | |||
+ | somFree uses CORBA 1.1 C Language Mappings. Most of CORBA compatible ORBs uses later specifications, | ||
+ | |||
+ | - All CORBA base types now prefixed by CORBA_ prefix | ||
+ | - All items from module CORBA prefixed by CORBA_ prefix (as well as other items from other modules also must be prefixed) | ||
+ | - Environment and Context moved to last function arguments | ||
+ | |||
+ | So, to simplify migration from CORBA 2.0+ mapping to CORBA 1.1 mapping follow include file (not finished yes, contains only some conversions) can be used: | ||
+ | |||
+ | <code c> | ||
+ | /* | ||
+ | | ||
+ | */ | ||
+ | |||
+ | #ifndef CORBA_Environment | ||
+ | #define CORBA_Environment Environment | ||
+ | #endif | ||
+ | |||
+ | #define CORBA_exception_init(ev) SOM_InitEnvironment(ev) | ||
+ | |||
+ | #ifndef CORBA_ORB | ||
+ | #define CORBA_ORB ORB | ||
+ | #endif | ||
+ | |||
+ | #ifndef CORBA_ORB_init | ||
+ | CORBA_ORB SOMSTAR CORBA_ORB_init ( int * argc, char ** argv, char * orb_id, CORBA_Environment * env); | ||
+ | |||
+ | CORBA_ORB SOMSTAR CORBA_ORB_init ( int * argc, char ** argv, char * orb_id, CORBA_Environment * env) | ||
+ | { | ||
+ | SOMD_Init(env); | ||
+ | return SOMD_ORBObject; | ||
+ | } | ||
+ | #endif | ||
+ | |||
+ | #ifndef CORBA_ORB_destroy | ||
+ | #define CORBA_ORB_destroy(orb, | ||
+ | #endif | ||
+ | |||
+ | #ifndef CORBA_OBJECT_NIL | ||
+ | #define CORBA_OBJECT_NIL NULL | ||
+ | #endif | ||
+ | |||
+ | #ifndef CORBA_NO_EXCEPTION | ||
+ | #define CORBA_NO_EXCEPTION NO_EXCEPTION | ||
+ | #endif | ||
+ | |||
+ | #ifndef CORBA_exception_id | ||
+ | #define CORBA_exception_id(ev) somExceptionId(ev) | ||
+ | #endif | ||
+ | |||
+ | #ifndef CORBA_exception_free | ||
+ | #define CORBA_exception_free(ev) somExceptionFree(ev) | ||
+ | #endif | ||
+ | |||
+ | #ifndef CORBA_ORB_string_to_object | ||
+ | #define CORBA_ORB_string_to_object ORB_string_to_object | ||
+ | #endif | ||
+ | |||
+ | #ifndef CORBA_Object_release | ||
+ | #define CORBA_Object_release SOMDObject_release | ||
+ | #endif | ||
+ | |||
+ | #ifndef CORBA_double | ||
+ | #define CORBA_double double | ||
+ | #endif | ||
+ | |||
+ | #ifndef CORBA_Object | ||
+ | #define CORBA_Object SOMObject | ||
+ | #endif | ||
+ | |||
+ | </ | ||
+ | |||
+ | If you convert from CORBA 1.2 mapping such approach mostly enough. But for CORBA 2.0+ mapping you also need to change methods arguments order. For example: | ||
+ | |||
+ | <code c> | ||
+ | echo_client = CORBA_ORB_string_to_object(orb, | ||
+ | </ | ||
+ | |||
+ | must be changed to | ||
+ | |||
+ | <code c> | ||
+ | echo_client = CORBA_ORB_string_to_object(orb, | ||
</ | </ | ||