#ifndef _RADIUS_MODULE_H #define _RADIUS_MODULE_H /* * Copyright (c) 2015 YASUOKA Masahiko * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include "radiusd.h" struct module_ctx; struct module_handlers { /* Should send IMSG_OK or IMSG_NG */ void (*config_set)(void *ctx, const char *paramname, int paramvalc, char * const * paramvalv); void (*start)(void *ctx); void (*stop)(void *ctx); void (*userpass)(void *ctx, u_int query_id, const char *user, const char *pass); void (*access_request)(void *ctx, u_int query_id, const u_char *pkt, size_t pktlen); /* User-Password Attribute is encrypted if the module has the secret */ }; #define SYNTAX_ASSERT(_cond, _msg) \ do { \ if (!(_cond)) { \ errmsg = (_msg); \ goto syntax_error; \ } \ } while (0 /* CONSTCOND */) __BEGIN_DECLS struct module_base *module_create(int, void *, struct module_handlers *); void module_start(struct module_base *); int module_run(struct module_base *); void module_destroy(struct module_base *); void module_load(struct module_base *); void module_drop_privilege(struct module_base *); int module_notify_secret(struct module_base *, const char *); int module_send_message(struct module_base *, uint32_t, const char *, ...) __attribute__((__format__ (__printf__, 3, 4))); int module_userpass_ok(struct module_base *, u_int, const char *); int module_userpass_fail(struct module_base *, u_int, const char *); int module_accsreq_answer(struct module_base *, u_int, const u_char *, size_t); int module_accsreq_aborted(struct module_base *, u_int); __END_DECLS #endif