Freeciv-3.1
Loading...
Searching...
No Matches
api_fcdb_auth.c
Go to the documentation of this file.
1/*****************************************************************************
2 Freeciv - Copyright (C) 2005 - The Freeciv Project
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12*****************************************************************************/
13
14#ifdef HAVE_CONFIG_H
15#include <fc_config.h>
16#endif
17
18/* utility */
19#include "log.h"
20
21/* common */
22#include "connection.h"
23
24/* common/scriptcore */
25#include "luascript.h"
26
27/* server */
28#include "auth.h"
29
30/* server/scripting */
31#include "script_fcdb.h"
32
33#include "api_fcdb_auth.h"
34
35/**********************************************************************/
38const char *api_auth_get_username(lua_State *L, Connection *pconn)
39{
40 LUASCRIPT_CHECK_STATE(L, NULL);
41 LUASCRIPT_CHECK_SELF(L, pconn, NULL);
42 fc_assert_ret_val(conn_is_valid(pconn), NULL);
43
44 return auth_get_username(pconn);
45}
46
47/**********************************************************************/
50const char *api_auth_get_ipaddr(lua_State *L, Connection *pconn)
51{
52 LUASCRIPT_CHECK_STATE(L, NULL);
53 LUASCRIPT_CHECK_SELF(L, pconn, NULL);
54 fc_assert_ret_val(conn_is_valid(pconn), NULL);
55
56 return auth_get_ipaddr(pconn);
57}
const char * api_auth_get_username(lua_State *L, Connection *pconn)
const char * api_auth_get_ipaddr(lua_State *L, Connection *pconn)
const char * auth_get_username(struct connection *pconn)
Definition auth.c:348
const char * auth_get_ipaddr(struct connection *pconn)
Definition auth.c:358
bool conn_is_valid(const struct connection *pconn)
Definition connection.c:931
#define fc_assert_ret_val(condition, val)
Definition log.h:194
#define LUASCRIPT_CHECK_STATE(L,...)
Definition luascript.h:117
#define LUASCRIPT_CHECK_SELF(L, value,...)
Definition luascript.h:146