diff options
Diffstat (limited to 'common/eurephia_admin_common.h')
-rw-r--r-- | common/eurephia_admin_common.h | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/common/eurephia_admin_common.h b/common/eurephia_admin_common.h new file mode 100644 index 0000000..7593e2e --- /dev/null +++ b/common/eurephia_admin_common.h @@ -0,0 +1,120 @@ +/* eurephia_admin_common.h -- Common functions used for the admin API + * + * GPLv2 - Copyright (C) 2008 David Sommerseth <dazo@users.sourceforge.net> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; version 2 + * of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef EUREPHIA_ADMIN_COMMON_H_ +# define EUREPHIA_ADMIN_COMMON_H_ + +#define TABLE_USERS 0x01 +#define TABLE_CERTS 0x02 +#define TABLE_LASTLOG 0x03 +#define TABLE_ATTEMPTS 0x04 +#define TABLE_BLACKLIST 0x05 + +#define SORTKEY_NONE 0x00000 +#define SORTKEY_RECID 0x00001 // Primary keys +#define SORTKEY_UID 0x00002 +#define SORTKEY_CERTID 0x00004 +#define SORTKEY_UNAME 0x00008 +#define SORTKEY_ACTIVATED 0x00010 +#define SORTKEY_DEACTIVATED 0x00020 +#define SORTKEY_LASTACCESS 0x00040 + +#define SORTKEY_CERTDEPTH 0x00080 +#define SORTKEY_CNAME 0x00100 +#define SORTKEY_EMAIL 0x00200 +#define SORTKEY_ORG 0x00400 +#define SORTKEY_REGISTERED 0x00800 + +#define SORTKEY_REMOTEIP 0x01000 +#define SORTKEY_VPNIP 0x02000 +#define SORTKEY_ATTEMPTS 0x04000 +#define SORTKEY_LASTATTEMPT 0x08000 + +#define SORTKEY_SESSTATUS 0x10000 +#define SORTKEY_LOGIN 0x20000 +#define SORTKEY_LOGOUT 0x40000 + + +typedef struct { + int tableid; + long sortkeyid; + char *fieldname; +} eFieldMap; + + +eFieldMap eSortkeys_user[] = { + {TABLE_USERS, SORTKEY_RECID, "recid"}, + {TABLE_USERS, SORTKEY_RECID, "uid"}, + {TABLE_USERS, SORTKEY_UNAME, "username"}, + {TABLE_USERS, SORTKEY_ACTIVATED, "activated"}, + {TABLE_USERS, SORTKEY_DEACTIVATED, "deactivated"}, + {TABLE_USERS, SORTKEY_LASTACCESS, "lastaccess"}, + {TABLE_USERS, SORTKEY_NONE, NULL} +}; + +eFieldMap eSortkeys_certificates[] = { + {TABLE_CERTS, SORTKEY_RECID, "recid"}, + {TABLE_CERTS, SORTKEY_RECID, "certid"}, + {TABLE_CERTS, SORTKEY_CERTDEPTH, "depth"}, + {TABLE_CERTS, SORTKEY_CNAME, "name"}, + {TABLE_CERTS, SORTKEY_ORG, "org"}, + {TABLE_CERTS, SORTKEY_EMAIL, "email"}, + {TABLE_CERTS, SORTKEY_REGISTERED, "registered"}, + {TABLE_CERTS, SORTKEY_NONE, NULL} +}; + +eFieldMap eSortkeys_lastlog[] = { + {TABLE_LASTLOG, SORTKEY_UID, "uid"}, + {TABLE_LASTLOG, SORTKEY_CERTID, "certid"}, + {TABLE_LASTLOG, SORTKEY_REMOTEIP, "ip"}, + {TABLE_LASTLOG, SORTKEY_VPNIP, "vpnip"}, + {TABLE_LASTLOG, SORTKEY_SESSTATUS, "status"}, + {TABLE_LASTLOG, SORTKEY_LOGIN, "login"}, + {TABLE_LASTLOG, SORTKEY_LOGOUT, "logout"}, + {TABLE_LASTLOG, SORTKEY_RECID, "recid"}, + {TABLE_LASTLOG, SORTKEY_NONE, NULL} +}; + +eFieldMap eSortkeys_attempts[] = { + {TABLE_ATTEMPTS, SORTKEY_UNAME, "username"}, + {TABLE_ATTEMPTS, SORTKEY_REMOTEIP, "ip"}, + {TABLE_ATTEMPTS, SORTKEY_ATTEMPTS, "attempts"}, + {TABLE_ATTEMPTS, SORTKEY_REGISTERED, "registered"}, + {TABLE_ATTEMPTS, SORTKEY_LASTATTEMPT, "lastattempt"}, + {TABLE_ATTEMPTS, SORTKEY_RECID, "recid"}, + {TABLE_ATTEMPTS, SORTKEY_NONE, NULL} +}; + +eFieldMap eSortkeys_blacklist[] = { + {TABLE_BLACKLIST, SORTKEY_UNAME, "username"}, + {TABLE_BLACKLIST, SORTKEY_REMOTEIP, "ip"}, + {TABLE_BLACKLIST, SORTKEY_REGISTERED, "registered"}, + {TABLE_BLACKLIST, SORTKEY_LASTACCESS, "lastattempt"}, + {TABLE_BLACKLIST, SORTKEY_LASTACCESS, "lastaccessed"}, + {TABLE_BLACKLIST, SORTKEY_RECID, "recid"}, + {TABLE_BLACKLIST, SORTKEY_NONE, NULL} +}; + + +eFieldMap *eAdminGetTableMap(int table); +char *eAdminGetSortKey(int table, const char *str); + + +#endif /* !EUREPHIA_ADMIN_COMMON_H_ */ |