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/*****************************************************************************
15  ADVERTISEMENT: do not attempt to change the name of the API functions.
16  They *must* be compatible between the minor Freeciv versions within the
17  same major version. If you really like to change a function name, be sure
18  to keep also the old one running.
19*****************************************************************************/
20
21$#ifdef HAVE_CONFIG_H
22$#include <fc_config.h>
23$#endif
24
25/* common/scriptcore */
26$#include "luascript_types.h"
27
28/* server/scripting */
29$#include "api_fcdb_auth.h"
30$#include "api_fcdb_base.h"
31$#include "script_fcdb.h"
32
33/* Authentication module. */
34module auth {
35  const char *api_auth_get_username
36    @ get_username(lua_State *L, Connection *pconn);
37  const char *api_auth_get_ipaddr
38    @ get_ipaddr(lua_State *L, Connection *pconn);
39  bool api_auth_set_password
40    @ set_password(lua_State *L, Connection *pconn, const char *password);
41  const char *api_auth_get_password
42    @ get_password(lua_State *L, Connection *pconn);
43}
44
45/* Freeciv database (fcdb) module. */
46module fcdb {
47  module status {
48    enum fcdb_status {
49      FCDB_ERROR @ ERROR,
50      FCDB_SUCCESS_TRUE @ TRUE,
51      FCDB_SUCCESS_FALSE @ FALSE
52    };
53  }
54
55  const char *api_fcdb_option
56    @ option(lua_State *L, const char *name);
57}
58
59$[
60-- Definitions for backward compatibility with Freeciv 2.4.
61-- Old database.lua scripts might pass fcdb.param.USER etc to fcdb.option(),
62-- but it's deprecated in favour of literal strings, and the strings listed
63-- here are only conventional.
64fcdb["param"] = {
65  HOST       = "host",
66  USER       = "user",
67  PORT       = "port",
68  PASSWORD   = "password",
69  DATABASE   = "database",
70  TABLE_USER = "table_user",
71  TABLE_LOG  = "table_log",
72  BACKEND    = "backend"
73}
74$]
75