-
Notifications
You must be signed in to change notification settings - Fork 0
/
structuresonly.d
4460 lines (3671 loc) · 166 KB
/
structuresonly.d
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
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
enum no_argument =0;
enum required_argument =1;
enum optional_argument =2;
struct option {
/*const */char *name;
int has_arg;
int *flag;
int val;
}
struct mailstream_ssl_context
{
int fd;
static if(USE_SSL==1)
{
static if(USE_GNUTLS!=1)
{
//SSL_CTX * openssl_ssl_ctx;
void *openssl_ssl_ctx;
//X509* client_x509;
void* client_x509;
//EVP_PKEY *client_pkey;
void* *client_pkey;
}
else
{
gnutls_session session;
gnutls_x509_crt client_x509;
gnutls_x509_privkey client_pkey;
gnutls_certificate_credentials_t gnutls_credentials;
}
}
}
struct mailengine
{
mailprivacy * privacy;
static if (LIBETPAN_REENTRANT==1)
{
static if( (HAVE_PTHREAD_H==1) && (IGNORE_PTHREAD_H!=1))
{
pthread_mutex_t storage_hash_lock;
}
}
chash * storage_hash;
}
struct db_session_state_data {
char db_filename[PATH_MAX];
mail_flags_store * db_flags_store;
}
struct db_mailstorage {
char * db_pathname;
};
struct maildir_session_state_data {
maildir * md_session;
mail_flags_store * md_flags_store;
}
enum {
MAILDIRDRIVER_CACHED_SET_CACHE_DIRECTORY = 1,
MAILDIRDRIVER_CACHED_SET_FLAGS_DIRECTORY
};
struct maildir_cached_session_state_data {
mailsession * md_ancestor;
char * md_quoted_mb;
mail_flags_store * md_flags_store;
char[PATH_MAX] md_cache_directory;
char[PATH_MAX] md_flags_directory;
}
struct maildir_mailstorage {
char * md_pathname;
int md_cached;
char * md_cache_directory;
char * md_flags_directory;
}
enum {
POP3DRIVER_SET_AUTH_TYPE = 1
}
enum {
POP3DRIVER_AUTH_TYPE_PLAIN = 0,
POP3DRIVER_AUTH_TYPE_APOP,
POP3DRIVER_AUTH_TYPE_TRY_APOP
}
struct pop3_session_state_data
{
int pop3_auth_type;
mailpop3 * pop3_session;
void function(mailstream_ssl_context * ssl_context, void * data) pop3_ssl_callback;
void * pop3_ssl_cb_data;
}
enum {
/* the mapping of the parameters should be the same as for pop3 */
POP3DRIVER_CACHED_SET_AUTH_TYPE = 1,
POP3DRIVER_CACHED_SET_SSL_CALLBACK = 2,
POP3DRIVER_CACHED_SET_SSL_CALLBACK_DATA = 3,
/* cache specific */
POP3DRIVER_CACHED_SET_CACHE_DIRECTORY = 1001,
POP3DRIVER_CACHED_SET_FLAGS_DIRECTORY = 1002
}
struct pop3_cached_session_state_data {
mailsession * pop3_ancestor;
char pop3_cache_directory[PATH_MAX];
char pop3_flags_directory[PATH_MAX];
chash * pop3_flags_hash;
carray * pop3_flags_array;
mail_flags_store * pop3_flags_store;
}
struct pop3_mailstorage {
char * pop3_servername;
uint16_t pop3_port;
char * pop3_command;
int pop3_connection_type;
int pop3_auth_type;
char * pop3_login; /* deprecated */
char * pop3_password; /* deprecated */
int pop3_cached;
char * pop3_cache_directory;
char * pop3_flags_directory;
struct pop3_sasl_t {
int sasl_enabled;
char * sasl_auth_type;
char * sasl_server_fqdn;
char * sasl_local_ip_port;
char * sasl_remote_ip_port;
char * sasl_login;
char * sasl_auth_name;
char * sasl_password;
char * sasl_realm;
}
pop3_sasl_t pop3_sasl;
char * pop3_local_address;
uint16_t pop3_local_port;
}
/* this is the type of POP3 authentication */
enum {
POP3_AUTH_TYPE_PLAIN, /* plain text authentication */
POP3_AUTH_TYPE_APOP, /* APOP authentication */
POP3_AUTH_TYPE_TRY_APOP, /* first, try APOP, if it fails,
try plain text */
POP3_AUTH_TYPE_SASL_ANONYMOUS, /* SASL anonymous */
POP3_AUTH_TYPE_SASL_CRAM_MD5, /* SASL CRAM MD5 */
POP3_AUTH_TYPE_SASL_KERBEROS_V4, /* SASL KERBEROS V4 */
POP3_AUTH_TYPE_SASL_PLAIN, /* SASL plain */
POP3_AUTH_TYPE_SASL_SCRAM_MD5, /* SASL SCRAM MD5 */
POP3_AUTH_TYPE_SASL_GSSAPI, /* SASL GSSAPI */
POP3_AUTH_TYPE_SASL_DIGEST_MD5 /* SASL digest MD5 */
};
enum POP3_SASL_AUTH_TYPE_APOP="X-LIBETPAN-APOP";
enum POP3_SASL_AUTH_TYPE_TRY_APOP="X-LIBETPAN-TRY-APOP";
struct mh_session_state_data {
mailmh * mh_session;
mailmh_folder * mh_cur_folder;
clist * mh_subscribed_list;
}
enum {
MHDRIVER_CACHED_SET_CACHE_DIRECTORY = 1,
MHDRIVER_CACHED_SET_FLAGS_DIRECTORY
}
struct mh_cached_session_state_data {
mailsession * mh_ancestor;
char * mh_quoted_mb;
char mh_cache_directory[PATH_MAX];
char mh_flags_directory[PATH_MAX];
mail_flags_store * mh_flags_store;
}
struct mh_mailstorage {
char * mh_pathname;
int mh_cached;
char * mh_cache_directory;
char * mh_flags_directory;
}
enum {
NNTPDRIVER_SET_MAX_ARTICLES = 1
};
struct nntp_session_state_data {
newsnntp * nntp_session;
char * nntp_userid;
char * nntp_password;
newsnntp_group_info * nntp_group_info;
char * nntp_group_name;
clist * nntp_subscribed_list;
uint32_t nntp_max_articles;
int nntp_mode_reader;
};
enum {
NNTPDRIVER_CACHED_SET_MAX_ARTICLES = 1,
NNTPDRIVER_CACHED_SET_CACHE_DIRECTORY,
NNTPDRIVER_CACHED_SET_FLAGS_DIRECTORY
};
struct nntp_cached_session_state_data {
mailsession * nntp_ancestor;
char nntp_cache_directory[PATH_MAX];
char nntp_flags_directory[PATH_MAX];
mail_flags_store * nntp_flags_store;
}
struct nntp_mailstorage {
char * nntp_servername;
uint16_t nntp_port;
char * nntp_command;
int nntp_connection_type;
int nntp_auth_type;
char * nntp_login;
char * nntp_password;
int nntp_cached;
char * nntp_cache_directory;
char * nntp_flags_directory;
char * nntp_local_address;
uint16_t nntp_local_port;
};
/* this is the type of NNTP authentication */
enum {
NNTP_AUTH_TYPE_PLAIN /* plain text authentication */
};
struct imap_session_state_data {
mailimap * imap_session;
char * imap_mailbox;
mail_flags_store * imap_flags_store;
void function(mailstream_ssl_context * ssl_context, void * data) imap_ssl_callback;
void * imap_ssl_cb_data;
};
enum {
IMAP_SECTION_MESSAGE,
IMAP_SECTION_HEADER,
IMAP_SECTION_MIME,
IMAP_SECTION_BODY
};
/* cached IMAP driver for session */
enum {
IMAPDRIVER_CACHED_SET_SSL_CALLBACK = 1,
IMAPDRIVER_CACHED_SET_SSL_CALLBACK_DATA = 2,
/* cache */
IMAPDRIVER_CACHED_SET_CACHE_DIRECTORY = 1001
};
struct imap_cached_session_state_data {
mailsession * imap_ancestor;
char * imap_quoted_mb;
char imap_cache_directory[PATH_MAX];
carray * imap_uid_list;
uint32_t imap_uidvalidity;
};
struct imap_mailstorage {
char * imap_servername;
uint16_t imap_port;
char * imap_command;
int imap_connection_type;
int imap_auth_type;
char * imap_login; /* deprecated */
char * imap_password; /* deprecated */
int imap_cached;
char * imap_cache_directory;
struct imap_sasl_t
{
int sasl_enabled;
char * sasl_auth_type;
char * sasl_server_fqdn;
char * sasl_local_ip_port;
char * sasl_remote_ip_port;
char * sasl_login;
char * sasl_auth_name;
char * sasl_password;
char * sasl_realm;
}
imap_sasl_t imap_sasl;
char * imap_local_address;
uint16_t imap_local_port;
};
/* this is the type of IMAP4rev1 authentication */
enum {
IMAP_AUTH_TYPE_PLAIN, /* plain text authentication */
IMAP_AUTH_TYPE_SASL_ANONYMOUS, /* SASL anonymous */
IMAP_AUTH_TYPE_SASL_CRAM_MD5, /* SASL CRAM MD5 */
IMAP_AUTH_TYPE_SASL_KERBEROS_V4, /* SASL KERBEROS V4 */
IMAP_AUTH_TYPE_SASL_PLAIN, /* SASL plain */
IMAP_AUTH_TYPE_SASL_SCRAM_MD5, /* SASL SCRAM MD5 */
IMAP_AUTH_TYPE_SASL_GSSAPI, /* SASL GSSAPI */
IMAP_AUTH_TYPE_SASL_DIGEST_MD5 /* SASL digest MD5 */
};
struct feed_session_state_data {
time_t feed_last_update;
newsfeed * feed_session;
int feed_error;
};
struct feed_mailstorage {
char * feed_url;
int feed_cached;
char * feed_cache_directory;
char * feed_flags_directory;
}
enum {
MBOXDRIVER_SET_READ_ONLY = 1,
MBOXDRIVER_SET_NO_UID
}
struct mbox_session_state_data {
mailmbox_folder * mbox_folder;
int mbox_force_read_only;
int mbox_force_no_uid;
}
/* cached version */
enum {
/* the mapping of the parameters should be the same as for mbox */
MBOXDRIVER_CACHED_SET_READ_ONLY = 1,
MBOXDRIVER_CACHED_SET_NO_UID,
/* cache specific */
MBOXDRIVER_CACHED_SET_CACHE_DIRECTORY,
MBOXDRIVER_CACHED_SET_FLAGS_DIRECTORY
}
struct mbox_cached_session_state_data {
mailsession * mbox_ancestor;
char * mbox_quoted_mb;
char mbox_cache_directory[PATH_MAX];
char mbox_flags_directory[PATH_MAX];
mail_flags_store * mbox_flags_store;
}
struct mbox_mailstorage {
char * mbox_pathname;
int mbox_cached;
char * mbox_cache_directory;
char * mbox_flags_directory;
}
enum {
MAIL_THREAD_REFERENCES, /* this is threading using
References fields only) */
MAIL_THREAD_REFERENCES_NO_SUBJECT, /* this is threading using References
fields, then subject */
MAIL_THREAD_ORDEREDSUBJECT, /* this is threading using only subject */
MAIL_THREAD_NONE /* no thread */
}
struct mail_flags_store {
carray * fls_tab;
chash * fls_hash;
};
struct mailstorage_driver {
char * sto_name;
int function(mailstorage * storage) sto_connect;
int function(mailstorage * storage, char * pathname, mailsession ** result) sto_get_folder_session;
void function(mailstorage * storage) sto_uninitialize;
}
struct mailstorage {
char * sto_id;
void * sto_data;
mailsession * sto_session;
mailstorage_driver * sto_driver;
clist * sto_shared_folders; /* list of (struct mailfolder *) */
void * sto_user_data;
}
struct mailfolder {
char * fld_pathname;
char * fld_virtual_name;
mailstorage * fld_storage;
mailsession * fld_session;
int fld_shared_session;
clistiter * fld_pos;
mailfolder * fld_parent;
uint fld_sibling_index;
carray * fld_children; /* array of (struct mailfolder *) */
void * fld_user_data;
}
enum {
CONNECTION_TYPE_PLAIN, /* when the connection is plain text */
CONNECTION_TYPE_STARTTLS, /* when the connection is first plain,
then, we want to switch to
TLS (secure connection) */
CONNECTION_TYPE_TRY_STARTTLS, /* the connection is first plain,
then, we will try to switch to TLS */
CONNECTION_TYPE_TLS, /* the connection is over TLS */
CONNECTION_TYPE_COMMAND, /* the connection is over a shell command */
CONNECTION_TYPE_COMMAND_STARTTLS, /* the connection is over a shell
command and STARTTLS will be used */
CONNECTION_TYPE_COMMAND_TRY_STARTTLS, /* the connection is over
a shell command and STARTTLS will
be tried */
CONNECTION_TYPE_COMMAND_TLS /* the connection is over a shell
command in TLS */
}
enum {
MAIL_NO_ERROR = 0,
MAIL_NO_ERROR_AUTHENTICATED,
MAIL_NO_ERROR_NON_AUTHENTICATED,
MAIL_ERROR_NOT_IMPLEMENTED,
MAIL_ERROR_UNKNOWN,
MAIL_ERROR_CONNECT,
MAIL_ERROR_BAD_STATE,
MAIL_ERROR_FILE,
MAIL_ERROR_STREAM,
MAIL_ERROR_LOGIN,
MAIL_ERROR_CREATE, /* 10 */
MAIL_ERROR_DELETE,
MAIL_ERROR_LOGOUT,
MAIL_ERROR_NOOP,
MAIL_ERROR_RENAME,
MAIL_ERROR_CHECK,
MAIL_ERROR_EXAMINE,
MAIL_ERROR_SELECT,
MAIL_ERROR_MEMORY,
MAIL_ERROR_STATUS,
MAIL_ERROR_SUBSCRIBE, /* 20 */
MAIL_ERROR_UNSUBSCRIBE,
MAIL_ERROR_LIST,
MAIL_ERROR_LSUB,
MAIL_ERROR_APPEND,
MAIL_ERROR_COPY,
MAIL_ERROR_FETCH,
MAIL_ERROR_STORE,
MAIL_ERROR_SEARCH,
MAIL_ERROR_DISKSPACE,
MAIL_ERROR_MSG_NOT_FOUND, /* 30 */
MAIL_ERROR_PARSE,
MAIL_ERROR_INVAL,
MAIL_ERROR_PART_NOT_FOUND,
MAIL_ERROR_REMOVE,
MAIL_ERROR_FOLDER_NOT_FOUND,
MAIL_ERROR_MOVE,
MAIL_ERROR_STARTTLS,
MAIL_ERROR_CACHE_MISS,
MAIL_ERROR_NO_TLS,
MAIL_ERROR_EXPUNGE, /* 40 */
/* misc errors */
MAIL_ERROR_MISC,
MAIL_ERROR_PROTOCOL,
MAIL_ERROR_CAPABILITY,
MAIL_ERROR_CLOSE,
MAIL_ERROR_FATAL,
MAIL_ERROR_READONLY,
MAIL_ERROR_NO_APOP,
MAIL_ERROR_COMMAND_NOT_SUPPORTED,
MAIL_ERROR_NO_PERMISSION,
MAIL_ERROR_PROGRAM_ERROR, /* 50 */
MAIL_ERROR_SUBJECT_NOT_FOUND,
MAIL_ERROR_CHAR_ENCODING_FAILED,
MAIL_ERROR_SEND,
MAIL_ERROR_COMMAND,
MAIL_ERROR_SYSTEM,
MAIL_ERROR_UNABLE,
MAIL_ERROR_FOLDER,
MAIL_ERROR_SSL
}
struct mailmessage_list {
carray * msg_tab; /* elements are (mailmessage *) */
}
struct mail_list {
clist * mb_list; /* elements are (char *) */
};
mail_list * mail_list_new(clist * mb_list);
void mail_list_free(mail_list * resp);
enum {
MAIL_FLAG_NEW = 1 << 0,
MAIL_FLAG_SEEN = 1 << 1,
MAIL_FLAG_FLAGGED = 1 << 2,
MAIL_FLAG_DELETED = 1 << 3,
MAIL_FLAG_ANSWERED = 1 << 4,
MAIL_FLAG_FORWARDED = 1 << 5,
MAIL_FLAG_CANCELLED = 1 << 6
}
struct mail_flags {
uint32_t fl_flags;
clist * fl_extension; /* elements are (char *) */
}
enum {
MAIL_SEARCH_KEY_ALL, /* all messages correspond */
MAIL_SEARCH_KEY_ANSWERED, /* messages with flag \Answered */
MAIL_SEARCH_KEY_BCC, /* messages which Bcc field contains
a given string */
MAIL_SEARCH_KEY_BEFORE, /* messages which internal date is earlier
than the specified date */
MAIL_SEARCH_KEY_BODY, /* message that contains the given string
(in header and text parts) */
MAIL_SEARCH_KEY_CC, /* messages whose Cc field contains the
given string */
MAIL_SEARCH_KEY_DELETED, /* messages with the flag \Deleted */
MAIL_SEARCH_KEY_FLAGGED, /* messages with the flag \Flagged */
MAIL_SEARCH_KEY_FROM, /* messages whose From field contains the
given string */
MAIL_SEARCH_KEY_NEW, /* messages with the flag \Recent and not
the \Seen flag */
MAIL_SEARCH_KEY_OLD, /* messages that do not have the
\Recent flag set */
MAIL_SEARCH_KEY_ON, /* messages whose internal date is the
specified date */
MAIL_SEARCH_KEY_RECENT, /* messages with the flag \Recent */
MAIL_SEARCH_KEY_SEEN, /* messages with the flag \Seen */
MAIL_SEARCH_KEY_SINCE, /* messages whose internal date is later
than specified date */
MAIL_SEARCH_KEY_SUBJECT, /* messages whose Subject field contains the
given string */
MAIL_SEARCH_KEY_TEXT, /* messages whose text part contains the
given string */
MAIL_SEARCH_KEY_TO, /* messages whose To field contains the
given string */
MAIL_SEARCH_KEY_UNANSWERED, /* messages with no flag \Answered */
MAIL_SEARCH_KEY_UNDELETED, /* messages with no flag \Deleted */
MAIL_SEARCH_KEY_UNFLAGGED, /* messages with no flag \Flagged */
MAIL_SEARCH_KEY_UNSEEN, /* messages with no flag \Seen */
MAIL_SEARCH_KEY_HEADER, /* messages whose given field
contains the given string */
MAIL_SEARCH_KEY_LARGER, /* messages whose size is larger then
the given size */
MAIL_SEARCH_KEY_NOT, /* not operation of the condition */
MAIL_SEARCH_KEY_OR, /* or operation between two conditions */
MAIL_SEARCH_KEY_SMALLER, /* messages whose size is smaller than
the given size */
MAIL_SEARCH_KEY_MULTIPLE /* the boolean operator between the
conditions is AND */
}
struct mailsession_driver {
char * sess_name;
int function(mailsession * session) sess_initialize;
void function(mailsession * session) sess_uninitialize;
int function(mailsession * session, int id, void * value) sess_parameters;
int function(mailsession * session, mailstream * s) sess_connect_stream;
int function(mailsession * session, const char * path) sess_connect_path;
int function(mailsession * session) sess_starttls;
int function(mailsession * session, const char * userid, const char * password) sess_login;
int function(mailsession * session) sess_logout;
int function(mailsession * session) sess_noop;
int function(mailsession * session, const char * mb, const char * name, char ** result) sess_build_folder_name;
int function(mailsession * session, const char * mb) sess_create_folder;
int function(mailsession * session, const char * mb) sess_delete_folder;
int function(mailsession * session, const char * mb, const char * new_name) sess_rename_folder;
int function(mailsession * session) sess_check_folder;
int function(mailsession * session, const char * mb) sess_examine_folder;
int function(mailsession * session, const char * mb) sess_select_folder;
int function(mailsession * session) sess_expunge_folder;
int function(mailsession * session, const char * mb, uint32_t * result_num, uint32_t * result_recent, uint32_t * result_unseen) sess_status_folder;
int function(mailsession * session, const char * mb, uint32_t * result) sess_messages_number;
int function(mailsession * session, const char * mb, uint32_t * result) sess_recent_number;
int function(mailsession * session, const char * mb, uint32_t * result) sess_unseen_number;
int function(mailsession * session, const char * mb, mail_list ** result) sess_list_folders;
int function(mailsession * session, const char * mb, mail_list ** result) sess_lsub_folders;
int function(mailsession * session, const char * mb) sess_subscribe_folder;
int function(mailsession * session, const char * mb) sess_unsubscribe_folder;
int function(mailsession * session, const char * message, size_t size) sess_append_message;
int function(mailsession * session, const char * message, size_t size, mail_flags * flags) sess_append_message_flags;
int function(mailsession * session, uint32_t num, const char * mb) sess_copy_message;
int function(mailsession * session, uint32_t num, const char * mb) sess_move_message;
int function(mailsession * session, uint32_t num, mailmessage ** result) sess_get_message;
int function(mailsession * session, const char * uid, mailmessage ** result) sess_get_message_by_uid;
int function(mailsession * session, mailmessage_list ** result) sess_get_messages_list;
int function(mailsession * session, mailmessage_list * env_list) sess_get_envelopes_list;
int function(mailsession * session, uint32_t num) sess_remove_message;
int function(mailsession * session, const char * auth_type, const char * server_fqdn, const char * local_ip_port, const char * remote_ip_port, const char * login, const char * auth_name, const char * password, const char * realm) sess_login_sasl;
}
struct mailsession {
void * sess_data;
mailsession_driver * sess_driver;
}
struct mailmessage_driver
{
char * msg_name;
int function(mailmessage * msg_info) msg_initialize;
void function(mailmessage * msg_info) msg_uninitialize;
void function(mailmessage * msg_info) msg_flush;
void function(mailmessage * msg_info) msg_check;
void function(mailmessage * msg_info, char * msg) msg_fetch_result_free;
int function(mailmessage * msg_info, char ** result, size_t * result_len) msg_fetch;
int function(mailmessage * msg_info, char ** result, size_t * result_len) msg_fetch_header;
int function(mailmessage * msg_info, char ** result, size_t * result_len) msg_fetch_body;
int function(mailmessage * msg_info, size_t * result) msg_fetch_size;
int function(mailmessage * msg_info, mailmime ** result) msg_get_bodystructure;
int function(mailmessage * msg_info, mailmime * mime, char ** result, size_t * result_len) msg_fetch_section;
int function(mailmessage * msg_info, mailmime * mime, char ** result, size_t * result_len) msg_fetch_section_header;
int function(mailmessage * msg_info, mailmime * mime, char ** result, size_t * result_len) msg_fetch_section_mime;
int function(mailmessage * msg_info, mailmime * mime, char ** result, size_t * result_len) msg_fetch_section_body;
int function(mailmessage * msg_info, mailimf_fields ** result) msg_fetch_envelope;
int function(mailmessage * msg_info, mail_flags ** result) msg_get_flags;
}
struct mailmessage {
mailsession * msg_session;
mailmessage_driver * msg_driver;
uint32_t msg_index;
char * msg_uid;
size_t msg_size;
mailimf_fields * msg_fields;
mail_flags * msg_flags;
int msg_resolved;
mailimf_single_fields msg_single_fields;
mailmime * msg_mime;
int msg_cached;
void * msg_data;
void * msg_folder;
void * msg_user_data;
}
struct mailmessage_tree {
mailmessage_tree * node_parent;
char * node_msgid;
time_t node_date;
mailmessage * node_msg;
carray * node_children; /* array of (struct mailmessage_tree *) */
int node_is_reply;
char * node_base_subject;
}
mailmessage_tree * mailmessage_tree_new(char * node_msgid, time_t node_date, mailmessage * node_msg);
void mailmessage_tree_free(mailmessage_tree *tree);
void mailmessage_tree_free_recursive(mailmessage_tree * tree);
struct generic_message_t {
int function(mailmessage * msg_info) msg_prefetch;
void function(generic_message_t * msg) * msg_prefetch_free;
int msg_fetched;
char * msg_message;
size_t msg_length;
void * msg_data;
};
enum {
NEWSNNTP_NO_ERROR = 0,
NEWSNNTP_WARNING_REQUEST_AUTHORIZATION_USERNAME=1, /* DEPRECATED, use ERROR instead */
NEWSNNTP_ERROR_REQUEST_AUTHORIZATION_USERNAME=1,
NEWSNNTP_WARNING_REQUEST_AUTHORIZATION_PASSWORD,
NEWSNNTP_ERROR_STREAM,
NEWSNNTP_ERROR_UNEXPECTED,
NEWSNNTP_ERROR_NO_NEWSGROUP_SELECTED,
NEWSNNTP_ERROR_NO_ARTICLE_SELECTED,
NEWSNNTP_ERROR_INVALID_ARTICLE_NUMBER,
NEWSNNTP_ERROR_ARTICLE_NOT_FOUND,
NEWSNNTP_ERROR_UNEXPECTED_RESPONSE,
NEWSNNTP_ERROR_INVALID_RESPONSE,
NEWSNNTP_ERROR_NO_SUCH_NEWS_GROUP,
NEWSNNTP_ERROR_POSTING_NOT_ALLOWED,
NEWSNNTP_ERROR_POSTING_FAILED,
NEWSNNTP_ERROR_PROGRAM_ERROR,
NEWSNNTP_ERROR_NO_PERMISSION,
NEWSNNTP_ERROR_COMMAND_NOT_UNDERSTOOD,
NEWSNNTP_ERROR_COMMAND_NOT_SUPPORTED,
NEWSNNTP_ERROR_CONNECTION_REFUSED,
NEWSNNTP_ERROR_MEMORY,
NEWSNNTP_ERROR_AUTHENTICATION_REJECTED,
NEWSNNTP_ERROR_BAD_STATE,
NEWSNNTP_ERROR_SSL,
NEWSNNTP_ERROR_AUTHENTICATION_OUT_OF_SEQUENCE,
};
struct newsnntp
{
mailstream * nntp_stream;
int nntp_readonly;
size_t nntp_progr_rate;
progress_function * nntp_progr_fun;
MMAPString * nntp_stream_buffer;
MMAPString * nntp_response_buffer;
char * nntp_response;
time_t nntp_timeout;
void function(newsnntp * session, int log_type, const char * str, size_t size, void * context) nntp_logger;
void * nntp_logger_context;
mailprogress_function * nntp_progress_fun;
void * nntp_progress_context;
};
struct newsnntp_group_info
{
char * grp_name;
uint32_t grp_first;
uint32_t grp_last;
uint32_t grp_count;
char grp_type;
};
struct newsnntp_group_time {
char * grp_name;
time_t grp_date;
char * grp_email;
};
struct newsnntp_distrib_value_meaning {
char * dst_value;
char * dst_meaning;
};
struct newsnntp_distrib_default_value {
uint32_t dst_weight;
char * dst_group_pattern;
char * dst_value;
};
struct newsnntp_group_description {
char * grp_name;
char * grp_description;
};
struct newsnntp_xhdr_resp_item {
uint32_t hdr_article;
char * hdr_value;
};
struct newsnntp_xover_resp_item {
uint32_t ovr_article;
char * ovr_subject;
char * ovr_author;
char * ovr_date;
char * ovr_message_id;
char * ovr_references;
size_t ovr_size;
uint32_t ovr_line_count;
clist * ovr_others;
}
enum {
MAILPOP3_NO_ERROR = 0,
MAILPOP3_ERROR_BAD_STATE,
MAILPOP3_ERROR_UNAUTHORIZED,
MAILPOP3_ERROR_STREAM,
MAILPOP3_ERROR_DENIED,
MAILPOP3_ERROR_BAD_USER,
MAILPOP3_ERROR_BAD_PASSWORD,
MAILPOP3_ERROR_CANT_LIST,
MAILPOP3_ERROR_NO_SUCH_MESSAGE,
MAILPOP3_ERROR_MEMORY,
MAILPOP3_ERROR_CONNECTION_REFUSED,
MAILPOP3_ERROR_APOP_NOT_SUPPORTED,
MAILPOP3_ERROR_CAPA_NOT_SUPPORTED,
MAILPOP3_ERROR_STLS_NOT_SUPPORTED,
MAILPOP3_ERROR_SSL,
MAILPOP3_ERROR_QUIT_FAILED
};
struct mailpop3
{
char * pop3_response; /* response message */
char * pop3_timestamp; /* connection timestamp */
/* internals */
mailstream * pop3_stream;
size_t pop3_progr_rate;
progress_function * pop3_progr_fun;
MMAPString * pop3_stream_buffer; /* buffer for lines reading */
MMAPString * pop3_response_buffer; /* buffer for responses */
carray * pop3_msg_tab; /* list of pop3_msg_info structures */
int pop3_state; /* state */
uint pop3_deleted_count;
struct pop3_sasl_t {
void * sasl_conn;
const char * sasl_server_fqdn;
const char * sasl_login;
const char * sasl_auth_name;
const char * sasl_password;
const char * sasl_realm;
void * sasl_secret;
}
pop3_sasl_t pop3_sasl;
time_t pop3_timeout;
mailprogress_function * pop3_progress_fun;
void * pop3_progress_context;
void function(mailpop3 * session, int log_type, const char * str, size_t size, void * context) pop3_logger;
void * pop3_logger_context;
};
struct mailpop3_msg_info
{
uint msg_index;
uint32_t msg_size;
char * msg_uidl;
int msg_deleted;
};
struct mailpop3_capa_t {
char * cap_name;
clist * cap_param; /* (char *) */
}
struct mailpop3_stat_response {
uint msgs_count;
size_t msgs_size;
}
enum {
MAILMIME_COMPOSITE_TYPE_ERROR,
MAILMIME_COMPOSITE_TYPE_MESSAGE,
MAILMIME_COMPOSITE_TYPE_MULTIPART,
MAILMIME_COMPOSITE_TYPE_EXTENSION
};
struct mailmime_composite_type {
int ct_type;
char * ct_token;
}
struct mailmime_content {
mailmime_type * ct_type;
char * ct_subtype;
clist * ct_parameters; /* elements are (struct mailmime_parameter *) */
}
enum {
MAILMIME_DISCRETE_TYPE_ERROR,
MAILMIME_DISCRETE_TYPE_TEXT,
MAILMIME_DISCRETE_TYPE_IMAGE,
MAILMIME_DISCRETE_TYPE_AUDIO,
MAILMIME_DISCRETE_TYPE_VIDEO,
MAILMIME_DISCRETE_TYPE_APPLICATION,
MAILMIME_DISCRETE_TYPE_EXTENSION
};
struct mailmime_discrete_type {
int dt_type;
char * dt_extension;
}
enum {
MAILMIME_FIELD_NONE,
MAILMIME_FIELD_TYPE,
MAILMIME_FIELD_TRANSFER_ENCODING,
MAILMIME_FIELD_ID,
MAILMIME_FIELD_DESCRIPTION,
MAILMIME_FIELD_VERSION,
MAILMIME_FIELD_DISPOSITION,
MAILMIME_FIELD_LANGUAGE,
MAILMIME_FIELD_LOCATION
}
struct mailmime_field {
int fld_type;
union fld_data_t {
mailmime_content * fld_content;
mailmime_mechanism * fld_encoding;
char * fld_id;
char * fld_description;
uint32_t fld_version;
mailmime_disposition * fld_disposition;
mailmime_language * fld_language;
char * fld_location;
}
fld_data_t fld_data;
}
enum {
MAILMIME_MECHANISM_ERROR,
MAILMIME_MECHANISM_7BIT,
MAILMIME_MECHANISM_8BIT,
MAILMIME_MECHANISM_BINARY,
MAILMIME_MECHANISM_QUOTED_PRINTABLE,
MAILMIME_MECHANISM_BASE64,
MAILMIME_MECHANISM_TOKEN
};
struct mailmime_mechanism {
int enc_type;
char * enc_token;
};
struct mailmime_fields {
clist * fld_list; /* list of (struct mailmime_field *) */
};
struct mailmime_parameter {
char * pa_name;
char * pa_value;
};
enum {
MAILMIME_TYPE_ERROR,
MAILMIME_TYPE_DISCRETE_TYPE,
MAILMIME_TYPE_COMPOSITE_TYPE
};
struct mailmime_type
{
int tp_type;
union tp_data_t
{
mailmime_discrete_type * tp_discrete_type;
mailmime_composite_type * tp_composite_type;
}
tp_data_t tp_data;
}
struct mailmime_multipart_body {
clist * bd_list;
};
enum {
MAILMIME_DATA_TEXT,
MAILMIME_DATA_FILE
};
struct mailmime_data {
int dt_type;
int dt_encoding;
int dt_encoded;
union dt_data_t
{
struct dt_text_t