view src/pop3/client.h @ 3384:3b75956d20c4 HEAD

Added configurable logging for login process. Added configurable pop3 logout string. Based on a patch by Andrey Panin.
author Timo Sirainen <tss@iki.fi>
date Sat, 14 May 2005 23:32:03 +0300
parents 96a4ab34c8f1
children aeb424e64f24
line wrap: on
line source

#ifndef __CLIENT_H
#define __CLIENT_H

struct client;
struct mail_storage;

typedef void command_func_t(struct client *client);

struct client {
	int socket;
	struct io *io;
	struct istream *input;
	struct ostream *output;

	command_func_t *cmd;
	void *cmd_context;

	struct mail_storage *storage;
	struct mailbox *mailbox;
	struct mailbox_transaction_context *trans;

	time_t last_input, last_output;
	unsigned int bad_counter;

	unsigned int uid_validity;
	unsigned int messages_count;
	unsigned int deleted_count;
	uoff_t *message_sizes;
	uoff_t total_size;
	uoff_t deleted_size;
	uint32_t last_seen;

	uoff_t top_bytes;
	uoff_t retr_bytes;
	unsigned int top_count;
	unsigned int retr_count;

	uoff_t *byte_counter;
	uoff_t byte_counter_offset;

	unsigned char *deleted_bitmask;

	unsigned int deleted:1;
	unsigned int waiting_input:1;
};

/* Create new client with specified input/output handles. socket specifies
   if the handle is a socket. */
struct client *client_create(int hin, int hout, struct mail_storage *storage);
void client_destroy(struct client *client, const char *reason);

/* Disconnect client connection */
void client_disconnect(struct client *client, const char *reason);

/* Send a line of data to client */
int client_send_line(struct client *client, const char *fmt, ...)
	__attr_format__(2, 3);
void client_send_storage_error(struct client *client);

void clients_init(void);
void clients_deinit(void);

#endif