/* 
 * Authentication Layer
 * 
 * auth.h
 *
 * Interface to the authentication layer.
 * 
 */

#ifndef _AUTH_H_
#define _AUTH_H_


#define MAX_FILENAME_SIZE 256
#define MAX_USERNAME_SIZE 64
#define MAX_PASSWORD_SIZE 64


/*
 * auth_new: defines an authentication file
 * - filename: the file name with the users data
 *   returns: 0 if success, -1 if not
 */
int auth_new(char *filename);


/*
 * auth_login: authenticate an user
 * - username - the username of the user
 * - password - the password of the user
 *   returns: id (positive integer) if authentication is valid, 0 if not
 */
int auth_login(char *username, char *password);


/*
 * auth_lookup: check if the username exists
 * - username - the username of the user
 *   returns: id (positive integer) if username exists, 0 if not
 */
int auth_lookup(char *username);


/*
 * auth_total_users: gives the total number of users
 *   returns: total number of users
 */
int auth_total_users();


/*
 * auth_dump: dumps the content of users data
 */
void auth_dump();


#endif
