/** * nm_setting_vlan_remove_priority: * @map: the type of priority map * @setting: the #NMSettingVlan * @idx: the zero-based index of the priority map to remove * * Removes the priority map at index @idx from the * #NMSettingVlan:ingress_priority_map or #NMSettingVlan:egress_priority_map * properties. */ void nm_setting_vlan_remove_priority (NMSettingVlan *setting, NMVlanPriorityMap map, guint32 idx) { GSList *list = NULL, *item = NULL; g_return_if_fail (NM_IS_SETTING_VLAN (setting)); g_return_if_fail (map == NM_VLAN_INGRESS_MAP || map == NM_VLAN_EGRESS_MAP); list = get_map (setting, map); g_return_if_fail (idx < g_slist_length (list)); item = g_slist_nth_data (list, idx); priority_map_free ((PriorityMap *) item); set_map (setting, map, g_slist_delete_link (list, item)); }
/** * nm_setting_vlan_remove_priority_by_value: * @setting: the #NMSettingVlan * @map: the type of priority map * @from: the priority to map to @to * @to: the priority to map @from to * * Removes the priority map @form:@to from the #NMSettingVlan:ingress_priority_map * or #NMSettingVlan:egress_priority_map (according to @map argument) * properties. * * Returns: %TRUE if the priority mapping was found and removed; %FALSE if it was not. */ gboolean nm_setting_vlan_remove_priority_by_value (NMSettingVlan *setting, NMVlanPriorityMap map, guint32 from, guint32 to) { GSList *list = NULL, *iter = NULL; NMVlanQosMapping *item; g_return_val_if_fail (NM_IS_SETTING_VLAN (setting), FALSE); g_return_val_if_fail (map == NM_VLAN_INGRESS_MAP || map == NM_VLAN_EGRESS_MAP, FALSE); list = get_map (setting, map); for (iter = list; iter; iter = g_slist_next (iter)) { item = iter->data; if (item->from == from && item->to == to) { priority_map_free ((NMVlanQosMapping *) (iter->data)); set_map (setting, map, g_slist_delete_link (list, iter)); return TRUE; } } return FALSE; }