diff options
Diffstat (limited to 'tools/libxen/src/xen_vif.c')
-rw-r--r-- | tools/libxen/src/xen_vif.c | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/tools/libxen/src/xen_vif.c b/tools/libxen/src/xen_vif.c index 3fc214b16e..62a6ef16a2 100644 --- a/tools/libxen/src/xen_vif.c +++ b/tools/libxen/src/xen_vif.c @@ -23,6 +23,7 @@ #include "xen_common.h" #include "xen_internal.h" #include "xen_network.h" +#include "xen_string_string_map.h" #include "xen_vif.h" #include "xen_vif_metrics.h" #include "xen_vm.h" @@ -57,6 +58,12 @@ static const struct_member xen_vif_record_struct_members[] = { .key = "MTU", .type = &abstract_type_int, .offset = offsetof(xen_vif_record, mtu) }, + { .key = "qos_algorithm_type", + .type = &abstract_type_string, + .offset = offsetof(xen_vif_record, qos_algorithm_type) }, + { .key = "qos_algorithm_params", + .type = &abstract_type_string_string_map, + .offset = offsetof(xen_vif_record, qos_algorithm_params) }, { .key = "metrics", .type = &abstract_type_ref, .offset = offsetof(xen_vif_record, metrics) } @@ -85,6 +92,8 @@ xen_vif_record_free(xen_vif_record *record) xen_network_record_opt_free(record->network); xen_vm_record_opt_free(record->vm); free(record->mac); + free(record->qos_algorithm_type); + xen_string_string_map_free(record->qos_algorithm_params); xen_vif_metrics_record_opt_free(record->metrics); free(record); } @@ -246,6 +255,40 @@ xen_vif_get_mtu(xen_session *session, int64_t *result, xen_vif vif) bool +xen_vif_get_qos_algorithm_type(xen_session *session, char **result, xen_vif vif) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = vif } + }; + + abstract_type result_type = abstract_type_string; + + *result = NULL; + XEN_CALL_("VIF.get_qos_algorithm_type"); + return session->ok; +} + + +bool +xen_vif_get_qos_algorithm_params(xen_session *session, xen_string_string_map **result, xen_vif vif) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = vif } + }; + + abstract_type result_type = abstract_type_string_string_map; + + *result = NULL; + XEN_CALL_("VIF.get_qos_algorithm_params"); + return session->ok; +} + + +bool xen_vif_get_metrics(xen_session *session, xen_vif_metrics *result, xen_vif vif) { abstract_value param_values[] = @@ -311,6 +354,72 @@ xen_vif_set_mtu(xen_session *session, xen_vif vif, int64_t mtu) bool +xen_vif_set_qos_algorithm_type(xen_session *session, xen_vif vif, char *algorithm_type) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = vif }, + { .type = &abstract_type_string, + .u.string_val = algorithm_type } + }; + + xen_call_(session, "VIF.set_qos_algorithm_type", param_values, 2, NULL, NULL); + return session->ok; +} + + +bool +xen_vif_set_qos_algorithm_params(xen_session *session, xen_vif vif, xen_string_string_map *algorithm_params) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = vif }, + { .type = &abstract_type_string_string_map, + .u.set_val = (arbitrary_set *)algorithm_params } + }; + + xen_call_(session, "VIF.set_qos_algorithm_params", param_values, 2, NULL, NULL); + return session->ok; +} + + +bool +xen_vif_add_to_qos_algorithm_params(xen_session *session, xen_vif vif, char *key, char *value) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = vif }, + { .type = &abstract_type_string, + .u.string_val = key }, + { .type = &abstract_type_string, + .u.string_val = value } + }; + + xen_call_(session, "VIF.add_to_qos_algorithm_params", param_values, 3, NULL, NULL); + return session->ok; +} + + +bool +xen_vif_remove_from_qos_algorithm_params(xen_session *session, xen_vif vif, char *key) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = vif }, + { .type = &abstract_type_string, + .u.string_val = key } + }; + + xen_call_(session, "VIF.remove_from_qos_algorithm_params", param_values, 2, NULL, NULL); + return session->ok; +} + + +bool xen_vif_get_uuid(xen_session *session, char **result, xen_vif vif) { *result = session->ok ? xen_strdup_((char *)vif) : NULL; |