Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

78 lines (66 sloc) 2.914 kB
/* vim: set expandtab ts=4 sw=4: */
/*
* You may redistribute this program and/or modify it under the terms of
* the GNU General Public License as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later version.
*
* 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef Admin_H
#define Admin_H
#include "benc/Dict.h"
#include "exception/Except.h"
#include "interface/Interface.h"
#include "memory/Allocator.h"
#include "util/log/Log.h"
#include "util/UniqueName.h"
#include "util/events/EventBase.h"
#include <stdbool.h>
#define Admin_FUNCTION(name) void (* name)(Dict* input, void* context, String* txid)
struct Admin;
struct Admin_FunctionArg
{
char* name;
char* type;
bool required;
};
#define Admin_MAX_REQUEST_SIZE 512
// This must not exceed PipeInterface_MAX_MESSAGE_SIZE
#define Admin_MAX_RESPONSE_SIZE 65536
/**
* @param arguments an array of struct Admin_FunctionArg specifying what functions are available
* and of those, which are required.
* Example C code:
* struct Admin_FunctionArg adma[2] = {
* { .name = "password", .required = 1, .type = "String" },
* { .name = "authType", .required = 0, .type = "Int" }
* };
* Admin_registerFunction("AuthorizedPasswords_add", add, context, true, adma, admin);
*/
void Admin_registerFunctionWithArgCount(char* name,
Admin_FUNCTION(callback),
void* callbackContext,
bool needsAuth,
struct Admin_FunctionArg* arguments,
int argCount,
struct Admin* admin);
#define Admin_registerFunction(name, cb, ctx, needsAuth, args, admin) \
Admin_registerFunctionWithArgCount( \
name, cb, ctx, needsAuth, args, (sizeof(args) / sizeof(struct Admin_FunctionArg)), admin)
#define Admin_sendMessage_CHANNEL_CLOSED -1
int Admin_sendMessage(Dict* message, String* txid, struct Admin* admin);
int Admin_sendMessageToAngel(Dict* message, struct Admin* admin);
struct Admin* Admin_new(struct Interface* toAngelInterface,
struct Allocator* alloc,
struct Log* logger,
struct EventBase* eventBase,
String* password);
#else
#include "util/UniqueName.h"
#endif
Jump to Line
Something went wrong with that request. Please try again.