]> git.meshlink.io Git - catta/blob - avahi-compat-howl/include/salt/salt.h
fix avahi_netlink_new to allow multiple netlinks per process
[catta] / avahi-compat-howl / include / salt / salt.h
1 #ifndef _sw_salt_h
2 #define _sw_salt_h
3
4 /*
5  * Copyright 2003, 2004 Porchdog Software, Inc. 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, Inc.
30  */
31
32 #include <salt/platform.h>
33 #include <salt/time.h>
34
35
36 #ifdef __cplusplus
37 extern "C"
38 {
39 #endif
40
41
42 typedef enum _sw_socket_event
43 {
44         SW_SOCKET_READ          =       (1 << 0),
45         SW_SOCKET_WRITE =       (1 << 1),
46         SW_SOCKET_OOB           =       (1 << 2)
47 } sw_socket_event;
48
49
50 struct                                                  _sw_salt;
51 typedef struct _sw_salt *       sw_salt;
52 struct                                                  _sw_socket;
53 struct                                                  _sw_timer;
54 struct                                                  _sw_network_interface;
55 struct                                                  _sw_signal;
56
57 typedef sw_opaque                               sw_socket_handler;
58 typedef sw_result
59 (HOWL_API *sw_socket_handler_func)(
60                                                                         sw_socket_handler               handler,
61                                                                         sw_salt                                 salt,
62                                                                         struct _sw_socket       *       socket,
63                                                                         sw_socket_event         events,
64                                                                         sw_opaque                               extra);
65
66
67 typedef sw_opaque                               sw_timer_handler;
68 typedef sw_result
69 (HOWL_API *sw_timer_handler_func)(
70                                                                         sw_timer_handler                handler,
71                                                                         sw_salt                                 salt,
72                                                                         struct _sw_timer        *       timer,
73                                                                         sw_time                                 timeout,
74                                                                         sw_opaque                               extra);
75
76 typedef sw_opaque                               sw_network_interface_handler;
77 typedef sw_result
78 (HOWL_API *sw_network_interface_handler_func)(
79                                                                         sw_network_interface_handler            handler,
80                                                                         sw_salt                                                                 salt,
81                                                                         struct _sw_network_interface    *       netif,
82                                                                         sw_opaque                                                               extra);
83
84 typedef sw_opaque                               sw_signal_handler;
85 typedef sw_result
86 (HOWL_API *sw_signal_handler_func)(
87                                                                         sw_signal_handler               handler,
88                                                                         sw_salt                                 salt,
89                                                                         struct _sw_signal       *       signal,
90                                                                         sw_opaque                               extra);
91
92
93 sw_result HOWL_API
94 sw_salt_init(
95                                 sw_salt         *       self,
96                                 int                             argc,
97                                 char                    **      argv);
98
99
100 sw_result HOWL_API
101 sw_salt_fina(
102                                 sw_salt self);
103
104
105 sw_result HOWL_API
106 sw_salt_register_socket(
107                                 sw_salt                                         self,
108                                 struct _sw_socket               *       socket,
109                                 sw_socket_event                 events,
110                                 sw_socket_handler                       handler,
111                                 sw_socket_handler_func  func,
112                                 sw_opaque                                       extra);
113
114
115 sw_result HOWL_API
116 sw_salt_unregister_socket(
117                                 sw_salt                                         self,
118                                 struct _sw_socket               *       socket);
119
120
121 sw_result HOWL_API
122 sw_salt_register_timer(
123                                 sw_salt                                         self,
124                                 struct _sw_timer                *       timer,
125                                 sw_time                                         timeout,
126                                 sw_timer_handler                        handler,
127                                 sw_timer_handler_func   func,
128                                 sw_opaque                                       extra);
129
130
131 sw_result HOWL_API
132 sw_salt_unregister_timer(
133                                 sw_salt                                         self,
134                                 struct _sw_timer                *       timer);
135
136
137 sw_result HOWL_API
138 sw_salt_register_network_interface(
139                                 sw_salt                                                                         self,
140                                 struct _sw_network_interface            *       netif,
141                                 sw_network_interface_handler                    handler,
142                                 sw_network_interface_handler_func       func,
143                                 sw_opaque                                                                       extra);
144
145
146 sw_result HOWL_API
147 sw_salt_unregister_network_interface_handler(
148                                 sw_salt                                         self);
149
150
151 sw_result HOWL_API
152 sw_salt_register_signal(
153                                 sw_salt                                         self,
154                                 struct _sw_signal       *               signal,
155                                 sw_signal_handler                       handler,
156                                 sw_signal_handler_func  func,
157                                 sw_opaque                                       extra);
158
159
160 sw_result HOWL_API
161 sw_salt_unregister_signal(
162                                 sw_salt                                         self,
163                                 struct _sw_signal       *               signal);
164
165
166 sw_result HOWL_API
167 sw_salt_lock(
168                                 sw_salt self);
169
170
171 sw_result HOWL_API
172 sw_salt_unlock(
173                                 sw_salt self);
174
175
176 sw_result HOWL_API
177 sw_salt_step(
178                                 sw_salt         self,
179                                 sw_uint32       *       msec);
180
181
182 sw_result HOWL_API
183 sw_salt_run(
184                                 sw_salt self);
185
186
187 sw_result HOWL_API
188 sw_salt_stop_run(
189                                 sw_salt self);
190
191
192 #define SW_FALSE                0
193 #define SW_TRUE         1
194 #define SW_OKAY         0
195
196
197 /*
198  * error codes
199  */
200 #define SW_E_CORE_BASE                                  0x80000000
201 #define SW_E_UNKNOWN                                    (SW_E_CORE_BASE) + 1
202 #define SW_E_INIT                                               (SW_E_CORE_BASE) + 2
203 #define SW_E_MEM                                                        (SW_E_CORE_BASE) + 3
204 #define SW_E_EOF                                                        (SW_E_CORE_BASE) + 4
205 #define SW_E_NO_IMPL                                    (SW_E_CORE_BASE) + 5
206 #define SW_E_FILE_LOCKED                                (SW_E_CORE_BASE) + 6
207 #define SW_E_PROTOCOL_NOT_FOUND         (SW_E_CORE_BASE) + 7
208
209
210 #ifdef __cplusplus
211 }
212 #endif
213
214
215 #endif