iwinfo: convert to plugin library

This commit is contained in:
Jo-Philipp Wich 2013-09-02 14:52:22 +02:00
parent 3d358bb3a1
commit bc100538d3
3 changed files with 9 additions and 8 deletions

View file

@ -16,10 +16,8 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <sys/types.h>
#include <dirent.h>
#include "iwinfo.h"
#include "plugin.h"
static struct blob_buf buf;
static const struct iwinfo_ops *iw;
@ -622,7 +620,8 @@ rpc_iwinfo_devices(struct ubus_context *ctx, struct ubus_object *obj,
}
int rpc_iwinfo_api_init(struct ubus_context *ctx)
static int
rpc_iwinfo_api_init(const struct rpc_daemon_ops *o, struct ubus_context *ctx)
{
static const struct ubus_method iwinfo_methods[] = {
{ .name = "devices", .handler = rpc_iwinfo_devices },
@ -646,3 +645,7 @@ int rpc_iwinfo_api_init(struct ubus_context *ctx)
return ubus_add_object(ctx, &obj);
}
const struct rpc_plugin rpc_plugin = {
.init = rpc_iwinfo_api_init
};

View file

@ -19,10 +19,10 @@
#ifndef __RPC_IWINFO_H
#define __RPC_IWINFO_H
#include <sys/types.h>
#include <dirent.h>
#include <libubus.h>
#include <iwinfo.h>
#include <iwinfo/utils.h>
int rpc_iwinfo_api_init(struct ubus_context *ctx);
#endif

2
main.c
View file

@ -26,7 +26,6 @@
#include "session.h"
#include "file.h"
#include "uci.h"
#include "iwinfo.h"
#include "luci2.h"
#include "plugin.h"
@ -65,7 +64,6 @@ int main(int argc, char **argv)
rpc_session_api_init(ctx);
rpc_file_api_init(ctx);
rpc_uci_api_init(ctx);
rpc_iwinfo_api_init(ctx);
rpc_luci2_api_init(ctx);
rpc_plugin_api_init(ctx);