• source navigation  • diff markup  • identifier search  • freetext search  • 

Sources/netifd/handler.h

  1 /*
  2  * netifd - network interface daemon
  3  * Copyright (C) 2012-2013 Felix Fietkau <nbd@openwrt.org>
  4  *
  5  * This program is free software; you can redistribute it and/or modify
  6  * it under the terms of the GNU General Public License version 2
  7  * as published by the Free Software Foundation
  8  *
  9  * This program is distributed in the hope that it will be useful,
 10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 12  * GNU General Public License for more details.
 13  */
 14 #ifndef __NETIFD_HANDLER_H
 15 #define __NETIFD_HANDLER_H
 16 
 17 #include <libubox/blobmsg_json.h>
 18 #include <json-c/json.h>
 19 #include "config.h"
 20 
 21 typedef void (*script_dump_cb)(const char *script, const char *name, json_object *obj);
 22 typedef void (*create_extdev_handler_cb)(const char *cfg_file, const char *name,
 23                                          const char *ubus_name, bool bridge,
 24                                          const char *br_prefix, json_object *config_obj,
 25                                          json_object *info_obj, json_object *stats_obj);
 26 
 27 static inline json_object *
 28 json_check_type(json_object *obj, json_type type)
 29 {
 30         if (!obj)
 31                 return NULL;
 32 
 33         if (json_object_get_type(obj) != type)
 34                 return NULL;
 35 
 36         return obj;
 37 }
 38 
 39 static inline json_object *
 40 json_get_field(json_object *obj, const char *name, json_type type)
 41 {
 42         return json_object_object_get_ex(obj, name, &obj) ?
 43                         json_check_type(obj, type) : NULL;
 44 }
 45 
 46 int netifd_open_subdir(const char *name);
 47 void netifd_init_script_handlers(int dir_fd, script_dump_cb cb);
 48 void netifd_init_extdev_handlers(int dir_fd, create_extdev_handler_cb cb);
 49 char *netifd_handler_parse_config(struct uci_blob_param_list *config, json_object *obj);
 50 
 51 #endif
 52 

This page was automatically generated by LXR 0.3.1.  •  OpenWrt