X-Git-Url: http://git.openwrt.org/?p=openwrt%2Fstaging%2Fchunkeey.git;a=blobdiff_plain;f=package%2Fswconfig%2Fsrc%2Fswlib.h;h=ff73969c8718cc0edcc1c7010669b44f24da0b14;hp=e00ff47a51d3d943eefc1202c074d6cf93411fe0;hb=965710d3e17738006bb22f01584cfe56319ceac1;hpb=487c622ac0c37f3cd26add56df9081ea7caf3835 diff --git a/package/swconfig/src/swlib.h b/package/swconfig/src/swlib.h index e00ff47a51..ff73969c87 100644 --- a/package/swconfig/src/swlib.h +++ b/package/swconfig/src/swlib.h @@ -1,7 +1,7 @@ /* * swlib.h: Switch configuration API (user space part) * - * Copyright (C) 2008 Felix Fietkau + * Copyright (C) 2008-2009 Felix Fietkau * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -110,13 +110,16 @@ struct switch_dev; struct switch_attr; struct switch_port; struct switch_val; +struct uci_package; struct switch_dev { int id; + char dev_name[IFNAMSIZ]; const char *name; - const char *dev_name; + const char *alias; int ports; int vlans; + int cpu_port; struct switch_attr *ops; struct switch_attr *port_ops; struct switch_attr *vlan_ops; @@ -199,6 +202,17 @@ struct switch_attr *swlib_lookup_attr(struct switch_dev *dev, int swlib_set_attr(struct switch_dev *dev, struct switch_attr *attr, struct switch_val *val); +/** + * swlib_set_attr_string: set the value for an attribute with type conversion + * @dev: switch device struct + * @attr: switch attribute struct + * @port_vlan: port or vlan (if applicable) + * @str: string value + * returns 0 on success + */ +int swlib_set_attr_string(struct switch_dev *dev, struct switch_attr *attr, + int port_vlan, const char *str); + /** * swlib_get_attr: get the value for an attribute * @dev: switch device struct @@ -210,4 +224,11 @@ int swlib_set_attr(struct switch_dev *dev, struct switch_attr *attr, int swlib_get_attr(struct switch_dev *dev, struct switch_attr *attr, struct switch_val *val); +/** + * swlib_apply_from_uci: set up the switch from a uci configuration + * @dev: switch device struct + * @p: uci package which contains the desired global config + */ +int swlib_apply_from_uci(struct switch_dev *dev, struct uci_package *p); + #endif