]> git.meshlink.io Git - catta/blob - corby/channel.h
Fix compilation error caused by ACX_THREAD
[catta] / corby / channel.h
1 #ifndef _sw_corby_channel_h
2 #define _sw_corby_channel_h
3
4 /*
5  * Copyright 2003, 2004 Porchdog Software. All rights reserved.
6  *
7  *      Redistribution and use in source and binary forms, with or without modification,
8  *      are permitted provided that the following conditions are met:
9  *
10  *              1. Redistributions of source code must retain the above copyright notice,
11  *                 this list of conditions and the following disclaimer.
12  *              2. Redistributions in binary form must reproduce the above copyright notice,
13  *                 this list of conditions and the following disclaimer in the documentation
14  *                 and/or other materials provided with the distribution.
15  *
16  *      THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
17  *      EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18  *      WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19  *      IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
20  *      INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21  *      BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22  *      DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
23  *      OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
24  *      OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
25  *      OF THE POSSIBILITY OF SUCH DAMAGE.
26  *
27  *      The views and conclusions contained in the software and documentation are those
28  *      of the authors and should not be interpreted as representing official policies,
29  *      either expressed or implied, of Porchdog Software.
30  */
31
32 #include <salt/salt.h>
33 #include <salt/socket.h>
34 #include <corby/corby.h>
35 #include <corby/buffer.h>
36
37
38 #ifdef __cplusplus
39 extern "C"
40 {
41 #endif
42
43 struct                                                                                          _sw_corby_channel;
44 typedef struct _sw_corby_channel                        *       sw_corby_channel;
45 struct                                                                                          _sw_corby_message;
46 struct                                                                                          _sw_corby_profile;
47 typedef struct _sw_corby_profile                        *       sw_corby_profile;
48 typedef struct _sw_corby_profile const  *       sw_const_corby_profile;
49
50
51 typedef enum _sw_corby_reply_status
52 {
53    SW_CORBY_NO_EXCEPTION                =       0,
54    SW_CORBY_SYSTEM_EXCEPTION    =       1,
55    SW_CORBY_USER_EXCEPTION              =       2,
56    SW_CORBY_LOCATION_FORWARD    =       3
57 } sw_corby_reply_status;
58
59
60 typedef sw_result
61 (HOWL_API *sw_corby_channel_will_send_func)(
62                                                 sw_corby_channel                        channel,
63                                                 sw_octets                                       bytes,
64                                                 sw_size_t                                       len,
65                                                 sw_opaque_t                                     extra);
66
67
68 typedef sw_result
69 (HOWL_API *sw_corby_channel_did_read_func)(
70                                                 sw_corby_channel                        channel,
71                                                 sw_octets                                       bytes,
72                                                 sw_size_t                                       len,
73                                                 sw_opaque_t                                     extra);
74
75
76 typedef void
77 (HOWL_API *sw_corby_channel_cleanup_func)(
78                                                 sw_corby_channel                        channel);
79
80
81 typedef struct _sw_corby_channel_delegate
82 {
83         sw_opaque_t                                                             m_delegate;
84         sw_corby_channel_will_send_func m_will_send_func;
85         sw_corby_channel_did_read_func  m_did_read_func;
86         sw_corby_channel_cleanup_func           m_cleanup_func;
87         sw_opaque_t                                                             m_extra;
88 } * sw_corby_channel_delegate;
89
90
91 sw_result HOWL_API
92 sw_corby_channel_start_request(
93                                                         sw_corby_channel                                self,
94                                                         sw_const_corby_profile          profile,
95                                                         struct _sw_corby_buffer **      buffer,
96                                                         sw_const_string                         op,
97                                                         sw_uint32                                               oplen,
98                                                         sw_bool                                         reply_expected);
99
100
101 sw_result HOWL_API
102 sw_corby_channel_start_reply(
103                                                         sw_corby_channel                                self,
104                                                         struct _sw_corby_buffer **      buffer,
105                                                         sw_uint32                                               request_id,
106                                                         sw_corby_reply_status           status);
107
108
109 sw_result HOWL_API
110 sw_corby_channel_send(
111                                                         sw_corby_channel                                        self,
112                                                         struct _sw_corby_buffer         *       buffer,
113                                                         sw_corby_buffer_observer                observer,
114                                                         sw_corby_buffer_written_func    func,
115                                                         sw_opaque_t                                                     extra);
116
117
118 sw_result HOWL_API
119 sw_corby_channel_recv(
120                                                         sw_corby_channel                                        self,
121                                                         sw_salt                                                 *       salt,
122                                                         struct _sw_corby_message        **      message,
123                                                         sw_uint32                                               *       request_id,
124                                                         sw_string                                               *       op,
125                                                         sw_uint32                                               *       op_len,
126                                                         struct _sw_corby_buffer         **      buffer,
127                                                         sw_uint8                                                *       endian,
128                                                         sw_bool                                                 block);
129
130
131 sw_result HOWL_API
132 sw_corby_channel_last_recv_from(
133                                                         sw_corby_channel                                        self,
134                                                         sw_ipv4_address                         *       from,
135                                                         sw_port                                         *       from_port);
136
137
138 sw_result HOWL_API
139 sw_corby_channel_ff(
140                                                         sw_corby_channel                                        self,
141                                                         struct _sw_corby_buffer         *       buffer);
142
143
144 sw_socket HOWL_API
145 sw_corby_channel_socket(
146                                                         sw_corby_channel                                self);
147
148
149 sw_result HOWL_API
150 sw_corby_channel_retain(
151                                                         sw_corby_channel                                self);
152
153
154 sw_result HOWL_API
155 sw_corby_channel_set_delegate(
156                                                         sw_corby_channel                                self,
157                                                         sw_corby_channel_delegate       delegate);
158
159
160 sw_corby_channel_delegate HOWL_API
161 sw_corby_channel_get_delegate(
162                                                         sw_corby_channel                                self);
163
164
165 void HOWL_API
166 sw_corby_channel_set_app_data(
167                                                         sw_corby_channel                                self,
168                                                         sw_opaque                                               app_data);
169
170
171 sw_opaque HOWL_API
172 sw_corby_channel_get_app_data(
173                                                         sw_corby_channel                                self);
174
175
176 sw_result HOWL_API
177 sw_corby_channel_fina(
178                                                         sw_corby_channel                                self);
179
180
181 #ifdef __cplusplus
182 }
183 #endif
184
185
186 #endif