Exemplo n.º 1
0
static inline ni_netdev_t *
__ni_objectmodel_tuntap_device_arg(const ni_dbus_variant_t *dict,
					const ni_iftype_t iftype)
{
	switch (iftype) {
	case NI_IFTYPE_TUN:
		return ni_objectmodel_get_netif_argument(dict, iftype,
				&ni_objectmodel_tun_service);
	case NI_IFTYPE_TAP:
		return ni_objectmodel_get_netif_argument(dict, iftype,
				&ni_objectmodel_tap_service);
	default:
		return NULL;
	}
}
Exemplo n.º 2
0
/*
 * Extract ethtool properties from a dbug dict argument.
 * We're re-using device properties from ni_objectmodel_ethtool_service,
 * which are derived from changeDevice method configuration propeties.
 */
static ni_netdev_t *
ni_objectmodel_ethtool_request_arg(const ni_dbus_variant_t *argument)
{
	if (!ni_dbus_variant_is_dict(argument))
		return NULL;

	return ni_objectmodel_get_netif_argument(argument, NI_IFTYPE_UNKNOWN,
						&ni_objectmodel_ethtool_service);
}
Exemplo n.º 3
0
Arquivo: ppp.c Projeto: mchf/wicked
/*
 * Support for PPP over serial
 */
static inline ni_netdev_t *
__ni_objectmodel_ppp_device_arg(const ni_dbus_variant_t *dict, DBusError *error)
{
	ni_netdev_t *ppp_dev;
	const char *device_path;
	ni_dbus_object_t *device_object;
	ni_ppp_t *ppp;
	ni_modem_t *modem;

	if (!(ppp_dev = ni_objectmodel_get_netif_argument(dict, NI_IFTYPE_PPP, &ni_objectmodel_ppp_service))) {
		dbus_set_error(error, DBUS_ERROR_INVALID_ARGS, "Error unwrapping PPP device configuration");
		return NULL;
	}

	ppp = ni_netdev_get_ppp(ppp_dev);
	if (!ni_ppp_check_config(ppp) || !(device_path = ppp->config->device.object_path)) {
		dbus_set_error(error, DBUS_ERROR_INVALID_ARGS, "No or incomplete PPP device configuration");
		return NULL;
	}

	device_object = ni_objectmodel_object_by_path(device_path);
	if (device_object == NULL) {
		dbus_set_error(error, DBUS_ERROR_INVALID_ARGS,
				"PPP device configuration references unknown object path \"%s\"", device_path);
		return NULL;
	}

	modem = ni_objectmodel_unwrap_modem(device_object, error);
	if (modem == NULL) {
		dbus_set_error(error, DBUS_ERROR_INVALID_ARGS,
				"PPP device configuration references incompatible object (expected a modem)");
		return NULL;
	}
	ppp->config->device.modem = ni_modem_hold(modem);
	ni_string_dup(&ppp->config->device.name, modem->device);

	return ppp_dev;
}
Exemplo n.º 4
0
Arquivo: ppp.c Projeto: mchf/wicked
/*
 * Support for PPP over Ethernet
 */
static inline ni_netdev_t *
__ni_objectmodel_pppoe_device_arg(const ni_dbus_variant_t *dict, DBusError *error)
{
	ni_netdev_t *ppp_dev, *eth_dev;
	const char *device_path;
	ni_dbus_object_t *device_object;
	ni_ppp_t *ppp;

	if (!(ppp_dev = ni_objectmodel_get_netif_argument(dict, NI_IFTYPE_PPP, &ni_objectmodel_ppp_service))) {
		dbus_set_error(error, DBUS_ERROR_INVALID_ARGS, "Error unwrapping PPP device configuration");
		return NULL;
	}

	ppp = ni_netdev_get_ppp(ppp_dev);
	if (!ppp || !ppp->config || !(device_path = ppp->config->device.object_path)) {
		dbus_set_error(error, DBUS_ERROR_INVALID_ARGS, "No or incomplete PPP device configuration");
		return NULL;
	}

	device_object = ni_objectmodel_object_by_path(device_path);
	if (device_object == NULL) {
		dbus_set_error(error, DBUS_ERROR_INVALID_ARGS,
				"PPP device configuration references unknown object path \"%s\"", device_path);
		return NULL;
	}

	eth_dev = ni_objectmodel_unwrap_netif(device_object, error);
	if (eth_dev == NULL || !eth_dev->ethernet) {
		dbus_set_error(error, DBUS_ERROR_INVALID_ARGS,
				"PPP device configuration references incompatible object (expected an ethernet device)");
		return NULL;
	}
	ppp->config->device.ethernet = ni_netdev_get(eth_dev);
	ni_string_dup(&ppp->config->device.name, eth_dev->name);

	return ppp_dev;
}
Exemplo n.º 5
0
/*
 * Return an interface handle containing all macvlan-specific information provided
 * by the dict argument
 */
static inline ni_netdev_t *
__ni_objectmodel_macvlan_device_arg(const ni_dbus_variant_t *dict, unsigned int iftype)
{
	return ni_objectmodel_get_netif_argument(dict, iftype,
					&ni_objectmodel_macvlan_service);
}
Exemplo n.º 6
0
static ni_netdev_t *
ni_objectmodel_ppp_device_arg(const ni_dbus_variant_t *dict)
{
	return ni_objectmodel_get_netif_argument(dict, NI_IFTYPE_PPP, &ni_objectmodel_ppp_service);
}
Exemplo n.º 7
0
/*
 * Return an interface handle containing all bridge-specific information provided
 * by the dict argument
 */
static inline ni_netdev_t *
__ni_objectmodel_ovs_bridge_device_arg(const ni_dbus_variant_t *dict)
{
	return ni_objectmodel_get_netif_argument(dict, NI_IFTYPE_OVS_BRIDGE, &ni_objectmodel_ovs_bridge_service);
}
Exemplo n.º 8
0
/*
 * Return an interface handle containing all bridge-specific information provided
 * by the dict argument
 */
static inline ni_netdev_t *
__ni_objectmodel_team_device_arg(const ni_dbus_variant_t *dict)
{
	return ni_objectmodel_get_netif_argument(dict, NI_IFTYPE_TEAM, &ni_objectmodel_team_service);
}
Exemplo n.º 9
0
static inline ni_netdev_t *
__ni_objectmodel_ibchild_device_arg(const ni_dbus_variant_t *dict)
{
	return ni_objectmodel_get_netif_argument(dict, NI_IFTYPE_INFINIBAND_CHILD,
						&ni_objectmodel_ibchild_service);
}