Here is the complete definition of the CORBA_Environment 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 semantically divided into three areas :
Observe that the advanced user wishing to write own composit functions must have good knowledge of Erl_interface or/and EI-* functions.
Contains only one (1) field, the _major which is defined as a CORBA_Exception_type. The CORBA_Exception type is forced to be an integer type due to implementation details and in the current version can be one of :
The current definition of these values look like :
#ifndef CORBA_NO_EXCEPTION
#define CORBA_NO_EXCEPTION 0
#endif
#ifndef CORBA_SYSTEM_EXCEPTION
#define CORBA_SYSTEM_EXCEPTION -1
#endif
This area contains nine (9) fields :
This area contains eight (8) fields :
The advanced user who defines his own composit/switch functions has to update/support these values a way similar to the use of these in the generated code.
There are two ways to set the CORBA_Environment structure :
CORBA_Environment *CORBA_Environment_alloc(int inbufsz,
int outbufsz);
where :
![]() |
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. |
![]() |
Never assign static buffers to the buffer pointers. Never set the _memchunk field to a value less than 32. |
If the advanced user wishes to set own system exceptions at critical positions on the code, it is strongly recommended to use one of the current values :
#define UNKNOWN "UNKNOWN"
#define BAD_PARAM "BAD_PARAM"
#define NO_MEMORY "NO_MEMORY"
#define IMPL_LIMIT "IMP_LIMIT"
#define COMM_FAILURE "COMM_FAILURE"
#define INV_OBJREF "INV_OBJREF"
#define NO_PERMISSION "NO_PERMISSION"
#define INTERNAL "INTERNAL"
#define MARSHAL "MARSHAL"
#define INITIALIZE "INITIALIZE"
#define NO_IMPLEMENT "NO_IMPLEMENT"
#define BAD_TYPECODE "BAD_TYPECODE"
#define BAD_OPERATION "BAD_OPERATION"
#define NO_RESOURCES "NO_RESOURCES"
#define NO_RESPONSE "NO_RESPONSE"
#define PERSIST_STORE "PERSIST_STORE"
#define BAD_INV_ORDER "BAD_INV_ORDER"
#define TRANSIENT "TRANSIENT"
#define FREE_MEM "FREE_MEM"
#define INV_IDENT "INV_IDENT"
#define INV_FLAG "INV_FLAG"
#define INTF_REPOS "INTF_REPOS"
#define BAD_CONTEXT "BAD_CONTEXT"
#define OBJ_ADAPTER "OBJ_ADAPTER"
#define DATA_CONVERSION "DATA_CONVERSION"
#define OBJ_NOT_EXIST "OBJECT_NOT_EXIST"
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"
Here are some guidelines for the composit function programmer: