client.h revision c49a19168dab6fda80aee16ad799a8a56d3bc18f
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz#ifndef __CLIENT_H
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz#define __CLIENT_H
630c1df5b6aaec452b0ef040df56cffd978fe9c3Timo Sirainen
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz#include "network.h"
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz#include "master.h"
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz#include "client-common.h"
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz#include "auth-client.h"
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarzstruct pop3_client {
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct client common;
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz time_t created;
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz int refcount;
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
1265ab7fdd2e88a1f4b1057593c5e0dbe3fb757aMichael M Slusarz struct io *io;
1265ab7fdd2e88a1f4b1057593c5e0dbe3fb757aMichael M Slusarz struct istream *input;
1265ab7fdd2e88a1f4b1057593c5e0dbe3fb757aMichael M Slusarz struct ostream *output;
1265ab7fdd2e88a1f4b1057593c5e0dbe3fb757aMichael M Slusarz
1265ab7fdd2e88a1f4b1057593c5e0dbe3fb757aMichael M Slusarz time_t last_input;
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz unsigned int bad_counter;
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz char *last_user;
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz char *apop_challenge;
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct auth_connect_id auth_id;
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz unsigned int tls:1;
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz unsigned int secured:1;
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz unsigned int authenticating:1;
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz unsigned int auth_connected:1;
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz unsigned int destroyed:1;
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz};
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarzvoid client_destroy(struct pop3_client *client, const char *reason);
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarzvoid client_send_line(struct pop3_client *client, const char *line);
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarzint client_read(struct pop3_client *client);
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarzvoid client_input(void *context);
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarzvoid client_ref(struct pop3_client *client);
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarzint client_unref(struct pop3_client *client);
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarzvoid clients_init(void);
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarzvoid clients_deinit(void);
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz#endif
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz