Add support for async signal handlers
[vala-lang.git] / vapi / libesmtp.vapi
blob0942d499045742d9e3adcae7eee4482dfb05e58a
1 /* libesmtp.vapi
2  *
3  * Copyright (C) 2010  Adrien Bustany
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
18  *
19  * As a special exception, if you use inline functions from this file, this
20  * file does not by itself cause the resulting executable to be covered by
21  * the GNU Lesser General Public License.
22  * 
23  * Author:
24  *      Adrien Bustany <abustany@gnome.org>
25  */
27 [CCode (cheader_filename="libesmtp.h")]
28 namespace Smtp {
29         [SimpleType]
30         [CCode (cname="smtp_session_t", free_function="smtp_destroy_session")]
31         public struct Session {
32                 [CCode (cname="smtp_create_session")]
33                 public Session ();
35                 [CCode (cname="smtp_add_message")]
36                 public Smtp.Message add_message ();
37                 [CCode (cname="smtp_enumerate_messages")]
38                 public int enumerate_message (EnumerateMessageCb cb);
39                 [CCode (cname="smtp_set_server")]
40                 public int set_server (string hostport);
41                 [CCode (cname="smtp_set_hostname")]
42                 public int set_hostname (string hostname);
43                 [CCode (cname="smtp_set_eventcb")]
44                 public int set_eventcb (EventCb cb);
45                 [CCode (cname="smtp_set_monitorcb", instance_pos="1.5")]
46                 public int set_monitorcb (MonitorCb cb, int headers);
47                 [CCode (cname="smtp_start_session")]
48                 public int start_session ();
49                 [CCode (cname="smtp_set_application_data")]
50                 public void* set_application_data (void *data);
51                 [CCode (cname="smtp_get_application_data")]
52                 public void* get_application_data ();
53                 [CCode (cname="smtp_option_require_all_recipients")]
54                 public int option_require_all_recipients (int state);
55                 [CCode (cname="smtp_auth_set_context")]
56                 public int auth_set_context (Smtp.AuthContext context);
57                 [CCode (cname="smtp_set_timeout")]
58                 public long set_timeout (int which, long value);
59                 /* Will be enabled if there are SSL bindings
60                 [CCode (cname="smtp_starttls_set_ctx")]
61                 public int starttls_set_ctx (SSL.Ctx ctx); */
62                 [CCode (cname="smtp_etrn_add_node")]
63                 public EtrnNode etrn_add_node (int option, string node);
64                 [CCode (cname="smtp_etrn_enumerate_nodes")]
65                 public int etrn_enumerate_nodes (EtrnEnumerateNodeCb cb);
66         }
68         [SimpleType]
69         [CCode (cname="smtp_message_t", free_function="g_free")]
70         public struct Message {
71                 [CCode (cname="smtp_set_reverse_path")]
72                 public int set_reverse_path (string mailbox);
73                 [CCode (cname="smtp_add_recipient")]
74                 public Smtp.Recipient add_recipient (string mailbox);
75                 [CCode (cname="smtp_enumerate_recipients")]
76                 public int enumerate_recipients (EnumerateRecipientCb cb);
77                 [CCode (cname="smtp_set_header", sentinel="")]
78                 public int set_header (string header, ...);
79                 [CCode (cname="smtp_set_header_option")]
80                 public int set_header_option (string header, Smtp.HeaderOption option, ...);
81                 [CCode (cname="smtp_set_resent_headers")]
82                 public int set_resent_headers (int onoff);
83                 [CCode (cname="smtp_set_messagecb")]
84                 public int set_messagecb (MessageCb cb);
85                 [CCode (cname="smtp_message_transfer_status")]
86                 public Smtp.Status transfer_status ();
87                 [CCode (cname="smtp_reverse_path_status")]
88                 public Smtp.Status reverse_path_status ();
89                 [CCode (cname="smtp_message_reset_status")]
90                 public static int reset_status (Smtp.Recipient recipient);
91                 [CCode (cname="smtp_dsn_set_ret")]
92                 public int dsn_set_ret (Smtp.RetFlags flags);
93                 [CCode (cname="smtp_dsn_set_envid")]
94                 public int dsn_set_envid (string envid);
95                 [CCode (cname="smtp_dsn_set_notify")]
96                 public int dsn_set_notify (NotifyFlags flags);
97                 [CCode (cname="smtp_dsn_set_orcpt")]
98                 public int dsn_set_orcpt (string address_type, string address);
99                 [CCode (cname="smtp_size_set_estimate")]
100                 public int smtp_size_set_estimate (ulong size);
101                 [CCode (cname="smtp_8bitmime_set_body")]
102                 public int @8bitmime_set_body (E8BitMimeBody body);
103                 [CCode (cname="smtp_deliverby_set_mode")]
104                 public int deliverby_set_mode (long time, ByMode mode, int trace);
105                 [CCode (cname="smtp_starttls_enable")]
106                 public int starttls_enable (StartTlsOption how);
107         }
109         [SimpleType]
110         [CCode (cname="smtp_session_t", free_function="g_free")]
111         public struct Recipient {
112                 [CCode (cname="smtp_recipient_check_complete")]
113                 public int check_complete ();
114                 [CCode (cname="smtp_recipient_reset_status")]
115                 public int reset_status ();
116                 [CCode (cname="smtp_recipient_set_application_data")]
117                 public void set_application_data (void *data);
118                 [CCode (cname="smtp_recipient_get_application_data")]
119                 public void get_application_data ();
120         }
122         [CCode (cname="smtp_status_t")]
123         public struct Status {
124                 int code;
125                 string text;
126                 int enh_struct;
127                 int enh_subject;
128                 int enh_detail;
129         }
131         [SimpleType]
132         [CCode (cname="smtp_etrn_node_t")]
133         public struct EtrnNode {
134                 [CCode (cname="smtp_etrn_node_status")]
135                 public Smtp.Status node_status ();
136                 [CCode (cname="smtp_etrn_set_application_data")]
137                 public void* set_application_data (void *data);
138                 [CCode (cname="smtp_etrn_get_application_data")]
139                 public void* get_application_data ();
140         }
142         [SimpleType]
143         [CCode (cname="auth_context_t", cheader_filename="auth-client.h", free_function="auth_destroy_context")]
144         public struct AuthContext {
145                 [CCode (cname="auth_set_mechanism_flags")]
146                 public int set_mechanism_flags (uint @set, uint clear);
147                 [CCode (cname="auth_set_mechanism_ssf")]
148                 public int set_mechanism_ssf (int min_ssf);
149                 [CCode (cname="auth_set_interact_cb")]
150                 public int set_interact_cb (AuthInteract interact);
151                 [CCode (cname="auth_client_enabled")]
152                 public int client_enabled ();
153                 [CCode (cname="auth_set_mechanism")]
154                 public int set_mechanism (string name);
155                 [CCode (cname="auth_mechanism_name")]
156                 public string mechanism_name ();
157                 [CCode (cname="auth_response")]
158                 public string response (string challenge, int len);
159                 [CCode (cname="auth_get_ssf")]
160                 public int get_ssf ();
161                 [CCode (cname="auth_set_external_id")]
162                 public int set_external_id (string identity);
163         }
165         [CCode (cname="auth_client_request_t", cheader_filename="auth-client.h")]
166         public struct AuthClientRequest {
167                 string name;
168                 uint flags;
169                 string prompt;
170                 uint size;
171         }
173         // the "what" parameter must be 0
174         // if buf_len is not enough, SMTP_ERR_INVAL error will be set. 32 is generally enough
175         [CCode (cname="smtp_version")]
176         public static int version (string buf, string buf_len, int what);
178         [CCode (cname="smtp_errno")]
179         public static int errno ();
181         [CCode (cname="smtp_strerror")]
182         public static string strerror (int error, string buf, string buflen);
184         [CCode (cname="auth_client_init", cheader_filename="auth-client.h")]
185         public static void auth_client_init ();
187         [CCode (cname="auth_client_exit", cheader_filename="auth-client.h")]
188         public static void auth_client_exit ();
190         [CCode (cname="auth_encode", cheader_filename="auth-client.h")]
191         public static void auth_encode (out string dstbuf, out int dstlen, string srcbuf, int srclen, void *arg);
193         [CCode (cname="auth_decode", cheader_filename="auth-client.h")]
194         public static void auth_decode (out string dstbuf, out int dstlen, string srcbuf, int srclen, void *arg);
196         [CCode (cname="auth_create_context", cheader_filename="auth-client.h")]
197         public static AuthContext auth_create_context ();
199         [CCode (cname="smtp_enumerate_messagecb_t")]
200         public delegate void EnumerateMessageCb (Smtp.Message message);
202         [CCode (cname="smtp_enumerate_recipientcb_t")]
203         public delegate void EnumerateRecipientCb (Smtp.Recipient recipient, string mailbox);
205         [CCode (cname="smtp_messagecb_t")]
206         public delegate unowned string MessageCb (out string buf, out int len);
208         [CCode (cname="smtp_eventcb_t", instance_pos="2.5")]
209         public delegate void EventCb (Smtp.Session session, int event_no, ...);
211         [CCode (cname="smtp_monitorcb_t")]
212         public delegate void MonitorCb (string buf, int buflen, int writing);
214         [CCode (cname="smtp_starttls_passwordcb_t")]
215         public delegate int StartTlsPasswordCb (string buf, int buflen, int rwflag);
217         [CCode (cname="smtp_etrn_enumerate_nodecb_t")]
218         public delegate void EtrnEnumerateNodeCb (Smtp.EtrnNode node, int option, string domain);
220         [CCode (cname="auth_interact_t", cheader_filename="auth-client.h")]
221         public delegate int AuthInteract (AuthClientRequest request, out string result, int fields);
223         [CCode (cname="auth_response_t", cheader_filename="auth-client.h")]
224         public delegate string AuthResponse (void *ctx, string challenge, int len, AuthInteract interact);
226         [CCode (cname="auth_recode_t", cheader_filename="auth-client.h", has_target=false)]
227         public delegate int AuthRecode (void *ctx, out string dstbuf, out int dstlen, string srcbuf, int srclen);
229         [CCode (cname="header_option", cprefix="Hdr_")]
230         public enum HeaderOption {
231                 OVERRIDE,
232                 PROHIBIT
233         }
235         [CCode (cname="ret_flags", cprefix="Ret_")]
236         public enum RetFlags {
237                 NOTSET,
238                 FULL,
239                 HDRS
240         }
242         [CCode (cname="notify_flags", cprefix="Notify_")]
243         public enum NotifyFlags {
244                 NOTSET,
245                 NEVER,
246                 SUCCESS,
247                 FAILURE,
248                 DELAY
249         }
251         [CCode (cname="e8bitmime_body", cprefix="E8bitmime_")]
252         public enum E8BitMimeBody {
253                 NOTSET,
254                 @7BIT,
255                 @8BITMIME,
256                 BINARYMIME
257         }
259         [CCode (cname="by_mode", cprefix="By_")]
260         public enum ByMode {
261                 NOTSET,
262                 NOTIFY,
263                 RETURN
264         }
266         [CCode (cname="starttls_option", cprefix="Starttls_")]
267         public enum StartTlsOption {
268                 DISABLED,
269                 ENABLED,
270                 REQUIRED
271         }
273         [CCode (cname="SMTP_EV_CONNECT")]
274         public static const uint EV_CONNECT;
275         [CCode (cname="SMTP_EV_MAILSTATUS")]
276         public static const uint EV_MAILSTATUS;
277         [CCode (cname="SMTP_EV_RCPTSTATUS")]
278         public static const uint EV_RCPTSTATUS;
279         [CCode (cname="SMTP_EV_MESSAGEDATA")]
280         public static const uint EV_MESSAGEDATA;
281         [CCode (cname="SMTP_EV_MESSAGESENT")]
282         public static const uint EV_MESSAGESENT;
283         [CCode (cname="SMTP_EV_DISCONNECT")]
284         public static const uint EV_DISCONNECT;
285         [CCode (cname="SMTP_EV_ETRNSTATUS")]
286         public static const uint EV_ETRNSTATUS;
287         [CCode (cname="SMTP_EV_EXTNA_DSN")]
288         public static const uint EV_EXTNA_DSN;
289         [CCode (cname="SMTP_EV_EXTNA_8BITMIME")]
290         public static const uint EV_EXTNA_8BITMIME;
291         [CCode (cname="SMTP_EV_EXTNA_STARTTLS")]
292         public static const uint EV_EXTNA_STARTTLS;
293         [CCode (cname="SMTP_EV_EXTNA_ETRN")]
294         public static const uint EV_EXTNA_ETRN;
295         [CCode (cname="SMTP_EV_EXTNA_CHUNKING")]
296         public static const uint EV_EXTNA_CHUNKING;
297         [CCode (cname="SMTP_EV_EXTNA_BINARYMIME")]
298         public static const uint EV_EXTNA_BINARYMIME;
299         [CCode (cname="SMTP_EV_DELIVERBY_EXPIRED")]
300         public static const uint EV_DELIVERBY_EXPIRED;
301         [CCode (cname="SMTP_EV_WEAK_CIPHER")]
302         public static const uint EV_WEAK_CIPHER;
303         [CCode (cname="SMTP_EV_STARTTLS_OK")]
304         public static const uint EV_STARTTLS_OK;
305         [CCode (cname="SMTP_EV_INVALID_PEER_CERTIFICATE")]
306         public static const uint EV_INVALID_PEER_CERTIFICATE;
307         [CCode (cname="SMTP_EV_NO_PEER_CERTIFICATE")]
308         public static const uint EV_NO_PEER_CERTIFICATE;
309         [CCode (cname="SMTP_EV_WRONG_PEER_CERTIFICATE")]
310         public static const uint EV_WRONG_PEER_CERTIFICATE;
311         [CCode (cname="SMTP_EV_NO_CLIENT_CERTIFICATE")]
312         public static const uint EV_NO_CLIENT_CERTIFICATE;
313         [CCode (cname="SMTP_EV_UNUSABLE_CLIENT_CERTIFICATE")]
314         public static const uint EV_UNUSABLE_CLIENT_CERTIFICATE;
315         [CCode (cname="SMTP_EV_UNUSABLE_CA_LIST")]
316         public static const uint EV_UNUSABLE_CA_LIST;
318         [CCode (cname="Timeout_OVERRIDE_RFC2822_MINIMUM")]
319         public static const long TIMEOUT_OVERRIDE_RFC2822_MINIMUM;
321         [CCode (cname="SMTP_ERR_NOTHING_TO_DO")]
322         public static const uint ERR_NOTHING_TO_DO;
323         [CCode (cname="SMTP_ERR_DROPPED_CONNECTION")]
324         public static const uint ERR_DROPPED_CONNECTION;
325         [CCode (cname="SMTP_ERR_INVALID_RESPONSE_SYNTAX")]
326         public static const uint ERR_INVALID_RESPONSE_SYNTAX;
327         [CCode (cname="SMTP_ERR_STATUS_MISMATCH")]
328         public static const uint ERR_STATUS_MISMATCH;
329         [CCode (cname="SMTP_ERR_INVALID_RESPONSE_STATUS")]
330         public static const uint ERR_INVALID_RESPONSE_STATUS;
331         [CCode (cname="SMTP_ERR_INVAL")]
332         public static const uint ERR_INVAL;
333         [CCode (cname="SMTP_ERR_EXTENSION_NOT_AVAILABLE")]
334         public static const uint ERR_EXTENSION_NOT_AVAILABLE;
335         [CCode (cname="SMTP_ERR_HOST_NOT_FOUND")]
336         public static const uint ERR_HOST_NOT_FOUND;
337         [CCode (cname="SMTP_ERR_NO_ADDRESS")]
338         public static const uint ERR_NO_ADDRESS;
339         [CCode (cname="SMTP_ERR_NO_RECOVERY")]
340         public static const uint ERR_NO_RECOVERY;
341         [CCode (cname="SMTP_ERR_TRY_AGAIN")]
342         public static const uint ERR_TRY_AGAIN;
343         [CCode (cname="SMTP_ERR_EAI_AGAIN")]
344         public static const uint ERR_EAI_AGAIN;
345         [CCode (cname="SMTP_ERR_EAI_FAIL")]
346         public static const uint ERR_EAI_FAIL;
347         [CCode (cname="SMTP_ERR_EAI_MEMORY")]
348         public static const uint ERR_EAI_MEMORY;
349         [CCode (cname="SMTP_ERR_EAI_ADDRFAMILY")]
350         public static const uint ERR_EAI_ADDRFAMILY;
351         [CCode (cname="SMTP_ERR_EAI_NODATA")]
352         public static const uint ERR_EAI_NODATA;
353         [CCode (cname="SMTP_ERR_EAI_FAMILY")]
354         public static const uint ERR_EAI_FAMILY;
355         [CCode (cname="SMTP_ERR_EAI_BADFLAGS")]
356         public static const uint ERR_EAI_BADFLAGS;
357         [CCode (cname="SMTP_ERR_EAI_NONAME")]
358         public static const uint ERR_EAI_NONAME;
359         [CCode (cname="SMTP_ERR_EAI_SERVICE")]
360         public static const uint ERR_EAI_SERVICE;
361         [CCode (cname="SMTP_ERR_EAI_SOCKTYPE")]
362         public static const uint ERR_EAI_SOCKTYPE;
363         [CCode (cname="SMTP_ERR_UNTERMINATED_RESPONSE")]
364         public static const uint ERR_UNTERMINATED_RESPONSE;
365         [CCode (cname="SMTP_ERR_CLIENT_ERROR")]
366         public static const uint ERR_CLIENT_ERROR;
367         [CCode (cname="SMTP_CB_READING")]
368         public static const uint CB_READING;
369         [CCode (cname="SMTP_CB_WRITING")]
370         public static const uint CB_WRITING;
371         [CCode (cname="SMTP_CB_HEADERS")]
372         public static const uint CB_HEADERS;
374         [CCode (cname="AUTH_USER", cheader_filename="auth-client.h")]
375         public static uint AUTH_USER;
376         [CCode (cname="AUTH_REALM", cheader_filename="auth-client.h")]
377         public static uint AUTH_REALM;
378         [CCode (cname="AUTH_PASS", cheader_filename="auth-client.h")]
379         public static uint AUTH_PASS;
381         [CCode (cname="AUTH_PLUGIN_ANONYMOUS", cheader_filename="auth-client.h")]
382         public static uint AUTH_PLUGIN_ANONYMOUS;
383         [CCode (cname="AUTH_PLUGIN_PLAIN", cheader_filename="auth-client.h")]
384         public static uint AUTH_PLUGIN_PLAIN;
385         [CCode (cname="AUTH_PLUGIN_EXTERNAL", cheader_filename="auth-client.h")]
386         public static uint AUTH_PLUGIN_EXTERNAL;