aboutsummaryrefslogtreecommitdiffstats
path: root/lib/orber/doc/src/interceptors.xml
blob: 739da8ab2fb20459c0d63c7de86b3ea97b952ee3 (plain) (blame)
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">

<erlref>
  <header>
    <copyright>
      <year>2001</year><year>2013</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>interceptors</title>
    <prepared></prepared>
    <responsible></responsible>
    <docno></docno>
    <approved></approved>
    <checked></checked>
    <date>1999-09-03</date>
    <rev>A</rev>
  </header>
  <module>interceptors</module>
  <modulesummary>Describe the functions which must be exported by any supplied Orber native interceptor.</modulesummary>
  <description>
    <p>This module contains the mandatory functions for user supplied native
      interceptors and their intended behavior. See also the User's Guide.</p>
    <warning>
      <p>Using <c>Interceptors</c> may reduce the through-put significantly
        if the supplied interceptors invoke expensive operations. Hence, 
        one should always supply interceptors which cause as little overhead
        as possible.</p>
    </warning>
    <warning>
      <p>It is possible to alter the <c>Data</c>, <c>Bin</c> and <c>Args</c>
        parameter for the <c>in_reply</c> and <c>out_reply</c>, 
        <c>in_reply_encoded</c>, <c>in_request_encoded</c>, 
        <c>out_reply_encoded</c> and <c>out_request_encoded</c>,
        <c>in_request</c> and <c>out_request</c> respectively. But,
        if it is done incorrectly, the consequences can be serious.</p>
    </warning>
    <note>
      <p>The <c>Extra</c> parameter is set to 'undefined' by Orber when calling
        the first interceptor and may be set to any Erlang term.  If an
        interceptor change this parameter it will be passed on to the next
        interceptor in the list uninterpreted.</p>
    </note>
    <note>
      <p>The <c>Ref</c> parameter is set to 'undefined' by Orber when calling
        <c>new_in_connection</c> or <c>new_out_connection</c> using
        the first interceptor. The user supplied interceptor may set <c>NewRef</c>
        to any Erlang term.  If an interceptor change this parameter it will be
        passed on to the next interceptor in the list uninterpreted.</p>
    </note>
  </description>
  <funcs>
    <func>
      <name>new_in_connection(Ref, PeerHost, PeerPort) -> NewRef</name>
      <name>new_in_connection(Ref, PeerHost, PeerPort, SocketHost, SocketPort) -> NewRef</name>
      <fsummary>Invoke when a new client ORB wants to setup a connection</fsummary>
      <type>
        <v>Ref    = term() | undefined</v>
        <v>PeerHost = SocketHost = string(), e.g., "myHost@myServer" or "192.0.0.10"</v>
        <v>PeerPort = SocketPort = integer()</v>
        <v>NewRef = term() | {'EXIT', Reason}</v>
      </type>
      <desc>
        <p>When a new connection is requested by a client side ORB this operation
          is invoked. If more than one interceptor is supplied, e.g., 
          <c>{native, ['myInterceptor1', 'myInterceptor2']}</c>, the return value
          from 'myInterceptor1' is passed to 'myInterceptor2' as <c>Ref</c>.
          Initially, Orber uses the atom 'undefined' as <c>Ref</c> parameter
          when calling the first interceptor. The return value from the last
          interceptor, in the example above 'myInterceptor2', is passed
          to all other functions exported by the interceptors. Hence,
          the <c>Ref</c> parameter can, for example, be used as a unique 
          identifier to mnesia or ets where information/restrictions for
          this connection is stored.</p>
        <p>The PeerHost and PeerPort variables supplied data of
          the client ORB which requested a new connection. SocketHost 
          and SocketPort are the local interface and port the client
          connected to.</p>
        <p>If, for some reason, we do not allow the client ORB to connect
          simply invoke <c>exit(Reason)</c>.</p>
      </desc>
    </func>
    <func>
      <name>new_out_connection(Ref, PeerHost, PeerPort) -> NewRef</name>
      <name>new_out_connection(Ref, PeerHost, PeerPort, SocketHost, SocketPort) -> NewRef</name>
      <fsummary>Invoke when setting up a new connection to a server side  ORB</fsummary>
      <type>
        <v>Ref    = term() | undefined</v>
        <v>PeerHost = SocketHost = string(), e.g., "myHost@myServer" or "192.0.0.10"</v>
        <v>PeerPort = SocketPort = integer()</v>
        <v>NewRef = term() | {'EXIT', Reason}</v>
      </type>
      <desc>
        <p>When a new connection is set up this function is invoked. Behaves
          just like <c>new_in_connection</c>; the only difference is that
          the PeerHost and PeerPort variables identifies the target ORB's bootstrap
          data and SocketHost and SocketPort are the local interface and port
          the client ORB connected via.</p>
      </desc>
    </func>
    <func>
      <name>closed_in_connection(Ref) -> NewRef</name>
      <fsummary>Invoke when an existing connection to a client side ORB have been terminated</fsummary>
      <type>
        <v>Ref    = term()</v>
        <v>NewRef = term()</v>
      </type>
      <desc>
        <p>When an existing connection is terminated this operation is invoked.
          The main purpose of this function is to make it possible for a user
          to clean up all data associated with the associated connection.</p>
        <p>The input parameter <c>Ref</c> is the return value from 
          <c>new_in_connection/3</c>.</p>
      </desc>
    </func>
    <func>
      <name>closed_out_connection(Ref) -> NewRef</name>
      <fsummary>Invoke when an existing connection to a server side ORB have been terminated</fsummary>
      <type>
        <v>Ref    = term()</v>
        <v>NewRef = term()</v>
      </type>
      <desc>
        <p>When an existing connection is terminated this operation is invoked.
          The main purpose of this function is to make it possible for a user
          to clean up all data associated with the associated connection.</p>
        <p>The input parameter <c>Ref</c> is the return value from 
          <c>new_out_connection/3</c>.</p>
      </desc>
    </func>
    <func>
      <name>in_reply(Ref, Obj, Ctx, Op, Data, Extra) -> Reply</name>
      <fsummary>Invoke when replies arrives at the client side ORB</fsummary>
      <type>
        <v>Ref   = term()</v>
        <v>Obj   = #objref</v>
        <v>Ctx   = [#'IOP_ServiceContext'{}]</v>
        <v>Op    = atom()</v>
        <v>Data  = [Result, OutParameter1, ..., OutPramaterN]</v>
        <v>Reply = {NewData, NewExtra}</v>
      </type>
      <desc>
        <p>When replies are delivered from the server side ORB to the client side
          ORB this operation is invoked. The <c>Data</c> parameter is a list in which
          the first element is the return value value from the target object and
          the rest is a all parameters defined as <c>out</c> or <c>inout</c> in
          the IDL-specification.</p>
      </desc>
    </func>
    <func>
      <name>in_reply_encoded(Ref, Obj, Ctx, Op, Bin, Extra) -> Reply</name>
      <fsummary>Invoke when replies arrives at the client side ORB with undecoded reply body</fsummary>
      <type>
        <v>Ref   = term()</v>
        <v>Obj   = #objref</v>
        <v>Ctx   = [#'IOP_ServiceContext'{}]</v>
        <v>Op    = atom()</v>
        <v>Bin   = #binary</v>
        <v>Reply = {NewBin, NewExtra}</v>
      </type>
      <desc>
        <p>When replies are delivered from the server side ORB to the client side
          ORB this operation is invoked. The <c>Bin</c> parameter is the reply 
          body still uncoded.</p>
      </desc>
    </func>
    <func>
      <name>in_request(Ref, Obj, Ctx, Op, Args, Extra) -> Reply</name>
      <fsummary>Invoke when requests arrive at the server side ORB</fsummary>
      <type>
        <v>Ref   = term()</v>
        <v>Obj   = #objref</v>
        <v>Ctx   = [#'IOP_ServiceContext'{}]</v>
        <v>Op    = atom()</v>
        <v>Args  = [Argument] - defined in the IDL-specification</v>
        <v>Reply = {NewArgs, NewExtra}</v>
      </type>
      <desc>
        <p>When a new request arrives at the server side ORB this operation is 
          invoked.</p>
      </desc>
    </func>
    <func>
      <name>in_request_encoded(Ref, Obj, Ctx, Op, Bin, Extra) -> Reply</name>
      <fsummary>Invoke when requests arrive at the server side ORB with undecoded request body</fsummary>
      <type>
        <v>Ref   = term()</v>
        <v>Obj   = #objref</v>
        <v>Ctx   = [#'IOP_ServiceContext'{}]</v>
        <v>Op    = atom()</v>
        <v>Bin   = #binary</v>
        <v>Reply = {NewBin, NewExtra}</v>
      </type>
      <desc>
        <p>When a new request arrives at the server side ORB this operation is 
          invoked before decoding the request body.</p>
      </desc>
    </func>
    <func>
      <name>out_reply(Ref, Obj, Ctx, Op, Data, Extra) -> Reply</name>
      <fsummary>Invoke after the target object replied</fsummary>
      <type>
        <v>Ref   = term()</v>
        <v>Obj   = #objref</v>
        <v>Ctx   = [#'IOP_ServiceContext'{}]</v>
        <v>Op    = atom()</v>
        <v>Data  = [Result, OutParameter1, ..., OutPramaterN]</v>
        <v>Reply = {NewData, NewExtra}</v>
      </type>
      <desc>
        <p>After the target object have been invoked this operation is invoked
          with the result. The <c>Data</c> parameter is a list in which
          the first element is the return value value from the target object and
          the rest is a all parameters defined as <c>out</c> or <c>inout</c> in
          the IDL-specification.</p>
      </desc>
    </func>
    <func>
      <name>out_reply_encoded(Ref, Obj, Ctx, Op, Bin, Extra) -> Reply</name>
      <fsummary>Invoke after the target object replied with the reply  encoded</fsummary>
      <type>
        <v>Ref   = term()</v>
        <v>Obj   = #objref</v>
        <v>Ctx   = [#'IOP_ServiceContext'{}]</v>
        <v>Op    = atom()</v>
        <v>Bin   = #binary</v>
        <v>Reply = {NewBin, NewExtra}</v>
      </type>
      <desc>
        <p>This operation is similar to <c>out_reply</c>; the only difference is
          that the reply body have been encoded.</p>
      </desc>
    </func>
    <func>
      <name>out_request(Ref, Obj, Ctx, Op, Args, Extra) -> Reply</name>
      <fsummary>Invoke on the client side ORB before encoding and sending the request</fsummary>
      <type>
        <v>Ref   = term()</v>
        <v>Obj   = #objref</v>
        <v>Ctx   = [#'IOP_ServiceContext'{}]</v>
        <v>Op    = atom()</v>
        <v>Args  = [Argument] - defined in the IDL-specification</v>
        <v>Reply = {NewArgs, NewExtra}</v>
      </type>
      <desc>
        <p>Before a request is sent to the server side ORB, <c>out_request</c> is
          invoked.</p>
      </desc>
    </func>
    <func>
      <name>out_request_encoded(Ref, Obj, Ctx, Op, Bin, Extra) -> Reply</name>
      <fsummary>Invoke on the client side ORB before sending the request</fsummary>
      <type>
        <v>Ref   = term()</v>
        <v>Obj   = #objref</v>
        <v>Ctx   = [#'IOP_ServiceContext'{}]</v>
        <v>Op    = atom()</v>
        <v>Bin   = #binary</v>
        <v>Reply = {NewBin, NewExtra}</v>
      </type>
      <desc>
        <p>This operation is similar to <c>out_request</c>; the only
          difference is that the request body have been encoded.</p>
      </desc>
    </func>
  </funcs>
  
</erlref>