Integrate test_header in test_view_mail and various coding style modifications
[rmail.git] / src / network / pop3.h
blobb540cf102eb8ef09d36d93b579592c72720edc1f
1 /*
2 * Copyright (C) 2011 - Roberto Branciforti
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #ifndef POP3_H
21 #define POP3_H
23 #include <polarssl/ssl.h>
24 #include <polarssl/havege.h>
26 #define POP3_BUFSIZE 1000
28 struct pop3_host {
29 int sockfd; /* Socket descriptor */
30 char *name; /* Hostname */
31 char *port; /* Port */
34 #define POP3_AUTH_USERPASS 0
35 #define POP3_AUTH_SSL 1
37 struct pop3_auth_ssl {
38 ssl_context ctx;
39 ssl_session ssn;
40 havege_state hs;
41 x509_cert cert;
44 struct pop3_auth {
45 unsigned int type; /* Authentication type */
47 char *user; /* User name */
48 char *pass; /* Password */
50 struct pop3_auth_ssl ssl;
53 struct pop3_mailbox {
54 struct pop3_host host;
55 struct pop3_auth auth;
56 unsigned int messages; /* Number of messages in maildrop */
59 /* Connection */
60 int pop3_connect(struct pop3_mailbox *mbox);
61 int pop3_disconnect(struct pop3_mailbox *mbox);
63 /* Authentication */
64 int pop3_authenticate(struct pop3_mailbox *mbox);
66 /* Maildrop commands */
67 int pop3_stat(struct pop3_mailbox *mbox);
68 int pop3_list(struct pop3_mailbox *mbox);
69 int pop3_capa(struct pop3_mailbox *mbox);
71 int pop3_top(struct pop3_mailbox *mbox, unsigned int n);
72 int pop3_retr(struct pop3_mailbox *mbox, unsigned int n);
74 #endif /* POP3_H */