view src/auth/auth-client-connection.h @ 14681:ca37d1577291

Added o_stream_nsend*() and related functions to make delayed error handling safer. Once o_stream_nsend*() is called, o_stream_nfinish() must be called before stream is destroyed to finish checking if there were any errors. If something failed and the stream is just wanted to be closed, o_stream_ignore_last_errors() can be called. For streams where errors don't really make any difference (network sockets) you can call o_stream_set_no_error_handling() immediately after creating the stream.
author Timo Sirainen <tss@iki.fi>
date Mon, 25 Jun 2012 00:01:59 +0300
parents fd8fc3b7615e
children aa6027a0a78e
line wrap: on
line source

#ifndef AUTH_CLIENT_CONNECTION_H
#define AUTH_CLIENT_CONNECTION_H

#include "master-auth.h"

struct auth_client_connection {
	struct auth_client_connection *prev, *next;
	struct auth *auth;
	int refcount;

	int fd;
	struct io *io;
	struct istream *input;
	struct ostream *output;

	unsigned int pid;
	unsigned int connect_uid;
	uint8_t cookie[MASTER_AUTH_COOKIE_SIZE];
	struct auth_request_handler *request_handler;

	unsigned int login_requests:1;
	unsigned int version_received:1;
};

void auth_client_connection_create(struct auth *auth, int fd,
				   bool login_requests);
void auth_client_connection_destroy(struct auth_client_connection **conn);

struct auth_client_connection *
auth_client_connection_lookup(unsigned int pid);

void auth_client_connections_destroy_all(void);

#endif