Home

GEONius.com
14-Mar-2016
E-mail

coli_util - CORBA-Lite Utilities

CORBA-Lite is a lightweight CORBA implementation consisting of:

COMX_UTIL
marshaling functions for the basic Common Data Representation (CDR) primitive and constructed data types.
GIMX_UTIL
marshaling functions for some of the GIOP data types.
IIOP_UTIL
networking functions for sending and receiving GIOP messages over IIOP (TCP/IP) streams.
COLI_UTIL
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.h and gimx_idl.c as examples, albeit somewhat large examples. The header file is divided into 3 parts:
  1. data type definitions
  2. enumeration lookup table (LUT) declarations, and
  3. the declarations of the marshaling functions for the defined data types.
The source file is also divided into 3 parts:
  1. some convenience macros for error checking,
  2. the code for the marshaling functions, and
  3. the enumeration lookup table definitions if required.
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.

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

COLI Functions

Once an IIOP connection is established, a client application can use the following two functions for basic communications with the service:

coliRequest()
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.
coliGetReply()
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:

coliGetRequest()
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.
coliReply()
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 IORs and corbaloc: URLs.

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.


Public Procedures

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.

Source Files

coli_util.c
coli_util.h

Alex Measday  /  E-mail