diff options
author | Ewan Mellor <ewan@xensource.com> | 2007-03-27 00:19:20 +0100 |
---|---|---|
committer | Ewan Mellor <ewan@xensource.com> | 2007-03-27 00:19:20 +0100 |
commit | 99b271fd7d5999dc54a6073da59983fc41b51af8 (patch) | |
tree | db3fd7a3d89771286a603c021adc2ddbdf2c7e98 /tools/libxen/src | |
parent | 6b8760eabada5dd7f76476a589e7425d64a80721 (diff) | |
download | xen-99b271fd7d5999dc54a6073da59983fc41b51af8.tar.gz xen-99b271fd7d5999dc54a6073da59983fc41b51af8.tar.bz2 xen-99b271fd7d5999dc54a6073da59983fc41b51af8.zip |
Added network.other_config map. To make this easier, add a new automatic
plumbing facility from the XendNetwork class into XendAPI (credit to Tom
Wilkie for the idea).
Signed-off-by: Ewan Mellor <ewan@xensource.com>
Diffstat (limited to 'tools/libxen/src')
-rw-r--r-- | tools/libxen/src/xen_network.c | 74 |
1 files changed, 73 insertions, 1 deletions
diff --git a/tools/libxen/src/xen_network.c b/tools/libxen/src/xen_network.c index 723616204c..01393f6773 100644 --- a/tools/libxen/src/xen_network.c +++ b/tools/libxen/src/xen_network.c @@ -24,6 +24,7 @@ #include "xen_internal.h" #include "xen_network.h" #include "xen_pif.h" +#include "xen_string_string_map.h" #include "xen_vif.h" @@ -52,7 +53,10 @@ static const struct_member xen_network_record_struct_members[] = .offset = offsetof(xen_network_record, vifs) }, { .key = "PIFs", .type = &abstract_type_ref_set, - .offset = offsetof(xen_network_record, pifs) } + .offset = offsetof(xen_network_record, pifs) }, + { .key = "other_config", + .type = &abstract_type_string_string_map, + .offset = offsetof(xen_network_record, other_config) } }; const abstract_type xen_network_record_abstract_type_ = @@ -78,6 +82,7 @@ xen_network_record_free(xen_network_record *record) free(record->name_description); xen_vif_record_opt_set_free(record->vifs); xen_pif_record_opt_set_free(record->pifs); + xen_string_string_map_free(record->other_config); free(record); } @@ -239,6 +244,23 @@ xen_network_get_pifs(xen_session *session, struct xen_pif_set **result, xen_netw bool +xen_network_get_other_config(xen_session *session, xen_string_string_map **result, xen_network network) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = network } + }; + + abstract_type result_type = abstract_type_string_string_map; + + *result = NULL; + XEN_CALL_("network.get_other_config"); + return session->ok; +} + + +bool xen_network_set_name_label(xen_session *session, xen_network network, char *label) { abstract_value param_values[] = @@ -271,6 +293,56 @@ xen_network_set_name_description(xen_session *session, xen_network network, char bool +xen_network_set_other_config(xen_session *session, xen_network network, xen_string_string_map *other_config) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = network }, + { .type = &abstract_type_string_string_map, + .u.set_val = (arbitrary_set *)other_config } + }; + + xen_call_(session, "network.set_other_config", param_values, 2, NULL, NULL); + return session->ok; +} + + +bool +xen_network_add_to_other_config(xen_session *session, xen_network network, char *key, char *value) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = network }, + { .type = &abstract_type_string, + .u.string_val = key }, + { .type = &abstract_type_string, + .u.string_val = value } + }; + + xen_call_(session, "network.add_to_other_config", param_values, 3, NULL, NULL); + return session->ok; +} + + +bool +xen_network_remove_from_other_config(xen_session *session, xen_network network, char *key) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = network }, + { .type = &abstract_type_string, + .u.string_val = key } + }; + + xen_call_(session, "network.remove_from_other_config", param_values, 2, NULL, NULL); + return session->ok; +} + + +bool xen_network_get_all(xen_session *session, struct xen_network_set **result) { |