CORBA_Environment_alloc

Allocation function for the CORBA_Environement struct

The CORBA_Environment_alloc() function is the function used to allocate and initiate the CORBA_Environment structure.

Functions


CORBA_Environment * CORBA_Environment_alloc(inbufsz, outbufsz)
  • int inbufsz;
  • int outbufsz;

This function is used to create and initiate the CORBA_Environment structure. In particular, it is used to dynamically allocate a CORBA_Environment structure and set the default values for the structure's fields.

inbufsize is the wished size of input buffer.

outbufsize is the wished size of output buffer.

CORBA_Environment is the CORBA 2.0 state structure used by the generated stub.

This function will set all needed default values and allocate buffers equal to the values passed, but will not allocate space for the _to_pid and _from_pid fields.

To free the space allocated by CORBA_Environment_alloc/2 :

First call CORBA_free for the input and output buffers.

After freeing the buffer space, call CORBA_free for the CORBA_Environment space.

The CORBA_Environment structure

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 output
    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; 
    

Note!

Remember to set the field values _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.

SEE ALSO

ic(3)

View Functions