2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. 2N/A * Generic object manipulation functions. Given an object handle and 2N/A * etc. All object handles are "struct nwam_handle *" objects, sharing 2N/A * the same description based on the object type, name, original name 2N/A * (used in renaming) and associated data representing properties. 2N/A * Interface NCUs will have "_ifname" in the idlist instead of "name". 2N/A * Link NCUs will have "linkname" in the idlist instead of "name". If 2N/A * looking up "name" fails for an NCU, lookup "_ifname" and 2N/A * Read object of specified type from dbname. 2N/A * For interface NCUs, the keyname is "_ifname" instead of "name". 2N/A * For link NCUs, the keyname is "linkname" instead of "name". 2N/A * The object name might need to be case-corrected; update the name in 2N/A * the handle with the name value from the returned idlist. 2N/A * Create simply creates the handle - the object-specific function must 2N/A * then fill in property values. 2N/A /* Create new object list */ 2N/A * Generic walk function takes the standard walk arguments, and in addition 2N/A * takes a selection callback that is object-specific. If this returns 2N/A * 0, the object is a valid selection for the walk and the callback is called. 2N/A * Otherwise, it is skipped. 2N/A * Copy object represented by oldhp to an object newname, all in container 2N/A /* skip any object-id-list values */ 2N/A * Note that prior to calling the generic commit function, object-specific 2N/A * validation should be carried out. 2N/A * Does object already exist? If not, action is ADD, otherwise REFRESH. 2N/A * If this is an NCU, it must be a link NCU, as interface NCUs 2N/A * are written using libipadm function calls. dladm db entries 2N/A * use "linkname" for the object name key, rather than "name". 2N/A /* Check if object is active */ 2N/A * Interface NCUs are not destroyed through nwam_destroy(). They are 2N/A * removed using libipadm function calls. Thus, there's no need for a 2N/A * special case to add "_ifname". Link NCUs have "linkname" for the 2N/A * key instead of "name". 2N/A /* remove the object */ 2N/A * functions specifies the NCP for NCUs. 2N/A * Structure used to pass in prop table and errprop string pointer to internal 2N/A * validate function. 2N/A * Callback used by nwam_walk_props() in nwam_validate(), and 2N/A * by nwam_validate_prop() to determine that the number, type and 2N/A * range of values are correct, and that validation function (if present) 2N/A * Property not found in the property table. There's no way 2N/A * to validate this property; hence, return SUCCESS to 2N/A * continue walk and validation of other properties. 2N/A /* have we get expected number of values? */ 2N/A /* Ensure type matches */ 2N/A /* Call property-specific validation function */ 2N/A * Given the type and class flag representations, return the list of properties 2N/A * that can be set for that type/class combination. Note this list is a complete 2N/A * property list that includes both the required and the optional properties. 2N/A * The type and class flags are only used for NCU objects at present. 2N/A * Caller needs to free prop_list. 2N/A /* Construct a list of all properties for required type/class */