[Ericsson AB]

9 CORBA_Environment C Structure

This chapter describes the CORBA_Environment C structure.

9.1 C Structure

Here is the complete definition of the CORBA_Environment C structure, defined in file "ic.h" :

/* Environment definition */
typedef struct {

  /*----- CORBA compatibility part ------------------------*/
  /* Exception tag, initially set to CORBA_NO_EXCEPTION ---*/
  CORBA_exception_type   _major;          

  /*----- External Implementation part - initiated by the user ---*/
  /* File descriptor                                              */
  int                    _fd;             
  /* Size of input buffer                                         */
  int                    _inbufsz;        
  /* Pointer to always dynamically allocated buffer for input     */
  char                  *_inbuf;         
  /* Size of output buffer                                        */
  int                    _outbufsz;       
  /* Pointer to always dynamically allocated buffer for output    */ 
  char                  *_outbuf;        
 /* Size of memory chunks in bytes, used for increasing the outpuy
    buffer, set to >= 32, should be around >= 1024 for performance
    reasons                                                       */ 
 int                    _memchunk;       
 /* Pointer for registered name                                   */
  char                   _regname[256];   
 /* Process identity for caller                                   */
  erlang_pid            *_to_pid;         
  /* Process identity for callee                                  */ 
  erlang_pid            *_from_pid;      

  /*- Internal Implementation part - used by the server/client ---*/
  /* Index for input buffer                                       */
  int                    _iin;            
  /* Index for output buffer                                      */
  int                    _iout;          
  /* Pointer for operation name                                   */
  char                   _operation[256];
   /* Used to count parameters                                    */
  int                    _received;      
  /* Used to identify the caller                                  */
  erlang_pid             _caller;        
 /* Used to identify the call                                     */
  erlang_ref             _unique;         
  /* Exception id field                                           */
  CORBA_char            *_exc_id;        
  /* Exception value field                                        */
   void                  *_exc_value;           

  
} CORBA_Environment; 
      
    

The structure is divided into three parts:

9.2 The CORBA Compatibility Part

Contains only one field _major defined as a CORBA_Exception_type. The CORBA_Exception type is an integer which can be one of:

The current definition of these values are:

      #define CORBA_NO_EXCEPTION      0
      #define CORBA_SYSTEM_EXCEPTION -1
    

9.3 The External Part

This part contains the following fields:

9.4 The Internal Part

This part contains the following fields:

The advanced user who defines his own functions has to update/support these values in a way similar to how they are updated in the generated code.

9.5 Creating and Initiating the CORBA_Environment Structure

There are two ways to set the CORBA_Environment structure:

Note!

Remember to set the fields _fd, _regname, *_to_pid and/or *_from_pid to the appropriate application values. These are not automatically set by the stubs.

Warning!

Never assign static buffers to the buffer pointers. Never set the _memchunk field to a value less than 32.

9.6 Setting System Exceptions

If the user wishes to set own system exceptions at critical positions on the code, it is strongly recommended to use one of the current values:

The value of the _exc_value field should be then set to a string that explains the problem in an informative way. The user should use the functions CORBA_exc_set/4 and CORBA_exception_free/1 to free the exception. The user has to use CORBA_exception_id/1 and CORBA_exception_value/1 to access exception information. Prototypes for these functions are declared in "ic.h"


ic 4.2.13
Copyright © 1991-2007 Ericsson AB