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

Sources/netifd/proto.h

  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_H
 15 #define __NETIFD_PROTO_H
 16 
 17 struct interface;
 18 struct interface_proto_state;
 19 struct proto_handler;
 20 
 21 enum interface_proto_event {
 22         IFPEV_UP,
 23         IFPEV_DOWN,
 24         IFPEV_LINK_LOST,
 25         IFPEV_RENEW,
 26 };
 27 
 28 enum interface_proto_cmd {
 29         PROTO_CMD_SETUP,
 30         PROTO_CMD_TEARDOWN,
 31         PROTO_CMD_RENEW,
 32 };
 33 
 34 enum {
 35         PROTO_FLAG_IMMEDIATE = (1 << 0),
 36         PROTO_FLAG_NODEV = (1 << 1),
 37         PROTO_FLAG_INIT_AVAILABLE = (1 << 2),
 38         PROTO_FLAG_RENEW_AVAILABLE = (1 << 3),
 39         PROTO_FLAG_FORCE_LINK_DEFAULT = (1 << 4),
 40         PROTO_FLAG_LASTERROR = (1 << 5),
 41         PROTO_FLAG_TEARDOWN_ON_L3_LINK_DOWN = (1 << 6),
 42         PROTO_FLAG_NO_TASK = (1 << 7),
 43         PROTO_FLAG_NODEV_CONFIG = (1 << 8),
 44 };
 45 
 46 struct interface_proto_state {
 47         const struct proto_handler *handler;
 48         struct interface *iface;
 49 
 50         /* filled in by the protocol user */
 51         void (*proto_event)(struct interface_proto_state *, enum interface_proto_event ev);
 52 
 53         /* filled in by the protocol handler */
 54         int (*notify)(struct interface_proto_state *, struct blob_attr *data);
 55         int (*cb)(struct interface_proto_state *, enum interface_proto_cmd cmd, bool force);
 56         void (*free)(struct interface_proto_state *);
 57 };
 58 
 59 
 60 struct proto_handler {
 61         struct avl_node avl;
 62 
 63         unsigned int flags;
 64 
 65         const char *name;
 66         const struct uci_blob_param_list *config_params;
 67 
 68         struct interface_proto_state *(*attach)(const struct proto_handler *h,
 69                 struct interface *iface, struct blob_attr *attr);
 70 };
 71 
 72 extern const struct uci_blob_param_list proto_ip_attr;
 73 
 74 void add_proto_handler(struct proto_handler *p);
 75 void proto_init_interface(struct interface *iface, struct blob_attr *attr);
 76 void proto_attach_interface(struct interface *iface, const char *proto_name);
 77 int interface_proto_event(struct interface_proto_state *proto,
 78                           enum interface_proto_cmd cmd, bool force);
 79 
 80 unsigned int parse_netmask_string(const char *str, bool v6);
 81 int proto_apply_static_ip_settings(struct interface *iface, struct blob_attr *attr);
 82 int proto_apply_ip_settings(struct interface *iface, struct blob_attr *attr, bool ext);
 83 void proto_dump_handlers(struct blob_buf *b);
 84 void proto_shell_init(void);
 85 
 86 #endif
 87 

This page was automatically generated by LXR 0.3.1.  •  OpenWrt