coli_util- CORBA-Lite Utilities
CORBA-Lite is a lightweight CORBA implementation consisting of:
- marshaling functions for the basic Common Data Representation (CDR) primitive and constructed data types.
- marshaling functions for some of the GIOP data types.
- networking functions for sending and receiving GIOP messages over IIOP (TCP/IP) streams.
- higher-level functions for performing CORBA message transactions.
More detailed information about the other packages is found in the respective package prologs. The GIMX_UTIL page has links to the Python scripts used to automatically generate C header and source files from IDL files.
NOTE: The Python scripts are not strictly necessary. If you have a small amount of IDL, it is easy to manually write the header files and source code that would have been generated by the Python scripts. I myself did this originally until our spacecraft-command database IDL was written with what seemed like 50,000 data types - I then realized it was time to pull out the old Python book! You can use
gimx_idl.cas examples, albeit somewhat large examples. The header file is divided into 3 parts:
The source file is also divided into 3 parts:
- data type definitions
- enumeration lookup table (LUT) declarations, and
- the declarations of the marshaling functions for the defined data types.
Each of the marshaling functions is structured consistently and, with some fast cutting and pasting, it should only take you a few minutes to write a bunch of your own marshaling functions.
- some convenience macros for error checking,
- the code for the marshaling functions, and
- the enumeration lookup table definitions if required.
CORBA-Lite does not support the CORBA C binding. It provides a simple, low-level means of communicating with CORBA peers and is useful for writing test/debug clients and servers.
The CORBA-Lite package has been built and tested under Linux, Solaris, Windows (Visual C++/Studio), VAX/VMS (!), Nintendo DS (built but only colior has been tested), and PalmOS (!). The screen snap to the right is of a standard I/O client running in the PalmOS Emulator (POSE) emulating an m105 Palm Pilot (PalmOS 3.5). The client has requested and is receiving telemetry data from a UNIX server via CORBA callbacks. The first two full lines of output (folded on the screen) are:
timestamp flags mnemonic = value (EU value) 2005-307-23:06:51.186 00800000 0000003F R- CPU_DWELL = 0 [NORMAL_CPU1] 2005-307-23:06:51.616 00480000 00200002 RL- T02264 = 6.0000000e00 (-2.3974884e00)
which show that the Palm application is receiving and displaying the data correctly, including UNIX timevals, UTF-16 wide-character strings, and IEEE floating-point numbers. (My Palm applications are built using prc-tools. Early in 2006, the project-specific IDL grew so large that one of the code sections overflowed and clients such as the one above no longer build. Base CORBA clients such as colior still build successfully.) It's unrelated to my code, but see Mary Connolly's interesting 2001 dissertation, "CORBA Middleware for a Palm Operating System" (PDF).
Once an IIOP connection is established, a client application can use the following two functions for basic communications with the service:
- submits a request for an operation on a service-hosted object. A list of marshaling function/value pairs is supplied for arguments expected by the operation.
- reads a reply from the service. If the operation was successful, a list of marshaling function/value pairs is used to decode and store the return values and function result returned by the operation.
A server application, on the other hand, would use these functions:
- reads a request. If the target object and operation in the request match the caller-supplied object and operation, a list of marshaling function/value pairs is used to decode and store the arguments expected by the operation.
- returns the completion status for a request. A list of marshaling function/value pairs is supplied for the return values expected from the operation.
The COLI package also includes routines for working with Interoperable
Object References (IORs). Functions are available for constructing IORs,
converting between binary and "stringified" IORs, and converting between
Finally, two table-lookup functions can be used (with the appropriate tables) to map enumerated types to their ASCII names and vice-versa. These capabilities are useful for displaying enumeration fields in human-readable form and, particularly in the case of application- or project-specific enumerations, for translating human input of field values by name into their binary enumeration values.
coliGetReply()- gets the next reply from a CORBA server.
coliGetRequest()- gets the next request from a CORBA client.
coliMakeIOR()- make an IOR for an object.
coliO2S()- converts an IOR to a stringified reference.
coliO2URL()- converts an IOR to a URL.
coliProfile()- returns an IOR's TAG_INTERNET_IOP profile.
coliReply()- issues a reply to a prior CORBA request.
coliRequest()- issues a request to a CORBA server object.
coliS2O()- converts a stringified reference to an IOR.
coliToName()- maps a number (e.g., CORBA enumeration) to a name.
coliToNumber()- maps a name to a number (e.g., CORBA enumeration).
coliURL2O()- converts a URL to an IOR.
coliVersion()- gets/sets the GIOP version.