1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
<?xml version="1.0" encoding="latin1" ?>
<!DOCTYPE cref SYSTEM "cref.dtd">
<cref>
<header>
<copyright>
<year>1998</year><year>2009</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
The contents of this file are subject to the Erlang Public License,
Version 1.1, (the "License"); you may not use this file except in
compliance with the License. You should have received a copy of the
Erlang Public License along with this software. If not, it can be
retrieved online at http://www.erlang.org/.
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and limitations
under the License.
</legalnotice>
<title>CORBA_Environment_alloc</title>
<prepared></prepared>
<docno></docno>
<checked></checked>
<date>1998-12-01</date>
<rev>A</rev>
</header>
<lib>CORBA_Environment_alloc</lib>
<libsummary>Allocation function for the CORBA_Environement struct</libsummary>
<description>
<p>The <em>CORBA_Environment_alloc()</em> function is the
function used to allocate and initiate the <em>CORBA_Environment</em>
structure.</p>
</description>
<funcs>
<func>
<name><ret>CORBA_Environment *</ret><nametext>CORBA_Environment_alloc(inbufsz, outbufsz)</nametext></name>
<fsummary>Initialize communication</fsummary>
<type>
<v>int inbufsz;</v>
<v>int outbufsz;</v>
</type>
<desc>
<p>This function is used to create and initiate the <c>CORBA_Environment</c>
structure. In particular, it is used to dynamically allocate a CORBA_Environment
structure and set the default values for the structure's fields. </p>
<p><em>inbufsize</em> is the wished size of input buffer.</p>
<p><em>outbufsize</em> is the wished size of output buffer.</p>
<p><em>CORBA_Environment</em> is the CORBA 2.0 state structure used by the
generated stub.</p>
<p>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.</p>
<p>To free the space allocated by CORBA_Environment_alloc/2 :</p>
<list type="bulleted">
<item>
<p>First call CORBA_free for the input and output buffers.</p>
</item>
<item>
<p>After freeing the buffer space, call CORBA_free for the CORBA_Environment space. </p>
</item>
</list>
</desc>
</func>
</funcs>
<section>
<title>The CORBA_Environment structure</title>
<p>Here is the complete definition of the CORBA_Environment structure,
defined in file <em>ic.h</em> : </p>
<code type="none">
/* 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;
</code>
<note>
<p>Remember to set the field values <em>_fd </em>, <em>_regname </em>, <em>*_to_pid </em> and/or
<em>*_from_pid </em> to the appropriate application values. These are not automatically
set by the stubs.</p>
</note>
<warning>
<p>Never assign static buffers to the buffer pointers, never set the <em>_memchunk</em> field to
a value less than <em>32</em>.</p>
</warning>
</section>
<section>
<title>SEE ALSO</title>
<p>ic(3)</p>
</section>
</cref>
|