/*****************************************************************************\
* Copyright (c) 2002 Pelle Johansson.                                         *
* All rights reserved.                                                        *
*                                                                             *
* This file is part of the moftpd package. Use and distribution of            *
* this software is governed by the terms in the file LICENCE, which           *
* should have come with this package.                                         *
\*****************************************************************************/

/* $moftpd: accounter.h 1251 2005-03-06 22:24:29Z morth $ */

#ifndef _ACCOUNTER_H
#define _ACCOUNTER_H

#include "server.h"
#include "user.h"

typedef struct accuser
{
  char *name;
  int numLogins;
  struct accuser *next;
} accuser_t;

typedef struct accserver
{
  char *name;
  int numConnects;
  accuser_t *users;
} accserver_t;

typedef struct accounter
{
  int id, sock;
  time_t removed;
  accserver_t *server;
  accuser_t *user;
  char rhost[256], acct[256], email[256];
  char work[4097];
  int sent;
  pid_t pid;
} accounter_t;

accserver_t *find_acc_server (const char *name);
accuser_t *find_acc_user (accserver_t *serv, const char *name);

int start_accounter (void);
void close_accounter (int level);

int connect_accounter (void);

int accounter_accepter (int sock, void *user, int urgent);
int accounter_client_handler (int sock, void *user, int urgent);

int accounter (int sock, const char *format, ...)
     __attribute__((format (printf, 2, 3)));

#endif /*_ACCOUNTER_H*/


syntax highlighted by Code2HTML, v. 0.9.1