1 /* 2 * netifd - network interface daemon 3 * Copyright (C) 2012 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_PROTO_EXT_H 15 #define __NETIFD_PROTO_EXT_H 16 17 #include "netifd.h" 18 #include "interface.h" 19 #include "interface-ip.h" 20 #include "proto.h" 21 22 enum proto_ext_sm { 23 S_IDLE, 24 S_SETUP, 25 S_SETUP_ABORT, 26 S_TEARDOWN, 27 }; 28 29 struct proto_ext_state { 30 struct interface_proto_state proto; 31 struct blob_attr *config; 32 33 struct uloop_timeout teardown_timeout; 34 35 int checkup_interval; 36 struct uloop_timeout checkup_timeout; 37 38 struct netifd_process script_task; 39 struct netifd_process proto_task; 40 41 enum proto_ext_sm sm; 42 bool proto_task_killed; 43 bool renew_pending; 44 bool restart_pending; 45 46 int last_error; 47 48 struct list_head deps; 49 }; 50 51 struct proto_ext_dep { 52 struct list_head list; 53 54 struct proto_ext_state *proto; 55 struct interface_user dep; 56 57 union if_addr host; 58 bool v6; 59 bool any; 60 61 char interface[]; 62 }; 63 64 typedef int (*proto_ext_handler_cb)(struct proto_ext_state *state, 65 const char *action, const char *config, 66 char **envp); 67 68 void proto_ext_state_init(struct proto_ext_state *state, 69 struct interface *iface, struct blob_attr *attr, 70 int dir_fd); 71 int proto_ext_run(struct proto_ext_state *state, 72 enum interface_proto_cmd cmd, bool force, 73 proto_ext_handler_cb start_cb); 74 int proto_ext_notify(struct interface_proto_state *proto, struct blob_attr *attr); 75 void proto_ext_free(struct interface_proto_state *proto); 76 77 #endif 78
This page was automatically generated by LXR 0.3.1. • OpenWrt