summaryrefslogtreecommitdiffstats
path: root/user.h
diff options
context:
space:
mode:
authorFreeArtMan <dos21h@gmail.com>2015-01-11 17:49:03 +0900
committerFreeArtMan <dos21h@gmail.com>2015-01-11 17:49:03 +0900
commit9b3d5f87e7718b00f786531b58bf102cdadc8264 (patch)
tree51c445bbfd347353bcbc1412aaec654819739555 /user.h
parent4e148546810a2902dff9444526e47c9569c79b64 (diff)
downloadmicrobbs-9b3d5f87e7718b00f786531b58bf102cdadc8264.tar.gz
microbbs-9b3d5f87e7718b00f786531b58bf102cdadc8264.zip
Added primitive authentification support
Diffstat (limited to 'user.h')
-rw-r--r--user.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/user.h b/user.h
new file mode 100644
index 0000000..60ddaa5
--- /dev/null
+++ b/user.h
@@ -0,0 +1,54 @@
+#ifndef __MICROBBS_USER_H
+#define __MICROBBS_USER_H
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <dirent.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <termios.h>
+
+#include "kconfig.h"
+#include "sds.h"
+
+#include "libterm/term.h"
+#include "libterm/term_io.h"
+
+#define BBS_USER_GUEST 0
+#define BBS_USER_LOGEDIN 1
+#define BBS_USER_BLOCKED 2
+#define BBS_USER_LOGEDOUT 3
+
+
+#define BBS_USER_UN_SZ 32
+typedef struct bbs_user
+{
+ int login_status;
+ char username[BBS_USER_UN_SZ];
+} bbs_user;
+
+typedef struct user_config_file
+{
+ char *password;
+} user_config_file;
+
+#define BBS_USER_INIT { BBS_USER_GUEST, {0} };
+
+//GLOBAL USER
+#ifdef __MICROBBS_MAIN
+bbs_user g_user = BBS_USER_INIT;
+#else
+extern bbs_user g_user;
+#endif
+
+int bbs_login( term_screen *ts );
+int bbs_login_auth( const char *dir, const char *username, const char *password );
+
+int bbs_user_init( bbs_user *bu );
+int bbs_user_auth( bbs_user *bu );
+int bbs_user_set_status( bbs_user *bu, int status );
+int bbs_user_get_status( bbs_user *bu );
+
+#endif \ No newline at end of file