From c6efdfcbc8014ab8bf285bdb5b3b05b76ef0b54a Mon Sep 17 00:00:00 2001 From: Ilya Verbitskiy Date: Mon, 11 Mar 2024 18:08:45 +0100 Subject: [PATCH] virtuerl: remove unused stuff --- virtuerl/config/sys.config | 7 - virtuerl/rebar.config | 12 +- virtuerl/rebar.lock | 29 +- virtuerl/src/pb/controller_pb.erl | 8217 ----------------- virtuerl/src/pb/controller_service_bhvr.erl | 157 - virtuerl/src/pb/controller_service_client.erl | 691 -- virtuerl/src/pb/daemon_pb.erl | 5962 ------------ virtuerl/src/pb/daemon_service_bhvr.erl | 109 - virtuerl/src/pb/daemon_service_client.erl | 475 - virtuerl/src/pb/dns_bhvr.erl | 25 - virtuerl/src/pb/dns_client.erl | 97 - virtuerl/src/pb/dns_pb.erl | 1228 --- virtuerl/src/pb/domain_pb.erl | 3401 ------- virtuerl/src/pb/domain_service_bhvr.erl | 45 - virtuerl/src/pb/domain_service_client.erl | 187 - virtuerl/src/pb/host_pb.erl | 1431 --- virtuerl/src/pb/host_service_bhvr.erl | 33 - virtuerl/src/pb/host_service_client.erl | 133 - virtuerl/src/pb/port_forwarding_pb.erl | 1320 --- .../src/pb/port_forwarding_service_bhvr.erl | 25 - .../src/pb/port_forwarding_service_client.erl | 97 - virtuerl/src/pb/route_pb.erl | 1912 ---- virtuerl/src/pb/route_service_bhvr.erl | 45 - virtuerl/src/pb/route_service_client.erl | 187 - virtuerl/src/pb/volume_pb.erl | 2159 ----- virtuerl/src/pb/volume_service_bhvr.erl | 45 - virtuerl/src/pb/volume_service_client.erl | 187 - virtuerl/src/virtuerl.app.src | 3 +- virtuerl/src/virtuerl_api_domain_col.erl | 58 - virtuerl/src/virtuerl_api_domain_res.erl | 58 - 30 files changed, 4 insertions(+), 28331 deletions(-) delete mode 100644 virtuerl/src/pb/controller_pb.erl delete mode 100644 virtuerl/src/pb/controller_service_bhvr.erl delete mode 100644 virtuerl/src/pb/controller_service_client.erl delete mode 100644 virtuerl/src/pb/daemon_pb.erl delete mode 100644 virtuerl/src/pb/daemon_service_bhvr.erl delete mode 100644 virtuerl/src/pb/daemon_service_client.erl delete mode 100644 virtuerl/src/pb/dns_bhvr.erl delete mode 100644 virtuerl/src/pb/dns_client.erl delete mode 100644 virtuerl/src/pb/dns_pb.erl delete mode 100644 virtuerl/src/pb/domain_pb.erl delete mode 100644 virtuerl/src/pb/domain_service_bhvr.erl delete mode 100644 virtuerl/src/pb/domain_service_client.erl delete mode 100644 virtuerl/src/pb/host_pb.erl delete mode 100644 virtuerl/src/pb/host_service_bhvr.erl delete mode 100644 virtuerl/src/pb/host_service_client.erl delete mode 100644 virtuerl/src/pb/port_forwarding_pb.erl delete mode 100644 virtuerl/src/pb/port_forwarding_service_bhvr.erl delete mode 100644 virtuerl/src/pb/port_forwarding_service_client.erl delete mode 100644 virtuerl/src/pb/route_pb.erl delete mode 100644 virtuerl/src/pb/route_service_bhvr.erl delete mode 100644 virtuerl/src/pb/route_service_client.erl delete mode 100644 virtuerl/src/pb/volume_pb.erl delete mode 100644 virtuerl/src/pb/volume_service_bhvr.erl delete mode 100644 virtuerl/src/pb/volume_service_client.erl delete mode 100644 virtuerl/src/virtuerl_api_domain_col.erl delete mode 100644 virtuerl/src/virtuerl_api_domain_res.erl diff --git a/virtuerl/config/sys.config b/virtuerl/config/sys.config index c65080a..d445da2 100644 --- a/virtuerl/config/sys.config +++ b/virtuerl/config/sys.config @@ -5,12 +5,5 @@ #{ level => debug, formatter => {logger_formatter, #{single_line => false}}}} ]}]}, - {grpcbox, [ - {client, #{channels => [{default_channel, [{https, "verbit.in-berlin.de", 8443, [ - {certfile, "config/client.crt"}, - {keyfile, "config/client.key"}, - {cacertfile, "config/ca.crt"} - ]}], #{}}]}} - ]}, {erlexec, [{root, true}, {user, "root"}]} ]. diff --git a/virtuerl/rebar.config b/virtuerl/rebar.config index 6596040..94af93d 100644 --- a/virtuerl/rebar.config +++ b/virtuerl/rebar.config @@ -2,24 +2,16 @@ {deps, [ {khepri, "0.7.0"}, {thoas, "1.0.0"}, - {grpcbox, "0.16.0"}, - {cowboy, "2.10.0"}, {mochiweb, "3.1.2"}, {erlexec, "~> 2.0"} ]}. {relx, [ {release, {virtuerl, git}, [virtuerl, {khepri, load}, {mnesia, load}, erts]}, - {mode, prod} + {mode, prod}, + {extended_start_script, false} ]}. -{plugins, [grpcbox_plugin]}. -{grpc, [ - {out_dir, "src/pb"}, - {protos, "../protos/minivirt"}, - {gpb_opts, [{module_name_suffix, "_pb"}, {i, "../protos"}, {o, "src/pb"}]} - ]}. - {shell, [ {config, "config/sys.config"}, {apps, [virtuerl]} diff --git a/virtuerl/rebar.lock b/virtuerl/rebar.lock index 347e593..f90d145 100644 --- a/virtuerl/rebar.lock +++ b/virtuerl/rebar.lock @@ -1,59 +1,32 @@ {"1.2.0", -[{<<"acceptor_pool">>,{pkg,<<"acceptor_pool">>,<<"1.0.0">>},1}, - {<<"aten">>,{pkg,<<"aten">>,<<"0.5.8">>},2}, - {<<"chatterbox">>,{pkg,<<"ts_chatterbox">>,<<"0.13.0">>},1}, - {<<"cowboy">>,{pkg,<<"cowboy">>,<<"2.10.0">>},0}, - {<<"cowlib">>,{pkg,<<"cowlib">>,<<"2.12.1">>},1}, - {<<"ctx">>,{pkg,<<"ctx">>,<<"0.6.0">>},1}, +[{<<"aten">>,{pkg,<<"aten">>,<<"0.5.8">>},2}, {<<"erlexec">>,{pkg,<<"erlexec">>,<<"2.0.2">>},0}, {<<"gen_batch_server">>,{pkg,<<"gen_batch_server">>,<<"0.8.8">>},2}, - {<<"gproc">>,{pkg,<<"gproc">>,<<"0.8.0">>},1}, - {<<"grpcbox">>,{pkg,<<"grpcbox">>,<<"0.16.0">>},0}, {<<"horus">>,{pkg,<<"horus">>,<<"0.2.3">>},1}, - {<<"hpack">>,{pkg,<<"hpack_erl">>,<<"0.2.3">>},2}, {<<"khepri">>,{pkg,<<"khepri">>,<<"0.7.0">>},0}, {<<"mochiweb">>,{pkg,<<"mochiweb">>,<<"3.1.2">>},0}, {<<"ra">>,{pkg,<<"ra">>,<<"2.5.1">>},1}, - {<<"ranch">>,{pkg,<<"ranch">>,<<"1.8.0">>},1}, {<<"seshat">>,{pkg,<<"seshat">>,<<"0.4.0">>},2}, {<<"thoas">>,{pkg,<<"thoas">>,<<"1.0.0">>},0}]}. [ {pkg_hash,[ - {<<"acceptor_pool">>, <<"43C20D2ACAE35F0C2BCD64F9D2BDE267E459F0F3FD23DAB26485BF518C281B21">>}, {<<"aten">>, <<"B5C97F48517C4F37F26A519AA57A00A31FF1B8EA4324EC1CAE27F818ED5C0DB2">>}, - {<<"chatterbox">>, <<"6F059D97BCAA758B8EA6FFFE2B3B81362BD06B639D3EA2BB088335511D691EBF">>}, - {<<"cowboy">>, <<"FF9FFEFF91DAE4AE270DD975642997AFE2A1179D94B1887863E43F681A203E26">>}, - {<<"cowlib">>, <<"A9FA9A625F1D2025FE6B462CB865881329B5CAFF8F1854D1CBC9F9533F00E1E1">>}, - {<<"ctx">>, <<"8FF88B70E6400C4DF90142E7F130625B82086077A45364A78D208ED3ED53C7FE">>}, {<<"erlexec">>, <<"995E40477DE94C37EC1264CC3E52EB6273938E80C9BCC4F94110A3F1C0D9ABA3">>}, {<<"gen_batch_server">>, <<"7840A1FA63EE1EFFC83E8A91D22664847A2BA1192D30EAFFFD914ACB51578068">>}, - {<<"gproc">>, <<"CEA02C578589C61E5341FCE149EA36CCEF236CC2ECAC8691FBA408E7EA77EC2F">>}, - {<<"grpcbox">>, <<"B83F37C62D6EECA347B77F9B1EC7E9F62231690CDFEB3A31BE07CD4002BA9C82">>}, {<<"horus">>, <<"A8AC0E7B335B83860ECECFA12EE4CB50289A15A515175BEF804A9C0D06C619B5">>}, - {<<"hpack">>, <<"17670F83FF984AE6CD74B1C456EDDE906D27FF013740EE4D9EFAA4F1BF999633">>}, {<<"khepri">>, <<"5CB9B1D35051DAEAF6308BFC64446A4BC2DEAAAE39C619DFB890B6CCFF8F45AF">>}, {<<"mochiweb">>, <<"D872D470DBBA367171A38C41592B19DE370854E74C8621BF0C6FE39B17CDD1CF">>}, {<<"ra">>, <<"9EE208B7CD229B34F67C56B6BEFAD0E906C5B37C6175DB9C76C00B1BC0CF82D8">>}, - {<<"ranch">>, <<"8C7A100A139FD57F17327B6413E4167AC559FBC04CA7448E9BE9057311597A1D">>}, {<<"seshat">>, <<"1D5DC4294E36B8745245AB2649E24E39D7B6B1209D7A6484F2B8D706C35C9814">>}, {<<"thoas">>, <<"567C03902920827A18A89F05B79A37B5BF93553154B883E0131801600CF02CE0">>}]}, {pkg_hash_ext,[ - {<<"acceptor_pool">>, <<"0CBCD83FDC8B9AD2EEE2067EF8B91A14858A5883CB7CD800E6FCD5803E158788">>}, {<<"aten">>, <<"64D40A8CF0DDFEA4E13AF00B7327F0925147F83612D0627D9506CBFFE90C13EF">>}, - {<<"chatterbox">>, <<"B93D19104D86AF0B3F2566C4CBA2A57D2E06D103728246BA1AC6C3C0FF010AA7">>}, - {<<"cowboy">>, <<"3AFDCCB7183CC6F143CB14D3CF51FA00E53DB9EC80CDCD525482F5E99BC41D6B">>}, - {<<"cowlib">>, <<"163B73F6367A7341B33C794C4E88E7DBFE6498AC42DCD69EF44C5BC5507C8DB0">>}, - {<<"ctx">>, <<"A14ED2D1B67723DBEBBE423B28D7615EB0BDCBA6FF28F2D1F1B0A7E1D4AA5FC2">>}, {<<"erlexec">>, <<"CC829A7C6C23D399832DA2E998EA5EBC552232A6FE3EB1EDB400178EC8287DCB">>}, {<<"gen_batch_server">>, <<"C3E6A1A2A0FB62AEE631A98CFA0FD8903E9562422CBF72043953E2FB1D203017">>}, - {<<"gproc">>, <<"580ADAFA56463B75263EF5A5DF4C86AF321F68694E7786CB057FD805D1E2A7DE">>}, - {<<"grpcbox">>, <<"294DF743AE20A7E030889F00644001370A4F7CE0121F3BBDAF13CF3169C62913">>}, {<<"horus">>, <<"0CA6AA70A348F73EF0B78F498C82F9C29F49B45D5915B890945A1C326A216C10">>}, - {<<"hpack">>, <<"06F580167C4B8B8A6429040DF36CC93BBA6D571FAEAEC1B28816523379CBB23A">>}, {<<"khepri">>, <<"784D90A578340E137BF7E2C8D1F1F45E59D6E13262804A841BF9E709E7505954">>}, {<<"mochiweb">>, <<"A8609035711F9264E8ABE54312D1B1645374B9E08986AE06E979BB0AC8B99F9F">>}, {<<"ra">>, <<"13B03F02CF6C1837C527EDD4A953F0C09DA0ABAD0AF6985B64BFD66943C4C5C3">>}, - {<<"ranch">>, <<"49FBCFD3682FAB1F5D109351B61257676DA1A2FDBE295904176D5E521A2DDFE5">>}, {<<"seshat">>, <<"2C3DEEC7FF86E0D0C05EDEBD3455C8363123C227BE292FFFFC1A05EEC08BFF63">>}, {<<"thoas">>, <<"FC763185B932ECB32A554FB735EE03C3B6B1B31366077A2427D2A97F3BD26735">>}]} ]. diff --git a/virtuerl/src/pb/controller_pb.erl b/virtuerl/src/pb/controller_pb.erl deleted file mode 100644 index f6bad6d..0000000 --- a/virtuerl/src/pb/controller_pb.erl +++ /dev/null @@ -1,8217 +0,0 @@ -%% -*- coding: utf-8 -*- -%% @private -%% Automatically generated, do not edit -%% Generated by gpb_compile version 4.19.8 -%% Version source: file --module(controller_pb). - --export([encode_msg/2, encode_msg/3]). --export([decode_msg/2, decode_msg/3]). --export([merge_msgs/3, merge_msgs/4]). --export([verify_msg/2, verify_msg/3]). --export([get_msg_defs/0]). --export([get_msg_names/0]). --export([get_group_names/0]). --export([get_msg_or_group_names/0]). --export([get_enum_names/0]). --export([find_msg_def/1, fetch_msg_def/1]). --export([find_enum_def/1, fetch_enum_def/1]). --export([enum_symbol_by_value/2, enum_value_by_symbol/2]). --export([get_service_names/0]). --export([get_service_def/1]). --export([get_rpc_names/1]). --export([find_rpc_def/2, fetch_rpc_def/2]). --export([fqbin_to_service_name/1]). --export([service_name_to_fqbin/1]). --export([fqbins_to_service_and_rpc_name/2]). --export([service_and_rpc_name_to_fqbins/2]). --export([fqbin_to_msg_name/1]). --export([msg_name_to_fqbin/1]). --export([fqbin_to_enum_name/1]). --export([enum_name_to_fqbin/1]). --export([get_package_name/0]). --export([uses_packages/0]). --export([source_basename/0]). --export([get_all_source_basenames/0]). --export([get_all_proto_names/0]). --export([get_msg_containment/1]). --export([get_pkg_containment/1]). --export([get_service_containment/1]). --export([get_rpc_containment/1]). --export([get_enum_containment/1]). --export([get_proto_by_msg_name_as_fqbin/1]). --export([get_proto_by_service_name_as_fqbin/1]). --export([get_proto_by_enum_name_as_fqbin/1]). --export([get_protos_by_pkg_name_as_fqbin/1]). --export([gpb_version_as_string/0, gpb_version_as_list/0]). --export([gpb_version_source/0]). - - -%% enumerated types - --export_type([]). - -%% message types --type empty() :: - #{ - }. - --type sync_routes_request() :: - #{ - }. - --type start_domain_request() :: - #{host => unicode:chardata(), % = 1, optional - uuid => unicode:chardata() % = 2, optional - }. - --type stop_domain_request() :: - #{host => unicode:chardata(), % = 1, optional - uuid => unicode:chardata(), % = 2, optional - force => boolean() | 0 | 1 % = 3, optional - }. - --type get_domain_request() :: - #{uuid => unicode:chardata(), % = 1, optional - host => unicode:chardata() % = 2, optional - }. - --type domain() :: - #{id => non_neg_integer(), % = 1, optional, 64 bits - uuid => unicode:chardata(), % = 2, optional - name => unicode:chardata(), % = 3, optional - vcpu => non_neg_integer(), % = 4, optional, 32 bits - memory => non_neg_integer(), % = 5, optional, 64 bits - network => unicode:chardata(), % = 6, optional - bridge => unicode:chardata(), % = 7, optional - state => unicode:chardata(), % = 8, optional - private_ip => unicode:chardata(), % = 9, optional - ipv6_address => unicode:chardata(), % = 15, optional - user_data => unicode:chardata(), % = 10, optional - nested_virtualization => boolean() | 0 | 1, % = 11, optional - base_image => unicode:chardata(), % = 12, optional - created_at => timestamp(), % = 13, optional - os_type => unicode:chardata() % = 14, optional - }. - --type list_domains_request() :: - #{host => unicode:chardata() % = 1, optional - }. - --type list_domains_response() :: - #{domains => [domain()] % = 1, repeated - }. - --type create_domain_request() :: - #{domain => domain(), % = 1, optional - host => unicode:chardata() % = 2, optional - }. - --type delete_domain_request() :: - #{uuid => unicode:chardata(), % = 1, optional - host => unicode:chardata() % = 2, optional - }. - --type download_image_request() :: - #{domain_id => unicode:chardata(), % = 1, optional - host => unicode:chardata() % = 2, optional - }. - --type image_chunk() :: - #{bytes => iodata() % = 1, optional - }. - --type get_network_request() :: - #{uuid => unicode:chardata(), % = 1, optional - host => unicode:chardata() % = 2, optional - }. - --type network() :: - #{uuid => unicode:chardata(), % = 1, optional - name => unicode:chardata(), % = 2, optional - cidr => unicode:chardata(), % = 3, optional - cidr6 => unicode:chardata() % = 4, optional - }. - --type list_networks_request() :: - #{host => unicode:chardata() % = 1, optional - }. - --type list_networks_response() :: - #{networks => [network()] % = 1, repeated - }. - --type create_network_request() :: - #{network => network(), % = 1, optional - host => unicode:chardata() % = 2, optional - }. - --type delete_network_request() :: - #{uuid => unicode:chardata(), % = 1, optional - host => unicode:chardata() % = 2, optional - }. - --type get_volume_request() :: - #{uuid => unicode:chardata(), % = 1, optional - host => unicode:chardata() % = 2, optional - }. - --type volume() :: - #{id => unicode:chardata(), % = 1, optional - name => unicode:chardata(), % = 2, optional - size => non_neg_integer() % = 3, optional, 64 bits - }. - --type list_volumes_request() :: - #{host => unicode:chardata() % = 1, optional - }. - --type list_volumes_response() :: - #{volumes => [volume()] % = 1, repeated - }. - --type create_volume_request() :: - #{volume => volume(), % = 1, optional - host => unicode:chardata() % = 2, optional - }. - --type update_volume_request() :: - #{host => unicode:chardata(), % = 1, optional - volume => volume() % = 2, optional - }. - --type delete_volume_request() :: - #{uuid => unicode:chardata(), % = 1, optional - host => unicode:chardata() % = 2, optional - }. - --type volume_attachment_identifier() :: - #{domain_id => unicode:chardata(), % = 1, optional - volume_id => unicode:chardata(), % = 2, optional - host => unicode:chardata() % = 3, optional - }. - --type volume_attachment() :: - #{domain_id => unicode:chardata(), % = 1, optional - volume_id => unicode:chardata(), % = 2, optional - disk_address => unicode:chardata() % = 3, optional - }. - --type list_volume_attachments_request() :: - #{domain_id => unicode:chardata(), % = 1, optional - host => unicode:chardata() % = 2, optional - }. - --type list_volume_attachments_response() :: - #{attachments => [volume_attachment()] % = 1, repeated - }. - --type port_forwarding_identifier() :: - #{host => unicode:chardata(), % = 1, optional - protocol => unicode:chardata(), % = 2, optional - source_port => non_neg_integer() % = 3, optional, 32 bits - }. - --type port_forwarding() :: - #{protocol => unicode:chardata(), % = 2, optional - source_port => non_neg_integer(), % = 3, optional, 32 bits - target_ip => unicode:chardata(), % = 4, optional - target_port => non_neg_integer() % = 5, optional, 32 bits - }. - --type list_port_forwardings_request() :: - #{host => unicode:chardata() % = 1, optional - }. - --type list_port_forwardings_response() :: - #{port_forwardings => [port_forwarding()] % = 1, repeated - }. - --type put_port_forwarding_request() :: - #{port_forwarding => port_forwarding(), % = 1, optional - host => unicode:chardata() % = 2, optional - }. - --type dns_record_identifier() :: - #{name => unicode:chardata(), % = 1, optional - type => unicode:chardata() % = 2, optional - }. - --type dns_record() :: - #{name => unicode:chardata(), % = 1, optional - type => unicode:chardata(), % = 2, optional - ttl => non_neg_integer(), % = 3, optional, 64 bits - records => [unicode:chardata()] % = 4, repeated - }. - --type list_dns_records_request() :: - #{ - }. - --type list_dns_records_response() :: - #{dns_records => [dns_record()] % = 1, repeated - }. - --type put_dns_record_request() :: - #{dns_record => dns_record() % = 1, optional - }. - --type route_table() :: - #{network_name => unicode:chardata(), % = 1, optional - id => non_neg_integer(), % = 2, optional, 32 bits - name => unicode:chardata() % = 3, optional - }. - --type route_table_identifier() :: - #{id => non_neg_integer() % = 1, optional, 32 bits - }. - --type list_route_tables_request() :: - #{network_name => unicode:chardata() % = 1, optional - }. - --type list_route_tables_response() :: - #{route_tables => [route_table()] % = 1, repeated - }. - --type create_route_table_request() :: - #{route_table => route_table() % = 1, optional - }. - --type route_identifier() :: - #{route_table_id => non_neg_integer(), % = 1, optional, 32 bits - destination => unicode:chardata() % = 2, optional - }. - --type route() :: - #{route_table_id => non_neg_integer(), % = 1, optional, 32 bits - destination => unicode:chardata(), % = 2, optional - gateways => [unicode:chardata()] % = 3, repeated - }. - --type list_routes_request() :: - #{route_table_id => non_neg_integer() % = 1, optional, 32 bits - }. - --type list_routes_response() :: - #{routes => [route()] % = 1, repeated - }. - --type put_route_request() :: - #{route => route() % = 1, optional - }. - --type sync_request() :: - #{ - }. - --type timestamp() :: - #{seconds => integer(), % = 1, optional, 64 bits - nanos => integer() % = 2, optional, 32 bits - }. - --export_type(['empty'/0, 'sync_routes_request'/0, 'start_domain_request'/0, 'stop_domain_request'/0, 'get_domain_request'/0, 'domain'/0, 'list_domains_request'/0, 'list_domains_response'/0, 'create_domain_request'/0, 'delete_domain_request'/0, 'download_image_request'/0, 'image_chunk'/0, 'get_network_request'/0, 'network'/0, 'list_networks_request'/0, 'list_networks_response'/0, 'create_network_request'/0, 'delete_network_request'/0, 'get_volume_request'/0, 'volume'/0, 'list_volumes_request'/0, 'list_volumes_response'/0, 'create_volume_request'/0, 'update_volume_request'/0, 'delete_volume_request'/0, 'volume_attachment_identifier'/0, 'volume_attachment'/0, 'list_volume_attachments_request'/0, 'list_volume_attachments_response'/0, 'port_forwarding_identifier'/0, 'port_forwarding'/0, 'list_port_forwardings_request'/0, 'list_port_forwardings_response'/0, 'put_port_forwarding_request'/0, 'dns_record_identifier'/0, 'dns_record'/0, 'list_dns_records_request'/0, 'list_dns_records_response'/0, 'put_dns_record_request'/0, 'route_table'/0, 'route_table_identifier'/0, 'list_route_tables_request'/0, 'list_route_tables_response'/0, 'create_route_table_request'/0, 'route_identifier'/0, 'route'/0, 'list_routes_request'/0, 'list_routes_response'/0, 'put_route_request'/0, 'sync_request'/0, 'timestamp'/0]). --type '$msg_name'() :: empty | sync_routes_request | start_domain_request | stop_domain_request | get_domain_request | domain | list_domains_request | list_domains_response | create_domain_request | delete_domain_request | download_image_request | image_chunk | get_network_request | network | list_networks_request | list_networks_response | create_network_request | delete_network_request | get_volume_request | volume | list_volumes_request | list_volumes_response | create_volume_request | update_volume_request | delete_volume_request | volume_attachment_identifier | volume_attachment | list_volume_attachments_request | list_volume_attachments_response | port_forwarding_identifier | port_forwarding | list_port_forwardings_request | list_port_forwardings_response | put_port_forwarding_request | dns_record_identifier | dns_record | list_dns_records_request | list_dns_records_response | put_dns_record_request | route_table | route_table_identifier | list_route_tables_request | list_route_tables_response | create_route_table_request | route_identifier | route | list_routes_request | list_routes_response | put_route_request | sync_request | timestamp. --type '$msg'() :: empty() | sync_routes_request() | start_domain_request() | stop_domain_request() | get_domain_request() | domain() | list_domains_request() | list_domains_response() | create_domain_request() | delete_domain_request() | download_image_request() | image_chunk() | get_network_request() | network() | list_networks_request() | list_networks_response() | create_network_request() | delete_network_request() | get_volume_request() | volume() | list_volumes_request() | list_volumes_response() | create_volume_request() | update_volume_request() | delete_volume_request() | volume_attachment_identifier() | volume_attachment() | list_volume_attachments_request() | list_volume_attachments_response() | port_forwarding_identifier() | port_forwarding() | list_port_forwardings_request() | list_port_forwardings_response() | put_port_forwarding_request() | dns_record_identifier() | dns_record() | list_dns_records_request() | list_dns_records_response() | put_dns_record_request() | route_table() | route_table_identifier() | list_route_tables_request() | list_route_tables_response() | create_route_table_request() | route_identifier() | route() | list_routes_request() | list_routes_response() | put_route_request() | sync_request() | timestamp(). --export_type(['$msg_name'/0, '$msg'/0]). - --if(?OTP_RELEASE >= 24). --dialyzer({no_underspecs, encode_msg/2}). --endif. --spec encode_msg('$msg'(), '$msg_name'()) -> binary(). -encode_msg(Msg, MsgName) when is_atom(MsgName) -> encode_msg(Msg, MsgName, []). - --if(?OTP_RELEASE >= 24). --dialyzer({no_underspecs, encode_msg/3}). --endif. --spec encode_msg('$msg'(), '$msg_name'(), list()) -> binary(). -encode_msg(Msg, MsgName, Opts) -> - case proplists:get_bool(verify, Opts) of - true -> verify_msg(Msg, MsgName, Opts); - false -> ok - end, - TrUserData = proplists:get_value(user_data, Opts), - case MsgName of - empty -> encode_msg_empty(id(Msg, TrUserData), TrUserData); - sync_routes_request -> encode_msg_sync_routes_request(id(Msg, TrUserData), TrUserData); - start_domain_request -> encode_msg_start_domain_request(id(Msg, TrUserData), TrUserData); - stop_domain_request -> encode_msg_stop_domain_request(id(Msg, TrUserData), TrUserData); - get_domain_request -> encode_msg_get_domain_request(id(Msg, TrUserData), TrUserData); - domain -> encode_msg_domain(id(Msg, TrUserData), TrUserData); - list_domains_request -> encode_msg_list_domains_request(id(Msg, TrUserData), TrUserData); - list_domains_response -> encode_msg_list_domains_response(id(Msg, TrUserData), TrUserData); - create_domain_request -> encode_msg_create_domain_request(id(Msg, TrUserData), TrUserData); - delete_domain_request -> encode_msg_delete_domain_request(id(Msg, TrUserData), TrUserData); - download_image_request -> encode_msg_download_image_request(id(Msg, TrUserData), TrUserData); - image_chunk -> encode_msg_image_chunk(id(Msg, TrUserData), TrUserData); - get_network_request -> encode_msg_get_network_request(id(Msg, TrUserData), TrUserData); - network -> encode_msg_network(id(Msg, TrUserData), TrUserData); - list_networks_request -> encode_msg_list_networks_request(id(Msg, TrUserData), TrUserData); - list_networks_response -> encode_msg_list_networks_response(id(Msg, TrUserData), TrUserData); - create_network_request -> encode_msg_create_network_request(id(Msg, TrUserData), TrUserData); - delete_network_request -> encode_msg_delete_network_request(id(Msg, TrUserData), TrUserData); - get_volume_request -> encode_msg_get_volume_request(id(Msg, TrUserData), TrUserData); - volume -> encode_msg_volume(id(Msg, TrUserData), TrUserData); - list_volumes_request -> encode_msg_list_volumes_request(id(Msg, TrUserData), TrUserData); - list_volumes_response -> encode_msg_list_volumes_response(id(Msg, TrUserData), TrUserData); - create_volume_request -> encode_msg_create_volume_request(id(Msg, TrUserData), TrUserData); - update_volume_request -> encode_msg_update_volume_request(id(Msg, TrUserData), TrUserData); - delete_volume_request -> encode_msg_delete_volume_request(id(Msg, TrUserData), TrUserData); - volume_attachment_identifier -> encode_msg_volume_attachment_identifier(id(Msg, TrUserData), TrUserData); - volume_attachment -> encode_msg_volume_attachment(id(Msg, TrUserData), TrUserData); - list_volume_attachments_request -> encode_msg_list_volume_attachments_request(id(Msg, TrUserData), TrUserData); - list_volume_attachments_response -> encode_msg_list_volume_attachments_response(id(Msg, TrUserData), TrUserData); - port_forwarding_identifier -> encode_msg_port_forwarding_identifier(id(Msg, TrUserData), TrUserData); - port_forwarding -> encode_msg_port_forwarding(id(Msg, TrUserData), TrUserData); - list_port_forwardings_request -> encode_msg_list_port_forwardings_request(id(Msg, TrUserData), TrUserData); - list_port_forwardings_response -> encode_msg_list_port_forwardings_response(id(Msg, TrUserData), TrUserData); - put_port_forwarding_request -> encode_msg_put_port_forwarding_request(id(Msg, TrUserData), TrUserData); - dns_record_identifier -> encode_msg_dns_record_identifier(id(Msg, TrUserData), TrUserData); - dns_record -> encode_msg_dns_record(id(Msg, TrUserData), TrUserData); - list_dns_records_request -> encode_msg_list_dns_records_request(id(Msg, TrUserData), TrUserData); - list_dns_records_response -> encode_msg_list_dns_records_response(id(Msg, TrUserData), TrUserData); - put_dns_record_request -> encode_msg_put_dns_record_request(id(Msg, TrUserData), TrUserData); - route_table -> encode_msg_route_table(id(Msg, TrUserData), TrUserData); - route_table_identifier -> encode_msg_route_table_identifier(id(Msg, TrUserData), TrUserData); - list_route_tables_request -> encode_msg_list_route_tables_request(id(Msg, TrUserData), TrUserData); - list_route_tables_response -> encode_msg_list_route_tables_response(id(Msg, TrUserData), TrUserData); - create_route_table_request -> encode_msg_create_route_table_request(id(Msg, TrUserData), TrUserData); - route_identifier -> encode_msg_route_identifier(id(Msg, TrUserData), TrUserData); - route -> encode_msg_route(id(Msg, TrUserData), TrUserData); - list_routes_request -> encode_msg_list_routes_request(id(Msg, TrUserData), TrUserData); - list_routes_response -> encode_msg_list_routes_response(id(Msg, TrUserData), TrUserData); - put_route_request -> encode_msg_put_route_request(id(Msg, TrUserData), TrUserData); - sync_request -> encode_msg_sync_request(id(Msg, TrUserData), TrUserData); - timestamp -> encode_msg_timestamp(id(Msg, TrUserData), TrUserData) - end. - - -encode_msg_empty(_Msg, _TrUserData) -> <<>>. - -encode_msg_sync_routes_request(_Msg, _TrUserData) -> <<>>. - -encode_msg_start_domain_request(Msg, TrUserData) -> encode_msg_start_domain_request(Msg, <<>>, TrUserData). - - -encode_msg_start_domain_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{host := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{uuid := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_stop_domain_request(Msg, TrUserData) -> encode_msg_stop_domain_request(Msg, <<>>, TrUserData). - - -encode_msg_stop_domain_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{host := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - B2 = case M of - #{uuid := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end, - case M of - #{force := F3} -> - begin - TrF3 = id(F3, TrUserData), - if TrF3 =:= false -> B2; - true -> e_type_bool(TrF3, <>, TrUserData) - end - end; - _ -> B2 - end. - -encode_msg_get_domain_request(Msg, TrUserData) -> encode_msg_get_domain_request(Msg, <<>>, TrUserData). - - -encode_msg_get_domain_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{uuid := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{host := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_domain(Msg, TrUserData) -> encode_msg_domain(Msg, <<>>, TrUserData). - - -encode_msg_domain(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{id := F1} -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= 0 -> Bin; - true -> e_varint(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - B2 = case M of - #{uuid := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end, - B3 = case M of - #{name := F3} -> - begin - TrF3 = id(F3, TrUserData), - case is_empty_string(TrF3) of - true -> B2; - false -> e_type_string(TrF3, <>, TrUserData) - end - end; - _ -> B2 - end, - B4 = case M of - #{vcpu := F4} -> - begin - TrF4 = id(F4, TrUserData), - if TrF4 =:= 0 -> B3; - true -> e_varint(TrF4, <>, TrUserData) - end - end; - _ -> B3 - end, - B5 = case M of - #{memory := F5} -> - begin - TrF5 = id(F5, TrUserData), - if TrF5 =:= 0 -> B4; - true -> e_varint(TrF5, <>, TrUserData) - end - end; - _ -> B4 - end, - B6 = case M of - #{network := F6} -> - begin - TrF6 = id(F6, TrUserData), - case is_empty_string(TrF6) of - true -> B5; - false -> e_type_string(TrF6, <>, TrUserData) - end - end; - _ -> B5 - end, - B7 = case M of - #{bridge := F7} -> - begin - TrF7 = id(F7, TrUserData), - case is_empty_string(TrF7) of - true -> B6; - false -> e_type_string(TrF7, <>, TrUserData) - end - end; - _ -> B6 - end, - B8 = case M of - #{state := F8} -> - begin - TrF8 = id(F8, TrUserData), - case is_empty_string(TrF8) of - true -> B7; - false -> e_type_string(TrF8, <>, TrUserData) - end - end; - _ -> B7 - end, - B9 = case M of - #{private_ip := F9} -> - begin - TrF9 = id(F9, TrUserData), - case is_empty_string(TrF9) of - true -> B8; - false -> e_type_string(TrF9, <>, TrUserData) - end - end; - _ -> B8 - end, - B10 = case M of - #{ipv6_address := F10} -> - begin - TrF10 = id(F10, TrUserData), - case is_empty_string(TrF10) of - true -> B9; - false -> e_type_string(TrF10, <>, TrUserData) - end - end; - _ -> B9 - end, - B11 = case M of - #{user_data := F11} -> - begin - TrF11 = id(F11, TrUserData), - case is_empty_string(TrF11) of - true -> B10; - false -> e_type_string(TrF11, <>, TrUserData) - end - end; - _ -> B10 - end, - B12 = case M of - #{nested_virtualization := F12} -> - begin - TrF12 = id(F12, TrUserData), - if TrF12 =:= false -> B11; - true -> e_type_bool(TrF12, <>, TrUserData) - end - end; - _ -> B11 - end, - B13 = case M of - #{base_image := F13} -> - begin - TrF13 = id(F13, TrUserData), - case is_empty_string(TrF13) of - true -> B12; - false -> e_type_string(TrF13, <>, TrUserData) - end - end; - _ -> B12 - end, - B14 = case M of - #{created_at := F14} -> - begin - TrF14 = id(F14, TrUserData), - if TrF14 =:= undefined -> B13; - true -> e_mfield_domain_created_at(TrF14, <>, TrUserData) - end - end; - _ -> B13 - end, - case M of - #{os_type := F15} -> - begin - TrF15 = id(F15, TrUserData), - case is_empty_string(TrF15) of - true -> B14; - false -> e_type_string(TrF15, <>, TrUserData) - end - end; - _ -> B14 - end. - -encode_msg_list_domains_request(Msg, TrUserData) -> encode_msg_list_domains_request(Msg, <<>>, TrUserData). - - -encode_msg_list_domains_request(#{} = M, Bin, TrUserData) -> - case M of - #{host := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end. - -encode_msg_list_domains_response(Msg, TrUserData) -> encode_msg_list_domains_response(Msg, <<>>, TrUserData). - - -encode_msg_list_domains_response(#{} = M, Bin, TrUserData) -> - case M of - #{domains := F1} -> - TrF1 = id(F1, TrUserData), - if TrF1 == [] -> Bin; - true -> e_field_list_domains_response_domains(TrF1, Bin, TrUserData) - end; - _ -> Bin - end. - -encode_msg_create_domain_request(Msg, TrUserData) -> encode_msg_create_domain_request(Msg, <<>>, TrUserData). - - -encode_msg_create_domain_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{domain := F1} -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= undefined -> Bin; - true -> e_mfield_create_domain_request_domain(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{host := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_delete_domain_request(Msg, TrUserData) -> encode_msg_delete_domain_request(Msg, <<>>, TrUserData). - - -encode_msg_delete_domain_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{uuid := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{host := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_download_image_request(Msg, TrUserData) -> encode_msg_download_image_request(Msg, <<>>, TrUserData). - - -encode_msg_download_image_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{domain_id := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{host := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_image_chunk(Msg, TrUserData) -> encode_msg_image_chunk(Msg, <<>>, TrUserData). - - -encode_msg_image_chunk(#{} = M, Bin, TrUserData) -> - case M of - #{bytes := F1} -> - begin - TrF1 = id(F1, TrUserData), - case iolist_size(TrF1) of - 0 -> Bin; - _ -> e_type_bytes(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end. - -encode_msg_get_network_request(Msg, TrUserData) -> encode_msg_get_network_request(Msg, <<>>, TrUserData). - - -encode_msg_get_network_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{uuid := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{host := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_network(Msg, TrUserData) -> encode_msg_network(Msg, <<>>, TrUserData). - - -encode_msg_network(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{uuid := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - B2 = case M of - #{name := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end, - B3 = case M of - #{cidr := F3} -> - begin - TrF3 = id(F3, TrUserData), - case is_empty_string(TrF3) of - true -> B2; - false -> e_type_string(TrF3, <>, TrUserData) - end - end; - _ -> B2 - end, - case M of - #{cidr6 := F4} -> - begin - TrF4 = id(F4, TrUserData), - case is_empty_string(TrF4) of - true -> B3; - false -> e_type_string(TrF4, <>, TrUserData) - end - end; - _ -> B3 - end. - -encode_msg_list_networks_request(Msg, TrUserData) -> encode_msg_list_networks_request(Msg, <<>>, TrUserData). - - -encode_msg_list_networks_request(#{} = M, Bin, TrUserData) -> - case M of - #{host := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end. - -encode_msg_list_networks_response(Msg, TrUserData) -> encode_msg_list_networks_response(Msg, <<>>, TrUserData). - - -encode_msg_list_networks_response(#{} = M, Bin, TrUserData) -> - case M of - #{networks := F1} -> - TrF1 = id(F1, TrUserData), - if TrF1 == [] -> Bin; - true -> e_field_list_networks_response_networks(TrF1, Bin, TrUserData) - end; - _ -> Bin - end. - -encode_msg_create_network_request(Msg, TrUserData) -> encode_msg_create_network_request(Msg, <<>>, TrUserData). - - -encode_msg_create_network_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{network := F1} -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= undefined -> Bin; - true -> e_mfield_create_network_request_network(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{host := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_delete_network_request(Msg, TrUserData) -> encode_msg_delete_network_request(Msg, <<>>, TrUserData). - - -encode_msg_delete_network_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{uuid := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{host := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_get_volume_request(Msg, TrUserData) -> encode_msg_get_volume_request(Msg, <<>>, TrUserData). - - -encode_msg_get_volume_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{uuid := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{host := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_volume(Msg, TrUserData) -> encode_msg_volume(Msg, <<>>, TrUserData). - - -encode_msg_volume(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{id := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - B2 = case M of - #{name := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end, - case M of - #{size := F3} -> - begin - TrF3 = id(F3, TrUserData), - if TrF3 =:= 0 -> B2; - true -> e_varint(TrF3, <>, TrUserData) - end - end; - _ -> B2 - end. - -encode_msg_list_volumes_request(Msg, TrUserData) -> encode_msg_list_volumes_request(Msg, <<>>, TrUserData). - - -encode_msg_list_volumes_request(#{} = M, Bin, TrUserData) -> - case M of - #{host := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end. - -encode_msg_list_volumes_response(Msg, TrUserData) -> encode_msg_list_volumes_response(Msg, <<>>, TrUserData). - - -encode_msg_list_volumes_response(#{} = M, Bin, TrUserData) -> - case M of - #{volumes := F1} -> - TrF1 = id(F1, TrUserData), - if TrF1 == [] -> Bin; - true -> e_field_list_volumes_response_volumes(TrF1, Bin, TrUserData) - end; - _ -> Bin - end. - -encode_msg_create_volume_request(Msg, TrUserData) -> encode_msg_create_volume_request(Msg, <<>>, TrUserData). - - -encode_msg_create_volume_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{volume := F1} -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= undefined -> Bin; - true -> e_mfield_create_volume_request_volume(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{host := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_update_volume_request(Msg, TrUserData) -> encode_msg_update_volume_request(Msg, <<>>, TrUserData). - - -encode_msg_update_volume_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{host := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{volume := F2} -> - begin - TrF2 = id(F2, TrUserData), - if TrF2 =:= undefined -> B1; - true -> e_mfield_update_volume_request_volume(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_delete_volume_request(Msg, TrUserData) -> encode_msg_delete_volume_request(Msg, <<>>, TrUserData). - - -encode_msg_delete_volume_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{uuid := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{host := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_volume_attachment_identifier(Msg, TrUserData) -> encode_msg_volume_attachment_identifier(Msg, <<>>, TrUserData). - - -encode_msg_volume_attachment_identifier(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{domain_id := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - B2 = case M of - #{volume_id := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end, - case M of - #{host := F3} -> - begin - TrF3 = id(F3, TrUserData), - case is_empty_string(TrF3) of - true -> B2; - false -> e_type_string(TrF3, <>, TrUserData) - end - end; - _ -> B2 - end. - -encode_msg_volume_attachment(Msg, TrUserData) -> encode_msg_volume_attachment(Msg, <<>>, TrUserData). - - -encode_msg_volume_attachment(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{domain_id := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - B2 = case M of - #{volume_id := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end, - case M of - #{disk_address := F3} -> - begin - TrF3 = id(F3, TrUserData), - case is_empty_string(TrF3) of - true -> B2; - false -> e_type_string(TrF3, <>, TrUserData) - end - end; - _ -> B2 - end. - -encode_msg_list_volume_attachments_request(Msg, TrUserData) -> encode_msg_list_volume_attachments_request(Msg, <<>>, TrUserData). - - -encode_msg_list_volume_attachments_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{domain_id := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{host := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_list_volume_attachments_response(Msg, TrUserData) -> encode_msg_list_volume_attachments_response(Msg, <<>>, TrUserData). - - -encode_msg_list_volume_attachments_response(#{} = M, Bin, TrUserData) -> - case M of - #{attachments := F1} -> - TrF1 = id(F1, TrUserData), - if TrF1 == [] -> Bin; - true -> e_field_list_volume_attachments_response_attachments(TrF1, Bin, TrUserData) - end; - _ -> Bin - end. - -encode_msg_port_forwarding_identifier(Msg, TrUserData) -> encode_msg_port_forwarding_identifier(Msg, <<>>, TrUserData). - - -encode_msg_port_forwarding_identifier(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{host := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - B2 = case M of - #{protocol := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end, - case M of - #{source_port := F3} -> - begin - TrF3 = id(F3, TrUserData), - if TrF3 =:= 0 -> B2; - true -> e_varint(TrF3, <>, TrUserData) - end - end; - _ -> B2 - end. - -encode_msg_port_forwarding(Msg, TrUserData) -> encode_msg_port_forwarding(Msg, <<>>, TrUserData). - - -encode_msg_port_forwarding(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{protocol := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - B2 = case M of - #{source_port := F2} -> - begin - TrF2 = id(F2, TrUserData), - if TrF2 =:= 0 -> B1; - true -> e_varint(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end, - B3 = case M of - #{target_ip := F3} -> - begin - TrF3 = id(F3, TrUserData), - case is_empty_string(TrF3) of - true -> B2; - false -> e_type_string(TrF3, <>, TrUserData) - end - end; - _ -> B2 - end, - case M of - #{target_port := F4} -> - begin - TrF4 = id(F4, TrUserData), - if TrF4 =:= 0 -> B3; - true -> e_varint(TrF4, <>, TrUserData) - end - end; - _ -> B3 - end. - -encode_msg_list_port_forwardings_request(Msg, TrUserData) -> encode_msg_list_port_forwardings_request(Msg, <<>>, TrUserData). - - -encode_msg_list_port_forwardings_request(#{} = M, Bin, TrUserData) -> - case M of - #{host := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end. - -encode_msg_list_port_forwardings_response(Msg, TrUserData) -> encode_msg_list_port_forwardings_response(Msg, <<>>, TrUserData). - - -encode_msg_list_port_forwardings_response(#{} = M, Bin, TrUserData) -> - case M of - #{port_forwardings := F1} -> - TrF1 = id(F1, TrUserData), - if TrF1 == [] -> Bin; - true -> e_field_list_port_forwardings_response_port_forwardings(TrF1, Bin, TrUserData) - end; - _ -> Bin - end. - -encode_msg_put_port_forwarding_request(Msg, TrUserData) -> encode_msg_put_port_forwarding_request(Msg, <<>>, TrUserData). - - -encode_msg_put_port_forwarding_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{port_forwarding := F1} -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= undefined -> Bin; - true -> e_mfield_put_port_forwarding_request_port_forwarding(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{host := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_dns_record_identifier(Msg, TrUserData) -> encode_msg_dns_record_identifier(Msg, <<>>, TrUserData). - - -encode_msg_dns_record_identifier(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{name := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{type := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_dns_record(Msg, TrUserData) -> encode_msg_dns_record(Msg, <<>>, TrUserData). - - -encode_msg_dns_record(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{name := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - B2 = case M of - #{type := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end, - B3 = case M of - #{ttl := F3} -> - begin - TrF3 = id(F3, TrUserData), - if TrF3 =:= 0 -> B2; - true -> e_varint(TrF3, <>, TrUserData) - end - end; - _ -> B2 - end, - case M of - #{records := F4} -> - TrF4 = id(F4, TrUserData), - if TrF4 == [] -> B3; - true -> e_field_dns_record_records(TrF4, B3, TrUserData) - end; - _ -> B3 - end. - -encode_msg_list_dns_records_request(_Msg, _TrUserData) -> <<>>. - -encode_msg_list_dns_records_response(Msg, TrUserData) -> encode_msg_list_dns_records_response(Msg, <<>>, TrUserData). - - -encode_msg_list_dns_records_response(#{} = M, Bin, TrUserData) -> - case M of - #{dns_records := F1} -> - TrF1 = id(F1, TrUserData), - if TrF1 == [] -> Bin; - true -> e_field_list_dns_records_response_dns_records(TrF1, Bin, TrUserData) - end; - _ -> Bin - end. - -encode_msg_put_dns_record_request(Msg, TrUserData) -> encode_msg_put_dns_record_request(Msg, <<>>, TrUserData). - - -encode_msg_put_dns_record_request(#{} = M, Bin, TrUserData) -> - case M of - #{dns_record := F1} -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= undefined -> Bin; - true -> e_mfield_put_dns_record_request_dns_record(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end. - -encode_msg_route_table(Msg, TrUserData) -> encode_msg_route_table(Msg, <<>>, TrUserData). - - -encode_msg_route_table(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{network_name := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - B2 = case M of - #{id := F2} -> - begin - TrF2 = id(F2, TrUserData), - if TrF2 =:= 0 -> B1; - true -> e_varint(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end, - case M of - #{name := F3} -> - begin - TrF3 = id(F3, TrUserData), - case is_empty_string(TrF3) of - true -> B2; - false -> e_type_string(TrF3, <>, TrUserData) - end - end; - _ -> B2 - end. - -encode_msg_route_table_identifier(Msg, TrUserData) -> encode_msg_route_table_identifier(Msg, <<>>, TrUserData). - - -encode_msg_route_table_identifier(#{} = M, Bin, TrUserData) -> - case M of - #{id := F1} -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= 0 -> Bin; - true -> e_varint(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end. - -encode_msg_list_route_tables_request(Msg, TrUserData) -> encode_msg_list_route_tables_request(Msg, <<>>, TrUserData). - - -encode_msg_list_route_tables_request(#{} = M, Bin, TrUserData) -> - case M of - #{network_name := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end. - -encode_msg_list_route_tables_response(Msg, TrUserData) -> encode_msg_list_route_tables_response(Msg, <<>>, TrUserData). - - -encode_msg_list_route_tables_response(#{} = M, Bin, TrUserData) -> - case M of - #{route_tables := F1} -> - TrF1 = id(F1, TrUserData), - if TrF1 == [] -> Bin; - true -> e_field_list_route_tables_response_route_tables(TrF1, Bin, TrUserData) - end; - _ -> Bin - end. - -encode_msg_create_route_table_request(Msg, TrUserData) -> encode_msg_create_route_table_request(Msg, <<>>, TrUserData). - - -encode_msg_create_route_table_request(#{} = M, Bin, TrUserData) -> - case M of - #{route_table := F1} -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= undefined -> Bin; - true -> e_mfield_create_route_table_request_route_table(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end. - -encode_msg_route_identifier(Msg, TrUserData) -> encode_msg_route_identifier(Msg, <<>>, TrUserData). - - -encode_msg_route_identifier(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{route_table_id := F1} -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= 0 -> Bin; - true -> e_varint(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{destination := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_route(Msg, TrUserData) -> encode_msg_route(Msg, <<>>, TrUserData). - - -encode_msg_route(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{route_table_id := F1} -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= 0 -> Bin; - true -> e_varint(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - B2 = case M of - #{destination := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end, - case M of - #{gateways := F3} -> - TrF3 = id(F3, TrUserData), - if TrF3 == [] -> B2; - true -> e_field_route_gateways(TrF3, B2, TrUserData) - end; - _ -> B2 - end. - -encode_msg_list_routes_request(Msg, TrUserData) -> encode_msg_list_routes_request(Msg, <<>>, TrUserData). - - -encode_msg_list_routes_request(#{} = M, Bin, TrUserData) -> - case M of - #{route_table_id := F1} -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= 0 -> Bin; - true -> e_varint(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end. - -encode_msg_list_routes_response(Msg, TrUserData) -> encode_msg_list_routes_response(Msg, <<>>, TrUserData). - - -encode_msg_list_routes_response(#{} = M, Bin, TrUserData) -> - case M of - #{routes := F1} -> - TrF1 = id(F1, TrUserData), - if TrF1 == [] -> Bin; - true -> e_field_list_routes_response_routes(TrF1, Bin, TrUserData) - end; - _ -> Bin - end. - -encode_msg_put_route_request(Msg, TrUserData) -> encode_msg_put_route_request(Msg, <<>>, TrUserData). - - -encode_msg_put_route_request(#{} = M, Bin, TrUserData) -> - case M of - #{route := F1} -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= undefined -> Bin; - true -> e_mfield_put_route_request_route(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end. - -encode_msg_sync_request(_Msg, _TrUserData) -> <<>>. - -encode_msg_timestamp(Msg, TrUserData) -> encode_msg_timestamp(Msg, <<>>, TrUserData). - - -encode_msg_timestamp(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{seconds := F1} -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= 0 -> Bin; - true -> e_type_int64(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{nanos := F2} -> - begin - TrF2 = id(F2, TrUserData), - if TrF2 =:= 0 -> B1; - true -> e_type_int32(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -e_mfield_domain_created_at(Msg, Bin, TrUserData) -> - SubBin = encode_msg_timestamp(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_mfield_list_domains_response_domains(Msg, Bin, TrUserData) -> - SubBin = encode_msg_domain(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_field_list_domains_response_domains([Elem | Rest], Bin, TrUserData) -> - Bin2 = <>, - Bin3 = e_mfield_list_domains_response_domains(id(Elem, TrUserData), Bin2, TrUserData), - e_field_list_domains_response_domains(Rest, Bin3, TrUserData); -e_field_list_domains_response_domains([], Bin, _TrUserData) -> Bin. - -e_mfield_create_domain_request_domain(Msg, Bin, TrUserData) -> - SubBin = encode_msg_domain(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_mfield_list_networks_response_networks(Msg, Bin, TrUserData) -> - SubBin = encode_msg_network(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_field_list_networks_response_networks([Elem | Rest], Bin, TrUserData) -> - Bin2 = <>, - Bin3 = e_mfield_list_networks_response_networks(id(Elem, TrUserData), Bin2, TrUserData), - e_field_list_networks_response_networks(Rest, Bin3, TrUserData); -e_field_list_networks_response_networks([], Bin, _TrUserData) -> Bin. - -e_mfield_create_network_request_network(Msg, Bin, TrUserData) -> - SubBin = encode_msg_network(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_mfield_list_volumes_response_volumes(Msg, Bin, TrUserData) -> - SubBin = encode_msg_volume(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_field_list_volumes_response_volumes([Elem | Rest], Bin, TrUserData) -> - Bin2 = <>, - Bin3 = e_mfield_list_volumes_response_volumes(id(Elem, TrUserData), Bin2, TrUserData), - e_field_list_volumes_response_volumes(Rest, Bin3, TrUserData); -e_field_list_volumes_response_volumes([], Bin, _TrUserData) -> Bin. - -e_mfield_create_volume_request_volume(Msg, Bin, TrUserData) -> - SubBin = encode_msg_volume(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_mfield_update_volume_request_volume(Msg, Bin, TrUserData) -> - SubBin = encode_msg_volume(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_mfield_list_volume_attachments_response_attachments(Msg, Bin, TrUserData) -> - SubBin = encode_msg_volume_attachment(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_field_list_volume_attachments_response_attachments([Elem | Rest], Bin, TrUserData) -> - Bin2 = <>, - Bin3 = e_mfield_list_volume_attachments_response_attachments(id(Elem, TrUserData), Bin2, TrUserData), - e_field_list_volume_attachments_response_attachments(Rest, Bin3, TrUserData); -e_field_list_volume_attachments_response_attachments([], Bin, _TrUserData) -> Bin. - -e_mfield_list_port_forwardings_response_port_forwardings(Msg, Bin, TrUserData) -> - SubBin = encode_msg_port_forwarding(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_field_list_port_forwardings_response_port_forwardings([Elem | Rest], Bin, TrUserData) -> - Bin2 = <>, - Bin3 = e_mfield_list_port_forwardings_response_port_forwardings(id(Elem, TrUserData), Bin2, TrUserData), - e_field_list_port_forwardings_response_port_forwardings(Rest, Bin3, TrUserData); -e_field_list_port_forwardings_response_port_forwardings([], Bin, _TrUserData) -> Bin. - -e_mfield_put_port_forwarding_request_port_forwarding(Msg, Bin, TrUserData) -> - SubBin = encode_msg_port_forwarding(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_field_dns_record_records([Elem | Rest], Bin, TrUserData) -> - Bin2 = <>, - Bin3 = e_type_string(id(Elem, TrUserData), Bin2, TrUserData), - e_field_dns_record_records(Rest, Bin3, TrUserData); -e_field_dns_record_records([], Bin, _TrUserData) -> Bin. - -e_mfield_list_dns_records_response_dns_records(Msg, Bin, TrUserData) -> - SubBin = encode_msg_dns_record(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_field_list_dns_records_response_dns_records([Elem | Rest], Bin, TrUserData) -> - Bin2 = <>, - Bin3 = e_mfield_list_dns_records_response_dns_records(id(Elem, TrUserData), Bin2, TrUserData), - e_field_list_dns_records_response_dns_records(Rest, Bin3, TrUserData); -e_field_list_dns_records_response_dns_records([], Bin, _TrUserData) -> Bin. - -e_mfield_put_dns_record_request_dns_record(Msg, Bin, TrUserData) -> - SubBin = encode_msg_dns_record(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_mfield_list_route_tables_response_route_tables(Msg, Bin, TrUserData) -> - SubBin = encode_msg_route_table(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_field_list_route_tables_response_route_tables([Elem | Rest], Bin, TrUserData) -> - Bin2 = <>, - Bin3 = e_mfield_list_route_tables_response_route_tables(id(Elem, TrUserData), Bin2, TrUserData), - e_field_list_route_tables_response_route_tables(Rest, Bin3, TrUserData); -e_field_list_route_tables_response_route_tables([], Bin, _TrUserData) -> Bin. - -e_mfield_create_route_table_request_route_table(Msg, Bin, TrUserData) -> - SubBin = encode_msg_route_table(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_field_route_gateways([Elem | Rest], Bin, TrUserData) -> - Bin2 = <>, - Bin3 = e_type_string(id(Elem, TrUserData), Bin2, TrUserData), - e_field_route_gateways(Rest, Bin3, TrUserData); -e_field_route_gateways([], Bin, _TrUserData) -> Bin. - -e_mfield_list_routes_response_routes(Msg, Bin, TrUserData) -> - SubBin = encode_msg_route(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_field_list_routes_response_routes([Elem | Rest], Bin, TrUserData) -> - Bin2 = <>, - Bin3 = e_mfield_list_routes_response_routes(id(Elem, TrUserData), Bin2, TrUserData), - e_field_list_routes_response_routes(Rest, Bin3, TrUserData); -e_field_list_routes_response_routes([], Bin, _TrUserData) -> Bin. - -e_mfield_put_route_request_route(Msg, Bin, TrUserData) -> - SubBin = encode_msg_route(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - --compile({nowarn_unused_function,e_type_sint/3}). -e_type_sint(Value, Bin, _TrUserData) when Value >= 0 -> e_varint(Value * 2, Bin); -e_type_sint(Value, Bin, _TrUserData) -> e_varint(Value * -2 - 1, Bin). - --compile({nowarn_unused_function,e_type_int32/3}). -e_type_int32(Value, Bin, _TrUserData) when 0 =< Value, Value =< 127 -> <>; -e_type_int32(Value, Bin, _TrUserData) -> - <> = <>, - e_varint(N, Bin). - --compile({nowarn_unused_function,e_type_int64/3}). -e_type_int64(Value, Bin, _TrUserData) when 0 =< Value, Value =< 127 -> <>; -e_type_int64(Value, Bin, _TrUserData) -> - <> = <>, - e_varint(N, Bin). - --compile({nowarn_unused_function,e_type_bool/3}). -e_type_bool(true, Bin, _TrUserData) -> <>; -e_type_bool(false, Bin, _TrUserData) -> <>; -e_type_bool(1, Bin, _TrUserData) -> <>; -e_type_bool(0, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_string/3}). -e_type_string(S, Bin, _TrUserData) -> - Utf8 = unicode:characters_to_binary(S), - Bin2 = e_varint(byte_size(Utf8), Bin), - <>. - --compile({nowarn_unused_function,e_type_bytes/3}). -e_type_bytes(Bytes, Bin, _TrUserData) when is_binary(Bytes) -> - Bin2 = e_varint(byte_size(Bytes), Bin), - <>; -e_type_bytes(Bytes, Bin, _TrUserData) when is_list(Bytes) -> - BytesBin = iolist_to_binary(Bytes), - Bin2 = e_varint(byte_size(BytesBin), Bin), - <>. - --compile({nowarn_unused_function,e_type_fixed32/3}). -e_type_fixed32(Value, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_sfixed32/3}). -e_type_sfixed32(Value, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_fixed64/3}). -e_type_fixed64(Value, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_sfixed64/3}). -e_type_sfixed64(Value, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_float/3}). -e_type_float(V, Bin, _) when is_number(V) -> <>; -e_type_float(infinity, Bin, _) -> <>; -e_type_float('-infinity', Bin, _) -> <>; -e_type_float(nan, Bin, _) -> <>. - --compile({nowarn_unused_function,e_type_double/3}). -e_type_double(V, Bin, _) when is_number(V) -> <>; -e_type_double(infinity, Bin, _) -> <>; -e_type_double('-infinity', Bin, _) -> <>; -e_type_double(nan, Bin, _) -> <>. - --compile({nowarn_unused_function,e_unknown_elems/2}). -e_unknown_elems([Elem | Rest], Bin) -> - BinR = case Elem of - {varint, FNum, N} -> - BinF = e_varint(FNum bsl 3, Bin), - e_varint(N, BinF); - {length_delimited, FNum, Data} -> - BinF = e_varint(FNum bsl 3 bor 2, Bin), - BinL = e_varint(byte_size(Data), BinF), - <>; - {group, FNum, GroupFields} -> - Bin1 = e_varint(FNum bsl 3 bor 3, Bin), - Bin2 = e_unknown_elems(GroupFields, Bin1), - e_varint(FNum bsl 3 bor 4, Bin2); - {fixed32, FNum, V} -> - BinF = e_varint(FNum bsl 3 bor 5, Bin), - <>; - {fixed64, FNum, V} -> - BinF = e_varint(FNum bsl 3 bor 1, Bin), - <> - end, - e_unknown_elems(Rest, BinR); -e_unknown_elems([], Bin) -> Bin. - --compile({nowarn_unused_function,e_varint/3}). -e_varint(N, Bin, _TrUserData) -> e_varint(N, Bin). - --compile({nowarn_unused_function,e_varint/2}). -e_varint(N, Bin) when N =< 127 -> <>; -e_varint(N, Bin) -> - Bin2 = <>, - e_varint(N bsr 7, Bin2). - -is_empty_string("") -> true; -is_empty_string(<<>>) -> true; -is_empty_string(L) when is_list(L) -> not string_has_chars(L); -is_empty_string(B) when is_binary(B) -> false. - -string_has_chars([C | _]) when is_integer(C) -> true; -string_has_chars([H | T]) -> - case string_has_chars(H) of - true -> true; - false -> string_has_chars(T) - end; -string_has_chars(B) when is_binary(B), byte_size(B) =/= 0 -> true; -string_has_chars(C) when is_integer(C) -> true; -string_has_chars(<<>>) -> false; -string_has_chars([]) -> false. - - -decode_msg(Bin, MsgName) when is_binary(Bin) -> decode_msg(Bin, MsgName, []). - -decode_msg(Bin, MsgName, Opts) when is_binary(Bin) -> - TrUserData = proplists:get_value(user_data, Opts), - decode_msg_1_catch(Bin, MsgName, TrUserData). - --ifdef('OTP_RELEASE'). -decode_msg_1_catch(Bin, MsgName, TrUserData) -> - try decode_msg_2_doit(MsgName, Bin, TrUserData) - catch - error:{gpb_error,_}=Reason:StackTrace -> - erlang:raise(error, Reason, StackTrace); - Class:Reason:StackTrace -> error({gpb_error,{decoding_failure, {Bin, MsgName, {Class, Reason, StackTrace}}}}) - end. --else. -decode_msg_1_catch(Bin, MsgName, TrUserData) -> - try decode_msg_2_doit(MsgName, Bin, TrUserData) - catch - error:{gpb_error,_}=Reason -> - erlang:raise(error, Reason, - erlang:get_stacktrace()); - Class:Reason -> - StackTrace = erlang:get_stacktrace(), - error({gpb_error,{decoding_failure, {Bin, MsgName, {Class, Reason, StackTrace}}}}) - end. --endif. - -decode_msg_2_doit(empty, Bin, TrUserData) -> id(decode_msg_empty(Bin, TrUserData), TrUserData); -decode_msg_2_doit(sync_routes_request, Bin, TrUserData) -> id(decode_msg_sync_routes_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(start_domain_request, Bin, TrUserData) -> id(decode_msg_start_domain_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(stop_domain_request, Bin, TrUserData) -> id(decode_msg_stop_domain_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(get_domain_request, Bin, TrUserData) -> id(decode_msg_get_domain_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(domain, Bin, TrUserData) -> id(decode_msg_domain(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_domains_request, Bin, TrUserData) -> id(decode_msg_list_domains_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_domains_response, Bin, TrUserData) -> id(decode_msg_list_domains_response(Bin, TrUserData), TrUserData); -decode_msg_2_doit(create_domain_request, Bin, TrUserData) -> id(decode_msg_create_domain_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(delete_domain_request, Bin, TrUserData) -> id(decode_msg_delete_domain_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(download_image_request, Bin, TrUserData) -> id(decode_msg_download_image_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(image_chunk, Bin, TrUserData) -> id(decode_msg_image_chunk(Bin, TrUserData), TrUserData); -decode_msg_2_doit(get_network_request, Bin, TrUserData) -> id(decode_msg_get_network_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(network, Bin, TrUserData) -> id(decode_msg_network(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_networks_request, Bin, TrUserData) -> id(decode_msg_list_networks_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_networks_response, Bin, TrUserData) -> id(decode_msg_list_networks_response(Bin, TrUserData), TrUserData); -decode_msg_2_doit(create_network_request, Bin, TrUserData) -> id(decode_msg_create_network_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(delete_network_request, Bin, TrUserData) -> id(decode_msg_delete_network_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(get_volume_request, Bin, TrUserData) -> id(decode_msg_get_volume_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(volume, Bin, TrUserData) -> id(decode_msg_volume(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_volumes_request, Bin, TrUserData) -> id(decode_msg_list_volumes_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_volumes_response, Bin, TrUserData) -> id(decode_msg_list_volumes_response(Bin, TrUserData), TrUserData); -decode_msg_2_doit(create_volume_request, Bin, TrUserData) -> id(decode_msg_create_volume_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(update_volume_request, Bin, TrUserData) -> id(decode_msg_update_volume_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(delete_volume_request, Bin, TrUserData) -> id(decode_msg_delete_volume_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(volume_attachment_identifier, Bin, TrUserData) -> id(decode_msg_volume_attachment_identifier(Bin, TrUserData), TrUserData); -decode_msg_2_doit(volume_attachment, Bin, TrUserData) -> id(decode_msg_volume_attachment(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_volume_attachments_request, Bin, TrUserData) -> id(decode_msg_list_volume_attachments_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_volume_attachments_response, Bin, TrUserData) -> id(decode_msg_list_volume_attachments_response(Bin, TrUserData), TrUserData); -decode_msg_2_doit(port_forwarding_identifier, Bin, TrUserData) -> id(decode_msg_port_forwarding_identifier(Bin, TrUserData), TrUserData); -decode_msg_2_doit(port_forwarding, Bin, TrUserData) -> id(decode_msg_port_forwarding(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_port_forwardings_request, Bin, TrUserData) -> id(decode_msg_list_port_forwardings_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_port_forwardings_response, Bin, TrUserData) -> id(decode_msg_list_port_forwardings_response(Bin, TrUserData), TrUserData); -decode_msg_2_doit(put_port_forwarding_request, Bin, TrUserData) -> id(decode_msg_put_port_forwarding_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(dns_record_identifier, Bin, TrUserData) -> id(decode_msg_dns_record_identifier(Bin, TrUserData), TrUserData); -decode_msg_2_doit(dns_record, Bin, TrUserData) -> id(decode_msg_dns_record(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_dns_records_request, Bin, TrUserData) -> id(decode_msg_list_dns_records_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_dns_records_response, Bin, TrUserData) -> id(decode_msg_list_dns_records_response(Bin, TrUserData), TrUserData); -decode_msg_2_doit(put_dns_record_request, Bin, TrUserData) -> id(decode_msg_put_dns_record_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(route_table, Bin, TrUserData) -> id(decode_msg_route_table(Bin, TrUserData), TrUserData); -decode_msg_2_doit(route_table_identifier, Bin, TrUserData) -> id(decode_msg_route_table_identifier(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_route_tables_request, Bin, TrUserData) -> id(decode_msg_list_route_tables_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_route_tables_response, Bin, TrUserData) -> id(decode_msg_list_route_tables_response(Bin, TrUserData), TrUserData); -decode_msg_2_doit(create_route_table_request, Bin, TrUserData) -> id(decode_msg_create_route_table_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(route_identifier, Bin, TrUserData) -> id(decode_msg_route_identifier(Bin, TrUserData), TrUserData); -decode_msg_2_doit(route, Bin, TrUserData) -> id(decode_msg_route(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_routes_request, Bin, TrUserData) -> id(decode_msg_list_routes_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_routes_response, Bin, TrUserData) -> id(decode_msg_list_routes_response(Bin, TrUserData), TrUserData); -decode_msg_2_doit(put_route_request, Bin, TrUserData) -> id(decode_msg_put_route_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(sync_request, Bin, TrUserData) -> id(decode_msg_sync_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(timestamp, Bin, TrUserData) -> id(decode_msg_timestamp(Bin, TrUserData), TrUserData). - - - -decode_msg_empty(Bin, TrUserData) -> dfp_read_field_def_empty(Bin, 0, 0, 0, TrUserData). - -dfp_read_field_def_empty(<<>>, 0, 0, _, _) -> #{}; -dfp_read_field_def_empty(Other, Z1, Z2, F, TrUserData) -> dg_read_field_def_empty(Other, Z1, Z2, F, TrUserData). - -dg_read_field_def_empty(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 32 - 7 -> dg_read_field_def_empty(Rest, N + 7, X bsl N + Acc, F, TrUserData); -dg_read_field_def_empty(<<0:1, X:7, Rest/binary>>, N, Acc, _, TrUserData) -> - Key = X bsl N + Acc, - case Key band 7 of - 0 -> skip_varint_empty(Rest, 0, 0, Key bsr 3, TrUserData); - 1 -> skip_64_empty(Rest, 0, 0, Key bsr 3, TrUserData); - 2 -> skip_length_delimited_empty(Rest, 0, 0, Key bsr 3, TrUserData); - 3 -> skip_group_empty(Rest, 0, 0, Key bsr 3, TrUserData); - 5 -> skip_32_empty(Rest, 0, 0, Key bsr 3, TrUserData) - end; -dg_read_field_def_empty(<<>>, 0, 0, _, _) -> #{}. - -skip_varint_empty(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> skip_varint_empty(Rest, Z1, Z2, F, TrUserData); -skip_varint_empty(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_empty(Rest, Z1, Z2, F, TrUserData). - -skip_length_delimited_empty(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 57 -> skip_length_delimited_empty(Rest, N + 7, X bsl N + Acc, F, TrUserData); -skip_length_delimited_empty(<<0:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_empty(Rest2, 0, 0, F, TrUserData). - -skip_group_empty(Bin, _, Z2, FNum, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_empty(Rest, 0, Z2, FNum, TrUserData). - -skip_32_empty(<<_:32, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_empty(Rest, Z1, Z2, F, TrUserData). - -skip_64_empty(<<_:64, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_empty(Rest, Z1, Z2, F, TrUserData). - -decode_msg_sync_routes_request(Bin, TrUserData) -> dfp_read_field_def_sync_routes_request(Bin, 0, 0, 0, TrUserData). - -dfp_read_field_def_sync_routes_request(<<>>, 0, 0, _, _) -> #{}; -dfp_read_field_def_sync_routes_request(Other, Z1, Z2, F, TrUserData) -> dg_read_field_def_sync_routes_request(Other, Z1, Z2, F, TrUserData). - -dg_read_field_def_sync_routes_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 32 - 7 -> dg_read_field_def_sync_routes_request(Rest, N + 7, X bsl N + Acc, F, TrUserData); -dg_read_field_def_sync_routes_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, TrUserData) -> - Key = X bsl N + Acc, - case Key band 7 of - 0 -> skip_varint_sync_routes_request(Rest, 0, 0, Key bsr 3, TrUserData); - 1 -> skip_64_sync_routes_request(Rest, 0, 0, Key bsr 3, TrUserData); - 2 -> skip_length_delimited_sync_routes_request(Rest, 0, 0, Key bsr 3, TrUserData); - 3 -> skip_group_sync_routes_request(Rest, 0, 0, Key bsr 3, TrUserData); - 5 -> skip_32_sync_routes_request(Rest, 0, 0, Key bsr 3, TrUserData) - end; -dg_read_field_def_sync_routes_request(<<>>, 0, 0, _, _) -> #{}. - -skip_varint_sync_routes_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> skip_varint_sync_routes_request(Rest, Z1, Z2, F, TrUserData); -skip_varint_sync_routes_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_sync_routes_request(Rest, Z1, Z2, F, TrUserData). - -skip_length_delimited_sync_routes_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 57 -> skip_length_delimited_sync_routes_request(Rest, N + 7, X bsl N + Acc, F, TrUserData); -skip_length_delimited_sync_routes_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_sync_routes_request(Rest2, 0, 0, F, TrUserData). - -skip_group_sync_routes_request(Bin, _, Z2, FNum, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_sync_routes_request(Rest, 0, Z2, FNum, TrUserData). - -skip_32_sync_routes_request(<<_:32, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_sync_routes_request(Rest, Z1, Z2, F, TrUserData). - -skip_64_sync_routes_request(<<_:64, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_sync_routes_request(Rest, Z1, Z2, F, TrUserData). - -decode_msg_start_domain_request(Bin, TrUserData) -> dfp_read_field_def_start_domain_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_start_domain_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_start_domain_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_start_domain_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_start_domain_request_uuid(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_start_domain_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{host => F@_1, uuid => F@_2}; -dfp_read_field_def_start_domain_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_start_domain_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_start_domain_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_start_domain_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_start_domain_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_start_domain_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_start_domain_request_uuid(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_start_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_start_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_start_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_start_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_start_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_start_domain_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{host => F@_1, uuid => F@_2}. - -d_field_start_domain_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_start_domain_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_start_domain_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_start_domain_request(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_start_domain_request_uuid(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_start_domain_request_uuid(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_start_domain_request_uuid(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_start_domain_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_start_domain_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_start_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_start_domain_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_start_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_start_domain_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_start_domain_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_start_domain_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_start_domain_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_start_domain_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_start_domain_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_start_domain_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_start_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_start_domain_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_start_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_stop_domain_request(Bin, TrUserData) -> dfp_read_field_def_stop_domain_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), id(false, TrUserData), TrUserData). - -dfp_read_field_def_stop_domain_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_stop_domain_request_host(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_stop_domain_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_stop_domain_request_uuid(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_stop_domain_request(<<24, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_stop_domain_request_force(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_stop_domain_request(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{host => F@_1, uuid => F@_2, force => F@_3}; -dfp_read_field_def_stop_domain_request(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dg_read_field_def_stop_domain_request(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -dg_read_field_def_stop_domain_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 32 - 7 -> dg_read_field_def_stop_domain_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -dg_read_field_def_stop_domain_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_stop_domain_request_host(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 18 -> d_field_stop_domain_request_uuid(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 24 -> d_field_stop_domain_request_force(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_stop_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 1 -> skip_64_stop_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 2 -> skip_length_delimited_stop_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 3 -> skip_group_stop_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 5 -> skip_32_stop_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData) - end - end; -dg_read_field_def_stop_domain_request(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{host => F@_1, uuid => F@_2, force => F@_3}. - -d_field_stop_domain_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_stop_domain_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_stop_domain_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_stop_domain_request(RestF, 0, 0, F, NewFValue, F@_2, F@_3, TrUserData). - -d_field_stop_domain_request_uuid(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_stop_domain_request_uuid(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_stop_domain_request_uuid(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_stop_domain_request(RestF, 0, 0, F, F@_1, NewFValue, F@_3, TrUserData). - -d_field_stop_domain_request_force(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_stop_domain_request_force(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_stop_domain_request_force(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, TrUserData) -> - {NewFValue, RestF} = {id(X bsl N + Acc =/= 0, TrUserData), Rest}, - dfp_read_field_def_stop_domain_request(RestF, 0, 0, F, F@_1, F@_2, NewFValue, TrUserData). - -skip_varint_stop_domain_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> skip_varint_stop_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -skip_varint_stop_domain_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_stop_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_length_delimited_stop_domain_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> skip_length_delimited_stop_domain_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -skip_length_delimited_stop_domain_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_stop_domain_request(Rest2, 0, 0, F, F@_1, F@_2, F@_3, TrUserData). - -skip_group_stop_domain_request(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_stop_domain_request(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, TrUserData). - -skip_32_stop_domain_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_stop_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_64_stop_domain_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_stop_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -decode_msg_get_domain_request(Bin, TrUserData) -> dfp_read_field_def_get_domain_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_get_domain_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_get_domain_request_uuid(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_get_domain_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_get_domain_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_get_domain_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{uuid => F@_1, host => F@_2}; -dfp_read_field_def_get_domain_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_get_domain_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_get_domain_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_get_domain_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_get_domain_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_get_domain_request_uuid(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_get_domain_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_get_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_get_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_get_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_get_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_get_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_get_domain_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{uuid => F@_1, host => F@_2}. - -d_field_get_domain_request_uuid(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_get_domain_request_uuid(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_get_domain_request_uuid(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_get_domain_request(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_get_domain_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_get_domain_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_get_domain_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_get_domain_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_get_domain_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_get_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_get_domain_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_get_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_get_domain_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_get_domain_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_get_domain_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_get_domain_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_get_domain_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_get_domain_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_get_domain_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_get_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_get_domain_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_get_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_domain(Bin, TrUserData) -> - dfp_read_field_def_domain(Bin, - 0, - 0, - 0, - id(0, TrUserData), - id(<<>>, TrUserData), - id(<<>>, TrUserData), - id(0, TrUserData), - id(0, TrUserData), - id(<<>>, TrUserData), - id(<<>>, TrUserData), - id(<<>>, TrUserData), - id(<<>>, TrUserData), - id(<<>>, TrUserData), - id(<<>>, TrUserData), - id(false, TrUserData), - id(<<>>, TrUserData), - id('$undef', TrUserData), - id(<<>>, TrUserData), - TrUserData). - -dfp_read_field_def_domain(<<8, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_id(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_uuid(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<26, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_name(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_vcpu(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<40, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_memory(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<50, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_network(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<58, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_bridge(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<66, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_state(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<74, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_private_ip(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<122, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_ipv6_address(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<82, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_user_data(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<88, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_nested_virtualization(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<98, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_base_image(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<106, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_created_at(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<114, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_os_type(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, _) -> - S1 = #{id => F@_1, uuid => F@_2, name => F@_3, vcpu => F@_4, memory => F@_5, network => F@_6, bridge => F@_7, state => F@_8, private_ip => F@_9, ipv6_address => F@_10, user_data => F@_11, nested_virtualization => F@_12, base_image => F@_13, - os_type => F@_15}, - if F@_14 == '$undef' -> S1; - true -> S1#{created_at => F@_14} - end; -dfp_read_field_def_domain(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - dg_read_field_def_domain(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -dg_read_field_def_domain(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 32 - 7 -> - dg_read_field_def_domain(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dg_read_field_def_domain(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 8 -> d_field_domain_id(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 18 -> d_field_domain_uuid(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 26 -> d_field_domain_name(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 32 -> d_field_domain_vcpu(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 40 -> d_field_domain_memory(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 50 -> d_field_domain_network(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 58 -> d_field_domain_bridge(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 66 -> d_field_domain_state(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 74 -> d_field_domain_private_ip(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 122 -> d_field_domain_ipv6_address(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 82 -> d_field_domain_user_data(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 88 -> d_field_domain_nested_virtualization(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 98 -> d_field_domain_base_image(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 106 -> d_field_domain_created_at(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 114 -> d_field_domain_os_type(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_domain(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 1 -> skip_64_domain(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 2 -> skip_length_delimited_domain(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 3 -> skip_group_domain(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 5 -> skip_32_domain(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) - end - end; -dg_read_field_def_domain(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, _) -> - S1 = #{id => F@_1, uuid => F@_2, name => F@_3, vcpu => F@_4, memory => F@_5, network => F@_6, bridge => F@_7, state => F@_8, private_ip => F@_9, ipv6_address => F@_10, user_data => F@_11, nested_virtualization => F@_12, base_image => F@_13, - os_type => F@_15}, - if F@_14 == '$undef' -> S1; - true -> S1#{created_at => F@_14} - end. - -d_field_domain_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - {NewFValue, RestF} = {id((X bsl N + Acc) band 18446744073709551615, TrUserData), Rest}, - dfp_read_field_def_domain(RestF, 0, 0, F, NewFValue, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -d_field_domain_uuid(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_uuid(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_uuid(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_domain(RestF, 0, 0, F, F@_1, NewFValue, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -d_field_domain_name(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_name(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_name(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_domain(RestF, 0, 0, F, F@_1, F@_2, NewFValue, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -d_field_domain_vcpu(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_vcpu(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_vcpu(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, _, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - {NewFValue, RestF} = {id((X bsl N + Acc) band 4294967295, TrUserData), Rest}, - dfp_read_field_def_domain(RestF, 0, 0, F, F@_1, F@_2, F@_3, NewFValue, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -d_field_domain_memory(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_memory(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_memory(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, _, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - {NewFValue, RestF} = {id((X bsl N + Acc) band 18446744073709551615, TrUserData), Rest}, - dfp_read_field_def_domain(RestF, 0, 0, F, F@_1, F@_2, F@_3, F@_4, NewFValue, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -d_field_domain_network(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_network(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_network(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, _, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_domain(RestF, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, NewFValue, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -d_field_domain_bridge(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_bridge(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_bridge(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, _, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_domain(RestF, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, NewFValue, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -d_field_domain_state(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_state(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_state(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, _, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_domain(RestF, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, NewFValue, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -d_field_domain_private_ip(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_private_ip(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_private_ip(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, _, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_domain(RestF, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, NewFValue, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -d_field_domain_ipv6_address(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_ipv6_address(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_ipv6_address(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, _, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_domain(RestF, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, NewFValue, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -d_field_domain_user_data(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_user_data(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_user_data(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, _, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_domain(RestF, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, NewFValue, F@_12, F@_13, F@_14, F@_15, TrUserData). - -d_field_domain_nested_virtualization(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_nested_virtualization(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_nested_virtualization(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, _, F@_13, F@_14, F@_15, TrUserData) -> - {NewFValue, RestF} = {id(X bsl N + Acc =/= 0, TrUserData), Rest}, - dfp_read_field_def_domain(RestF, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, NewFValue, F@_13, F@_14, F@_15, TrUserData). - -d_field_domain_base_image(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_base_image(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_base_image(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, _, F@_14, F@_15, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_domain(RestF, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, NewFValue, F@_14, F@_15, TrUserData). - -d_field_domain_created_at(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_created_at(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_created_at(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, Prev, F@_15, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_timestamp(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_domain(RestF, - 0, - 0, - F, - F@_1, - F@_2, - F@_3, - F@_4, - F@_5, - F@_6, - F@_7, - F@_8, - F@_9, - F@_10, - F@_11, - F@_12, - F@_13, - if Prev == '$undef' -> NewFValue; - true -> merge_msg_timestamp(Prev, NewFValue, TrUserData) - end, - F@_15, - TrUserData). - -d_field_domain_os_type(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_os_type(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_os_type(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_domain(RestF, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, NewFValue, TrUserData). - -skip_varint_domain(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - skip_varint_domain(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -skip_varint_domain(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - dfp_read_field_def_domain(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -skip_length_delimited_domain(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - skip_length_delimited_domain(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -skip_length_delimited_domain(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_domain(Rest2, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -skip_group_domain(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_domain(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -skip_32_domain(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - dfp_read_field_def_domain(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -skip_64_domain(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - dfp_read_field_def_domain(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -decode_msg_list_domains_request(Bin, TrUserData) -> dfp_read_field_def_list_domains_request(Bin, 0, 0, 0, id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_list_domains_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_domains_request_host(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_list_domains_request(<<>>, 0, 0, _, F@_1, _) -> #{host => F@_1}; -dfp_read_field_def_list_domains_request(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_domains_request(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_list_domains_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_domains_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_list_domains_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_domains_request_host(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_domains_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_list_domains_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_list_domains_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_list_domains_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_list_domains_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_list_domains_request(<<>>, 0, 0, _, F@_1, _) -> #{host => F@_1}. - -d_field_list_domains_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_domains_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_list_domains_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_list_domains_request(RestF, 0, 0, F, NewFValue, TrUserData). - -skip_varint_list_domains_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_domains_request(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_list_domains_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_domains_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_list_domains_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_domains_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_list_domains_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_domains_request(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_list_domains_request(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_domains_request(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_list_domains_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_domains_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_list_domains_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_domains_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_list_domains_response(Bin, TrUserData) -> dfp_read_field_def_list_domains_response(Bin, 0, 0, 0, id([], TrUserData), TrUserData). - -dfp_read_field_def_list_domains_response(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_domains_response_domains(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_list_domains_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{domains => lists_reverse(R1, TrUserData)} - end; -dfp_read_field_def_list_domains_response(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_domains_response(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_list_domains_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_domains_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_list_domains_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_domains_response_domains(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_domains_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_list_domains_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_list_domains_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_list_domains_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_list_domains_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_list_domains_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{domains => lists_reverse(R1, TrUserData)} - end. - -d_field_list_domains_response_domains(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_domains_response_domains(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_list_domains_response_domains(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_domain(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_list_domains_response(RestF, 0, 0, F, cons(NewFValue, Prev, TrUserData), TrUserData). - -skip_varint_list_domains_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_domains_response(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_list_domains_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_domains_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_list_domains_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_domains_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_list_domains_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_domains_response(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_list_domains_response(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_domains_response(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_list_domains_response(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_domains_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_list_domains_response(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_domains_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_create_domain_request(Bin, TrUserData) -> dfp_read_field_def_create_domain_request(Bin, 0, 0, 0, id('$undef', TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_create_domain_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_create_domain_request_domain(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_create_domain_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_create_domain_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_create_domain_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> - S1 = #{host => F@_2}, - if F@_1 == '$undef' -> S1; - true -> S1#{domain => F@_1} - end; -dfp_read_field_def_create_domain_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_create_domain_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_create_domain_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_create_domain_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_create_domain_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_create_domain_request_domain(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_create_domain_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_create_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_create_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_create_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_create_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_create_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_create_domain_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> - S1 = #{host => F@_2}, - if F@_1 == '$undef' -> S1; - true -> S1#{domain => F@_1} - end. - -d_field_create_domain_request_domain(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_create_domain_request_domain(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_create_domain_request_domain(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_domain(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_create_domain_request(RestF, - 0, - 0, - F, - if Prev == '$undef' -> NewFValue; - true -> merge_msg_domain(Prev, NewFValue, TrUserData) - end, - F@_2, - TrUserData). - -d_field_create_domain_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_create_domain_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_create_domain_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_create_domain_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_create_domain_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_create_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_create_domain_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_create_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_create_domain_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_create_domain_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_create_domain_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_create_domain_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_create_domain_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_create_domain_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_create_domain_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_create_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_create_domain_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_create_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_delete_domain_request(Bin, TrUserData) -> dfp_read_field_def_delete_domain_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_delete_domain_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_delete_domain_request_uuid(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_delete_domain_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_delete_domain_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_delete_domain_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{uuid => F@_1, host => F@_2}; -dfp_read_field_def_delete_domain_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_delete_domain_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_delete_domain_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_delete_domain_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_delete_domain_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_delete_domain_request_uuid(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_delete_domain_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_delete_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_delete_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_delete_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_delete_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_delete_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_delete_domain_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{uuid => F@_1, host => F@_2}. - -d_field_delete_domain_request_uuid(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_delete_domain_request_uuid(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_delete_domain_request_uuid(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_delete_domain_request(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_delete_domain_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_delete_domain_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_delete_domain_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_delete_domain_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_delete_domain_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_delete_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_delete_domain_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_delete_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_delete_domain_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_delete_domain_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_delete_domain_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_delete_domain_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_delete_domain_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_delete_domain_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_delete_domain_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_delete_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_delete_domain_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_delete_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_download_image_request(Bin, TrUserData) -> dfp_read_field_def_download_image_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_download_image_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_download_image_request_domain_id(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_download_image_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_download_image_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_download_image_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{domain_id => F@_1, host => F@_2}; -dfp_read_field_def_download_image_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_download_image_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_download_image_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_download_image_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_download_image_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_download_image_request_domain_id(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_download_image_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_download_image_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_download_image_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_download_image_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_download_image_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_download_image_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_download_image_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{domain_id => F@_1, host => F@_2}. - -d_field_download_image_request_domain_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_download_image_request_domain_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_download_image_request_domain_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_download_image_request(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_download_image_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_download_image_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_download_image_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_download_image_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_download_image_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_download_image_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_download_image_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_download_image_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_download_image_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_download_image_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_download_image_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_download_image_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_download_image_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_download_image_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_download_image_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_download_image_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_download_image_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_download_image_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_image_chunk(Bin, TrUserData) -> dfp_read_field_def_image_chunk(Bin, 0, 0, 0, id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_image_chunk(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_image_chunk_bytes(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_image_chunk(<<>>, 0, 0, _, F@_1, _) -> #{bytes => F@_1}; -dfp_read_field_def_image_chunk(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_image_chunk(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_image_chunk(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_image_chunk(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_image_chunk(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_image_chunk_bytes(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_image_chunk(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_image_chunk(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_image_chunk(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_image_chunk(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_image_chunk(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_image_chunk(<<>>, 0, 0, _, F@_1, _) -> #{bytes => F@_1}. - -d_field_image_chunk_bytes(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_image_chunk_bytes(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_image_chunk_bytes(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_image_chunk(RestF, 0, 0, F, NewFValue, TrUserData). - -skip_varint_image_chunk(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_image_chunk(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_image_chunk(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_image_chunk(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_image_chunk(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_image_chunk(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_image_chunk(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_image_chunk(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_image_chunk(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_image_chunk(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_image_chunk(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_image_chunk(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_image_chunk(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_image_chunk(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_get_network_request(Bin, TrUserData) -> dfp_read_field_def_get_network_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_get_network_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_get_network_request_uuid(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_get_network_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_get_network_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_get_network_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{uuid => F@_1, host => F@_2}; -dfp_read_field_def_get_network_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_get_network_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_get_network_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_get_network_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_get_network_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_get_network_request_uuid(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_get_network_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_get_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_get_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_get_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_get_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_get_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_get_network_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{uuid => F@_1, host => F@_2}. - -d_field_get_network_request_uuid(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_get_network_request_uuid(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_get_network_request_uuid(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_get_network_request(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_get_network_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_get_network_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_get_network_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_get_network_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_get_network_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_get_network_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_get_network_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_get_network_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_get_network_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_get_network_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_get_network_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_get_network_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_get_network_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_get_network_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_get_network_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_get_network_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_get_network_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_get_network_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_network(Bin, TrUserData) -> dfp_read_field_def_network(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_network(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_network_uuid(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dfp_read_field_def_network(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_network_name(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dfp_read_field_def_network(<<26, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_network_cidr(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dfp_read_field_def_network(<<34, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_network_cidr6(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dfp_read_field_def_network(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, _) -> #{uuid => F@_1, name => F@_2, cidr => F@_3, cidr6 => F@_4}; -dfp_read_field_def_network(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dg_read_field_def_network(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -dg_read_field_def_network(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 32 - 7 -> dg_read_field_def_network(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dg_read_field_def_network(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, F@_4, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_network_uuid(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); - 18 -> d_field_network_name(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); - 26 -> d_field_network_cidr(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); - 34 -> d_field_network_cidr6(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_network(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); - 1 -> skip_64_network(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); - 2 -> skip_length_delimited_network(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); - 3 -> skip_group_network(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); - 5 -> skip_32_network(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData) - end - end; -dg_read_field_def_network(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, _) -> #{uuid => F@_1, name => F@_2, cidr => F@_3, cidr6 => F@_4}. - -d_field_network_uuid(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_network_uuid(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -d_field_network_uuid(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, F@_4, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_network(RestF, 0, 0, F, NewFValue, F@_2, F@_3, F@_4, TrUserData). - -d_field_network_name(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_network_name(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -d_field_network_name(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, F@_4, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_network(RestF, 0, 0, F, F@_1, NewFValue, F@_3, F@_4, TrUserData). - -d_field_network_cidr(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_network_cidr(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -d_field_network_cidr(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, F@_4, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_network(RestF, 0, 0, F, F@_1, F@_2, NewFValue, F@_4, TrUserData). - -d_field_network_cidr6(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_network_cidr6(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -d_field_network_cidr6(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_network(RestF, 0, 0, F, F@_1, F@_2, F@_3, NewFValue, TrUserData). - -skip_varint_network(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> skip_varint_network(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -skip_varint_network(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dfp_read_field_def_network(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -skip_length_delimited_network(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> skip_length_delimited_network(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -skip_length_delimited_network(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_network(Rest2, 0, 0, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -skip_group_network(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, F@_4, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_network(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, F@_4, TrUserData). - -skip_32_network(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dfp_read_field_def_network(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -skip_64_network(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dfp_read_field_def_network(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -decode_msg_list_networks_request(Bin, TrUserData) -> dfp_read_field_def_list_networks_request(Bin, 0, 0, 0, id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_list_networks_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_networks_request_host(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_list_networks_request(<<>>, 0, 0, _, F@_1, _) -> #{host => F@_1}; -dfp_read_field_def_list_networks_request(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_networks_request(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_list_networks_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_networks_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_list_networks_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_networks_request_host(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_networks_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_list_networks_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_list_networks_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_list_networks_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_list_networks_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_list_networks_request(<<>>, 0, 0, _, F@_1, _) -> #{host => F@_1}. - -d_field_list_networks_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_networks_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_list_networks_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_list_networks_request(RestF, 0, 0, F, NewFValue, TrUserData). - -skip_varint_list_networks_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_networks_request(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_list_networks_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_networks_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_list_networks_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_networks_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_list_networks_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_networks_request(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_list_networks_request(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_networks_request(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_list_networks_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_networks_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_list_networks_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_networks_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_list_networks_response(Bin, TrUserData) -> dfp_read_field_def_list_networks_response(Bin, 0, 0, 0, id([], TrUserData), TrUserData). - -dfp_read_field_def_list_networks_response(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_networks_response_networks(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_list_networks_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{networks => lists_reverse(R1, TrUserData)} - end; -dfp_read_field_def_list_networks_response(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_networks_response(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_list_networks_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_networks_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_list_networks_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_networks_response_networks(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_networks_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_list_networks_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_list_networks_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_list_networks_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_list_networks_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_list_networks_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{networks => lists_reverse(R1, TrUserData)} - end. - -d_field_list_networks_response_networks(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_networks_response_networks(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_list_networks_response_networks(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_network(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_list_networks_response(RestF, 0, 0, F, cons(NewFValue, Prev, TrUserData), TrUserData). - -skip_varint_list_networks_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_networks_response(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_list_networks_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_networks_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_list_networks_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_networks_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_list_networks_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_networks_response(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_list_networks_response(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_networks_response(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_list_networks_response(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_networks_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_list_networks_response(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_networks_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_create_network_request(Bin, TrUserData) -> dfp_read_field_def_create_network_request(Bin, 0, 0, 0, id('$undef', TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_create_network_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_create_network_request_network(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_create_network_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_create_network_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_create_network_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> - S1 = #{host => F@_2}, - if F@_1 == '$undef' -> S1; - true -> S1#{network => F@_1} - end; -dfp_read_field_def_create_network_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_create_network_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_create_network_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_create_network_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_create_network_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_create_network_request_network(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_create_network_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_create_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_create_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_create_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_create_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_create_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_create_network_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> - S1 = #{host => F@_2}, - if F@_1 == '$undef' -> S1; - true -> S1#{network => F@_1} - end. - -d_field_create_network_request_network(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_create_network_request_network(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_create_network_request_network(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_network(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_create_network_request(RestF, - 0, - 0, - F, - if Prev == '$undef' -> NewFValue; - true -> merge_msg_network(Prev, NewFValue, TrUserData) - end, - F@_2, - TrUserData). - -d_field_create_network_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_create_network_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_create_network_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_create_network_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_create_network_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_create_network_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_create_network_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_create_network_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_create_network_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_create_network_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_create_network_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_create_network_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_create_network_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_create_network_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_create_network_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_create_network_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_create_network_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_create_network_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_delete_network_request(Bin, TrUserData) -> dfp_read_field_def_delete_network_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_delete_network_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_delete_network_request_uuid(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_delete_network_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_delete_network_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_delete_network_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{uuid => F@_1, host => F@_2}; -dfp_read_field_def_delete_network_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_delete_network_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_delete_network_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_delete_network_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_delete_network_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_delete_network_request_uuid(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_delete_network_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_delete_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_delete_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_delete_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_delete_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_delete_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_delete_network_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{uuid => F@_1, host => F@_2}. - -d_field_delete_network_request_uuid(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_delete_network_request_uuid(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_delete_network_request_uuid(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_delete_network_request(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_delete_network_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_delete_network_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_delete_network_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_delete_network_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_delete_network_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_delete_network_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_delete_network_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_delete_network_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_delete_network_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_delete_network_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_delete_network_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_delete_network_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_delete_network_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_delete_network_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_delete_network_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_delete_network_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_delete_network_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_delete_network_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_get_volume_request(Bin, TrUserData) -> dfp_read_field_def_get_volume_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_get_volume_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_get_volume_request_uuid(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_get_volume_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_get_volume_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_get_volume_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{uuid => F@_1, host => F@_2}; -dfp_read_field_def_get_volume_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_get_volume_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_get_volume_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_get_volume_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_get_volume_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_get_volume_request_uuid(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_get_volume_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_get_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_get_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_get_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_get_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_get_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_get_volume_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{uuid => F@_1, host => F@_2}. - -d_field_get_volume_request_uuid(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_get_volume_request_uuid(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_get_volume_request_uuid(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_get_volume_request(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_get_volume_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_get_volume_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_get_volume_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_get_volume_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_get_volume_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_get_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_get_volume_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_get_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_get_volume_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_get_volume_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_get_volume_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_get_volume_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_get_volume_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_get_volume_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_get_volume_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_get_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_get_volume_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_get_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_volume(Bin, TrUserData) -> dfp_read_field_def_volume(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), id(0, TrUserData), TrUserData). - -dfp_read_field_def_volume(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_volume_id(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_volume(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_volume_name(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_volume(<<24, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_volume_size(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_volume(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{id => F@_1, name => F@_2, size => F@_3}; -dfp_read_field_def_volume(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dg_read_field_def_volume(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -dg_read_field_def_volume(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 32 - 7 -> dg_read_field_def_volume(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -dg_read_field_def_volume(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_volume_id(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 18 -> d_field_volume_name(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 24 -> d_field_volume_size(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_volume(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 1 -> skip_64_volume(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 2 -> skip_length_delimited_volume(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 3 -> skip_group_volume(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 5 -> skip_32_volume(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData) - end - end; -dg_read_field_def_volume(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{id => F@_1, name => F@_2, size => F@_3}. - -d_field_volume_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_volume_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_volume_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_volume(RestF, 0, 0, F, NewFValue, F@_2, F@_3, TrUserData). - -d_field_volume_name(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_volume_name(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_volume_name(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_volume(RestF, 0, 0, F, F@_1, NewFValue, F@_3, TrUserData). - -d_field_volume_size(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_volume_size(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_volume_size(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, TrUserData) -> - {NewFValue, RestF} = {id((X bsl N + Acc) band 18446744073709551615, TrUserData), Rest}, - dfp_read_field_def_volume(RestF, 0, 0, F, F@_1, F@_2, NewFValue, TrUserData). - -skip_varint_volume(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> skip_varint_volume(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -skip_varint_volume(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_volume(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_length_delimited_volume(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> skip_length_delimited_volume(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -skip_length_delimited_volume(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_volume(Rest2, 0, 0, F, F@_1, F@_2, F@_3, TrUserData). - -skip_group_volume(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_volume(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, TrUserData). - -skip_32_volume(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_volume(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_64_volume(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_volume(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -decode_msg_list_volumes_request(Bin, TrUserData) -> dfp_read_field_def_list_volumes_request(Bin, 0, 0, 0, id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_list_volumes_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_volumes_request_host(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_list_volumes_request(<<>>, 0, 0, _, F@_1, _) -> #{host => F@_1}; -dfp_read_field_def_list_volumes_request(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_volumes_request(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_list_volumes_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_volumes_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_list_volumes_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_volumes_request_host(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_volumes_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_list_volumes_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_list_volumes_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_list_volumes_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_list_volumes_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_list_volumes_request(<<>>, 0, 0, _, F@_1, _) -> #{host => F@_1}. - -d_field_list_volumes_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_volumes_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_list_volumes_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_list_volumes_request(RestF, 0, 0, F, NewFValue, TrUserData). - -skip_varint_list_volumes_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_volumes_request(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_list_volumes_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_volumes_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_list_volumes_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_volumes_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_list_volumes_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_volumes_request(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_list_volumes_request(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_volumes_request(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_list_volumes_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_volumes_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_list_volumes_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_volumes_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_list_volumes_response(Bin, TrUserData) -> dfp_read_field_def_list_volumes_response(Bin, 0, 0, 0, id([], TrUserData), TrUserData). - -dfp_read_field_def_list_volumes_response(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_volumes_response_volumes(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_list_volumes_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{volumes => lists_reverse(R1, TrUserData)} - end; -dfp_read_field_def_list_volumes_response(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_volumes_response(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_list_volumes_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_volumes_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_list_volumes_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_volumes_response_volumes(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_volumes_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_list_volumes_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_list_volumes_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_list_volumes_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_list_volumes_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_list_volumes_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{volumes => lists_reverse(R1, TrUserData)} - end. - -d_field_list_volumes_response_volumes(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_volumes_response_volumes(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_list_volumes_response_volumes(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_volume(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_list_volumes_response(RestF, 0, 0, F, cons(NewFValue, Prev, TrUserData), TrUserData). - -skip_varint_list_volumes_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_volumes_response(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_list_volumes_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_volumes_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_list_volumes_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_volumes_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_list_volumes_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_volumes_response(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_list_volumes_response(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_volumes_response(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_list_volumes_response(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_volumes_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_list_volumes_response(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_volumes_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_create_volume_request(Bin, TrUserData) -> dfp_read_field_def_create_volume_request(Bin, 0, 0, 0, id('$undef', TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_create_volume_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_create_volume_request_volume(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_create_volume_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_create_volume_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_create_volume_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> - S1 = #{host => F@_2}, - if F@_1 == '$undef' -> S1; - true -> S1#{volume => F@_1} - end; -dfp_read_field_def_create_volume_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_create_volume_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_create_volume_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_create_volume_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_create_volume_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_create_volume_request_volume(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_create_volume_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_create_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_create_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_create_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_create_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_create_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_create_volume_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> - S1 = #{host => F@_2}, - if F@_1 == '$undef' -> S1; - true -> S1#{volume => F@_1} - end. - -d_field_create_volume_request_volume(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_create_volume_request_volume(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_create_volume_request_volume(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_volume(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_create_volume_request(RestF, - 0, - 0, - F, - if Prev == '$undef' -> NewFValue; - true -> merge_msg_volume(Prev, NewFValue, TrUserData) - end, - F@_2, - TrUserData). - -d_field_create_volume_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_create_volume_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_create_volume_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_create_volume_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_create_volume_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_create_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_create_volume_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_create_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_create_volume_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_create_volume_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_create_volume_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_create_volume_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_create_volume_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_create_volume_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_create_volume_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_create_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_create_volume_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_create_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_update_volume_request(Bin, TrUserData) -> dfp_read_field_def_update_volume_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id('$undef', TrUserData), TrUserData). - -dfp_read_field_def_update_volume_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_update_volume_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_update_volume_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_update_volume_request_volume(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_update_volume_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> - S1 = #{host => F@_1}, - if F@_2 == '$undef' -> S1; - true -> S1#{volume => F@_2} - end; -dfp_read_field_def_update_volume_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_update_volume_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_update_volume_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_update_volume_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_update_volume_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_update_volume_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_update_volume_request_volume(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_update_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_update_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_update_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_update_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_update_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_update_volume_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> - S1 = #{host => F@_1}, - if F@_2 == '$undef' -> S1; - true -> S1#{volume => F@_2} - end. - -d_field_update_volume_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_update_volume_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_update_volume_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_update_volume_request(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_update_volume_request_volume(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_update_volume_request_volume(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_update_volume_request_volume(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_volume(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_update_volume_request(RestF, - 0, - 0, - F, - F@_1, - if Prev == '$undef' -> NewFValue; - true -> merge_msg_volume(Prev, NewFValue, TrUserData) - end, - TrUserData). - -skip_varint_update_volume_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_update_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_update_volume_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_update_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_update_volume_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_update_volume_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_update_volume_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_update_volume_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_update_volume_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_update_volume_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_update_volume_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_update_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_update_volume_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_update_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_delete_volume_request(Bin, TrUserData) -> dfp_read_field_def_delete_volume_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_delete_volume_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_delete_volume_request_uuid(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_delete_volume_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_delete_volume_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_delete_volume_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{uuid => F@_1, host => F@_2}; -dfp_read_field_def_delete_volume_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_delete_volume_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_delete_volume_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_delete_volume_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_delete_volume_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_delete_volume_request_uuid(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_delete_volume_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_delete_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_delete_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_delete_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_delete_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_delete_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_delete_volume_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{uuid => F@_1, host => F@_2}. - -d_field_delete_volume_request_uuid(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_delete_volume_request_uuid(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_delete_volume_request_uuid(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_delete_volume_request(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_delete_volume_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_delete_volume_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_delete_volume_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_delete_volume_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_delete_volume_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_delete_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_delete_volume_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_delete_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_delete_volume_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_delete_volume_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_delete_volume_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_delete_volume_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_delete_volume_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_delete_volume_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_delete_volume_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_delete_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_delete_volume_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_delete_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_volume_attachment_identifier(Bin, TrUserData) -> dfp_read_field_def_volume_attachment_identifier(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_volume_attachment_identifier(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_volume_attachment_identifier_domain_id(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_volume_attachment_identifier(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_volume_attachment_identifier_volume_id(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_volume_attachment_identifier(<<26, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_volume_attachment_identifier_host(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_volume_attachment_identifier(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{domain_id => F@_1, volume_id => F@_2, host => F@_3}; -dfp_read_field_def_volume_attachment_identifier(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dg_read_field_def_volume_attachment_identifier(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -dg_read_field_def_volume_attachment_identifier(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 32 - 7 -> dg_read_field_def_volume_attachment_identifier(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -dg_read_field_def_volume_attachment_identifier(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_volume_attachment_identifier_domain_id(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 18 -> d_field_volume_attachment_identifier_volume_id(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 26 -> d_field_volume_attachment_identifier_host(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_volume_attachment_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 1 -> skip_64_volume_attachment_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 2 -> skip_length_delimited_volume_attachment_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 3 -> skip_group_volume_attachment_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 5 -> skip_32_volume_attachment_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData) - end - end; -dg_read_field_def_volume_attachment_identifier(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{domain_id => F@_1, volume_id => F@_2, host => F@_3}. - -d_field_volume_attachment_identifier_domain_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_volume_attachment_identifier_domain_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_volume_attachment_identifier_domain_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_volume_attachment_identifier(RestF, 0, 0, F, NewFValue, F@_2, F@_3, TrUserData). - -d_field_volume_attachment_identifier_volume_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_volume_attachment_identifier_volume_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_volume_attachment_identifier_volume_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_volume_attachment_identifier(RestF, 0, 0, F, F@_1, NewFValue, F@_3, TrUserData). - -d_field_volume_attachment_identifier_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_volume_attachment_identifier_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_volume_attachment_identifier_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_volume_attachment_identifier(RestF, 0, 0, F, F@_1, F@_2, NewFValue, TrUserData). - -skip_varint_volume_attachment_identifier(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> skip_varint_volume_attachment_identifier(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -skip_varint_volume_attachment_identifier(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_volume_attachment_identifier(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_length_delimited_volume_attachment_identifier(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> skip_length_delimited_volume_attachment_identifier(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -skip_length_delimited_volume_attachment_identifier(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_volume_attachment_identifier(Rest2, 0, 0, F, F@_1, F@_2, F@_3, TrUserData). - -skip_group_volume_attachment_identifier(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_volume_attachment_identifier(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, TrUserData). - -skip_32_volume_attachment_identifier(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_volume_attachment_identifier(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_64_volume_attachment_identifier(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_volume_attachment_identifier(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -decode_msg_volume_attachment(Bin, TrUserData) -> dfp_read_field_def_volume_attachment(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_volume_attachment(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_volume_attachment_domain_id(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_volume_attachment(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_volume_attachment_volume_id(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_volume_attachment(<<26, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_volume_attachment_disk_address(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_volume_attachment(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{domain_id => F@_1, volume_id => F@_2, disk_address => F@_3}; -dfp_read_field_def_volume_attachment(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dg_read_field_def_volume_attachment(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -dg_read_field_def_volume_attachment(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 32 - 7 -> dg_read_field_def_volume_attachment(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -dg_read_field_def_volume_attachment(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_volume_attachment_domain_id(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 18 -> d_field_volume_attachment_volume_id(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 26 -> d_field_volume_attachment_disk_address(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_volume_attachment(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 1 -> skip_64_volume_attachment(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 2 -> skip_length_delimited_volume_attachment(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 3 -> skip_group_volume_attachment(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 5 -> skip_32_volume_attachment(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData) - end - end; -dg_read_field_def_volume_attachment(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{domain_id => F@_1, volume_id => F@_2, disk_address => F@_3}. - -d_field_volume_attachment_domain_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_volume_attachment_domain_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_volume_attachment_domain_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_volume_attachment(RestF, 0, 0, F, NewFValue, F@_2, F@_3, TrUserData). - -d_field_volume_attachment_volume_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_volume_attachment_volume_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_volume_attachment_volume_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_volume_attachment(RestF, 0, 0, F, F@_1, NewFValue, F@_3, TrUserData). - -d_field_volume_attachment_disk_address(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_volume_attachment_disk_address(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_volume_attachment_disk_address(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_volume_attachment(RestF, 0, 0, F, F@_1, F@_2, NewFValue, TrUserData). - -skip_varint_volume_attachment(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> skip_varint_volume_attachment(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -skip_varint_volume_attachment(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_volume_attachment(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_length_delimited_volume_attachment(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> skip_length_delimited_volume_attachment(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -skip_length_delimited_volume_attachment(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_volume_attachment(Rest2, 0, 0, F, F@_1, F@_2, F@_3, TrUserData). - -skip_group_volume_attachment(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_volume_attachment(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, TrUserData). - -skip_32_volume_attachment(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_volume_attachment(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_64_volume_attachment(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_volume_attachment(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -decode_msg_list_volume_attachments_request(Bin, TrUserData) -> dfp_read_field_def_list_volume_attachments_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_list_volume_attachments_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_list_volume_attachments_request_domain_id(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_list_volume_attachments_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_list_volume_attachments_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_list_volume_attachments_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{domain_id => F@_1, host => F@_2}; -dfp_read_field_def_list_volume_attachments_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_list_volume_attachments_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_list_volume_attachments_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_volume_attachments_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_list_volume_attachments_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_volume_attachments_request_domain_id(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_list_volume_attachments_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_volume_attachments_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_list_volume_attachments_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_list_volume_attachments_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_list_volume_attachments_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_list_volume_attachments_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_list_volume_attachments_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{domain_id => F@_1, host => F@_2}. - -d_field_list_volume_attachments_request_domain_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_list_volume_attachments_request_domain_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_list_volume_attachments_request_domain_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_list_volume_attachments_request(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_list_volume_attachments_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_list_volume_attachments_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_list_volume_attachments_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_list_volume_attachments_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_list_volume_attachments_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_list_volume_attachments_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_list_volume_attachments_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_list_volume_attachments_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_list_volume_attachments_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_list_volume_attachments_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_list_volume_attachments_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_volume_attachments_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_list_volume_attachments_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_volume_attachments_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_list_volume_attachments_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_list_volume_attachments_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_list_volume_attachments_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_list_volume_attachments_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_list_volume_attachments_response(Bin, TrUserData) -> dfp_read_field_def_list_volume_attachments_response(Bin, 0, 0, 0, id([], TrUserData), TrUserData). - -dfp_read_field_def_list_volume_attachments_response(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_volume_attachments_response_attachments(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_list_volume_attachments_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{attachments => lists_reverse(R1, TrUserData)} - end; -dfp_read_field_def_list_volume_attachments_response(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_volume_attachments_response(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_list_volume_attachments_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_volume_attachments_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_list_volume_attachments_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_volume_attachments_response_attachments(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_volume_attachments_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_list_volume_attachments_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_list_volume_attachments_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_list_volume_attachments_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_list_volume_attachments_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_list_volume_attachments_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{attachments => lists_reverse(R1, TrUserData)} - end. - -d_field_list_volume_attachments_response_attachments(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_volume_attachments_response_attachments(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_list_volume_attachments_response_attachments(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_volume_attachment(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_list_volume_attachments_response(RestF, 0, 0, F, cons(NewFValue, Prev, TrUserData), TrUserData). - -skip_varint_list_volume_attachments_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_volume_attachments_response(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_list_volume_attachments_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_volume_attachments_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_list_volume_attachments_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_volume_attachments_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_list_volume_attachments_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_volume_attachments_response(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_list_volume_attachments_response(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_volume_attachments_response(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_list_volume_attachments_response(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_volume_attachments_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_list_volume_attachments_response(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_volume_attachments_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_port_forwarding_identifier(Bin, TrUserData) -> dfp_read_field_def_port_forwarding_identifier(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), id(0, TrUserData), TrUserData). - -dfp_read_field_def_port_forwarding_identifier(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_port_forwarding_identifier_host(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_port_forwarding_identifier(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_port_forwarding_identifier_protocol(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_port_forwarding_identifier(<<24, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_port_forwarding_identifier_source_port(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_port_forwarding_identifier(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{host => F@_1, protocol => F@_2, source_port => F@_3}; -dfp_read_field_def_port_forwarding_identifier(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dg_read_field_def_port_forwarding_identifier(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -dg_read_field_def_port_forwarding_identifier(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 32 - 7 -> dg_read_field_def_port_forwarding_identifier(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -dg_read_field_def_port_forwarding_identifier(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_port_forwarding_identifier_host(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 18 -> d_field_port_forwarding_identifier_protocol(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 24 -> d_field_port_forwarding_identifier_source_port(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_port_forwarding_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 1 -> skip_64_port_forwarding_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 2 -> skip_length_delimited_port_forwarding_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 3 -> skip_group_port_forwarding_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 5 -> skip_32_port_forwarding_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData) - end - end; -dg_read_field_def_port_forwarding_identifier(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{host => F@_1, protocol => F@_2, source_port => F@_3}. - -d_field_port_forwarding_identifier_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_port_forwarding_identifier_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_port_forwarding_identifier_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_port_forwarding_identifier(RestF, 0, 0, F, NewFValue, F@_2, F@_3, TrUserData). - -d_field_port_forwarding_identifier_protocol(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_port_forwarding_identifier_protocol(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_port_forwarding_identifier_protocol(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_port_forwarding_identifier(RestF, 0, 0, F, F@_1, NewFValue, F@_3, TrUserData). - -d_field_port_forwarding_identifier_source_port(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_port_forwarding_identifier_source_port(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_port_forwarding_identifier_source_port(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, TrUserData) -> - {NewFValue, RestF} = {id((X bsl N + Acc) band 4294967295, TrUserData), Rest}, - dfp_read_field_def_port_forwarding_identifier(RestF, 0, 0, F, F@_1, F@_2, NewFValue, TrUserData). - -skip_varint_port_forwarding_identifier(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> skip_varint_port_forwarding_identifier(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -skip_varint_port_forwarding_identifier(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_port_forwarding_identifier(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_length_delimited_port_forwarding_identifier(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> skip_length_delimited_port_forwarding_identifier(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -skip_length_delimited_port_forwarding_identifier(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_port_forwarding_identifier(Rest2, 0, 0, F, F@_1, F@_2, F@_3, TrUserData). - -skip_group_port_forwarding_identifier(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_port_forwarding_identifier(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, TrUserData). - -skip_32_port_forwarding_identifier(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_port_forwarding_identifier(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_64_port_forwarding_identifier(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_port_forwarding_identifier(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -decode_msg_port_forwarding(Bin, TrUserData) -> dfp_read_field_def_port_forwarding(Bin, 0, 0, 0, id(<<>>, TrUserData), id(0, TrUserData), id(<<>>, TrUserData), id(0, TrUserData), TrUserData). - -dfp_read_field_def_port_forwarding(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_port_forwarding_protocol(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dfp_read_field_def_port_forwarding(<<24, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_port_forwarding_source_port(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dfp_read_field_def_port_forwarding(<<34, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_port_forwarding_target_ip(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dfp_read_field_def_port_forwarding(<<40, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_port_forwarding_target_port(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dfp_read_field_def_port_forwarding(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, _) -> #{protocol => F@_1, source_port => F@_2, target_ip => F@_3, target_port => F@_4}; -dfp_read_field_def_port_forwarding(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dg_read_field_def_port_forwarding(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -dg_read_field_def_port_forwarding(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 32 - 7 -> dg_read_field_def_port_forwarding(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dg_read_field_def_port_forwarding(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, F@_4, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 18 -> d_field_port_forwarding_protocol(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); - 24 -> d_field_port_forwarding_source_port(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); - 34 -> d_field_port_forwarding_target_ip(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); - 40 -> d_field_port_forwarding_target_port(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_port_forwarding(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); - 1 -> skip_64_port_forwarding(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); - 2 -> skip_length_delimited_port_forwarding(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); - 3 -> skip_group_port_forwarding(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); - 5 -> skip_32_port_forwarding(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData) - end - end; -dg_read_field_def_port_forwarding(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, _) -> #{protocol => F@_1, source_port => F@_2, target_ip => F@_3, target_port => F@_4}. - -d_field_port_forwarding_protocol(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_port_forwarding_protocol(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -d_field_port_forwarding_protocol(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, F@_4, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_port_forwarding(RestF, 0, 0, F, NewFValue, F@_2, F@_3, F@_4, TrUserData). - -d_field_port_forwarding_source_port(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_port_forwarding_source_port(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -d_field_port_forwarding_source_port(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, F@_4, TrUserData) -> - {NewFValue, RestF} = {id((X bsl N + Acc) band 4294967295, TrUserData), Rest}, - dfp_read_field_def_port_forwarding(RestF, 0, 0, F, F@_1, NewFValue, F@_3, F@_4, TrUserData). - -d_field_port_forwarding_target_ip(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_port_forwarding_target_ip(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -d_field_port_forwarding_target_ip(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, F@_4, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_port_forwarding(RestF, 0, 0, F, F@_1, F@_2, NewFValue, F@_4, TrUserData). - -d_field_port_forwarding_target_port(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_port_forwarding_target_port(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -d_field_port_forwarding_target_port(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, _, TrUserData) -> - {NewFValue, RestF} = {id((X bsl N + Acc) band 4294967295, TrUserData), Rest}, - dfp_read_field_def_port_forwarding(RestF, 0, 0, F, F@_1, F@_2, F@_3, NewFValue, TrUserData). - -skip_varint_port_forwarding(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> skip_varint_port_forwarding(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -skip_varint_port_forwarding(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dfp_read_field_def_port_forwarding(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -skip_length_delimited_port_forwarding(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> skip_length_delimited_port_forwarding(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -skip_length_delimited_port_forwarding(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_port_forwarding(Rest2, 0, 0, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -skip_group_port_forwarding(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, F@_4, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_port_forwarding(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, F@_4, TrUserData). - -skip_32_port_forwarding(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dfp_read_field_def_port_forwarding(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -skip_64_port_forwarding(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dfp_read_field_def_port_forwarding(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -decode_msg_list_port_forwardings_request(Bin, TrUserData) -> dfp_read_field_def_list_port_forwardings_request(Bin, 0, 0, 0, id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_list_port_forwardings_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_port_forwardings_request_host(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_list_port_forwardings_request(<<>>, 0, 0, _, F@_1, _) -> #{host => F@_1}; -dfp_read_field_def_list_port_forwardings_request(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_port_forwardings_request(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_list_port_forwardings_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_port_forwardings_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_list_port_forwardings_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_port_forwardings_request_host(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_port_forwardings_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_list_port_forwardings_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_list_port_forwardings_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_list_port_forwardings_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_list_port_forwardings_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_list_port_forwardings_request(<<>>, 0, 0, _, F@_1, _) -> #{host => F@_1}. - -d_field_list_port_forwardings_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_port_forwardings_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_list_port_forwardings_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_list_port_forwardings_request(RestF, 0, 0, F, NewFValue, TrUserData). - -skip_varint_list_port_forwardings_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_port_forwardings_request(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_list_port_forwardings_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_port_forwardings_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_list_port_forwardings_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_port_forwardings_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_list_port_forwardings_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_port_forwardings_request(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_list_port_forwardings_request(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_port_forwardings_request(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_list_port_forwardings_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_port_forwardings_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_list_port_forwardings_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_port_forwardings_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_list_port_forwardings_response(Bin, TrUserData) -> dfp_read_field_def_list_port_forwardings_response(Bin, 0, 0, 0, id([], TrUserData), TrUserData). - -dfp_read_field_def_list_port_forwardings_response(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_port_forwardings_response_port_forwardings(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_list_port_forwardings_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{port_forwardings => lists_reverse(R1, TrUserData)} - end; -dfp_read_field_def_list_port_forwardings_response(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_port_forwardings_response(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_list_port_forwardings_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_port_forwardings_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_list_port_forwardings_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_port_forwardings_response_port_forwardings(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_port_forwardings_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_list_port_forwardings_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_list_port_forwardings_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_list_port_forwardings_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_list_port_forwardings_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_list_port_forwardings_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{port_forwardings => lists_reverse(R1, TrUserData)} - end. - -d_field_list_port_forwardings_response_port_forwardings(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_port_forwardings_response_port_forwardings(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_list_port_forwardings_response_port_forwardings(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_port_forwarding(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_list_port_forwardings_response(RestF, 0, 0, F, cons(NewFValue, Prev, TrUserData), TrUserData). - -skip_varint_list_port_forwardings_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_port_forwardings_response(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_list_port_forwardings_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_port_forwardings_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_list_port_forwardings_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_port_forwardings_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_list_port_forwardings_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_port_forwardings_response(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_list_port_forwardings_response(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_port_forwardings_response(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_list_port_forwardings_response(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_port_forwardings_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_list_port_forwardings_response(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_port_forwardings_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_put_port_forwarding_request(Bin, TrUserData) -> dfp_read_field_def_put_port_forwarding_request(Bin, 0, 0, 0, id('$undef', TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_put_port_forwarding_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_put_port_forwarding_request_port_forwarding(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_put_port_forwarding_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_put_port_forwarding_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_put_port_forwarding_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> - S1 = #{host => F@_2}, - if F@_1 == '$undef' -> S1; - true -> S1#{port_forwarding => F@_1} - end; -dfp_read_field_def_put_port_forwarding_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_put_port_forwarding_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_put_port_forwarding_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_put_port_forwarding_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_put_port_forwarding_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_put_port_forwarding_request_port_forwarding(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_put_port_forwarding_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_put_port_forwarding_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_put_port_forwarding_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_put_port_forwarding_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_put_port_forwarding_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_put_port_forwarding_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_put_port_forwarding_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> - S1 = #{host => F@_2}, - if F@_1 == '$undef' -> S1; - true -> S1#{port_forwarding => F@_1} - end. - -d_field_put_port_forwarding_request_port_forwarding(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_put_port_forwarding_request_port_forwarding(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_put_port_forwarding_request_port_forwarding(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_port_forwarding(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_put_port_forwarding_request(RestF, - 0, - 0, - F, - if Prev == '$undef' -> NewFValue; - true -> merge_msg_port_forwarding(Prev, NewFValue, TrUserData) - end, - F@_2, - TrUserData). - -d_field_put_port_forwarding_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_put_port_forwarding_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_put_port_forwarding_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_put_port_forwarding_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_put_port_forwarding_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_put_port_forwarding_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_put_port_forwarding_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_put_port_forwarding_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_put_port_forwarding_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_put_port_forwarding_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_put_port_forwarding_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_put_port_forwarding_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_put_port_forwarding_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_put_port_forwarding_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_put_port_forwarding_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_put_port_forwarding_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_put_port_forwarding_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_put_port_forwarding_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_dns_record_identifier(Bin, TrUserData) -> dfp_read_field_def_dns_record_identifier(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_dns_record_identifier(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_dns_record_identifier_name(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_dns_record_identifier(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_dns_record_identifier_type(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_dns_record_identifier(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{name => F@_1, type => F@_2}; -dfp_read_field_def_dns_record_identifier(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_dns_record_identifier(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_dns_record_identifier(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_dns_record_identifier(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_dns_record_identifier(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_dns_record_identifier_name(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_dns_record_identifier_type(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_dns_record_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_dns_record_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_dns_record_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_dns_record_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_dns_record_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_dns_record_identifier(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{name => F@_1, type => F@_2}. - -d_field_dns_record_identifier_name(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_dns_record_identifier_name(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_dns_record_identifier_name(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_dns_record_identifier(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_dns_record_identifier_type(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_dns_record_identifier_type(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_dns_record_identifier_type(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_dns_record_identifier(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_dns_record_identifier(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_dns_record_identifier(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_dns_record_identifier(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_dns_record_identifier(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_dns_record_identifier(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_dns_record_identifier(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_dns_record_identifier(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_dns_record_identifier(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_dns_record_identifier(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_dns_record_identifier(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_dns_record_identifier(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_dns_record_identifier(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_dns_record_identifier(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_dns_record_identifier(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_dns_record(Bin, TrUserData) -> dfp_read_field_def_dns_record(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), id(0, TrUserData), id([], TrUserData), TrUserData). - -dfp_read_field_def_dns_record(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_dns_record_name(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dfp_read_field_def_dns_record(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_dns_record_type(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dfp_read_field_def_dns_record(<<24, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_dns_record_ttl(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dfp_read_field_def_dns_record(<<34, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_dns_record_records(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dfp_read_field_def_dns_record(<<>>, 0, 0, _, F@_1, F@_2, F@_3, R1, TrUserData) -> #{name => F@_1, type => F@_2, ttl => F@_3, records => lists_reverse(R1, TrUserData)}; -dfp_read_field_def_dns_record(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dg_read_field_def_dns_record(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -dg_read_field_def_dns_record(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 32 - 7 -> dg_read_field_def_dns_record(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dg_read_field_def_dns_record(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, F@_4, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_dns_record_name(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); - 18 -> d_field_dns_record_type(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); - 24 -> d_field_dns_record_ttl(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); - 34 -> d_field_dns_record_records(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_dns_record(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); - 1 -> skip_64_dns_record(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); - 2 -> skip_length_delimited_dns_record(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); - 3 -> skip_group_dns_record(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); - 5 -> skip_32_dns_record(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData) - end - end; -dg_read_field_def_dns_record(<<>>, 0, 0, _, F@_1, F@_2, F@_3, R1, TrUserData) -> #{name => F@_1, type => F@_2, ttl => F@_3, records => lists_reverse(R1, TrUserData)}. - -d_field_dns_record_name(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_dns_record_name(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -d_field_dns_record_name(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, F@_4, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_dns_record(RestF, 0, 0, F, NewFValue, F@_2, F@_3, F@_4, TrUserData). - -d_field_dns_record_type(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_dns_record_type(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -d_field_dns_record_type(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, F@_4, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_dns_record(RestF, 0, 0, F, F@_1, NewFValue, F@_3, F@_4, TrUserData). - -d_field_dns_record_ttl(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_dns_record_ttl(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -d_field_dns_record_ttl(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, F@_4, TrUserData) -> - {NewFValue, RestF} = {id((X bsl N + Acc) band 18446744073709551615, TrUserData), Rest}, - dfp_read_field_def_dns_record(RestF, 0, 0, F, F@_1, F@_2, NewFValue, F@_4, TrUserData). - -d_field_dns_record_records(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_dns_record_records(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -d_field_dns_record_records(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_dns_record(RestF, 0, 0, F, F@_1, F@_2, F@_3, cons(NewFValue, Prev, TrUserData), TrUserData). - -skip_varint_dns_record(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> skip_varint_dns_record(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -skip_varint_dns_record(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dfp_read_field_def_dns_record(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -skip_length_delimited_dns_record(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> skip_length_delimited_dns_record(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -skip_length_delimited_dns_record(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_dns_record(Rest2, 0, 0, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -skip_group_dns_record(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, F@_4, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_dns_record(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, F@_4, TrUserData). - -skip_32_dns_record(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dfp_read_field_def_dns_record(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -skip_64_dns_record(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dfp_read_field_def_dns_record(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -decode_msg_list_dns_records_request(Bin, TrUserData) -> dfp_read_field_def_list_dns_records_request(Bin, 0, 0, 0, TrUserData). - -dfp_read_field_def_list_dns_records_request(<<>>, 0, 0, _, _) -> #{}; -dfp_read_field_def_list_dns_records_request(Other, Z1, Z2, F, TrUserData) -> dg_read_field_def_list_dns_records_request(Other, Z1, Z2, F, TrUserData). - -dg_read_field_def_list_dns_records_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_dns_records_request(Rest, N + 7, X bsl N + Acc, F, TrUserData); -dg_read_field_def_list_dns_records_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, TrUserData) -> - Key = X bsl N + Acc, - case Key band 7 of - 0 -> skip_varint_list_dns_records_request(Rest, 0, 0, Key bsr 3, TrUserData); - 1 -> skip_64_list_dns_records_request(Rest, 0, 0, Key bsr 3, TrUserData); - 2 -> skip_length_delimited_list_dns_records_request(Rest, 0, 0, Key bsr 3, TrUserData); - 3 -> skip_group_list_dns_records_request(Rest, 0, 0, Key bsr 3, TrUserData); - 5 -> skip_32_list_dns_records_request(Rest, 0, 0, Key bsr 3, TrUserData) - end; -dg_read_field_def_list_dns_records_request(<<>>, 0, 0, _, _) -> #{}. - -skip_varint_list_dns_records_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> skip_varint_list_dns_records_request(Rest, Z1, Z2, F, TrUserData); -skip_varint_list_dns_records_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_list_dns_records_request(Rest, Z1, Z2, F, TrUserData). - -skip_length_delimited_list_dns_records_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 57 -> skip_length_delimited_list_dns_records_request(Rest, N + 7, X bsl N + Acc, F, TrUserData); -skip_length_delimited_list_dns_records_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_dns_records_request(Rest2, 0, 0, F, TrUserData). - -skip_group_list_dns_records_request(Bin, _, Z2, FNum, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_dns_records_request(Rest, 0, Z2, FNum, TrUserData). - -skip_32_list_dns_records_request(<<_:32, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_list_dns_records_request(Rest, Z1, Z2, F, TrUserData). - -skip_64_list_dns_records_request(<<_:64, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_list_dns_records_request(Rest, Z1, Z2, F, TrUserData). - -decode_msg_list_dns_records_response(Bin, TrUserData) -> dfp_read_field_def_list_dns_records_response(Bin, 0, 0, 0, id([], TrUserData), TrUserData). - -dfp_read_field_def_list_dns_records_response(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_dns_records_response_dns_records(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_list_dns_records_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{dns_records => lists_reverse(R1, TrUserData)} - end; -dfp_read_field_def_list_dns_records_response(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_dns_records_response(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_list_dns_records_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_dns_records_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_list_dns_records_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_dns_records_response_dns_records(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_dns_records_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_list_dns_records_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_list_dns_records_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_list_dns_records_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_list_dns_records_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_list_dns_records_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{dns_records => lists_reverse(R1, TrUserData)} - end. - -d_field_list_dns_records_response_dns_records(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_dns_records_response_dns_records(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_list_dns_records_response_dns_records(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_dns_record(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_list_dns_records_response(RestF, 0, 0, F, cons(NewFValue, Prev, TrUserData), TrUserData). - -skip_varint_list_dns_records_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_dns_records_response(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_list_dns_records_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_dns_records_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_list_dns_records_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_dns_records_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_list_dns_records_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_dns_records_response(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_list_dns_records_response(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_dns_records_response(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_list_dns_records_response(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_dns_records_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_list_dns_records_response(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_dns_records_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_put_dns_record_request(Bin, TrUserData) -> dfp_read_field_def_put_dns_record_request(Bin, 0, 0, 0, id('$undef', TrUserData), TrUserData). - -dfp_read_field_def_put_dns_record_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_put_dns_record_request_dns_record(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_put_dns_record_request(<<>>, 0, 0, _, F@_1, _) -> - S1 = #{}, - if F@_1 == '$undef' -> S1; - true -> S1#{dns_record => F@_1} - end; -dfp_read_field_def_put_dns_record_request(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_put_dns_record_request(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_put_dns_record_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_put_dns_record_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_put_dns_record_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_put_dns_record_request_dns_record(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_put_dns_record_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_put_dns_record_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_put_dns_record_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_put_dns_record_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_put_dns_record_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_put_dns_record_request(<<>>, 0, 0, _, F@_1, _) -> - S1 = #{}, - if F@_1 == '$undef' -> S1; - true -> S1#{dns_record => F@_1} - end. - -d_field_put_dns_record_request_dns_record(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_put_dns_record_request_dns_record(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_put_dns_record_request_dns_record(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_dns_record(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_put_dns_record_request(RestF, - 0, - 0, - F, - if Prev == '$undef' -> NewFValue; - true -> merge_msg_dns_record(Prev, NewFValue, TrUserData) - end, - TrUserData). - -skip_varint_put_dns_record_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_put_dns_record_request(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_put_dns_record_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_put_dns_record_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_put_dns_record_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_put_dns_record_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_put_dns_record_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_put_dns_record_request(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_put_dns_record_request(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_put_dns_record_request(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_put_dns_record_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_put_dns_record_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_put_dns_record_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_put_dns_record_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_route_table(Bin, TrUserData) -> dfp_read_field_def_route_table(Bin, 0, 0, 0, id(<<>>, TrUserData), id(0, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_route_table(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_route_table_network_name(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_route_table(<<16, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_route_table_id(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_route_table(<<26, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_route_table_name(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_route_table(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{network_name => F@_1, id => F@_2, name => F@_3}; -dfp_read_field_def_route_table(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dg_read_field_def_route_table(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -dg_read_field_def_route_table(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 32 - 7 -> dg_read_field_def_route_table(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -dg_read_field_def_route_table(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_route_table_network_name(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 16 -> d_field_route_table_id(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 26 -> d_field_route_table_name(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_route_table(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 1 -> skip_64_route_table(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 2 -> skip_length_delimited_route_table(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 3 -> skip_group_route_table(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 5 -> skip_32_route_table(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData) - end - end; -dg_read_field_def_route_table(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{network_name => F@_1, id => F@_2, name => F@_3}. - -d_field_route_table_network_name(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_route_table_network_name(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_route_table_network_name(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_route_table(RestF, 0, 0, F, NewFValue, F@_2, F@_3, TrUserData). - -d_field_route_table_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_route_table_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_route_table_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, TrUserData) -> - {NewFValue, RestF} = {id((X bsl N + Acc) band 4294967295, TrUserData), Rest}, - dfp_read_field_def_route_table(RestF, 0, 0, F, F@_1, NewFValue, F@_3, TrUserData). - -d_field_route_table_name(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_route_table_name(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_route_table_name(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_route_table(RestF, 0, 0, F, F@_1, F@_2, NewFValue, TrUserData). - -skip_varint_route_table(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> skip_varint_route_table(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -skip_varint_route_table(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_route_table(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_length_delimited_route_table(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> skip_length_delimited_route_table(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -skip_length_delimited_route_table(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_route_table(Rest2, 0, 0, F, F@_1, F@_2, F@_3, TrUserData). - -skip_group_route_table(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_route_table(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, TrUserData). - -skip_32_route_table(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_route_table(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_64_route_table(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_route_table(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -decode_msg_route_table_identifier(Bin, TrUserData) -> dfp_read_field_def_route_table_identifier(Bin, 0, 0, 0, id(0, TrUserData), TrUserData). - -dfp_read_field_def_route_table_identifier(<<8, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_route_table_identifier_id(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_route_table_identifier(<<>>, 0, 0, _, F@_1, _) -> #{id => F@_1}; -dfp_read_field_def_route_table_identifier(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_route_table_identifier(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_route_table_identifier(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_route_table_identifier(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_route_table_identifier(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 8 -> d_field_route_table_identifier_id(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_route_table_identifier(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_route_table_identifier(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_route_table_identifier(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_route_table_identifier(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_route_table_identifier(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_route_table_identifier(<<>>, 0, 0, _, F@_1, _) -> #{id => F@_1}. - -d_field_route_table_identifier_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_route_table_identifier_id(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_route_table_identifier_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, TrUserData) -> - {NewFValue, RestF} = {id((X bsl N + Acc) band 4294967295, TrUserData), Rest}, - dfp_read_field_def_route_table_identifier(RestF, 0, 0, F, NewFValue, TrUserData). - -skip_varint_route_table_identifier(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_route_table_identifier(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_route_table_identifier(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_route_table_identifier(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_route_table_identifier(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_route_table_identifier(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_route_table_identifier(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_route_table_identifier(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_route_table_identifier(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_route_table_identifier(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_route_table_identifier(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_route_table_identifier(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_route_table_identifier(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_route_table_identifier(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_list_route_tables_request(Bin, TrUserData) -> dfp_read_field_def_list_route_tables_request(Bin, 0, 0, 0, id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_list_route_tables_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_route_tables_request_network_name(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_list_route_tables_request(<<>>, 0, 0, _, F@_1, _) -> #{network_name => F@_1}; -dfp_read_field_def_list_route_tables_request(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_route_tables_request(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_list_route_tables_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_route_tables_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_list_route_tables_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_route_tables_request_network_name(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_route_tables_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_list_route_tables_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_list_route_tables_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_list_route_tables_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_list_route_tables_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_list_route_tables_request(<<>>, 0, 0, _, F@_1, _) -> #{network_name => F@_1}. - -d_field_list_route_tables_request_network_name(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_route_tables_request_network_name(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_list_route_tables_request_network_name(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_list_route_tables_request(RestF, 0, 0, F, NewFValue, TrUserData). - -skip_varint_list_route_tables_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_route_tables_request(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_list_route_tables_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_route_tables_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_list_route_tables_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_route_tables_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_list_route_tables_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_route_tables_request(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_list_route_tables_request(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_route_tables_request(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_list_route_tables_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_route_tables_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_list_route_tables_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_route_tables_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_list_route_tables_response(Bin, TrUserData) -> dfp_read_field_def_list_route_tables_response(Bin, 0, 0, 0, id([], TrUserData), TrUserData). - -dfp_read_field_def_list_route_tables_response(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_route_tables_response_route_tables(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_list_route_tables_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{route_tables => lists_reverse(R1, TrUserData)} - end; -dfp_read_field_def_list_route_tables_response(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_route_tables_response(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_list_route_tables_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_route_tables_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_list_route_tables_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_route_tables_response_route_tables(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_route_tables_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_list_route_tables_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_list_route_tables_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_list_route_tables_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_list_route_tables_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_list_route_tables_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{route_tables => lists_reverse(R1, TrUserData)} - end. - -d_field_list_route_tables_response_route_tables(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_route_tables_response_route_tables(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_list_route_tables_response_route_tables(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_route_table(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_list_route_tables_response(RestF, 0, 0, F, cons(NewFValue, Prev, TrUserData), TrUserData). - -skip_varint_list_route_tables_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_route_tables_response(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_list_route_tables_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_route_tables_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_list_route_tables_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_route_tables_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_list_route_tables_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_route_tables_response(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_list_route_tables_response(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_route_tables_response(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_list_route_tables_response(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_route_tables_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_list_route_tables_response(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_route_tables_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_create_route_table_request(Bin, TrUserData) -> dfp_read_field_def_create_route_table_request(Bin, 0, 0, 0, id('$undef', TrUserData), TrUserData). - -dfp_read_field_def_create_route_table_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_create_route_table_request_route_table(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_create_route_table_request(<<>>, 0, 0, _, F@_1, _) -> - S1 = #{}, - if F@_1 == '$undef' -> S1; - true -> S1#{route_table => F@_1} - end; -dfp_read_field_def_create_route_table_request(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_create_route_table_request(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_create_route_table_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_create_route_table_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_create_route_table_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_create_route_table_request_route_table(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_create_route_table_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_create_route_table_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_create_route_table_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_create_route_table_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_create_route_table_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_create_route_table_request(<<>>, 0, 0, _, F@_1, _) -> - S1 = #{}, - if F@_1 == '$undef' -> S1; - true -> S1#{route_table => F@_1} - end. - -d_field_create_route_table_request_route_table(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_create_route_table_request_route_table(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_create_route_table_request_route_table(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_route_table(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_create_route_table_request(RestF, - 0, - 0, - F, - if Prev == '$undef' -> NewFValue; - true -> merge_msg_route_table(Prev, NewFValue, TrUserData) - end, - TrUserData). - -skip_varint_create_route_table_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_create_route_table_request(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_create_route_table_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_create_route_table_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_create_route_table_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_create_route_table_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_create_route_table_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_create_route_table_request(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_create_route_table_request(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_create_route_table_request(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_create_route_table_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_create_route_table_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_create_route_table_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_create_route_table_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_route_identifier(Bin, TrUserData) -> dfp_read_field_def_route_identifier(Bin, 0, 0, 0, id(0, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_route_identifier(<<8, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_route_identifier_route_table_id(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_route_identifier(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_route_identifier_destination(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_route_identifier(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{route_table_id => F@_1, destination => F@_2}; -dfp_read_field_def_route_identifier(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_route_identifier(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_route_identifier(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_route_identifier(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_route_identifier(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 8 -> d_field_route_identifier_route_table_id(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_route_identifier_destination(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_route_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_route_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_route_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_route_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_route_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_route_identifier(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{route_table_id => F@_1, destination => F@_2}. - -d_field_route_identifier_route_table_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_route_identifier_route_table_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_route_identifier_route_table_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = {id((X bsl N + Acc) band 4294967295, TrUserData), Rest}, - dfp_read_field_def_route_identifier(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_route_identifier_destination(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_route_identifier_destination(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_route_identifier_destination(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_route_identifier(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_route_identifier(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_route_identifier(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_route_identifier(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_route_identifier(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_route_identifier(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_route_identifier(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_route_identifier(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_route_identifier(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_route_identifier(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_route_identifier(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_route_identifier(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_route_identifier(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_route_identifier(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_route_identifier(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_route(Bin, TrUserData) -> dfp_read_field_def_route(Bin, 0, 0, 0, id(0, TrUserData), id(<<>>, TrUserData), id([], TrUserData), TrUserData). - -dfp_read_field_def_route(<<8, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_route_route_table_id(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_route(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_route_destination(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_route(<<26, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_route_gateways(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_route(<<>>, 0, 0, _, F@_1, F@_2, R1, TrUserData) -> #{route_table_id => F@_1, destination => F@_2, gateways => lists_reverse(R1, TrUserData)}; -dfp_read_field_def_route(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dg_read_field_def_route(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -dg_read_field_def_route(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 32 - 7 -> dg_read_field_def_route(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -dg_read_field_def_route(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 8 -> d_field_route_route_table_id(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 18 -> d_field_route_destination(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 26 -> d_field_route_gateways(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_route(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 1 -> skip_64_route(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 2 -> skip_length_delimited_route(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 3 -> skip_group_route(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 5 -> skip_32_route(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData) - end - end; -dg_read_field_def_route(<<>>, 0, 0, _, F@_1, F@_2, R1, TrUserData) -> #{route_table_id => F@_1, destination => F@_2, gateways => lists_reverse(R1, TrUserData)}. - -d_field_route_route_table_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_route_route_table_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_route_route_table_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, TrUserData) -> - {NewFValue, RestF} = {id((X bsl N + Acc) band 4294967295, TrUserData), Rest}, - dfp_read_field_def_route(RestF, 0, 0, F, NewFValue, F@_2, F@_3, TrUserData). - -d_field_route_destination(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_route_destination(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_route_destination(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_route(RestF, 0, 0, F, F@_1, NewFValue, F@_3, TrUserData). - -d_field_route_gateways(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_route_gateways(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_route_gateways(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_route(RestF, 0, 0, F, F@_1, F@_2, cons(NewFValue, Prev, TrUserData), TrUserData). - -skip_varint_route(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> skip_varint_route(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -skip_varint_route(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_route(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_length_delimited_route(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> skip_length_delimited_route(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -skip_length_delimited_route(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_route(Rest2, 0, 0, F, F@_1, F@_2, F@_3, TrUserData). - -skip_group_route(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_route(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, TrUserData). - -skip_32_route(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_route(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_64_route(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_route(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -decode_msg_list_routes_request(Bin, TrUserData) -> dfp_read_field_def_list_routes_request(Bin, 0, 0, 0, id(0, TrUserData), TrUserData). - -dfp_read_field_def_list_routes_request(<<8, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_routes_request_route_table_id(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_list_routes_request(<<>>, 0, 0, _, F@_1, _) -> #{route_table_id => F@_1}; -dfp_read_field_def_list_routes_request(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_routes_request(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_list_routes_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_routes_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_list_routes_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 8 -> d_field_list_routes_request_route_table_id(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_routes_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_list_routes_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_list_routes_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_list_routes_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_list_routes_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_list_routes_request(<<>>, 0, 0, _, F@_1, _) -> #{route_table_id => F@_1}. - -d_field_list_routes_request_route_table_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_routes_request_route_table_id(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_list_routes_request_route_table_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, TrUserData) -> - {NewFValue, RestF} = {id((X bsl N + Acc) band 4294967295, TrUserData), Rest}, - dfp_read_field_def_list_routes_request(RestF, 0, 0, F, NewFValue, TrUserData). - -skip_varint_list_routes_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_routes_request(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_list_routes_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_routes_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_list_routes_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_routes_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_list_routes_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_routes_request(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_list_routes_request(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_routes_request(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_list_routes_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_routes_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_list_routes_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_routes_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_list_routes_response(Bin, TrUserData) -> dfp_read_field_def_list_routes_response(Bin, 0, 0, 0, id([], TrUserData), TrUserData). - -dfp_read_field_def_list_routes_response(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_routes_response_routes(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_list_routes_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{routes => lists_reverse(R1, TrUserData)} - end; -dfp_read_field_def_list_routes_response(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_routes_response(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_list_routes_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_routes_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_list_routes_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_routes_response_routes(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_routes_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_list_routes_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_list_routes_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_list_routes_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_list_routes_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_list_routes_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{routes => lists_reverse(R1, TrUserData)} - end. - -d_field_list_routes_response_routes(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_routes_response_routes(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_list_routes_response_routes(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_route(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_list_routes_response(RestF, 0, 0, F, cons(NewFValue, Prev, TrUserData), TrUserData). - -skip_varint_list_routes_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_routes_response(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_list_routes_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_routes_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_list_routes_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_routes_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_list_routes_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_routes_response(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_list_routes_response(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_routes_response(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_list_routes_response(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_routes_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_list_routes_response(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_routes_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_put_route_request(Bin, TrUserData) -> dfp_read_field_def_put_route_request(Bin, 0, 0, 0, id('$undef', TrUserData), TrUserData). - -dfp_read_field_def_put_route_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_put_route_request_route(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_put_route_request(<<>>, 0, 0, _, F@_1, _) -> - S1 = #{}, - if F@_1 == '$undef' -> S1; - true -> S1#{route => F@_1} - end; -dfp_read_field_def_put_route_request(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_put_route_request(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_put_route_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_put_route_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_put_route_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_put_route_request_route(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_put_route_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_put_route_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_put_route_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_put_route_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_put_route_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_put_route_request(<<>>, 0, 0, _, F@_1, _) -> - S1 = #{}, - if F@_1 == '$undef' -> S1; - true -> S1#{route => F@_1} - end. - -d_field_put_route_request_route(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_put_route_request_route(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_put_route_request_route(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_route(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_put_route_request(RestF, - 0, - 0, - F, - if Prev == '$undef' -> NewFValue; - true -> merge_msg_route(Prev, NewFValue, TrUserData) - end, - TrUserData). - -skip_varint_put_route_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_put_route_request(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_put_route_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_put_route_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_put_route_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_put_route_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_put_route_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_put_route_request(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_put_route_request(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_put_route_request(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_put_route_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_put_route_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_put_route_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_put_route_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_sync_request(Bin, TrUserData) -> dfp_read_field_def_sync_request(Bin, 0, 0, 0, TrUserData). - -dfp_read_field_def_sync_request(<<>>, 0, 0, _, _) -> #{}; -dfp_read_field_def_sync_request(Other, Z1, Z2, F, TrUserData) -> dg_read_field_def_sync_request(Other, Z1, Z2, F, TrUserData). - -dg_read_field_def_sync_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 32 - 7 -> dg_read_field_def_sync_request(Rest, N + 7, X bsl N + Acc, F, TrUserData); -dg_read_field_def_sync_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, TrUserData) -> - Key = X bsl N + Acc, - case Key band 7 of - 0 -> skip_varint_sync_request(Rest, 0, 0, Key bsr 3, TrUserData); - 1 -> skip_64_sync_request(Rest, 0, 0, Key bsr 3, TrUserData); - 2 -> skip_length_delimited_sync_request(Rest, 0, 0, Key bsr 3, TrUserData); - 3 -> skip_group_sync_request(Rest, 0, 0, Key bsr 3, TrUserData); - 5 -> skip_32_sync_request(Rest, 0, 0, Key bsr 3, TrUserData) - end; -dg_read_field_def_sync_request(<<>>, 0, 0, _, _) -> #{}. - -skip_varint_sync_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> skip_varint_sync_request(Rest, Z1, Z2, F, TrUserData); -skip_varint_sync_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_sync_request(Rest, Z1, Z2, F, TrUserData). - -skip_length_delimited_sync_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 57 -> skip_length_delimited_sync_request(Rest, N + 7, X bsl N + Acc, F, TrUserData); -skip_length_delimited_sync_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_sync_request(Rest2, 0, 0, F, TrUserData). - -skip_group_sync_request(Bin, _, Z2, FNum, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_sync_request(Rest, 0, Z2, FNum, TrUserData). - -skip_32_sync_request(<<_:32, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_sync_request(Rest, Z1, Z2, F, TrUserData). - -skip_64_sync_request(<<_:64, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_sync_request(Rest, Z1, Z2, F, TrUserData). - -decode_msg_timestamp(Bin, TrUserData) -> dfp_read_field_def_timestamp(Bin, 0, 0, 0, id(0, TrUserData), id(0, TrUserData), TrUserData). - -dfp_read_field_def_timestamp(<<8, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_timestamp_seconds(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_timestamp(<<16, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_timestamp_nanos(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_timestamp(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{seconds => F@_1, nanos => F@_2}; -dfp_read_field_def_timestamp(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_timestamp(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_timestamp(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_timestamp(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_timestamp(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 8 -> d_field_timestamp_seconds(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 16 -> d_field_timestamp_nanos(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_timestamp(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_timestamp(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_timestamp(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_timestamp(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_timestamp(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_timestamp(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{seconds => F@_1, nanos => F@_2}. - -d_field_timestamp_seconds(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_timestamp_seconds(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_timestamp_seconds(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = {begin <> = <<(X bsl N + Acc):64/unsigned-native>>, id(Res, TrUserData) end, Rest}, - dfp_read_field_def_timestamp(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_timestamp_nanos(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_timestamp_nanos(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_timestamp_nanos(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = {begin <> = <<(X bsl N + Acc):32/unsigned-native>>, id(Res, TrUserData) end, Rest}, - dfp_read_field_def_timestamp(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_timestamp(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_timestamp(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_timestamp(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_timestamp(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_timestamp(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_timestamp(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_timestamp(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_timestamp(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_timestamp(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_timestamp(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_timestamp(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_timestamp(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_timestamp(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_timestamp(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -read_group(Bin, FieldNum) -> - {NumBytes, EndTagLen} = read_gr_b(Bin, 0, 0, 0, 0, FieldNum), - <> = Bin, - {Group, Rest}. - -%% Like skipping over fields, but record the total length, -%% Each field is <(FieldNum bsl 3) bor FieldType> ++ -%% Record the length because varints may be non-optimally encoded. -%% -%% Groups can be nested, but assume the same FieldNum cannot be nested -%% because group field numbers are shared with the rest of the fields -%% numbers. Thus we can search just for an group-end with the same -%% field number. -%% -%% (The only time the same group field number could occur would -%% be in a nested sub message, but then it would be inside a -%% length-delimited entry, which we skip-read by length.) -read_gr_b(<<1:1, X:7, Tl/binary>>, N, Acc, NumBytes, TagLen, FieldNum) - when N < (32-7) -> - read_gr_b(Tl, N+7, X bsl N + Acc, NumBytes, TagLen+1, FieldNum); -read_gr_b(<<0:1, X:7, Tl/binary>>, N, Acc, NumBytes, TagLen, - FieldNum) -> - Key = X bsl N + Acc, - TagLen1 = TagLen + 1, - case {Key bsr 3, Key band 7} of - {FieldNum, 4} -> % 4 = group_end - {NumBytes, TagLen1}; - {_, 0} -> % 0 = varint - read_gr_vi(Tl, 0, NumBytes + TagLen1, FieldNum); - {_, 1} -> % 1 = bits64 - <<_:64, Tl2/binary>> = Tl, - read_gr_b(Tl2, 0, 0, NumBytes + TagLen1 + 8, 0, FieldNum); - {_, 2} -> % 2 = length_delimited - read_gr_ld(Tl, 0, 0, NumBytes + TagLen1, FieldNum); - {_, 3} -> % 3 = group_start - read_gr_b(Tl, 0, 0, NumBytes + TagLen1, 0, FieldNum); - {_, 4} -> % 4 = group_end - read_gr_b(Tl, 0, 0, NumBytes + TagLen1, 0, FieldNum); - {_, 5} -> % 5 = bits32 - <<_:32, Tl2/binary>> = Tl, - read_gr_b(Tl2, 0, 0, NumBytes + TagLen1 + 4, 0, FieldNum) - end. - -read_gr_vi(<<1:1, _:7, Tl/binary>>, N, NumBytes, FieldNum) - when N < (64-7) -> - read_gr_vi(Tl, N+7, NumBytes+1, FieldNum); -read_gr_vi(<<0:1, _:7, Tl/binary>>, _, NumBytes, FieldNum) -> - read_gr_b(Tl, 0, 0, NumBytes+1, 0, FieldNum). - -read_gr_ld(<<1:1, X:7, Tl/binary>>, N, Acc, NumBytes, FieldNum) - when N < (64-7) -> - read_gr_ld(Tl, N+7, X bsl N + Acc, NumBytes+1, FieldNum); -read_gr_ld(<<0:1, X:7, Tl/binary>>, N, Acc, NumBytes, FieldNum) -> - Len = X bsl N + Acc, - NumBytes1 = NumBytes + 1, - <<_:Len/binary, Tl2/binary>> = Tl, - read_gr_b(Tl2, 0, 0, NumBytes1 + Len, 0, FieldNum). - -merge_msgs(Prev, New, MsgName) when is_atom(MsgName) -> merge_msgs(Prev, New, MsgName, []). - -merge_msgs(Prev, New, MsgName, Opts) -> - TrUserData = proplists:get_value(user_data, Opts), - case MsgName of - empty -> merge_msg_empty(Prev, New, TrUserData); - sync_routes_request -> merge_msg_sync_routes_request(Prev, New, TrUserData); - start_domain_request -> merge_msg_start_domain_request(Prev, New, TrUserData); - stop_domain_request -> merge_msg_stop_domain_request(Prev, New, TrUserData); - get_domain_request -> merge_msg_get_domain_request(Prev, New, TrUserData); - domain -> merge_msg_domain(Prev, New, TrUserData); - list_domains_request -> merge_msg_list_domains_request(Prev, New, TrUserData); - list_domains_response -> merge_msg_list_domains_response(Prev, New, TrUserData); - create_domain_request -> merge_msg_create_domain_request(Prev, New, TrUserData); - delete_domain_request -> merge_msg_delete_domain_request(Prev, New, TrUserData); - download_image_request -> merge_msg_download_image_request(Prev, New, TrUserData); - image_chunk -> merge_msg_image_chunk(Prev, New, TrUserData); - get_network_request -> merge_msg_get_network_request(Prev, New, TrUserData); - network -> merge_msg_network(Prev, New, TrUserData); - list_networks_request -> merge_msg_list_networks_request(Prev, New, TrUserData); - list_networks_response -> merge_msg_list_networks_response(Prev, New, TrUserData); - create_network_request -> merge_msg_create_network_request(Prev, New, TrUserData); - delete_network_request -> merge_msg_delete_network_request(Prev, New, TrUserData); - get_volume_request -> merge_msg_get_volume_request(Prev, New, TrUserData); - volume -> merge_msg_volume(Prev, New, TrUserData); - list_volumes_request -> merge_msg_list_volumes_request(Prev, New, TrUserData); - list_volumes_response -> merge_msg_list_volumes_response(Prev, New, TrUserData); - create_volume_request -> merge_msg_create_volume_request(Prev, New, TrUserData); - update_volume_request -> merge_msg_update_volume_request(Prev, New, TrUserData); - delete_volume_request -> merge_msg_delete_volume_request(Prev, New, TrUserData); - volume_attachment_identifier -> merge_msg_volume_attachment_identifier(Prev, New, TrUserData); - volume_attachment -> merge_msg_volume_attachment(Prev, New, TrUserData); - list_volume_attachments_request -> merge_msg_list_volume_attachments_request(Prev, New, TrUserData); - list_volume_attachments_response -> merge_msg_list_volume_attachments_response(Prev, New, TrUserData); - port_forwarding_identifier -> merge_msg_port_forwarding_identifier(Prev, New, TrUserData); - port_forwarding -> merge_msg_port_forwarding(Prev, New, TrUserData); - list_port_forwardings_request -> merge_msg_list_port_forwardings_request(Prev, New, TrUserData); - list_port_forwardings_response -> merge_msg_list_port_forwardings_response(Prev, New, TrUserData); - put_port_forwarding_request -> merge_msg_put_port_forwarding_request(Prev, New, TrUserData); - dns_record_identifier -> merge_msg_dns_record_identifier(Prev, New, TrUserData); - dns_record -> merge_msg_dns_record(Prev, New, TrUserData); - list_dns_records_request -> merge_msg_list_dns_records_request(Prev, New, TrUserData); - list_dns_records_response -> merge_msg_list_dns_records_response(Prev, New, TrUserData); - put_dns_record_request -> merge_msg_put_dns_record_request(Prev, New, TrUserData); - route_table -> merge_msg_route_table(Prev, New, TrUserData); - route_table_identifier -> merge_msg_route_table_identifier(Prev, New, TrUserData); - list_route_tables_request -> merge_msg_list_route_tables_request(Prev, New, TrUserData); - list_route_tables_response -> merge_msg_list_route_tables_response(Prev, New, TrUserData); - create_route_table_request -> merge_msg_create_route_table_request(Prev, New, TrUserData); - route_identifier -> merge_msg_route_identifier(Prev, New, TrUserData); - route -> merge_msg_route(Prev, New, TrUserData); - list_routes_request -> merge_msg_list_routes_request(Prev, New, TrUserData); - list_routes_response -> merge_msg_list_routes_response(Prev, New, TrUserData); - put_route_request -> merge_msg_put_route_request(Prev, New, TrUserData); - sync_request -> merge_msg_sync_request(Prev, New, TrUserData); - timestamp -> merge_msg_timestamp(Prev, New, TrUserData) - end. - --compile({nowarn_unused_function,merge_msg_empty/3}). -merge_msg_empty(_Prev, New, _TrUserData) -> New. - --compile({nowarn_unused_function,merge_msg_sync_routes_request/3}). -merge_msg_sync_routes_request(_Prev, New, _TrUserData) -> New. - --compile({nowarn_unused_function,merge_msg_start_domain_request/3}). -merge_msg_start_domain_request(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S1#{host => NFhost}; - {#{host := PFhost}, _} -> S1#{host => PFhost}; - _ -> S1 - end, - case {PMsg, NMsg} of - {_, #{uuid := NFuuid}} -> S2#{uuid => NFuuid}; - {#{uuid := PFuuid}, _} -> S2#{uuid => PFuuid}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_stop_domain_request/3}). -merge_msg_stop_domain_request(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S1#{host => NFhost}; - {#{host := PFhost}, _} -> S1#{host => PFhost}; - _ -> S1 - end, - S3 = case {PMsg, NMsg} of - {_, #{uuid := NFuuid}} -> S2#{uuid => NFuuid}; - {#{uuid := PFuuid}, _} -> S2#{uuid => PFuuid}; - _ -> S2 - end, - case {PMsg, NMsg} of - {_, #{force := NFforce}} -> S3#{force => NFforce}; - {#{force := PFforce}, _} -> S3#{force => PFforce}; - _ -> S3 - end. - --compile({nowarn_unused_function,merge_msg_get_domain_request/3}). -merge_msg_get_domain_request(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{uuid := NFuuid}} -> S1#{uuid => NFuuid}; - {#{uuid := PFuuid}, _} -> S1#{uuid => PFuuid}; - _ -> S1 - end, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S2#{host => NFhost}; - {#{host := PFhost}, _} -> S2#{host => PFhost}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_domain/3}). -merge_msg_domain(PMsg, NMsg, TrUserData) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{id := NFid}} -> S1#{id => NFid}; - {#{id := PFid}, _} -> S1#{id => PFid}; - _ -> S1 - end, - S3 = case {PMsg, NMsg} of - {_, #{uuid := NFuuid}} -> S2#{uuid => NFuuid}; - {#{uuid := PFuuid}, _} -> S2#{uuid => PFuuid}; - _ -> S2 - end, - S4 = case {PMsg, NMsg} of - {_, #{name := NFname}} -> S3#{name => NFname}; - {#{name := PFname}, _} -> S3#{name => PFname}; - _ -> S3 - end, - S5 = case {PMsg, NMsg} of - {_, #{vcpu := NFvcpu}} -> S4#{vcpu => NFvcpu}; - {#{vcpu := PFvcpu}, _} -> S4#{vcpu => PFvcpu}; - _ -> S4 - end, - S6 = case {PMsg, NMsg} of - {_, #{memory := NFmemory}} -> S5#{memory => NFmemory}; - {#{memory := PFmemory}, _} -> S5#{memory => PFmemory}; - _ -> S5 - end, - S7 = case {PMsg, NMsg} of - {_, #{network := NFnetwork}} -> S6#{network => NFnetwork}; - {#{network := PFnetwork}, _} -> S6#{network => PFnetwork}; - _ -> S6 - end, - S8 = case {PMsg, NMsg} of - {_, #{bridge := NFbridge}} -> S7#{bridge => NFbridge}; - {#{bridge := PFbridge}, _} -> S7#{bridge => PFbridge}; - _ -> S7 - end, - S9 = case {PMsg, NMsg} of - {_, #{state := NFstate}} -> S8#{state => NFstate}; - {#{state := PFstate}, _} -> S8#{state => PFstate}; - _ -> S8 - end, - S10 = case {PMsg, NMsg} of - {_, #{private_ip := NFprivate_ip}} -> S9#{private_ip => NFprivate_ip}; - {#{private_ip := PFprivate_ip}, _} -> S9#{private_ip => PFprivate_ip}; - _ -> S9 - end, - S11 = case {PMsg, NMsg} of - {_, #{ipv6_address := NFipv6_address}} -> S10#{ipv6_address => NFipv6_address}; - {#{ipv6_address := PFipv6_address}, _} -> S10#{ipv6_address => PFipv6_address}; - _ -> S10 - end, - S12 = case {PMsg, NMsg} of - {_, #{user_data := NFuser_data}} -> S11#{user_data => NFuser_data}; - {#{user_data := PFuser_data}, _} -> S11#{user_data => PFuser_data}; - _ -> S11 - end, - S13 = case {PMsg, NMsg} of - {_, #{nested_virtualization := NFnested_virtualization}} -> S12#{nested_virtualization => NFnested_virtualization}; - {#{nested_virtualization := PFnested_virtualization}, _} -> S12#{nested_virtualization => PFnested_virtualization}; - _ -> S12 - end, - S14 = case {PMsg, NMsg} of - {_, #{base_image := NFbase_image}} -> S13#{base_image => NFbase_image}; - {#{base_image := PFbase_image}, _} -> S13#{base_image => PFbase_image}; - _ -> S13 - end, - S15 = case {PMsg, NMsg} of - {#{created_at := PFcreated_at}, #{created_at := NFcreated_at}} -> S14#{created_at => merge_msg_timestamp(PFcreated_at, NFcreated_at, TrUserData)}; - {_, #{created_at := NFcreated_at}} -> S14#{created_at => NFcreated_at}; - {#{created_at := PFcreated_at}, _} -> S14#{created_at => PFcreated_at}; - {_, _} -> S14 - end, - case {PMsg, NMsg} of - {_, #{os_type := NFos_type}} -> S15#{os_type => NFos_type}; - {#{os_type := PFos_type}, _} -> S15#{os_type => PFos_type}; - _ -> S15 - end. - --compile({nowarn_unused_function,merge_msg_list_domains_request/3}). -merge_msg_list_domains_request(PMsg, NMsg, _) -> - S1 = #{}, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S1#{host => NFhost}; - {#{host := PFhost}, _} -> S1#{host => PFhost}; - _ -> S1 - end. - --compile({nowarn_unused_function,merge_msg_list_domains_response/3}). -merge_msg_list_domains_response(PMsg, NMsg, TrUserData) -> - S1 = #{}, - case {PMsg, NMsg} of - {#{domains := PFdomains}, #{domains := NFdomains}} -> S1#{domains => 'erlang_++'(PFdomains, NFdomains, TrUserData)}; - {_, #{domains := NFdomains}} -> S1#{domains => NFdomains}; - {#{domains := PFdomains}, _} -> S1#{domains => PFdomains}; - {_, _} -> S1 - end. - --compile({nowarn_unused_function,merge_msg_create_domain_request/3}). -merge_msg_create_domain_request(PMsg, NMsg, TrUserData) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {#{domain := PFdomain}, #{domain := NFdomain}} -> S1#{domain => merge_msg_domain(PFdomain, NFdomain, TrUserData)}; - {_, #{domain := NFdomain}} -> S1#{domain => NFdomain}; - {#{domain := PFdomain}, _} -> S1#{domain => PFdomain}; - {_, _} -> S1 - end, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S2#{host => NFhost}; - {#{host := PFhost}, _} -> S2#{host => PFhost}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_delete_domain_request/3}). -merge_msg_delete_domain_request(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{uuid := NFuuid}} -> S1#{uuid => NFuuid}; - {#{uuid := PFuuid}, _} -> S1#{uuid => PFuuid}; - _ -> S1 - end, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S2#{host => NFhost}; - {#{host := PFhost}, _} -> S2#{host => PFhost}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_download_image_request/3}). -merge_msg_download_image_request(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{domain_id := NFdomain_id}} -> S1#{domain_id => NFdomain_id}; - {#{domain_id := PFdomain_id}, _} -> S1#{domain_id => PFdomain_id}; - _ -> S1 - end, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S2#{host => NFhost}; - {#{host := PFhost}, _} -> S2#{host => PFhost}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_image_chunk/3}). -merge_msg_image_chunk(PMsg, NMsg, _) -> - S1 = #{}, - case {PMsg, NMsg} of - {_, #{bytes := NFbytes}} -> S1#{bytes => NFbytes}; - {#{bytes := PFbytes}, _} -> S1#{bytes => PFbytes}; - _ -> S1 - end. - --compile({nowarn_unused_function,merge_msg_get_network_request/3}). -merge_msg_get_network_request(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{uuid := NFuuid}} -> S1#{uuid => NFuuid}; - {#{uuid := PFuuid}, _} -> S1#{uuid => PFuuid}; - _ -> S1 - end, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S2#{host => NFhost}; - {#{host := PFhost}, _} -> S2#{host => PFhost}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_network/3}). -merge_msg_network(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{uuid := NFuuid}} -> S1#{uuid => NFuuid}; - {#{uuid := PFuuid}, _} -> S1#{uuid => PFuuid}; - _ -> S1 - end, - S3 = case {PMsg, NMsg} of - {_, #{name := NFname}} -> S2#{name => NFname}; - {#{name := PFname}, _} -> S2#{name => PFname}; - _ -> S2 - end, - S4 = case {PMsg, NMsg} of - {_, #{cidr := NFcidr}} -> S3#{cidr => NFcidr}; - {#{cidr := PFcidr}, _} -> S3#{cidr => PFcidr}; - _ -> S3 - end, - case {PMsg, NMsg} of - {_, #{cidr6 := NFcidr6}} -> S4#{cidr6 => NFcidr6}; - {#{cidr6 := PFcidr6}, _} -> S4#{cidr6 => PFcidr6}; - _ -> S4 - end. - --compile({nowarn_unused_function,merge_msg_list_networks_request/3}). -merge_msg_list_networks_request(PMsg, NMsg, _) -> - S1 = #{}, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S1#{host => NFhost}; - {#{host := PFhost}, _} -> S1#{host => PFhost}; - _ -> S1 - end. - --compile({nowarn_unused_function,merge_msg_list_networks_response/3}). -merge_msg_list_networks_response(PMsg, NMsg, TrUserData) -> - S1 = #{}, - case {PMsg, NMsg} of - {#{networks := PFnetworks}, #{networks := NFnetworks}} -> S1#{networks => 'erlang_++'(PFnetworks, NFnetworks, TrUserData)}; - {_, #{networks := NFnetworks}} -> S1#{networks => NFnetworks}; - {#{networks := PFnetworks}, _} -> S1#{networks => PFnetworks}; - {_, _} -> S1 - end. - --compile({nowarn_unused_function,merge_msg_create_network_request/3}). -merge_msg_create_network_request(PMsg, NMsg, TrUserData) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {#{network := PFnetwork}, #{network := NFnetwork}} -> S1#{network => merge_msg_network(PFnetwork, NFnetwork, TrUserData)}; - {_, #{network := NFnetwork}} -> S1#{network => NFnetwork}; - {#{network := PFnetwork}, _} -> S1#{network => PFnetwork}; - {_, _} -> S1 - end, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S2#{host => NFhost}; - {#{host := PFhost}, _} -> S2#{host => PFhost}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_delete_network_request/3}). -merge_msg_delete_network_request(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{uuid := NFuuid}} -> S1#{uuid => NFuuid}; - {#{uuid := PFuuid}, _} -> S1#{uuid => PFuuid}; - _ -> S1 - end, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S2#{host => NFhost}; - {#{host := PFhost}, _} -> S2#{host => PFhost}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_get_volume_request/3}). -merge_msg_get_volume_request(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{uuid := NFuuid}} -> S1#{uuid => NFuuid}; - {#{uuid := PFuuid}, _} -> S1#{uuid => PFuuid}; - _ -> S1 - end, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S2#{host => NFhost}; - {#{host := PFhost}, _} -> S2#{host => PFhost}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_volume/3}). -merge_msg_volume(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{id := NFid}} -> S1#{id => NFid}; - {#{id := PFid}, _} -> S1#{id => PFid}; - _ -> S1 - end, - S3 = case {PMsg, NMsg} of - {_, #{name := NFname}} -> S2#{name => NFname}; - {#{name := PFname}, _} -> S2#{name => PFname}; - _ -> S2 - end, - case {PMsg, NMsg} of - {_, #{size := NFsize}} -> S3#{size => NFsize}; - {#{size := PFsize}, _} -> S3#{size => PFsize}; - _ -> S3 - end. - --compile({nowarn_unused_function,merge_msg_list_volumes_request/3}). -merge_msg_list_volumes_request(PMsg, NMsg, _) -> - S1 = #{}, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S1#{host => NFhost}; - {#{host := PFhost}, _} -> S1#{host => PFhost}; - _ -> S1 - end. - --compile({nowarn_unused_function,merge_msg_list_volumes_response/3}). -merge_msg_list_volumes_response(PMsg, NMsg, TrUserData) -> - S1 = #{}, - case {PMsg, NMsg} of - {#{volumes := PFvolumes}, #{volumes := NFvolumes}} -> S1#{volumes => 'erlang_++'(PFvolumes, NFvolumes, TrUserData)}; - {_, #{volumes := NFvolumes}} -> S1#{volumes => NFvolumes}; - {#{volumes := PFvolumes}, _} -> S1#{volumes => PFvolumes}; - {_, _} -> S1 - end. - --compile({nowarn_unused_function,merge_msg_create_volume_request/3}). -merge_msg_create_volume_request(PMsg, NMsg, TrUserData) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {#{volume := PFvolume}, #{volume := NFvolume}} -> S1#{volume => merge_msg_volume(PFvolume, NFvolume, TrUserData)}; - {_, #{volume := NFvolume}} -> S1#{volume => NFvolume}; - {#{volume := PFvolume}, _} -> S1#{volume => PFvolume}; - {_, _} -> S1 - end, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S2#{host => NFhost}; - {#{host := PFhost}, _} -> S2#{host => PFhost}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_update_volume_request/3}). -merge_msg_update_volume_request(PMsg, NMsg, TrUserData) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S1#{host => NFhost}; - {#{host := PFhost}, _} -> S1#{host => PFhost}; - _ -> S1 - end, - case {PMsg, NMsg} of - {#{volume := PFvolume}, #{volume := NFvolume}} -> S2#{volume => merge_msg_volume(PFvolume, NFvolume, TrUserData)}; - {_, #{volume := NFvolume}} -> S2#{volume => NFvolume}; - {#{volume := PFvolume}, _} -> S2#{volume => PFvolume}; - {_, _} -> S2 - end. - --compile({nowarn_unused_function,merge_msg_delete_volume_request/3}). -merge_msg_delete_volume_request(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{uuid := NFuuid}} -> S1#{uuid => NFuuid}; - {#{uuid := PFuuid}, _} -> S1#{uuid => PFuuid}; - _ -> S1 - end, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S2#{host => NFhost}; - {#{host := PFhost}, _} -> S2#{host => PFhost}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_volume_attachment_identifier/3}). -merge_msg_volume_attachment_identifier(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{domain_id := NFdomain_id}} -> S1#{domain_id => NFdomain_id}; - {#{domain_id := PFdomain_id}, _} -> S1#{domain_id => PFdomain_id}; - _ -> S1 - end, - S3 = case {PMsg, NMsg} of - {_, #{volume_id := NFvolume_id}} -> S2#{volume_id => NFvolume_id}; - {#{volume_id := PFvolume_id}, _} -> S2#{volume_id => PFvolume_id}; - _ -> S2 - end, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S3#{host => NFhost}; - {#{host := PFhost}, _} -> S3#{host => PFhost}; - _ -> S3 - end. - --compile({nowarn_unused_function,merge_msg_volume_attachment/3}). -merge_msg_volume_attachment(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{domain_id := NFdomain_id}} -> S1#{domain_id => NFdomain_id}; - {#{domain_id := PFdomain_id}, _} -> S1#{domain_id => PFdomain_id}; - _ -> S1 - end, - S3 = case {PMsg, NMsg} of - {_, #{volume_id := NFvolume_id}} -> S2#{volume_id => NFvolume_id}; - {#{volume_id := PFvolume_id}, _} -> S2#{volume_id => PFvolume_id}; - _ -> S2 - end, - case {PMsg, NMsg} of - {_, #{disk_address := NFdisk_address}} -> S3#{disk_address => NFdisk_address}; - {#{disk_address := PFdisk_address}, _} -> S3#{disk_address => PFdisk_address}; - _ -> S3 - end. - --compile({nowarn_unused_function,merge_msg_list_volume_attachments_request/3}). -merge_msg_list_volume_attachments_request(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{domain_id := NFdomain_id}} -> S1#{domain_id => NFdomain_id}; - {#{domain_id := PFdomain_id}, _} -> S1#{domain_id => PFdomain_id}; - _ -> S1 - end, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S2#{host => NFhost}; - {#{host := PFhost}, _} -> S2#{host => PFhost}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_list_volume_attachments_response/3}). -merge_msg_list_volume_attachments_response(PMsg, NMsg, TrUserData) -> - S1 = #{}, - case {PMsg, NMsg} of - {#{attachments := PFattachments}, #{attachments := NFattachments}} -> S1#{attachments => 'erlang_++'(PFattachments, NFattachments, TrUserData)}; - {_, #{attachments := NFattachments}} -> S1#{attachments => NFattachments}; - {#{attachments := PFattachments}, _} -> S1#{attachments => PFattachments}; - {_, _} -> S1 - end. - --compile({nowarn_unused_function,merge_msg_port_forwarding_identifier/3}). -merge_msg_port_forwarding_identifier(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S1#{host => NFhost}; - {#{host := PFhost}, _} -> S1#{host => PFhost}; - _ -> S1 - end, - S3 = case {PMsg, NMsg} of - {_, #{protocol := NFprotocol}} -> S2#{protocol => NFprotocol}; - {#{protocol := PFprotocol}, _} -> S2#{protocol => PFprotocol}; - _ -> S2 - end, - case {PMsg, NMsg} of - {_, #{source_port := NFsource_port}} -> S3#{source_port => NFsource_port}; - {#{source_port := PFsource_port}, _} -> S3#{source_port => PFsource_port}; - _ -> S3 - end. - --compile({nowarn_unused_function,merge_msg_port_forwarding/3}). -merge_msg_port_forwarding(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{protocol := NFprotocol}} -> S1#{protocol => NFprotocol}; - {#{protocol := PFprotocol}, _} -> S1#{protocol => PFprotocol}; - _ -> S1 - end, - S3 = case {PMsg, NMsg} of - {_, #{source_port := NFsource_port}} -> S2#{source_port => NFsource_port}; - {#{source_port := PFsource_port}, _} -> S2#{source_port => PFsource_port}; - _ -> S2 - end, - S4 = case {PMsg, NMsg} of - {_, #{target_ip := NFtarget_ip}} -> S3#{target_ip => NFtarget_ip}; - {#{target_ip := PFtarget_ip}, _} -> S3#{target_ip => PFtarget_ip}; - _ -> S3 - end, - case {PMsg, NMsg} of - {_, #{target_port := NFtarget_port}} -> S4#{target_port => NFtarget_port}; - {#{target_port := PFtarget_port}, _} -> S4#{target_port => PFtarget_port}; - _ -> S4 - end. - --compile({nowarn_unused_function,merge_msg_list_port_forwardings_request/3}). -merge_msg_list_port_forwardings_request(PMsg, NMsg, _) -> - S1 = #{}, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S1#{host => NFhost}; - {#{host := PFhost}, _} -> S1#{host => PFhost}; - _ -> S1 - end. - --compile({nowarn_unused_function,merge_msg_list_port_forwardings_response/3}). -merge_msg_list_port_forwardings_response(PMsg, NMsg, TrUserData) -> - S1 = #{}, - case {PMsg, NMsg} of - {#{port_forwardings := PFport_forwardings}, #{port_forwardings := NFport_forwardings}} -> S1#{port_forwardings => 'erlang_++'(PFport_forwardings, NFport_forwardings, TrUserData)}; - {_, #{port_forwardings := NFport_forwardings}} -> S1#{port_forwardings => NFport_forwardings}; - {#{port_forwardings := PFport_forwardings}, _} -> S1#{port_forwardings => PFport_forwardings}; - {_, _} -> S1 - end. - --compile({nowarn_unused_function,merge_msg_put_port_forwarding_request/3}). -merge_msg_put_port_forwarding_request(PMsg, NMsg, TrUserData) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {#{port_forwarding := PFport_forwarding}, #{port_forwarding := NFport_forwarding}} -> S1#{port_forwarding => merge_msg_port_forwarding(PFport_forwarding, NFport_forwarding, TrUserData)}; - {_, #{port_forwarding := NFport_forwarding}} -> S1#{port_forwarding => NFport_forwarding}; - {#{port_forwarding := PFport_forwarding}, _} -> S1#{port_forwarding => PFport_forwarding}; - {_, _} -> S1 - end, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S2#{host => NFhost}; - {#{host := PFhost}, _} -> S2#{host => PFhost}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_dns_record_identifier/3}). -merge_msg_dns_record_identifier(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{name := NFname}} -> S1#{name => NFname}; - {#{name := PFname}, _} -> S1#{name => PFname}; - _ -> S1 - end, - case {PMsg, NMsg} of - {_, #{type := NFtype}} -> S2#{type => NFtype}; - {#{type := PFtype}, _} -> S2#{type => PFtype}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_dns_record/3}). -merge_msg_dns_record(PMsg, NMsg, TrUserData) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{name := NFname}} -> S1#{name => NFname}; - {#{name := PFname}, _} -> S1#{name => PFname}; - _ -> S1 - end, - S3 = case {PMsg, NMsg} of - {_, #{type := NFtype}} -> S2#{type => NFtype}; - {#{type := PFtype}, _} -> S2#{type => PFtype}; - _ -> S2 - end, - S4 = case {PMsg, NMsg} of - {_, #{ttl := NFttl}} -> S3#{ttl => NFttl}; - {#{ttl := PFttl}, _} -> S3#{ttl => PFttl}; - _ -> S3 - end, - case {PMsg, NMsg} of - {#{records := PFrecords}, #{records := NFrecords}} -> S4#{records => 'erlang_++'(PFrecords, NFrecords, TrUserData)}; - {_, #{records := NFrecords}} -> S4#{records => NFrecords}; - {#{records := PFrecords}, _} -> S4#{records => PFrecords}; - {_, _} -> S4 - end. - --compile({nowarn_unused_function,merge_msg_list_dns_records_request/3}). -merge_msg_list_dns_records_request(_Prev, New, _TrUserData) -> New. - --compile({nowarn_unused_function,merge_msg_list_dns_records_response/3}). -merge_msg_list_dns_records_response(PMsg, NMsg, TrUserData) -> - S1 = #{}, - case {PMsg, NMsg} of - {#{dns_records := PFdns_records}, #{dns_records := NFdns_records}} -> S1#{dns_records => 'erlang_++'(PFdns_records, NFdns_records, TrUserData)}; - {_, #{dns_records := NFdns_records}} -> S1#{dns_records => NFdns_records}; - {#{dns_records := PFdns_records}, _} -> S1#{dns_records => PFdns_records}; - {_, _} -> S1 - end. - --compile({nowarn_unused_function,merge_msg_put_dns_record_request/3}). -merge_msg_put_dns_record_request(PMsg, NMsg, TrUserData) -> - S1 = #{}, - case {PMsg, NMsg} of - {#{dns_record := PFdns_record}, #{dns_record := NFdns_record}} -> S1#{dns_record => merge_msg_dns_record(PFdns_record, NFdns_record, TrUserData)}; - {_, #{dns_record := NFdns_record}} -> S1#{dns_record => NFdns_record}; - {#{dns_record := PFdns_record}, _} -> S1#{dns_record => PFdns_record}; - {_, _} -> S1 - end. - --compile({nowarn_unused_function,merge_msg_route_table/3}). -merge_msg_route_table(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{network_name := NFnetwork_name}} -> S1#{network_name => NFnetwork_name}; - {#{network_name := PFnetwork_name}, _} -> S1#{network_name => PFnetwork_name}; - _ -> S1 - end, - S3 = case {PMsg, NMsg} of - {_, #{id := NFid}} -> S2#{id => NFid}; - {#{id := PFid}, _} -> S2#{id => PFid}; - _ -> S2 - end, - case {PMsg, NMsg} of - {_, #{name := NFname}} -> S3#{name => NFname}; - {#{name := PFname}, _} -> S3#{name => PFname}; - _ -> S3 - end. - --compile({nowarn_unused_function,merge_msg_route_table_identifier/3}). -merge_msg_route_table_identifier(PMsg, NMsg, _) -> - S1 = #{}, - case {PMsg, NMsg} of - {_, #{id := NFid}} -> S1#{id => NFid}; - {#{id := PFid}, _} -> S1#{id => PFid}; - _ -> S1 - end. - --compile({nowarn_unused_function,merge_msg_list_route_tables_request/3}). -merge_msg_list_route_tables_request(PMsg, NMsg, _) -> - S1 = #{}, - case {PMsg, NMsg} of - {_, #{network_name := NFnetwork_name}} -> S1#{network_name => NFnetwork_name}; - {#{network_name := PFnetwork_name}, _} -> S1#{network_name => PFnetwork_name}; - _ -> S1 - end. - --compile({nowarn_unused_function,merge_msg_list_route_tables_response/3}). -merge_msg_list_route_tables_response(PMsg, NMsg, TrUserData) -> - S1 = #{}, - case {PMsg, NMsg} of - {#{route_tables := PFroute_tables}, #{route_tables := NFroute_tables}} -> S1#{route_tables => 'erlang_++'(PFroute_tables, NFroute_tables, TrUserData)}; - {_, #{route_tables := NFroute_tables}} -> S1#{route_tables => NFroute_tables}; - {#{route_tables := PFroute_tables}, _} -> S1#{route_tables => PFroute_tables}; - {_, _} -> S1 - end. - --compile({nowarn_unused_function,merge_msg_create_route_table_request/3}). -merge_msg_create_route_table_request(PMsg, NMsg, TrUserData) -> - S1 = #{}, - case {PMsg, NMsg} of - {#{route_table := PFroute_table}, #{route_table := NFroute_table}} -> S1#{route_table => merge_msg_route_table(PFroute_table, NFroute_table, TrUserData)}; - {_, #{route_table := NFroute_table}} -> S1#{route_table => NFroute_table}; - {#{route_table := PFroute_table}, _} -> S1#{route_table => PFroute_table}; - {_, _} -> S1 - end. - --compile({nowarn_unused_function,merge_msg_route_identifier/3}). -merge_msg_route_identifier(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{route_table_id := NFroute_table_id}} -> S1#{route_table_id => NFroute_table_id}; - {#{route_table_id := PFroute_table_id}, _} -> S1#{route_table_id => PFroute_table_id}; - _ -> S1 - end, - case {PMsg, NMsg} of - {_, #{destination := NFdestination}} -> S2#{destination => NFdestination}; - {#{destination := PFdestination}, _} -> S2#{destination => PFdestination}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_route/3}). -merge_msg_route(PMsg, NMsg, TrUserData) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{route_table_id := NFroute_table_id}} -> S1#{route_table_id => NFroute_table_id}; - {#{route_table_id := PFroute_table_id}, _} -> S1#{route_table_id => PFroute_table_id}; - _ -> S1 - end, - S3 = case {PMsg, NMsg} of - {_, #{destination := NFdestination}} -> S2#{destination => NFdestination}; - {#{destination := PFdestination}, _} -> S2#{destination => PFdestination}; - _ -> S2 - end, - case {PMsg, NMsg} of - {#{gateways := PFgateways}, #{gateways := NFgateways}} -> S3#{gateways => 'erlang_++'(PFgateways, NFgateways, TrUserData)}; - {_, #{gateways := NFgateways}} -> S3#{gateways => NFgateways}; - {#{gateways := PFgateways}, _} -> S3#{gateways => PFgateways}; - {_, _} -> S3 - end. - --compile({nowarn_unused_function,merge_msg_list_routes_request/3}). -merge_msg_list_routes_request(PMsg, NMsg, _) -> - S1 = #{}, - case {PMsg, NMsg} of - {_, #{route_table_id := NFroute_table_id}} -> S1#{route_table_id => NFroute_table_id}; - {#{route_table_id := PFroute_table_id}, _} -> S1#{route_table_id => PFroute_table_id}; - _ -> S1 - end. - --compile({nowarn_unused_function,merge_msg_list_routes_response/3}). -merge_msg_list_routes_response(PMsg, NMsg, TrUserData) -> - S1 = #{}, - case {PMsg, NMsg} of - {#{routes := PFroutes}, #{routes := NFroutes}} -> S1#{routes => 'erlang_++'(PFroutes, NFroutes, TrUserData)}; - {_, #{routes := NFroutes}} -> S1#{routes => NFroutes}; - {#{routes := PFroutes}, _} -> S1#{routes => PFroutes}; - {_, _} -> S1 - end. - --compile({nowarn_unused_function,merge_msg_put_route_request/3}). -merge_msg_put_route_request(PMsg, NMsg, TrUserData) -> - S1 = #{}, - case {PMsg, NMsg} of - {#{route := PFroute}, #{route := NFroute}} -> S1#{route => merge_msg_route(PFroute, NFroute, TrUserData)}; - {_, #{route := NFroute}} -> S1#{route => NFroute}; - {#{route := PFroute}, _} -> S1#{route => PFroute}; - {_, _} -> S1 - end. - --compile({nowarn_unused_function,merge_msg_sync_request/3}). -merge_msg_sync_request(_Prev, New, _TrUserData) -> New. - --compile({nowarn_unused_function,merge_msg_timestamp/3}). -merge_msg_timestamp(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{seconds := NFseconds}} -> S1#{seconds => NFseconds}; - {#{seconds := PFseconds}, _} -> S1#{seconds => PFseconds}; - _ -> S1 - end, - case {PMsg, NMsg} of - {_, #{nanos := NFnanos}} -> S2#{nanos => NFnanos}; - {#{nanos := PFnanos}, _} -> S2#{nanos => PFnanos}; - _ -> S2 - end. - - -verify_msg(Msg, MsgName) when is_atom(MsgName) -> verify_msg(Msg, MsgName, []). - -verify_msg(Msg, MsgName, Opts) -> - TrUserData = proplists:get_value(user_data, Opts), - case MsgName of - empty -> v_msg_empty(Msg, [MsgName], TrUserData); - sync_routes_request -> v_msg_sync_routes_request(Msg, [MsgName], TrUserData); - start_domain_request -> v_msg_start_domain_request(Msg, [MsgName], TrUserData); - stop_domain_request -> v_msg_stop_domain_request(Msg, [MsgName], TrUserData); - get_domain_request -> v_msg_get_domain_request(Msg, [MsgName], TrUserData); - domain -> v_msg_domain(Msg, [MsgName], TrUserData); - list_domains_request -> v_msg_list_domains_request(Msg, [MsgName], TrUserData); - list_domains_response -> v_msg_list_domains_response(Msg, [MsgName], TrUserData); - create_domain_request -> v_msg_create_domain_request(Msg, [MsgName], TrUserData); - delete_domain_request -> v_msg_delete_domain_request(Msg, [MsgName], TrUserData); - download_image_request -> v_msg_download_image_request(Msg, [MsgName], TrUserData); - image_chunk -> v_msg_image_chunk(Msg, [MsgName], TrUserData); - get_network_request -> v_msg_get_network_request(Msg, [MsgName], TrUserData); - network -> v_msg_network(Msg, [MsgName], TrUserData); - list_networks_request -> v_msg_list_networks_request(Msg, [MsgName], TrUserData); - list_networks_response -> v_msg_list_networks_response(Msg, [MsgName], TrUserData); - create_network_request -> v_msg_create_network_request(Msg, [MsgName], TrUserData); - delete_network_request -> v_msg_delete_network_request(Msg, [MsgName], TrUserData); - get_volume_request -> v_msg_get_volume_request(Msg, [MsgName], TrUserData); - volume -> v_msg_volume(Msg, [MsgName], TrUserData); - list_volumes_request -> v_msg_list_volumes_request(Msg, [MsgName], TrUserData); - list_volumes_response -> v_msg_list_volumes_response(Msg, [MsgName], TrUserData); - create_volume_request -> v_msg_create_volume_request(Msg, [MsgName], TrUserData); - update_volume_request -> v_msg_update_volume_request(Msg, [MsgName], TrUserData); - delete_volume_request -> v_msg_delete_volume_request(Msg, [MsgName], TrUserData); - volume_attachment_identifier -> v_msg_volume_attachment_identifier(Msg, [MsgName], TrUserData); - volume_attachment -> v_msg_volume_attachment(Msg, [MsgName], TrUserData); - list_volume_attachments_request -> v_msg_list_volume_attachments_request(Msg, [MsgName], TrUserData); - list_volume_attachments_response -> v_msg_list_volume_attachments_response(Msg, [MsgName], TrUserData); - port_forwarding_identifier -> v_msg_port_forwarding_identifier(Msg, [MsgName], TrUserData); - port_forwarding -> v_msg_port_forwarding(Msg, [MsgName], TrUserData); - list_port_forwardings_request -> v_msg_list_port_forwardings_request(Msg, [MsgName], TrUserData); - list_port_forwardings_response -> v_msg_list_port_forwardings_response(Msg, [MsgName], TrUserData); - put_port_forwarding_request -> v_msg_put_port_forwarding_request(Msg, [MsgName], TrUserData); - dns_record_identifier -> v_msg_dns_record_identifier(Msg, [MsgName], TrUserData); - dns_record -> v_msg_dns_record(Msg, [MsgName], TrUserData); - list_dns_records_request -> v_msg_list_dns_records_request(Msg, [MsgName], TrUserData); - list_dns_records_response -> v_msg_list_dns_records_response(Msg, [MsgName], TrUserData); - put_dns_record_request -> v_msg_put_dns_record_request(Msg, [MsgName], TrUserData); - route_table -> v_msg_route_table(Msg, [MsgName], TrUserData); - route_table_identifier -> v_msg_route_table_identifier(Msg, [MsgName], TrUserData); - list_route_tables_request -> v_msg_list_route_tables_request(Msg, [MsgName], TrUserData); - list_route_tables_response -> v_msg_list_route_tables_response(Msg, [MsgName], TrUserData); - create_route_table_request -> v_msg_create_route_table_request(Msg, [MsgName], TrUserData); - route_identifier -> v_msg_route_identifier(Msg, [MsgName], TrUserData); - route -> v_msg_route(Msg, [MsgName], TrUserData); - list_routes_request -> v_msg_list_routes_request(Msg, [MsgName], TrUserData); - list_routes_response -> v_msg_list_routes_response(Msg, [MsgName], TrUserData); - put_route_request -> v_msg_put_route_request(Msg, [MsgName], TrUserData); - sync_request -> v_msg_sync_request(Msg, [MsgName], TrUserData); - timestamp -> v_msg_timestamp(Msg, [MsgName], TrUserData); - _ -> mk_type_error(not_a_known_message, Msg, []) - end. - - --compile({nowarn_unused_function,v_msg_empty/3}). --dialyzer({nowarn_function,v_msg_empty/3}). -v_msg_empty(#{} = M, Path, _) -> - lists:foreach(fun (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) end, maps:keys(M)), - ok; -v_msg_empty(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), empty}, M, Path); -v_msg_empty(X, Path, _TrUserData) -> mk_type_error({expected_msg, empty}, X, Path). - --compile({nowarn_unused_function,v_msg_sync_routes_request/3}). --dialyzer({nowarn_function,v_msg_sync_routes_request/3}). -v_msg_sync_routes_request(#{} = M, Path, _) -> - lists:foreach(fun (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) end, maps:keys(M)), - ok; -v_msg_sync_routes_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), sync_routes_request}, M, Path); -v_msg_sync_routes_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, sync_routes_request}, X, Path). - --compile({nowarn_unused_function,v_msg_start_domain_request/3}). --dialyzer({nowarn_function,v_msg_start_domain_request/3}). -v_msg_start_domain_request(#{} = M, Path, TrUserData) -> - case M of - #{host := F1} -> v_type_string(F1, [host | Path], TrUserData); - _ -> ok - end, - case M of - #{uuid := F2} -> v_type_string(F2, [uuid | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (host) -> ok; - (uuid) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_start_domain_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), start_domain_request}, M, Path); -v_msg_start_domain_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, start_domain_request}, X, Path). - --compile({nowarn_unused_function,v_msg_stop_domain_request/3}). --dialyzer({nowarn_function,v_msg_stop_domain_request/3}). -v_msg_stop_domain_request(#{} = M, Path, TrUserData) -> - case M of - #{host := F1} -> v_type_string(F1, [host | Path], TrUserData); - _ -> ok - end, - case M of - #{uuid := F2} -> v_type_string(F2, [uuid | Path], TrUserData); - _ -> ok - end, - case M of - #{force := F3} -> v_type_bool(F3, [force | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (host) -> ok; - (uuid) -> ok; - (force) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_stop_domain_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), stop_domain_request}, M, Path); -v_msg_stop_domain_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, stop_domain_request}, X, Path). - --compile({nowarn_unused_function,v_msg_get_domain_request/3}). --dialyzer({nowarn_function,v_msg_get_domain_request/3}). -v_msg_get_domain_request(#{} = M, Path, TrUserData) -> - case M of - #{uuid := F1} -> v_type_string(F1, [uuid | Path], TrUserData); - _ -> ok - end, - case M of - #{host := F2} -> v_type_string(F2, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (uuid) -> ok; - (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_get_domain_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), get_domain_request}, M, Path); -v_msg_get_domain_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, get_domain_request}, X, Path). - --compile({nowarn_unused_function,v_msg_domain/3}). --dialyzer({nowarn_function,v_msg_domain/3}). -v_msg_domain(#{} = M, Path, TrUserData) -> - case M of - #{id := F1} -> v_type_uint64(F1, [id | Path], TrUserData); - _ -> ok - end, - case M of - #{uuid := F2} -> v_type_string(F2, [uuid | Path], TrUserData); - _ -> ok - end, - case M of - #{name := F3} -> v_type_string(F3, [name | Path], TrUserData); - _ -> ok - end, - case M of - #{vcpu := F4} -> v_type_uint32(F4, [vcpu | Path], TrUserData); - _ -> ok - end, - case M of - #{memory := F5} -> v_type_uint64(F5, [memory | Path], TrUserData); - _ -> ok - end, - case M of - #{network := F6} -> v_type_string(F6, [network | Path], TrUserData); - _ -> ok - end, - case M of - #{bridge := F7} -> v_type_string(F7, [bridge | Path], TrUserData); - _ -> ok - end, - case M of - #{state := F8} -> v_type_string(F8, [state | Path], TrUserData); - _ -> ok - end, - case M of - #{private_ip := F9} -> v_type_string(F9, [private_ip | Path], TrUserData); - _ -> ok - end, - case M of - #{ipv6_address := F10} -> v_type_string(F10, [ipv6_address | Path], TrUserData); - _ -> ok - end, - case M of - #{user_data := F11} -> v_type_string(F11, [user_data | Path], TrUserData); - _ -> ok - end, - case M of - #{nested_virtualization := F12} -> v_type_bool(F12, [nested_virtualization | Path], TrUserData); - _ -> ok - end, - case M of - #{base_image := F13} -> v_type_string(F13, [base_image | Path], TrUserData); - _ -> ok - end, - case M of - #{created_at := F14} -> v_msg_timestamp(F14, [created_at | Path], TrUserData); - _ -> ok - end, - case M of - #{os_type := F15} -> v_type_string(F15, [os_type | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (id) -> ok; - (uuid) -> ok; - (name) -> ok; - (vcpu) -> ok; - (memory) -> ok; - (network) -> ok; - (bridge) -> ok; - (state) -> ok; - (private_ip) -> ok; - (ipv6_address) -> ok; - (user_data) -> ok; - (nested_virtualization) -> ok; - (base_image) -> ok; - (created_at) -> ok; - (os_type) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_domain(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), domain}, M, Path); -v_msg_domain(X, Path, _TrUserData) -> mk_type_error({expected_msg, domain}, X, Path). - --compile({nowarn_unused_function,v_msg_list_domains_request/3}). --dialyzer({nowarn_function,v_msg_list_domains_request/3}). -v_msg_list_domains_request(#{} = M, Path, TrUserData) -> - case M of - #{host := F1} -> v_type_string(F1, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_domains_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_domains_request}, M, Path); -v_msg_list_domains_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_domains_request}, X, Path). - --compile({nowarn_unused_function,v_msg_list_domains_response/3}). --dialyzer({nowarn_function,v_msg_list_domains_response/3}). -v_msg_list_domains_response(#{} = M, Path, TrUserData) -> - case M of - #{domains := F1} -> - if is_list(F1) -> - _ = [v_msg_domain(Elem, [domains | Path], TrUserData) || Elem <- F1], - ok; - true -> mk_type_error({invalid_list_of, {msg, domain}}, F1, [domains | Path]) - end; - _ -> ok - end, - lists:foreach(fun (domains) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_domains_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_domains_response}, M, Path); -v_msg_list_domains_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_domains_response}, X, Path). - --compile({nowarn_unused_function,v_msg_create_domain_request/3}). --dialyzer({nowarn_function,v_msg_create_domain_request/3}). -v_msg_create_domain_request(#{} = M, Path, TrUserData) -> - case M of - #{domain := F1} -> v_msg_domain(F1, [domain | Path], TrUserData); - _ -> ok - end, - case M of - #{host := F2} -> v_type_string(F2, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (domain) -> ok; - (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_create_domain_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), create_domain_request}, M, Path); -v_msg_create_domain_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, create_domain_request}, X, Path). - --compile({nowarn_unused_function,v_msg_delete_domain_request/3}). --dialyzer({nowarn_function,v_msg_delete_domain_request/3}). -v_msg_delete_domain_request(#{} = M, Path, TrUserData) -> - case M of - #{uuid := F1} -> v_type_string(F1, [uuid | Path], TrUserData); - _ -> ok - end, - case M of - #{host := F2} -> v_type_string(F2, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (uuid) -> ok; - (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_delete_domain_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), delete_domain_request}, M, Path); -v_msg_delete_domain_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, delete_domain_request}, X, Path). - --compile({nowarn_unused_function,v_msg_download_image_request/3}). --dialyzer({nowarn_function,v_msg_download_image_request/3}). -v_msg_download_image_request(#{} = M, Path, TrUserData) -> - case M of - #{domain_id := F1} -> v_type_string(F1, [domain_id | Path], TrUserData); - _ -> ok - end, - case M of - #{host := F2} -> v_type_string(F2, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (domain_id) -> ok; - (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_download_image_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), download_image_request}, M, Path); -v_msg_download_image_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, download_image_request}, X, Path). - --compile({nowarn_unused_function,v_msg_image_chunk/3}). --dialyzer({nowarn_function,v_msg_image_chunk/3}). -v_msg_image_chunk(#{} = M, Path, TrUserData) -> - case M of - #{bytes := F1} -> v_type_bytes(F1, [bytes | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (bytes) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_image_chunk(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), image_chunk}, M, Path); -v_msg_image_chunk(X, Path, _TrUserData) -> mk_type_error({expected_msg, image_chunk}, X, Path). - --compile({nowarn_unused_function,v_msg_get_network_request/3}). --dialyzer({nowarn_function,v_msg_get_network_request/3}). -v_msg_get_network_request(#{} = M, Path, TrUserData) -> - case M of - #{uuid := F1} -> v_type_string(F1, [uuid | Path], TrUserData); - _ -> ok - end, - case M of - #{host := F2} -> v_type_string(F2, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (uuid) -> ok; - (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_get_network_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), get_network_request}, M, Path); -v_msg_get_network_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, get_network_request}, X, Path). - --compile({nowarn_unused_function,v_msg_network/3}). --dialyzer({nowarn_function,v_msg_network/3}). -v_msg_network(#{} = M, Path, TrUserData) -> - case M of - #{uuid := F1} -> v_type_string(F1, [uuid | Path], TrUserData); - _ -> ok - end, - case M of - #{name := F2} -> v_type_string(F2, [name | Path], TrUserData); - _ -> ok - end, - case M of - #{cidr := F3} -> v_type_string(F3, [cidr | Path], TrUserData); - _ -> ok - end, - case M of - #{cidr6 := F4} -> v_type_string(F4, [cidr6 | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (uuid) -> ok; - (name) -> ok; - (cidr) -> ok; - (cidr6) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_network(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), network}, M, Path); -v_msg_network(X, Path, _TrUserData) -> mk_type_error({expected_msg, network}, X, Path). - --compile({nowarn_unused_function,v_msg_list_networks_request/3}). --dialyzer({nowarn_function,v_msg_list_networks_request/3}). -v_msg_list_networks_request(#{} = M, Path, TrUserData) -> - case M of - #{host := F1} -> v_type_string(F1, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_networks_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_networks_request}, M, Path); -v_msg_list_networks_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_networks_request}, X, Path). - --compile({nowarn_unused_function,v_msg_list_networks_response/3}). --dialyzer({nowarn_function,v_msg_list_networks_response/3}). -v_msg_list_networks_response(#{} = M, Path, TrUserData) -> - case M of - #{networks := F1} -> - if is_list(F1) -> - _ = [v_msg_network(Elem, [networks | Path], TrUserData) || Elem <- F1], - ok; - true -> mk_type_error({invalid_list_of, {msg, network}}, F1, [networks | Path]) - end; - _ -> ok - end, - lists:foreach(fun (networks) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_networks_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_networks_response}, M, Path); -v_msg_list_networks_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_networks_response}, X, Path). - --compile({nowarn_unused_function,v_msg_create_network_request/3}). --dialyzer({nowarn_function,v_msg_create_network_request/3}). -v_msg_create_network_request(#{} = M, Path, TrUserData) -> - case M of - #{network := F1} -> v_msg_network(F1, [network | Path], TrUserData); - _ -> ok - end, - case M of - #{host := F2} -> v_type_string(F2, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (network) -> ok; - (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_create_network_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), create_network_request}, M, Path); -v_msg_create_network_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, create_network_request}, X, Path). - --compile({nowarn_unused_function,v_msg_delete_network_request/3}). --dialyzer({nowarn_function,v_msg_delete_network_request/3}). -v_msg_delete_network_request(#{} = M, Path, TrUserData) -> - case M of - #{uuid := F1} -> v_type_string(F1, [uuid | Path], TrUserData); - _ -> ok - end, - case M of - #{host := F2} -> v_type_string(F2, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (uuid) -> ok; - (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_delete_network_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), delete_network_request}, M, Path); -v_msg_delete_network_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, delete_network_request}, X, Path). - --compile({nowarn_unused_function,v_msg_get_volume_request/3}). --dialyzer({nowarn_function,v_msg_get_volume_request/3}). -v_msg_get_volume_request(#{} = M, Path, TrUserData) -> - case M of - #{uuid := F1} -> v_type_string(F1, [uuid | Path], TrUserData); - _ -> ok - end, - case M of - #{host := F2} -> v_type_string(F2, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (uuid) -> ok; - (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_get_volume_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), get_volume_request}, M, Path); -v_msg_get_volume_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, get_volume_request}, X, Path). - --compile({nowarn_unused_function,v_msg_volume/3}). --dialyzer({nowarn_function,v_msg_volume/3}). -v_msg_volume(#{} = M, Path, TrUserData) -> - case M of - #{id := F1} -> v_type_string(F1, [id | Path], TrUserData); - _ -> ok - end, - case M of - #{name := F2} -> v_type_string(F2, [name | Path], TrUserData); - _ -> ok - end, - case M of - #{size := F3} -> v_type_uint64(F3, [size | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (id) -> ok; - (name) -> ok; - (size) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_volume(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), volume}, M, Path); -v_msg_volume(X, Path, _TrUserData) -> mk_type_error({expected_msg, volume}, X, Path). - --compile({nowarn_unused_function,v_msg_list_volumes_request/3}). --dialyzer({nowarn_function,v_msg_list_volumes_request/3}). -v_msg_list_volumes_request(#{} = M, Path, TrUserData) -> - case M of - #{host := F1} -> v_type_string(F1, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_volumes_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_volumes_request}, M, Path); -v_msg_list_volumes_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_volumes_request}, X, Path). - --compile({nowarn_unused_function,v_msg_list_volumes_response/3}). --dialyzer({nowarn_function,v_msg_list_volumes_response/3}). -v_msg_list_volumes_response(#{} = M, Path, TrUserData) -> - case M of - #{volumes := F1} -> - if is_list(F1) -> - _ = [v_msg_volume(Elem, [volumes | Path], TrUserData) || Elem <- F1], - ok; - true -> mk_type_error({invalid_list_of, {msg, volume}}, F1, [volumes | Path]) - end; - _ -> ok - end, - lists:foreach(fun (volumes) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_volumes_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_volumes_response}, M, Path); -v_msg_list_volumes_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_volumes_response}, X, Path). - --compile({nowarn_unused_function,v_msg_create_volume_request/3}). --dialyzer({nowarn_function,v_msg_create_volume_request/3}). -v_msg_create_volume_request(#{} = M, Path, TrUserData) -> - case M of - #{volume := F1} -> v_msg_volume(F1, [volume | Path], TrUserData); - _ -> ok - end, - case M of - #{host := F2} -> v_type_string(F2, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (volume) -> ok; - (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_create_volume_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), create_volume_request}, M, Path); -v_msg_create_volume_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, create_volume_request}, X, Path). - --compile({nowarn_unused_function,v_msg_update_volume_request/3}). --dialyzer({nowarn_function,v_msg_update_volume_request/3}). -v_msg_update_volume_request(#{} = M, Path, TrUserData) -> - case M of - #{host := F1} -> v_type_string(F1, [host | Path], TrUserData); - _ -> ok - end, - case M of - #{volume := F2} -> v_msg_volume(F2, [volume | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (host) -> ok; - (volume) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_update_volume_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), update_volume_request}, M, Path); -v_msg_update_volume_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, update_volume_request}, X, Path). - --compile({nowarn_unused_function,v_msg_delete_volume_request/3}). --dialyzer({nowarn_function,v_msg_delete_volume_request/3}). -v_msg_delete_volume_request(#{} = M, Path, TrUserData) -> - case M of - #{uuid := F1} -> v_type_string(F1, [uuid | Path], TrUserData); - _ -> ok - end, - case M of - #{host := F2} -> v_type_string(F2, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (uuid) -> ok; - (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_delete_volume_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), delete_volume_request}, M, Path); -v_msg_delete_volume_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, delete_volume_request}, X, Path). - --compile({nowarn_unused_function,v_msg_volume_attachment_identifier/3}). --dialyzer({nowarn_function,v_msg_volume_attachment_identifier/3}). -v_msg_volume_attachment_identifier(#{} = M, Path, TrUserData) -> - case M of - #{domain_id := F1} -> v_type_string(F1, [domain_id | Path], TrUserData); - _ -> ok - end, - case M of - #{volume_id := F2} -> v_type_string(F2, [volume_id | Path], TrUserData); - _ -> ok - end, - case M of - #{host := F3} -> v_type_string(F3, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (domain_id) -> ok; - (volume_id) -> ok; - (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_volume_attachment_identifier(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), volume_attachment_identifier}, M, Path); -v_msg_volume_attachment_identifier(X, Path, _TrUserData) -> mk_type_error({expected_msg, volume_attachment_identifier}, X, Path). - --compile({nowarn_unused_function,v_msg_volume_attachment/3}). --dialyzer({nowarn_function,v_msg_volume_attachment/3}). -v_msg_volume_attachment(#{} = M, Path, TrUserData) -> - case M of - #{domain_id := F1} -> v_type_string(F1, [domain_id | Path], TrUserData); - _ -> ok - end, - case M of - #{volume_id := F2} -> v_type_string(F2, [volume_id | Path], TrUserData); - _ -> ok - end, - case M of - #{disk_address := F3} -> v_type_string(F3, [disk_address | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (domain_id) -> ok; - (volume_id) -> ok; - (disk_address) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_volume_attachment(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), volume_attachment}, M, Path); -v_msg_volume_attachment(X, Path, _TrUserData) -> mk_type_error({expected_msg, volume_attachment}, X, Path). - --compile({nowarn_unused_function,v_msg_list_volume_attachments_request/3}). --dialyzer({nowarn_function,v_msg_list_volume_attachments_request/3}). -v_msg_list_volume_attachments_request(#{} = M, Path, TrUserData) -> - case M of - #{domain_id := F1} -> v_type_string(F1, [domain_id | Path], TrUserData); - _ -> ok - end, - case M of - #{host := F2} -> v_type_string(F2, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (domain_id) -> ok; - (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_volume_attachments_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_volume_attachments_request}, M, Path); -v_msg_list_volume_attachments_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_volume_attachments_request}, X, Path). - --compile({nowarn_unused_function,v_msg_list_volume_attachments_response/3}). --dialyzer({nowarn_function,v_msg_list_volume_attachments_response/3}). -v_msg_list_volume_attachments_response(#{} = M, Path, TrUserData) -> - case M of - #{attachments := F1} -> - if is_list(F1) -> - _ = [v_msg_volume_attachment(Elem, [attachments | Path], TrUserData) || Elem <- F1], - ok; - true -> mk_type_error({invalid_list_of, {msg, volume_attachment}}, F1, [attachments | Path]) - end; - _ -> ok - end, - lists:foreach(fun (attachments) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_volume_attachments_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_volume_attachments_response}, M, Path); -v_msg_list_volume_attachments_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_volume_attachments_response}, X, Path). - --compile({nowarn_unused_function,v_msg_port_forwarding_identifier/3}). --dialyzer({nowarn_function,v_msg_port_forwarding_identifier/3}). -v_msg_port_forwarding_identifier(#{} = M, Path, TrUserData) -> - case M of - #{host := F1} -> v_type_string(F1, [host | Path], TrUserData); - _ -> ok - end, - case M of - #{protocol := F2} -> v_type_string(F2, [protocol | Path], TrUserData); - _ -> ok - end, - case M of - #{source_port := F3} -> v_type_uint32(F3, [source_port | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (host) -> ok; - (protocol) -> ok; - (source_port) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_port_forwarding_identifier(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), port_forwarding_identifier}, M, Path); -v_msg_port_forwarding_identifier(X, Path, _TrUserData) -> mk_type_error({expected_msg, port_forwarding_identifier}, X, Path). - --compile({nowarn_unused_function,v_msg_port_forwarding/3}). --dialyzer({nowarn_function,v_msg_port_forwarding/3}). -v_msg_port_forwarding(#{} = M, Path, TrUserData) -> - case M of - #{protocol := F1} -> v_type_string(F1, [protocol | Path], TrUserData); - _ -> ok - end, - case M of - #{source_port := F2} -> v_type_uint32(F2, [source_port | Path], TrUserData); - _ -> ok - end, - case M of - #{target_ip := F3} -> v_type_string(F3, [target_ip | Path], TrUserData); - _ -> ok - end, - case M of - #{target_port := F4} -> v_type_uint32(F4, [target_port | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (protocol) -> ok; - (source_port) -> ok; - (target_ip) -> ok; - (target_port) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_port_forwarding(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), port_forwarding}, M, Path); -v_msg_port_forwarding(X, Path, _TrUserData) -> mk_type_error({expected_msg, port_forwarding}, X, Path). - --compile({nowarn_unused_function,v_msg_list_port_forwardings_request/3}). --dialyzer({nowarn_function,v_msg_list_port_forwardings_request/3}). -v_msg_list_port_forwardings_request(#{} = M, Path, TrUserData) -> - case M of - #{host := F1} -> v_type_string(F1, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_port_forwardings_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_port_forwardings_request}, M, Path); -v_msg_list_port_forwardings_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_port_forwardings_request}, X, Path). - --compile({nowarn_unused_function,v_msg_list_port_forwardings_response/3}). --dialyzer({nowarn_function,v_msg_list_port_forwardings_response/3}). -v_msg_list_port_forwardings_response(#{} = M, Path, TrUserData) -> - case M of - #{port_forwardings := F1} -> - if is_list(F1) -> - _ = [v_msg_port_forwarding(Elem, [port_forwardings | Path], TrUserData) || Elem <- F1], - ok; - true -> mk_type_error({invalid_list_of, {msg, port_forwarding}}, F1, [port_forwardings | Path]) - end; - _ -> ok - end, - lists:foreach(fun (port_forwardings) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_port_forwardings_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_port_forwardings_response}, M, Path); -v_msg_list_port_forwardings_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_port_forwardings_response}, X, Path). - --compile({nowarn_unused_function,v_msg_put_port_forwarding_request/3}). --dialyzer({nowarn_function,v_msg_put_port_forwarding_request/3}). -v_msg_put_port_forwarding_request(#{} = M, Path, TrUserData) -> - case M of - #{port_forwarding := F1} -> v_msg_port_forwarding(F1, [port_forwarding | Path], TrUserData); - _ -> ok - end, - case M of - #{host := F2} -> v_type_string(F2, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (port_forwarding) -> ok; - (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_put_port_forwarding_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), put_port_forwarding_request}, M, Path); -v_msg_put_port_forwarding_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, put_port_forwarding_request}, X, Path). - --compile({nowarn_unused_function,v_msg_dns_record_identifier/3}). --dialyzer({nowarn_function,v_msg_dns_record_identifier/3}). -v_msg_dns_record_identifier(#{} = M, Path, TrUserData) -> - case M of - #{name := F1} -> v_type_string(F1, [name | Path], TrUserData); - _ -> ok - end, - case M of - #{type := F2} -> v_type_string(F2, [type | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (name) -> ok; - (type) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_dns_record_identifier(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), dns_record_identifier}, M, Path); -v_msg_dns_record_identifier(X, Path, _TrUserData) -> mk_type_error({expected_msg, dns_record_identifier}, X, Path). - --compile({nowarn_unused_function,v_msg_dns_record/3}). --dialyzer({nowarn_function,v_msg_dns_record/3}). -v_msg_dns_record(#{} = M, Path, TrUserData) -> - case M of - #{name := F1} -> v_type_string(F1, [name | Path], TrUserData); - _ -> ok - end, - case M of - #{type := F2} -> v_type_string(F2, [type | Path], TrUserData); - _ -> ok - end, - case M of - #{ttl := F3} -> v_type_uint64(F3, [ttl | Path], TrUserData); - _ -> ok - end, - case M of - #{records := F4} -> - if is_list(F4) -> - _ = [v_type_string(Elem, [records | Path], TrUserData) || Elem <- F4], - ok; - true -> mk_type_error({invalid_list_of, string}, F4, [records | Path]) - end; - _ -> ok - end, - lists:foreach(fun (name) -> ok; - (type) -> ok; - (ttl) -> ok; - (records) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_dns_record(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), dns_record}, M, Path); -v_msg_dns_record(X, Path, _TrUserData) -> mk_type_error({expected_msg, dns_record}, X, Path). - --compile({nowarn_unused_function,v_msg_list_dns_records_request/3}). --dialyzer({nowarn_function,v_msg_list_dns_records_request/3}). -v_msg_list_dns_records_request(#{} = M, Path, _) -> - lists:foreach(fun (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) end, maps:keys(M)), - ok; -v_msg_list_dns_records_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_dns_records_request}, M, Path); -v_msg_list_dns_records_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_dns_records_request}, X, Path). - --compile({nowarn_unused_function,v_msg_list_dns_records_response/3}). --dialyzer({nowarn_function,v_msg_list_dns_records_response/3}). -v_msg_list_dns_records_response(#{} = M, Path, TrUserData) -> - case M of - #{dns_records := F1} -> - if is_list(F1) -> - _ = [v_msg_dns_record(Elem, [dns_records | Path], TrUserData) || Elem <- F1], - ok; - true -> mk_type_error({invalid_list_of, {msg, dns_record}}, F1, [dns_records | Path]) - end; - _ -> ok - end, - lists:foreach(fun (dns_records) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_dns_records_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_dns_records_response}, M, Path); -v_msg_list_dns_records_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_dns_records_response}, X, Path). - --compile({nowarn_unused_function,v_msg_put_dns_record_request/3}). --dialyzer({nowarn_function,v_msg_put_dns_record_request/3}). -v_msg_put_dns_record_request(#{} = M, Path, TrUserData) -> - case M of - #{dns_record := F1} -> v_msg_dns_record(F1, [dns_record | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (dns_record) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_put_dns_record_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), put_dns_record_request}, M, Path); -v_msg_put_dns_record_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, put_dns_record_request}, X, Path). - --compile({nowarn_unused_function,v_msg_route_table/3}). --dialyzer({nowarn_function,v_msg_route_table/3}). -v_msg_route_table(#{} = M, Path, TrUserData) -> - case M of - #{network_name := F1} -> v_type_string(F1, [network_name | Path], TrUserData); - _ -> ok - end, - case M of - #{id := F2} -> v_type_uint32(F2, [id | Path], TrUserData); - _ -> ok - end, - case M of - #{name := F3} -> v_type_string(F3, [name | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (network_name) -> ok; - (id) -> ok; - (name) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_route_table(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), route_table}, M, Path); -v_msg_route_table(X, Path, _TrUserData) -> mk_type_error({expected_msg, route_table}, X, Path). - --compile({nowarn_unused_function,v_msg_route_table_identifier/3}). --dialyzer({nowarn_function,v_msg_route_table_identifier/3}). -v_msg_route_table_identifier(#{} = M, Path, TrUserData) -> - case M of - #{id := F1} -> v_type_uint32(F1, [id | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (id) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_route_table_identifier(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), route_table_identifier}, M, Path); -v_msg_route_table_identifier(X, Path, _TrUserData) -> mk_type_error({expected_msg, route_table_identifier}, X, Path). - --compile({nowarn_unused_function,v_msg_list_route_tables_request/3}). --dialyzer({nowarn_function,v_msg_list_route_tables_request/3}). -v_msg_list_route_tables_request(#{} = M, Path, TrUserData) -> - case M of - #{network_name := F1} -> v_type_string(F1, [network_name | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (network_name) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_route_tables_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_route_tables_request}, M, Path); -v_msg_list_route_tables_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_route_tables_request}, X, Path). - --compile({nowarn_unused_function,v_msg_list_route_tables_response/3}). --dialyzer({nowarn_function,v_msg_list_route_tables_response/3}). -v_msg_list_route_tables_response(#{} = M, Path, TrUserData) -> - case M of - #{route_tables := F1} -> - if is_list(F1) -> - _ = [v_msg_route_table(Elem, [route_tables | Path], TrUserData) || Elem <- F1], - ok; - true -> mk_type_error({invalid_list_of, {msg, route_table}}, F1, [route_tables | Path]) - end; - _ -> ok - end, - lists:foreach(fun (route_tables) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_route_tables_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_route_tables_response}, M, Path); -v_msg_list_route_tables_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_route_tables_response}, X, Path). - --compile({nowarn_unused_function,v_msg_create_route_table_request/3}). --dialyzer({nowarn_function,v_msg_create_route_table_request/3}). -v_msg_create_route_table_request(#{} = M, Path, TrUserData) -> - case M of - #{route_table := F1} -> v_msg_route_table(F1, [route_table | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (route_table) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_create_route_table_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), create_route_table_request}, M, Path); -v_msg_create_route_table_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, create_route_table_request}, X, Path). - --compile({nowarn_unused_function,v_msg_route_identifier/3}). --dialyzer({nowarn_function,v_msg_route_identifier/3}). -v_msg_route_identifier(#{} = M, Path, TrUserData) -> - case M of - #{route_table_id := F1} -> v_type_uint32(F1, [route_table_id | Path], TrUserData); - _ -> ok - end, - case M of - #{destination := F2} -> v_type_string(F2, [destination | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (route_table_id) -> ok; - (destination) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_route_identifier(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), route_identifier}, M, Path); -v_msg_route_identifier(X, Path, _TrUserData) -> mk_type_error({expected_msg, route_identifier}, X, Path). - --compile({nowarn_unused_function,v_msg_route/3}). --dialyzer({nowarn_function,v_msg_route/3}). -v_msg_route(#{} = M, Path, TrUserData) -> - case M of - #{route_table_id := F1} -> v_type_uint32(F1, [route_table_id | Path], TrUserData); - _ -> ok - end, - case M of - #{destination := F2} -> v_type_string(F2, [destination | Path], TrUserData); - _ -> ok - end, - case M of - #{gateways := F3} -> - if is_list(F3) -> - _ = [v_type_string(Elem, [gateways | Path], TrUserData) || Elem <- F3], - ok; - true -> mk_type_error({invalid_list_of, string}, F3, [gateways | Path]) - end; - _ -> ok - end, - lists:foreach(fun (route_table_id) -> ok; - (destination) -> ok; - (gateways) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_route(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), route}, M, Path); -v_msg_route(X, Path, _TrUserData) -> mk_type_error({expected_msg, route}, X, Path). - --compile({nowarn_unused_function,v_msg_list_routes_request/3}). --dialyzer({nowarn_function,v_msg_list_routes_request/3}). -v_msg_list_routes_request(#{} = M, Path, TrUserData) -> - case M of - #{route_table_id := F1} -> v_type_uint32(F1, [route_table_id | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (route_table_id) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_routes_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_routes_request}, M, Path); -v_msg_list_routes_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_routes_request}, X, Path). - --compile({nowarn_unused_function,v_msg_list_routes_response/3}). --dialyzer({nowarn_function,v_msg_list_routes_response/3}). -v_msg_list_routes_response(#{} = M, Path, TrUserData) -> - case M of - #{routes := F1} -> - if is_list(F1) -> - _ = [v_msg_route(Elem, [routes | Path], TrUserData) || Elem <- F1], - ok; - true -> mk_type_error({invalid_list_of, {msg, route}}, F1, [routes | Path]) - end; - _ -> ok - end, - lists:foreach(fun (routes) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_routes_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_routes_response}, M, Path); -v_msg_list_routes_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_routes_response}, X, Path). - --compile({nowarn_unused_function,v_msg_put_route_request/3}). --dialyzer({nowarn_function,v_msg_put_route_request/3}). -v_msg_put_route_request(#{} = M, Path, TrUserData) -> - case M of - #{route := F1} -> v_msg_route(F1, [route | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (route) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_put_route_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), put_route_request}, M, Path); -v_msg_put_route_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, put_route_request}, X, Path). - --compile({nowarn_unused_function,v_msg_sync_request/3}). --dialyzer({nowarn_function,v_msg_sync_request/3}). -v_msg_sync_request(#{} = M, Path, _) -> - lists:foreach(fun (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) end, maps:keys(M)), - ok; -v_msg_sync_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), sync_request}, M, Path); -v_msg_sync_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, sync_request}, X, Path). - --compile({nowarn_unused_function,v_msg_timestamp/3}). --dialyzer({nowarn_function,v_msg_timestamp/3}). -v_msg_timestamp(#{} = M, Path, TrUserData) -> - case M of - #{seconds := F1} -> v_type_int64(F1, [seconds | Path], TrUserData); - _ -> ok - end, - case M of - #{nanos := F2} -> v_type_int32(F2, [nanos | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (seconds) -> ok; - (nanos) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_timestamp(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), timestamp}, M, Path); -v_msg_timestamp(X, Path, _TrUserData) -> mk_type_error({expected_msg, timestamp}, X, Path). - --compile({nowarn_unused_function,v_type_int32/3}). --dialyzer({nowarn_function,v_type_int32/3}). -v_type_int32(N, _Path, _TrUserData) when -2147483648 =< N, N =< 2147483647 -> ok; -v_type_int32(N, Path, _TrUserData) when is_integer(N) -> mk_type_error({value_out_of_range, int32, signed, 32}, N, Path); -v_type_int32(X, Path, _TrUserData) -> mk_type_error({bad_integer, int32, signed, 32}, X, Path). - --compile({nowarn_unused_function,v_type_int64/3}). --dialyzer({nowarn_function,v_type_int64/3}). -v_type_int64(N, _Path, _TrUserData) when -9223372036854775808 =< N, N =< 9223372036854775807 -> ok; -v_type_int64(N, Path, _TrUserData) when is_integer(N) -> mk_type_error({value_out_of_range, int64, signed, 64}, N, Path); -v_type_int64(X, Path, _TrUserData) -> mk_type_error({bad_integer, int64, signed, 64}, X, Path). - --compile({nowarn_unused_function,v_type_uint32/3}). --dialyzer({nowarn_function,v_type_uint32/3}). -v_type_uint32(N, _Path, _TrUserData) when 0 =< N, N =< 4294967295 -> ok; -v_type_uint32(N, Path, _TrUserData) when is_integer(N) -> mk_type_error({value_out_of_range, uint32, unsigned, 32}, N, Path); -v_type_uint32(X, Path, _TrUserData) -> mk_type_error({bad_integer, uint32, unsigned, 32}, X, Path). - --compile({nowarn_unused_function,v_type_uint64/3}). --dialyzer({nowarn_function,v_type_uint64/3}). -v_type_uint64(N, _Path, _TrUserData) when 0 =< N, N =< 18446744073709551615 -> ok; -v_type_uint64(N, Path, _TrUserData) when is_integer(N) -> mk_type_error({value_out_of_range, uint64, unsigned, 64}, N, Path); -v_type_uint64(X, Path, _TrUserData) -> mk_type_error({bad_integer, uint64, unsigned, 64}, X, Path). - --compile({nowarn_unused_function,v_type_bool/3}). --dialyzer({nowarn_function,v_type_bool/3}). -v_type_bool(false, _Path, _TrUserData) -> ok; -v_type_bool(true, _Path, _TrUserData) -> ok; -v_type_bool(0, _Path, _TrUserData) -> ok; -v_type_bool(1, _Path, _TrUserData) -> ok; -v_type_bool(X, Path, _TrUserData) -> mk_type_error(bad_boolean_value, X, Path). - --compile({nowarn_unused_function,v_type_string/3}). --dialyzer({nowarn_function,v_type_string/3}). -v_type_string(S, Path, _TrUserData) when is_list(S); is_binary(S) -> - try unicode:characters_to_binary(S) of - B when is_binary(B) -> ok; - {error, _, _} -> mk_type_error(bad_unicode_string, S, Path) - catch - error:badarg -> mk_type_error(bad_unicode_string, S, Path) - end; -v_type_string(X, Path, _TrUserData) -> mk_type_error(bad_unicode_string, X, Path). - --compile({nowarn_unused_function,v_type_bytes/3}). --dialyzer({nowarn_function,v_type_bytes/3}). -v_type_bytes(B, _Path, _TrUserData) when is_binary(B) -> ok; -v_type_bytes(B, _Path, _TrUserData) when is_list(B) -> ok; -v_type_bytes(X, Path, _TrUserData) -> mk_type_error(bad_binary_value, X, Path). - --compile({nowarn_unused_function,mk_type_error/3}). --spec mk_type_error(_, _, list()) -> no_return(). -mk_type_error(Error, ValueSeen, Path) -> - Path2 = prettify_path(Path), - erlang:error({gpb_type_error, {Error, [{value, ValueSeen}, {path, Path2}]}}). - - --compile({nowarn_unused_function,prettify_path/1}). --dialyzer({nowarn_function,prettify_path/1}). -prettify_path([]) -> top_level; -prettify_path(PathR) -> lists:append(lists:join(".", lists:map(fun atom_to_list/1, lists:reverse(PathR)))). - - --compile({nowarn_unused_function,id/2}). --compile({inline,id/2}). -id(X, _TrUserData) -> X. - --compile({nowarn_unused_function,v_ok/3}). --compile({inline,v_ok/3}). -v_ok(_Value, _Path, _TrUserData) -> ok. - --compile({nowarn_unused_function,m_overwrite/3}). --compile({inline,m_overwrite/3}). -m_overwrite(_Prev, New, _TrUserData) -> New. - --compile({nowarn_unused_function,cons/3}). --compile({inline,cons/3}). -cons(Elem, Acc, _TrUserData) -> [Elem | Acc]. - --compile({nowarn_unused_function,lists_reverse/2}). --compile({inline,lists_reverse/2}). -'lists_reverse'(L, _TrUserData) -> lists:reverse(L). --compile({nowarn_unused_function,'erlang_++'/3}). --compile({inline,'erlang_++'/3}). -'erlang_++'(A, B, _TrUserData) -> A ++ B. - - -get_msg_defs() -> - [{{msg, empty}, []}, - {{msg, sync_routes_request}, []}, - {{msg, start_domain_request}, [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => uuid, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, stop_domain_request}, - [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => uuid, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => force, fnum => 3, rnum => 4, type => bool, occurrence => optional, opts => []}]}, - {{msg, get_domain_request}, [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, domain}, - [#{name => id, fnum => 1, rnum => 2, type => uint64, occurrence => optional, opts => []}, - #{name => uuid, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => name, fnum => 3, rnum => 4, type => string, occurrence => optional, opts => []}, - #{name => vcpu, fnum => 4, rnum => 5, type => uint32, occurrence => optional, opts => []}, - #{name => memory, fnum => 5, rnum => 6, type => uint64, occurrence => optional, opts => []}, - #{name => network, fnum => 6, rnum => 7, type => string, occurrence => optional, opts => []}, - #{name => bridge, fnum => 7, rnum => 8, type => string, occurrence => optional, opts => []}, - #{name => state, fnum => 8, rnum => 9, type => string, occurrence => optional, opts => []}, - #{name => private_ip, fnum => 9, rnum => 10, type => string, occurrence => optional, opts => []}, - #{name => ipv6_address, fnum => 15, rnum => 11, type => string, occurrence => optional, opts => []}, - #{name => user_data, fnum => 10, rnum => 12, type => string, occurrence => optional, opts => []}, - #{name => nested_virtualization, fnum => 11, rnum => 13, type => bool, occurrence => optional, opts => []}, - #{name => base_image, fnum => 12, rnum => 14, type => string, occurrence => optional, opts => []}, - #{name => created_at, fnum => 13, rnum => 15, type => {msg, timestamp}, occurrence => optional, opts => []}, - #{name => os_type, fnum => 14, rnum => 16, type => string, occurrence => optional, opts => []}]}, - {{msg, list_domains_request}, [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]}, - {{msg, list_domains_response}, [#{name => domains, fnum => 1, rnum => 2, type => {msg, domain}, occurrence => repeated, opts => []}]}, - {{msg, create_domain_request}, [#{name => domain, fnum => 1, rnum => 2, type => {msg, domain}, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, delete_domain_request}, [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, download_image_request}, [#{name => domain_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, image_chunk}, [#{name => bytes, fnum => 1, rnum => 2, type => bytes, occurrence => optional, opts => []}]}, - {{msg, get_network_request}, [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, network}, - [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => name, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => cidr, fnum => 3, rnum => 4, type => string, occurrence => optional, opts => []}, - #{name => cidr6, fnum => 4, rnum => 5, type => string, occurrence => optional, opts => []}]}, - {{msg, list_networks_request}, [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]}, - {{msg, list_networks_response}, [#{name => networks, fnum => 1, rnum => 2, type => {msg, network}, occurrence => repeated, opts => []}]}, - {{msg, create_network_request}, [#{name => network, fnum => 1, rnum => 2, type => {msg, network}, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, delete_network_request}, [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, get_volume_request}, [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, volume}, - [#{name => id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => name, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => size, fnum => 3, rnum => 4, type => uint64, occurrence => optional, opts => []}]}, - {{msg, list_volumes_request}, [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]}, - {{msg, list_volumes_response}, [#{name => volumes, fnum => 1, rnum => 2, type => {msg, volume}, occurrence => repeated, opts => []}]}, - {{msg, create_volume_request}, [#{name => volume, fnum => 1, rnum => 2, type => {msg, volume}, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, update_volume_request}, [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => volume, fnum => 2, rnum => 3, type => {msg, volume}, occurrence => optional, opts => []}]}, - {{msg, delete_volume_request}, [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, volume_attachment_identifier}, - [#{name => domain_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => volume_id, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => host, fnum => 3, rnum => 4, type => string, occurrence => optional, opts => []}]}, - {{msg, volume_attachment}, - [#{name => domain_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => volume_id, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => disk_address, fnum => 3, rnum => 4, type => string, occurrence => optional, opts => []}]}, - {{msg, list_volume_attachments_request}, [#{name => domain_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, list_volume_attachments_response}, [#{name => attachments, fnum => 1, rnum => 2, type => {msg, volume_attachment}, occurrence => repeated, opts => []}]}, - {{msg, port_forwarding_identifier}, - [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => protocol, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => source_port, fnum => 3, rnum => 4, type => uint32, occurrence => optional, opts => []}]}, - {{msg, port_forwarding}, - [#{name => protocol, fnum => 2, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => source_port, fnum => 3, rnum => 3, type => uint32, occurrence => optional, opts => []}, - #{name => target_ip, fnum => 4, rnum => 4, type => string, occurrence => optional, opts => []}, - #{name => target_port, fnum => 5, rnum => 5, type => uint32, occurrence => optional, opts => []}]}, - {{msg, list_port_forwardings_request}, [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]}, - {{msg, list_port_forwardings_response}, [#{name => port_forwardings, fnum => 1, rnum => 2, type => {msg, port_forwarding}, occurrence => repeated, opts => []}]}, - {{msg, put_port_forwarding_request}, [#{name => port_forwarding, fnum => 1, rnum => 2, type => {msg, port_forwarding}, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, dns_record_identifier}, [#{name => name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => type, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, dns_record}, - [#{name => name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => type, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => ttl, fnum => 3, rnum => 4, type => uint64, occurrence => optional, opts => []}, - #{name => records, fnum => 4, rnum => 5, type => string, occurrence => repeated, opts => []}]}, - {{msg, list_dns_records_request}, []}, - {{msg, list_dns_records_response}, [#{name => dns_records, fnum => 1, rnum => 2, type => {msg, dns_record}, occurrence => repeated, opts => []}]}, - {{msg, put_dns_record_request}, [#{name => dns_record, fnum => 1, rnum => 2, type => {msg, dns_record}, occurrence => optional, opts => []}]}, - {{msg, route_table}, - [#{name => network_name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => id, fnum => 2, rnum => 3, type => uint32, occurrence => optional, opts => []}, - #{name => name, fnum => 3, rnum => 4, type => string, occurrence => optional, opts => []}]}, - {{msg, route_table_identifier}, [#{name => id, fnum => 1, rnum => 2, type => uint32, occurrence => optional, opts => []}]}, - {{msg, list_route_tables_request}, [#{name => network_name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]}, - {{msg, list_route_tables_response}, [#{name => route_tables, fnum => 1, rnum => 2, type => {msg, route_table}, occurrence => repeated, opts => []}]}, - {{msg, create_route_table_request}, [#{name => route_table, fnum => 1, rnum => 2, type => {msg, route_table}, occurrence => optional, opts => []}]}, - {{msg, route_identifier}, [#{name => route_table_id, fnum => 1, rnum => 2, type => uint32, occurrence => optional, opts => []}, #{name => destination, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, route}, - [#{name => route_table_id, fnum => 1, rnum => 2, type => uint32, occurrence => optional, opts => []}, - #{name => destination, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => gateways, fnum => 3, rnum => 4, type => string, occurrence => repeated, opts => []}]}, - {{msg, list_routes_request}, [#{name => route_table_id, fnum => 1, rnum => 2, type => uint32, occurrence => optional, opts => []}]}, - {{msg, list_routes_response}, [#{name => routes, fnum => 1, rnum => 2, type => {msg, route}, occurrence => repeated, opts => []}]}, - {{msg, put_route_request}, [#{name => route, fnum => 1, rnum => 2, type => {msg, route}, occurrence => optional, opts => []}]}, - {{msg, sync_request}, []}, - {{msg, timestamp}, [#{name => seconds, fnum => 1, rnum => 2, type => int64, occurrence => optional, opts => []}, #{name => nanos, fnum => 2, rnum => 3, type => int32, occurrence => optional, opts => []}]}]. - - -get_msg_names() -> - [empty, - sync_routes_request, - start_domain_request, - stop_domain_request, - get_domain_request, - domain, - list_domains_request, - list_domains_response, - create_domain_request, - delete_domain_request, - download_image_request, - image_chunk, - get_network_request, - network, - list_networks_request, - list_networks_response, - create_network_request, - delete_network_request, - get_volume_request, - volume, - list_volumes_request, - list_volumes_response, - create_volume_request, - update_volume_request, - delete_volume_request, - volume_attachment_identifier, - volume_attachment, - list_volume_attachments_request, - list_volume_attachments_response, - port_forwarding_identifier, - port_forwarding, - list_port_forwardings_request, - list_port_forwardings_response, - put_port_forwarding_request, - dns_record_identifier, - dns_record, - list_dns_records_request, - list_dns_records_response, - put_dns_record_request, - route_table, - route_table_identifier, - list_route_tables_request, - list_route_tables_response, - create_route_table_request, - route_identifier, - route, - list_routes_request, - list_routes_response, - put_route_request, - sync_request, - timestamp]. - - -get_group_names() -> []. - - -get_msg_or_group_names() -> - [empty, - sync_routes_request, - start_domain_request, - stop_domain_request, - get_domain_request, - domain, - list_domains_request, - list_domains_response, - create_domain_request, - delete_domain_request, - download_image_request, - image_chunk, - get_network_request, - network, - list_networks_request, - list_networks_response, - create_network_request, - delete_network_request, - get_volume_request, - volume, - list_volumes_request, - list_volumes_response, - create_volume_request, - update_volume_request, - delete_volume_request, - volume_attachment_identifier, - volume_attachment, - list_volume_attachments_request, - list_volume_attachments_response, - port_forwarding_identifier, - port_forwarding, - list_port_forwardings_request, - list_port_forwardings_response, - put_port_forwarding_request, - dns_record_identifier, - dns_record, - list_dns_records_request, - list_dns_records_response, - put_dns_record_request, - route_table, - route_table_identifier, - list_route_tables_request, - list_route_tables_response, - create_route_table_request, - route_identifier, - route, - list_routes_request, - list_routes_response, - put_route_request, - sync_request, - timestamp]. - - -get_enum_names() -> []. - - -fetch_msg_def(MsgName) -> - case find_msg_def(MsgName) of - Fs when is_list(Fs) -> Fs; - error -> erlang:error({no_such_msg, MsgName}) - end. - - --spec fetch_enum_def(_) -> no_return(). -fetch_enum_def(EnumName) -> erlang:error({no_such_enum, EnumName}). - - -find_msg_def(empty) -> []; -find_msg_def(sync_routes_request) -> []; -find_msg_def(start_domain_request) -> [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => uuid, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(stop_domain_request) -> - [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => uuid, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => force, fnum => 3, rnum => 4, type => bool, occurrence => optional, opts => []}]; -find_msg_def(get_domain_request) -> [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(domain) -> - [#{name => id, fnum => 1, rnum => 2, type => uint64, occurrence => optional, opts => []}, - #{name => uuid, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => name, fnum => 3, rnum => 4, type => string, occurrence => optional, opts => []}, - #{name => vcpu, fnum => 4, rnum => 5, type => uint32, occurrence => optional, opts => []}, - #{name => memory, fnum => 5, rnum => 6, type => uint64, occurrence => optional, opts => []}, - #{name => network, fnum => 6, rnum => 7, type => string, occurrence => optional, opts => []}, - #{name => bridge, fnum => 7, rnum => 8, type => string, occurrence => optional, opts => []}, - #{name => state, fnum => 8, rnum => 9, type => string, occurrence => optional, opts => []}, - #{name => private_ip, fnum => 9, rnum => 10, type => string, occurrence => optional, opts => []}, - #{name => ipv6_address, fnum => 15, rnum => 11, type => string, occurrence => optional, opts => []}, - #{name => user_data, fnum => 10, rnum => 12, type => string, occurrence => optional, opts => []}, - #{name => nested_virtualization, fnum => 11, rnum => 13, type => bool, occurrence => optional, opts => []}, - #{name => base_image, fnum => 12, rnum => 14, type => string, occurrence => optional, opts => []}, - #{name => created_at, fnum => 13, rnum => 15, type => {msg, timestamp}, occurrence => optional, opts => []}, - #{name => os_type, fnum => 14, rnum => 16, type => string, occurrence => optional, opts => []}]; -find_msg_def(list_domains_request) -> [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]; -find_msg_def(list_domains_response) -> [#{name => domains, fnum => 1, rnum => 2, type => {msg, domain}, occurrence => repeated, opts => []}]; -find_msg_def(create_domain_request) -> [#{name => domain, fnum => 1, rnum => 2, type => {msg, domain}, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(delete_domain_request) -> [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(download_image_request) -> [#{name => domain_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(image_chunk) -> [#{name => bytes, fnum => 1, rnum => 2, type => bytes, occurrence => optional, opts => []}]; -find_msg_def(get_network_request) -> [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(network) -> - [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => name, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => cidr, fnum => 3, rnum => 4, type => string, occurrence => optional, opts => []}, - #{name => cidr6, fnum => 4, rnum => 5, type => string, occurrence => optional, opts => []}]; -find_msg_def(list_networks_request) -> [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]; -find_msg_def(list_networks_response) -> [#{name => networks, fnum => 1, rnum => 2, type => {msg, network}, occurrence => repeated, opts => []}]; -find_msg_def(create_network_request) -> [#{name => network, fnum => 1, rnum => 2, type => {msg, network}, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(delete_network_request) -> [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(get_volume_request) -> [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(volume) -> - [#{name => id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => name, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => size, fnum => 3, rnum => 4, type => uint64, occurrence => optional, opts => []}]; -find_msg_def(list_volumes_request) -> [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]; -find_msg_def(list_volumes_response) -> [#{name => volumes, fnum => 1, rnum => 2, type => {msg, volume}, occurrence => repeated, opts => []}]; -find_msg_def(create_volume_request) -> [#{name => volume, fnum => 1, rnum => 2, type => {msg, volume}, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(update_volume_request) -> [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => volume, fnum => 2, rnum => 3, type => {msg, volume}, occurrence => optional, opts => []}]; -find_msg_def(delete_volume_request) -> [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(volume_attachment_identifier) -> - [#{name => domain_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => volume_id, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => host, fnum => 3, rnum => 4, type => string, occurrence => optional, opts => []}]; -find_msg_def(volume_attachment) -> - [#{name => domain_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => volume_id, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => disk_address, fnum => 3, rnum => 4, type => string, occurrence => optional, opts => []}]; -find_msg_def(list_volume_attachments_request) -> [#{name => domain_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(list_volume_attachments_response) -> [#{name => attachments, fnum => 1, rnum => 2, type => {msg, volume_attachment}, occurrence => repeated, opts => []}]; -find_msg_def(port_forwarding_identifier) -> - [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => protocol, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => source_port, fnum => 3, rnum => 4, type => uint32, occurrence => optional, opts => []}]; -find_msg_def(port_forwarding) -> - [#{name => protocol, fnum => 2, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => source_port, fnum => 3, rnum => 3, type => uint32, occurrence => optional, opts => []}, - #{name => target_ip, fnum => 4, rnum => 4, type => string, occurrence => optional, opts => []}, - #{name => target_port, fnum => 5, rnum => 5, type => uint32, occurrence => optional, opts => []}]; -find_msg_def(list_port_forwardings_request) -> [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]; -find_msg_def(list_port_forwardings_response) -> [#{name => port_forwardings, fnum => 1, rnum => 2, type => {msg, port_forwarding}, occurrence => repeated, opts => []}]; -find_msg_def(put_port_forwarding_request) -> - [#{name => port_forwarding, fnum => 1, rnum => 2, type => {msg, port_forwarding}, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(dns_record_identifier) -> [#{name => name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => type, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(dns_record) -> - [#{name => name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => type, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => ttl, fnum => 3, rnum => 4, type => uint64, occurrence => optional, opts => []}, - #{name => records, fnum => 4, rnum => 5, type => string, occurrence => repeated, opts => []}]; -find_msg_def(list_dns_records_request) -> []; -find_msg_def(list_dns_records_response) -> [#{name => dns_records, fnum => 1, rnum => 2, type => {msg, dns_record}, occurrence => repeated, opts => []}]; -find_msg_def(put_dns_record_request) -> [#{name => dns_record, fnum => 1, rnum => 2, type => {msg, dns_record}, occurrence => optional, opts => []}]; -find_msg_def(route_table) -> - [#{name => network_name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => id, fnum => 2, rnum => 3, type => uint32, occurrence => optional, opts => []}, - #{name => name, fnum => 3, rnum => 4, type => string, occurrence => optional, opts => []}]; -find_msg_def(route_table_identifier) -> [#{name => id, fnum => 1, rnum => 2, type => uint32, occurrence => optional, opts => []}]; -find_msg_def(list_route_tables_request) -> [#{name => network_name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]; -find_msg_def(list_route_tables_response) -> [#{name => route_tables, fnum => 1, rnum => 2, type => {msg, route_table}, occurrence => repeated, opts => []}]; -find_msg_def(create_route_table_request) -> [#{name => route_table, fnum => 1, rnum => 2, type => {msg, route_table}, occurrence => optional, opts => []}]; -find_msg_def(route_identifier) -> [#{name => route_table_id, fnum => 1, rnum => 2, type => uint32, occurrence => optional, opts => []}, #{name => destination, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(route) -> - [#{name => route_table_id, fnum => 1, rnum => 2, type => uint32, occurrence => optional, opts => []}, - #{name => destination, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => gateways, fnum => 3, rnum => 4, type => string, occurrence => repeated, opts => []}]; -find_msg_def(list_routes_request) -> [#{name => route_table_id, fnum => 1, rnum => 2, type => uint32, occurrence => optional, opts => []}]; -find_msg_def(list_routes_response) -> [#{name => routes, fnum => 1, rnum => 2, type => {msg, route}, occurrence => repeated, opts => []}]; -find_msg_def(put_route_request) -> [#{name => route, fnum => 1, rnum => 2, type => {msg, route}, occurrence => optional, opts => []}]; -find_msg_def(sync_request) -> []; -find_msg_def(timestamp) -> [#{name => seconds, fnum => 1, rnum => 2, type => int64, occurrence => optional, opts => []}, #{name => nanos, fnum => 2, rnum => 3, type => int32, occurrence => optional, opts => []}]; -find_msg_def(_) -> error. - - -find_enum_def(_) -> error. - - --spec enum_symbol_by_value(_, _) -> no_return(). -enum_symbol_by_value(E, V) -> erlang:error({no_enum_defs, E, V}). - - --spec enum_value_by_symbol(_, _) -> no_return(). -enum_value_by_symbol(E, V) -> erlang:error({no_enum_defs, E, V}). - - - -get_service_names() -> ['ControllerService', 'DaemonService', 'DomainService', 'VolumeService', 'PortForwardingService', 'DNS', 'RouteService']. - - -get_service_def('ControllerService') -> - {{service, 'ControllerService'}, - [#{name => 'GetDNSRecord', input => dns_record_identifier, output => dns_record, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListDNSRecords', input => list_dns_records_request, output => list_dns_records_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'PutDNSRecord', input => put_dns_record_request, output => dns_record, input_stream => false, output_stream => false, opts => []}, - #{name => 'DeleteDNSRecord', input => dns_record_identifier, output => empty, input_stream => false, output_stream => false, opts => []}, - #{name => 'GetNetwork', input => get_network_request, output => network, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListNetworks', input => list_networks_request, output => list_networks_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'CreateNetwork', input => create_network_request, output => network, input_stream => false, output_stream => false, opts => []}, - #{name => 'DeleteNetwork', input => delete_network_request, output => empty, input_stream => false, output_stream => false, opts => []}, - #{name => 'StartDomain', input => start_domain_request, output => empty, input_stream => false, output_stream => false, opts => []}, - #{name => 'StopDomain', input => stop_domain_request, output => empty, input_stream => false, output_stream => false, opts => []}, - #{name => 'GetDomain', input => get_domain_request, output => domain, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListDomains', input => list_domains_request, output => list_domains_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'CreateDomain', input => create_domain_request, output => domain, input_stream => false, output_stream => false, opts => []}, - #{name => 'DeleteDomain', input => delete_domain_request, output => empty, input_stream => false, output_stream => false, opts => []}, - #{name => 'DownloadImage', input => download_image_request, output => image_chunk, input_stream => false, output_stream => true, opts => []}, - #{name => 'GetVolume', input => get_volume_request, output => volume, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListVolumes', input => list_volumes_request, output => list_volumes_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'CreateVolume', input => create_volume_request, output => volume, input_stream => false, output_stream => false, opts => []}, - #{name => 'UpdateVolume', input => update_volume_request, output => volume, input_stream => false, output_stream => false, opts => []}, - #{name => 'DeleteVolume', input => delete_volume_request, output => empty, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListVolumeAttachments', input => list_volume_attachments_request, output => list_volume_attachments_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'GetVolumeAttachment', input => volume_attachment_identifier, output => volume_attachment, input_stream => false, output_stream => false, opts => []}, - #{name => 'AttachVolume', input => volume_attachment_identifier, output => volume_attachment, input_stream => false, output_stream => false, opts => []}, - #{name => 'DetachVolume', input => volume_attachment_identifier, output => empty, input_stream => false, output_stream => false, opts => []}, - #{name => 'GetPortForwarding', input => port_forwarding_identifier, output => port_forwarding, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListPortForwardings', input => list_port_forwardings_request, output => list_port_forwardings_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'PutPortForwarding', input => put_port_forwarding_request, output => port_forwarding, input_stream => false, output_stream => false, opts => []}, - #{name => 'DeletePortForwarding', input => port_forwarding_identifier, output => empty, input_stream => false, output_stream => false, opts => []}, - #{name => 'GetRouteTable', input => route_table_identifier, output => route_table, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListRouteTables', input => list_route_tables_request, output => list_route_tables_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'CreateRouteTable', input => create_route_table_request, output => route_table, input_stream => false, output_stream => false, opts => []}, - #{name => 'DeleteRouteTable', input => route_table_identifier, output => empty, input_stream => false, output_stream => false, opts => []}, - #{name => 'GetRoute', input => route_identifier, output => route, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListRoutes', input => list_routes_request, output => list_routes_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'PutRoute', input => put_route_request, output => route, input_stream => false, output_stream => false, opts => []}, - #{name => 'DeleteRoute', input => route_identifier, output => empty, input_stream => false, output_stream => false, opts => []}, - #{name => 'SyncRoutes', input => sync_routes_request, output => empty, input_stream => false, output_stream => false, opts => []}]}; -get_service_def('DaemonService') -> - {{service, 'DaemonService'}, - [#{name => 'GetNetwork', input => get_network_request, output => network, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListNetworks', input => list_networks_request, output => list_networks_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'CreateNetwork', input => create_network_request, output => network, input_stream => false, output_stream => false, opts => []}, - #{name => 'DeleteNetwork', input => delete_network_request, output => empty, input_stream => false, output_stream => false, opts => []}, - #{name => 'StartDomain', input => start_domain_request, output => empty, input_stream => false, output_stream => false, opts => []}, - #{name => 'StopDomain', input => stop_domain_request, output => empty, input_stream => false, output_stream => false, opts => []}, - #{name => 'GetDomain', input => get_domain_request, output => domain, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListDomains', input => list_domains_request, output => list_domains_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'CreateDomain', input => create_domain_request, output => domain, input_stream => false, output_stream => false, opts => []}, - #{name => 'DeleteDomain', input => delete_domain_request, output => empty, input_stream => false, output_stream => false, opts => []}, - #{name => 'DownloadImage', input => download_image_request, output => image_chunk, input_stream => false, output_stream => true, opts => []}, - #{name => 'GetVolume', input => get_volume_request, output => volume, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListVolumes', input => list_volumes_request, output => list_volumes_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'CreateVolume', input => create_volume_request, output => volume, input_stream => false, output_stream => false, opts => []}, - #{name => 'UpdateVolume', input => update_volume_request, output => volume, input_stream => false, output_stream => false, opts => []}, - #{name => 'DeleteVolume', input => delete_volume_request, output => empty, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListVolumeAttachments', input => list_volume_attachments_request, output => list_volume_attachments_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'GetVolumeAttachment', input => volume_attachment_identifier, output => volume_attachment, input_stream => false, output_stream => false, opts => []}, - #{name => 'AttachVolume', input => volume_attachment_identifier, output => volume_attachment, input_stream => false, output_stream => false, opts => []}, - #{name => 'DetachVolume', input => volume_attachment_identifier, output => empty, input_stream => false, output_stream => false, opts => []}, - #{name => 'GetPortForwarding', input => port_forwarding_identifier, output => port_forwarding, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListPortForwardings', input => list_port_forwardings_request, output => list_port_forwardings_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'PutPortForwarding', input => put_port_forwarding_request, output => port_forwarding, input_stream => false, output_stream => false, opts => []}, - #{name => 'DeletePortForwarding', input => port_forwarding_identifier, output => empty, input_stream => false, output_stream => false, opts => []}, - #{name => 'SyncRoutes', input => sync_routes_request, output => empty, input_stream => false, output_stream => false, opts => []}]}; -get_service_def('DomainService') -> - {{service, 'DomainService'}, - [#{name => 'GetDomain', input => get_domain_request, output => domain, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListDomains', input => list_domains_request, output => list_domains_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'CreateDomain', input => create_domain_request, output => domain, input_stream => false, output_stream => false, opts => []}, - #{name => 'DeleteDomain', input => delete_domain_request, output => empty, input_stream => false, output_stream => false, opts => []}, - #{name => 'DownloadImage', input => download_image_request, output => image_chunk, input_stream => false, output_stream => true, opts => []}, - #{name => 'GetNetwork', input => get_network_request, output => network, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListNetworks', input => list_networks_request, output => list_networks_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'CreateNetwork', input => create_network_request, output => network, input_stream => false, output_stream => false, opts => []}, - #{name => 'DeleteNetwork', input => delete_network_request, output => empty, input_stream => false, output_stream => false, opts => []}]}; -get_service_def('VolumeService') -> - {{service, 'VolumeService'}, - [#{name => 'GetVolume', input => get_volume_request, output => volume, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListVolumes', input => list_volumes_request, output => list_volumes_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'CreateVolume', input => create_volume_request, output => volume, input_stream => false, output_stream => false, opts => []}, - #{name => 'UpdateVolume', input => update_volume_request, output => volume, input_stream => false, output_stream => false, opts => []}, - #{name => 'DeleteVolume', input => delete_volume_request, output => empty, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListVolumeAttachments', input => list_volume_attachments_request, output => list_volume_attachments_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'GetVolumeAttachment', input => volume_attachment_identifier, output => volume_attachment, input_stream => false, output_stream => false, opts => []}, - #{name => 'AttachVolume', input => volume_attachment_identifier, output => volume_attachment, input_stream => false, output_stream => false, opts => []}, - #{name => 'DetachVolume', input => volume_attachment_identifier, output => empty, input_stream => false, output_stream => false, opts => []}]}; -get_service_def('PortForwardingService') -> - {{service, 'PortForwardingService'}, - [#{name => 'GetPortForwarding', input => port_forwarding_identifier, output => port_forwarding, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListPortForwardings', input => list_port_forwardings_request, output => list_port_forwardings_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'PutPortForwarding', input => put_port_forwarding_request, output => port_forwarding, input_stream => false, output_stream => false, opts => []}, - #{name => 'DeletePortForwarding', input => port_forwarding_identifier, output => empty, input_stream => false, output_stream => false, opts => []}]}; -get_service_def('DNS') -> - {{service, 'DNS'}, - [#{name => 'GetDNSRecord', input => dns_record_identifier, output => dns_record, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListDNSRecords', input => list_dns_records_request, output => list_dns_records_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'PutDNSRecord', input => put_dns_record_request, output => dns_record, input_stream => false, output_stream => false, opts => []}, - #{name => 'DeleteDNSRecord', input => dns_record_identifier, output => empty, input_stream => false, output_stream => false, opts => []}]}; -get_service_def('RouteService') -> - {{service, 'RouteService'}, - [#{name => 'GetRouteTable', input => route_table_identifier, output => route_table, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListRouteTables', input => list_route_tables_request, output => list_route_tables_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'CreateRouteTable', input => create_route_table_request, output => route_table, input_stream => false, output_stream => false, opts => []}, - #{name => 'DeleteRouteTable', input => route_table_identifier, output => empty, input_stream => false, output_stream => false, opts => []}, - #{name => 'GetRoute', input => route_identifier, output => route, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListRoutes', input => list_routes_request, output => list_routes_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'PutRoute', input => put_route_request, output => route, input_stream => false, output_stream => false, opts => []}, - #{name => 'DeleteRoute', input => route_identifier, output => empty, input_stream => false, output_stream => false, opts => []}, - #{name => 'Sync', input => sync_request, output => empty, input_stream => false, output_stream => false, opts => []}]}; -get_service_def(_) -> error. - - -get_rpc_names('ControllerService') -> - ['GetDNSRecord', - 'ListDNSRecords', - 'PutDNSRecord', - 'DeleteDNSRecord', - 'GetNetwork', - 'ListNetworks', - 'CreateNetwork', - 'DeleteNetwork', - 'StartDomain', - 'StopDomain', - 'GetDomain', - 'ListDomains', - 'CreateDomain', - 'DeleteDomain', - 'DownloadImage', - 'GetVolume', - 'ListVolumes', - 'CreateVolume', - 'UpdateVolume', - 'DeleteVolume', - 'ListVolumeAttachments', - 'GetVolumeAttachment', - 'AttachVolume', - 'DetachVolume', - 'GetPortForwarding', - 'ListPortForwardings', - 'PutPortForwarding', - 'DeletePortForwarding', - 'GetRouteTable', - 'ListRouteTables', - 'CreateRouteTable', - 'DeleteRouteTable', - 'GetRoute', - 'ListRoutes', - 'PutRoute', - 'DeleteRoute', - 'SyncRoutes']; -get_rpc_names('DaemonService') -> - ['GetNetwork', - 'ListNetworks', - 'CreateNetwork', - 'DeleteNetwork', - 'StartDomain', - 'StopDomain', - 'GetDomain', - 'ListDomains', - 'CreateDomain', - 'DeleteDomain', - 'DownloadImage', - 'GetVolume', - 'ListVolumes', - 'CreateVolume', - 'UpdateVolume', - 'DeleteVolume', - 'ListVolumeAttachments', - 'GetVolumeAttachment', - 'AttachVolume', - 'DetachVolume', - 'GetPortForwarding', - 'ListPortForwardings', - 'PutPortForwarding', - 'DeletePortForwarding', - 'SyncRoutes']; -get_rpc_names('DomainService') -> ['GetDomain', 'ListDomains', 'CreateDomain', 'DeleteDomain', 'DownloadImage', 'GetNetwork', 'ListNetworks', 'CreateNetwork', 'DeleteNetwork']; -get_rpc_names('VolumeService') -> ['GetVolume', 'ListVolumes', 'CreateVolume', 'UpdateVolume', 'DeleteVolume', 'ListVolumeAttachments', 'GetVolumeAttachment', 'AttachVolume', 'DetachVolume']; -get_rpc_names('PortForwardingService') -> ['GetPortForwarding', 'ListPortForwardings', 'PutPortForwarding', 'DeletePortForwarding']; -get_rpc_names('DNS') -> ['GetDNSRecord', 'ListDNSRecords', 'PutDNSRecord', 'DeleteDNSRecord']; -get_rpc_names('RouteService') -> ['GetRouteTable', 'ListRouteTables', 'CreateRouteTable', 'DeleteRouteTable', 'GetRoute', 'ListRoutes', 'PutRoute', 'DeleteRoute', 'Sync']; -get_rpc_names(_) -> error. - - -find_rpc_def('ControllerService', RpcName) -> find_rpc_def_ControllerService(RpcName); -find_rpc_def('DaemonService', RpcName) -> find_rpc_def_DaemonService(RpcName); -find_rpc_def('DomainService', RpcName) -> find_rpc_def_DomainService(RpcName); -find_rpc_def('VolumeService', RpcName) -> find_rpc_def_VolumeService(RpcName); -find_rpc_def('PortForwardingService', RpcName) -> find_rpc_def_PortForwardingService(RpcName); -find_rpc_def('DNS', RpcName) -> find_rpc_def_DNS(RpcName); -find_rpc_def('RouteService', RpcName) -> find_rpc_def_RouteService(RpcName); -find_rpc_def(_, _) -> error. - - -find_rpc_def_ControllerService('GetDNSRecord') -> #{name => 'GetDNSRecord', input => dns_record_identifier, output => dns_record, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_ControllerService('ListDNSRecords') -> #{name => 'ListDNSRecords', input => list_dns_records_request, output => list_dns_records_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_ControllerService('PutDNSRecord') -> #{name => 'PutDNSRecord', input => put_dns_record_request, output => dns_record, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_ControllerService('DeleteDNSRecord') -> #{name => 'DeleteDNSRecord', input => dns_record_identifier, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_ControllerService('GetNetwork') -> #{name => 'GetNetwork', input => get_network_request, output => network, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_ControllerService('ListNetworks') -> #{name => 'ListNetworks', input => list_networks_request, output => list_networks_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_ControllerService('CreateNetwork') -> #{name => 'CreateNetwork', input => create_network_request, output => network, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_ControllerService('DeleteNetwork') -> #{name => 'DeleteNetwork', input => delete_network_request, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_ControllerService('StartDomain') -> #{name => 'StartDomain', input => start_domain_request, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_ControllerService('StopDomain') -> #{name => 'StopDomain', input => stop_domain_request, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_ControllerService('GetDomain') -> #{name => 'GetDomain', input => get_domain_request, output => domain, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_ControllerService('ListDomains') -> #{name => 'ListDomains', input => list_domains_request, output => list_domains_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_ControllerService('CreateDomain') -> #{name => 'CreateDomain', input => create_domain_request, output => domain, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_ControllerService('DeleteDomain') -> #{name => 'DeleteDomain', input => delete_domain_request, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_ControllerService('DownloadImage') -> #{name => 'DownloadImage', input => download_image_request, output => image_chunk, input_stream => false, output_stream => true, opts => []}; -find_rpc_def_ControllerService('GetVolume') -> #{name => 'GetVolume', input => get_volume_request, output => volume, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_ControllerService('ListVolumes') -> #{name => 'ListVolumes', input => list_volumes_request, output => list_volumes_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_ControllerService('CreateVolume') -> #{name => 'CreateVolume', input => create_volume_request, output => volume, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_ControllerService('UpdateVolume') -> #{name => 'UpdateVolume', input => update_volume_request, output => volume, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_ControllerService('DeleteVolume') -> #{name => 'DeleteVolume', input => delete_volume_request, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_ControllerService('ListVolumeAttachments') -> #{name => 'ListVolumeAttachments', input => list_volume_attachments_request, output => list_volume_attachments_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_ControllerService('GetVolumeAttachment') -> #{name => 'GetVolumeAttachment', input => volume_attachment_identifier, output => volume_attachment, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_ControllerService('AttachVolume') -> #{name => 'AttachVolume', input => volume_attachment_identifier, output => volume_attachment, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_ControllerService('DetachVolume') -> #{name => 'DetachVolume', input => volume_attachment_identifier, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_ControllerService('GetPortForwarding') -> #{name => 'GetPortForwarding', input => port_forwarding_identifier, output => port_forwarding, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_ControllerService('ListPortForwardings') -> #{name => 'ListPortForwardings', input => list_port_forwardings_request, output => list_port_forwardings_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_ControllerService('PutPortForwarding') -> #{name => 'PutPortForwarding', input => put_port_forwarding_request, output => port_forwarding, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_ControllerService('DeletePortForwarding') -> #{name => 'DeletePortForwarding', input => port_forwarding_identifier, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_ControllerService('GetRouteTable') -> #{name => 'GetRouteTable', input => route_table_identifier, output => route_table, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_ControllerService('ListRouteTables') -> #{name => 'ListRouteTables', input => list_route_tables_request, output => list_route_tables_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_ControllerService('CreateRouteTable') -> #{name => 'CreateRouteTable', input => create_route_table_request, output => route_table, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_ControllerService('DeleteRouteTable') -> #{name => 'DeleteRouteTable', input => route_table_identifier, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_ControllerService('GetRoute') -> #{name => 'GetRoute', input => route_identifier, output => route, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_ControllerService('ListRoutes') -> #{name => 'ListRoutes', input => list_routes_request, output => list_routes_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_ControllerService('PutRoute') -> #{name => 'PutRoute', input => put_route_request, output => route, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_ControllerService('DeleteRoute') -> #{name => 'DeleteRoute', input => route_identifier, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_ControllerService('SyncRoutes') -> #{name => 'SyncRoutes', input => sync_routes_request, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_ControllerService(_) -> error. - -find_rpc_def_DaemonService('GetNetwork') -> #{name => 'GetNetwork', input => get_network_request, output => network, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('ListNetworks') -> #{name => 'ListNetworks', input => list_networks_request, output => list_networks_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('CreateNetwork') -> #{name => 'CreateNetwork', input => create_network_request, output => network, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('DeleteNetwork') -> #{name => 'DeleteNetwork', input => delete_network_request, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('StartDomain') -> #{name => 'StartDomain', input => start_domain_request, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('StopDomain') -> #{name => 'StopDomain', input => stop_domain_request, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('GetDomain') -> #{name => 'GetDomain', input => get_domain_request, output => domain, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('ListDomains') -> #{name => 'ListDomains', input => list_domains_request, output => list_domains_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('CreateDomain') -> #{name => 'CreateDomain', input => create_domain_request, output => domain, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('DeleteDomain') -> #{name => 'DeleteDomain', input => delete_domain_request, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('DownloadImage') -> #{name => 'DownloadImage', input => download_image_request, output => image_chunk, input_stream => false, output_stream => true, opts => []}; -find_rpc_def_DaemonService('GetVolume') -> #{name => 'GetVolume', input => get_volume_request, output => volume, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('ListVolumes') -> #{name => 'ListVolumes', input => list_volumes_request, output => list_volumes_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('CreateVolume') -> #{name => 'CreateVolume', input => create_volume_request, output => volume, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('UpdateVolume') -> #{name => 'UpdateVolume', input => update_volume_request, output => volume, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('DeleteVolume') -> #{name => 'DeleteVolume', input => delete_volume_request, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('ListVolumeAttachments') -> #{name => 'ListVolumeAttachments', input => list_volume_attachments_request, output => list_volume_attachments_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('GetVolumeAttachment') -> #{name => 'GetVolumeAttachment', input => volume_attachment_identifier, output => volume_attachment, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('AttachVolume') -> #{name => 'AttachVolume', input => volume_attachment_identifier, output => volume_attachment, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('DetachVolume') -> #{name => 'DetachVolume', input => volume_attachment_identifier, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('GetPortForwarding') -> #{name => 'GetPortForwarding', input => port_forwarding_identifier, output => port_forwarding, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('ListPortForwardings') -> #{name => 'ListPortForwardings', input => list_port_forwardings_request, output => list_port_forwardings_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('PutPortForwarding') -> #{name => 'PutPortForwarding', input => put_port_forwarding_request, output => port_forwarding, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('DeletePortForwarding') -> #{name => 'DeletePortForwarding', input => port_forwarding_identifier, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('SyncRoutes') -> #{name => 'SyncRoutes', input => sync_routes_request, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService(_) -> error. - -find_rpc_def_DomainService('GetDomain') -> #{name => 'GetDomain', input => get_domain_request, output => domain, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DomainService('ListDomains') -> #{name => 'ListDomains', input => list_domains_request, output => list_domains_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DomainService('CreateDomain') -> #{name => 'CreateDomain', input => create_domain_request, output => domain, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DomainService('DeleteDomain') -> #{name => 'DeleteDomain', input => delete_domain_request, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DomainService('DownloadImage') -> #{name => 'DownloadImage', input => download_image_request, output => image_chunk, input_stream => false, output_stream => true, opts => []}; -find_rpc_def_DomainService('GetNetwork') -> #{name => 'GetNetwork', input => get_network_request, output => network, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DomainService('ListNetworks') -> #{name => 'ListNetworks', input => list_networks_request, output => list_networks_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DomainService('CreateNetwork') -> #{name => 'CreateNetwork', input => create_network_request, output => network, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DomainService('DeleteNetwork') -> #{name => 'DeleteNetwork', input => delete_network_request, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DomainService(_) -> error. - -find_rpc_def_VolumeService('GetVolume') -> #{name => 'GetVolume', input => get_volume_request, output => volume, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_VolumeService('ListVolumes') -> #{name => 'ListVolumes', input => list_volumes_request, output => list_volumes_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_VolumeService('CreateVolume') -> #{name => 'CreateVolume', input => create_volume_request, output => volume, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_VolumeService('UpdateVolume') -> #{name => 'UpdateVolume', input => update_volume_request, output => volume, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_VolumeService('DeleteVolume') -> #{name => 'DeleteVolume', input => delete_volume_request, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_VolumeService('ListVolumeAttachments') -> #{name => 'ListVolumeAttachments', input => list_volume_attachments_request, output => list_volume_attachments_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_VolumeService('GetVolumeAttachment') -> #{name => 'GetVolumeAttachment', input => volume_attachment_identifier, output => volume_attachment, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_VolumeService('AttachVolume') -> #{name => 'AttachVolume', input => volume_attachment_identifier, output => volume_attachment, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_VolumeService('DetachVolume') -> #{name => 'DetachVolume', input => volume_attachment_identifier, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_VolumeService(_) -> error. - -find_rpc_def_PortForwardingService('GetPortForwarding') -> #{name => 'GetPortForwarding', input => port_forwarding_identifier, output => port_forwarding, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_PortForwardingService('ListPortForwardings') -> #{name => 'ListPortForwardings', input => list_port_forwardings_request, output => list_port_forwardings_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_PortForwardingService('PutPortForwarding') -> #{name => 'PutPortForwarding', input => put_port_forwarding_request, output => port_forwarding, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_PortForwardingService('DeletePortForwarding') -> #{name => 'DeletePortForwarding', input => port_forwarding_identifier, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_PortForwardingService(_) -> error. - -find_rpc_def_DNS('GetDNSRecord') -> #{name => 'GetDNSRecord', input => dns_record_identifier, output => dns_record, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DNS('ListDNSRecords') -> #{name => 'ListDNSRecords', input => list_dns_records_request, output => list_dns_records_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DNS('PutDNSRecord') -> #{name => 'PutDNSRecord', input => put_dns_record_request, output => dns_record, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DNS('DeleteDNSRecord') -> #{name => 'DeleteDNSRecord', input => dns_record_identifier, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DNS(_) -> error. - -find_rpc_def_RouteService('GetRouteTable') -> #{name => 'GetRouteTable', input => route_table_identifier, output => route_table, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_RouteService('ListRouteTables') -> #{name => 'ListRouteTables', input => list_route_tables_request, output => list_route_tables_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_RouteService('CreateRouteTable') -> #{name => 'CreateRouteTable', input => create_route_table_request, output => route_table, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_RouteService('DeleteRouteTable') -> #{name => 'DeleteRouteTable', input => route_table_identifier, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_RouteService('GetRoute') -> #{name => 'GetRoute', input => route_identifier, output => route, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_RouteService('ListRoutes') -> #{name => 'ListRoutes', input => list_routes_request, output => list_routes_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_RouteService('PutRoute') -> #{name => 'PutRoute', input => put_route_request, output => route, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_RouteService('DeleteRoute') -> #{name => 'DeleteRoute', input => route_identifier, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_RouteService('Sync') -> #{name => 'Sync', input => sync_request, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_RouteService(_) -> error. - - -fetch_rpc_def(ServiceName, RpcName) -> - case find_rpc_def(ServiceName, RpcName) of - Def when is_map(Def) -> Def; - error -> erlang:error({no_such_rpc, ServiceName, RpcName}) - end. - - -%% Convert a a fully qualified (ie with package name) service name -%% as a binary to a service name as an atom. -fqbin_to_service_name(<<"ControllerService">>) -> 'ControllerService'; -fqbin_to_service_name(<<"DaemonService">>) -> 'DaemonService'; -fqbin_to_service_name(<<"DomainService">>) -> 'DomainService'; -fqbin_to_service_name(<<"VolumeService">>) -> 'VolumeService'; -fqbin_to_service_name(<<"PortForwardingService">>) -> 'PortForwardingService'; -fqbin_to_service_name(<<"DNS">>) -> 'DNS'; -fqbin_to_service_name(<<"RouteService">>) -> 'RouteService'; -fqbin_to_service_name(X) -> error({gpb_error, {badservice, X}}). - - -%% Convert a service name as an atom to a fully qualified -%% (ie with package name) name as a binary. -service_name_to_fqbin('ControllerService') -> <<"ControllerService">>; -service_name_to_fqbin('DaemonService') -> <<"DaemonService">>; -service_name_to_fqbin('DomainService') -> <<"DomainService">>; -service_name_to_fqbin('VolumeService') -> <<"VolumeService">>; -service_name_to_fqbin('PortForwardingService') -> <<"PortForwardingService">>; -service_name_to_fqbin('DNS') -> <<"DNS">>; -service_name_to_fqbin('RouteService') -> <<"RouteService">>; -service_name_to_fqbin(X) -> error({gpb_error, {badservice, X}}). - - -%% Convert a a fully qualified (ie with package name) service name -%% and an rpc name, both as binaries to a service name and an rpc -%% name, as atoms. -fqbins_to_service_and_rpc_name(<<"ControllerService">>, <<"GetDNSRecord">>) -> {'ControllerService', 'GetDNSRecord'}; -fqbins_to_service_and_rpc_name(<<"ControllerService">>, <<"ListDNSRecords">>) -> {'ControllerService', 'ListDNSRecords'}; -fqbins_to_service_and_rpc_name(<<"ControllerService">>, <<"PutDNSRecord">>) -> {'ControllerService', 'PutDNSRecord'}; -fqbins_to_service_and_rpc_name(<<"ControllerService">>, <<"DeleteDNSRecord">>) -> {'ControllerService', 'DeleteDNSRecord'}; -fqbins_to_service_and_rpc_name(<<"ControllerService">>, <<"GetNetwork">>) -> {'ControllerService', 'GetNetwork'}; -fqbins_to_service_and_rpc_name(<<"ControllerService">>, <<"ListNetworks">>) -> {'ControllerService', 'ListNetworks'}; -fqbins_to_service_and_rpc_name(<<"ControllerService">>, <<"CreateNetwork">>) -> {'ControllerService', 'CreateNetwork'}; -fqbins_to_service_and_rpc_name(<<"ControllerService">>, <<"DeleteNetwork">>) -> {'ControllerService', 'DeleteNetwork'}; -fqbins_to_service_and_rpc_name(<<"ControllerService">>, <<"StartDomain">>) -> {'ControllerService', 'StartDomain'}; -fqbins_to_service_and_rpc_name(<<"ControllerService">>, <<"StopDomain">>) -> {'ControllerService', 'StopDomain'}; -fqbins_to_service_and_rpc_name(<<"ControllerService">>, <<"GetDomain">>) -> {'ControllerService', 'GetDomain'}; -fqbins_to_service_and_rpc_name(<<"ControllerService">>, <<"ListDomains">>) -> {'ControllerService', 'ListDomains'}; -fqbins_to_service_and_rpc_name(<<"ControllerService">>, <<"CreateDomain">>) -> {'ControllerService', 'CreateDomain'}; -fqbins_to_service_and_rpc_name(<<"ControllerService">>, <<"DeleteDomain">>) -> {'ControllerService', 'DeleteDomain'}; -fqbins_to_service_and_rpc_name(<<"ControllerService">>, <<"DownloadImage">>) -> {'ControllerService', 'DownloadImage'}; -fqbins_to_service_and_rpc_name(<<"ControllerService">>, <<"GetVolume">>) -> {'ControllerService', 'GetVolume'}; -fqbins_to_service_and_rpc_name(<<"ControllerService">>, <<"ListVolumes">>) -> {'ControllerService', 'ListVolumes'}; -fqbins_to_service_and_rpc_name(<<"ControllerService">>, <<"CreateVolume">>) -> {'ControllerService', 'CreateVolume'}; -fqbins_to_service_and_rpc_name(<<"ControllerService">>, <<"UpdateVolume">>) -> {'ControllerService', 'UpdateVolume'}; -fqbins_to_service_and_rpc_name(<<"ControllerService">>, <<"DeleteVolume">>) -> {'ControllerService', 'DeleteVolume'}; -fqbins_to_service_and_rpc_name(<<"ControllerService">>, <<"ListVolumeAttachments">>) -> {'ControllerService', 'ListVolumeAttachments'}; -fqbins_to_service_and_rpc_name(<<"ControllerService">>, <<"GetVolumeAttachment">>) -> {'ControllerService', 'GetVolumeAttachment'}; -fqbins_to_service_and_rpc_name(<<"ControllerService">>, <<"AttachVolume">>) -> {'ControllerService', 'AttachVolume'}; -fqbins_to_service_and_rpc_name(<<"ControllerService">>, <<"DetachVolume">>) -> {'ControllerService', 'DetachVolume'}; -fqbins_to_service_and_rpc_name(<<"ControllerService">>, <<"GetPortForwarding">>) -> {'ControllerService', 'GetPortForwarding'}; -fqbins_to_service_and_rpc_name(<<"ControllerService">>, <<"ListPortForwardings">>) -> {'ControllerService', 'ListPortForwardings'}; -fqbins_to_service_and_rpc_name(<<"ControllerService">>, <<"PutPortForwarding">>) -> {'ControllerService', 'PutPortForwarding'}; -fqbins_to_service_and_rpc_name(<<"ControllerService">>, <<"DeletePortForwarding">>) -> {'ControllerService', 'DeletePortForwarding'}; -fqbins_to_service_and_rpc_name(<<"ControllerService">>, <<"GetRouteTable">>) -> {'ControllerService', 'GetRouteTable'}; -fqbins_to_service_and_rpc_name(<<"ControllerService">>, <<"ListRouteTables">>) -> {'ControllerService', 'ListRouteTables'}; -fqbins_to_service_and_rpc_name(<<"ControllerService">>, <<"CreateRouteTable">>) -> {'ControllerService', 'CreateRouteTable'}; -fqbins_to_service_and_rpc_name(<<"ControllerService">>, <<"DeleteRouteTable">>) -> {'ControllerService', 'DeleteRouteTable'}; -fqbins_to_service_and_rpc_name(<<"ControllerService">>, <<"GetRoute">>) -> {'ControllerService', 'GetRoute'}; -fqbins_to_service_and_rpc_name(<<"ControllerService">>, <<"ListRoutes">>) -> {'ControllerService', 'ListRoutes'}; -fqbins_to_service_and_rpc_name(<<"ControllerService">>, <<"PutRoute">>) -> {'ControllerService', 'PutRoute'}; -fqbins_to_service_and_rpc_name(<<"ControllerService">>, <<"DeleteRoute">>) -> {'ControllerService', 'DeleteRoute'}; -fqbins_to_service_and_rpc_name(<<"ControllerService">>, <<"SyncRoutes">>) -> {'ControllerService', 'SyncRoutes'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"GetNetwork">>) -> {'DaemonService', 'GetNetwork'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"ListNetworks">>) -> {'DaemonService', 'ListNetworks'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"CreateNetwork">>) -> {'DaemonService', 'CreateNetwork'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"DeleteNetwork">>) -> {'DaemonService', 'DeleteNetwork'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"StartDomain">>) -> {'DaemonService', 'StartDomain'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"StopDomain">>) -> {'DaemonService', 'StopDomain'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"GetDomain">>) -> {'DaemonService', 'GetDomain'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"ListDomains">>) -> {'DaemonService', 'ListDomains'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"CreateDomain">>) -> {'DaemonService', 'CreateDomain'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"DeleteDomain">>) -> {'DaemonService', 'DeleteDomain'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"DownloadImage">>) -> {'DaemonService', 'DownloadImage'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"GetVolume">>) -> {'DaemonService', 'GetVolume'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"ListVolumes">>) -> {'DaemonService', 'ListVolumes'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"CreateVolume">>) -> {'DaemonService', 'CreateVolume'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"UpdateVolume">>) -> {'DaemonService', 'UpdateVolume'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"DeleteVolume">>) -> {'DaemonService', 'DeleteVolume'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"ListVolumeAttachments">>) -> {'DaemonService', 'ListVolumeAttachments'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"GetVolumeAttachment">>) -> {'DaemonService', 'GetVolumeAttachment'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"AttachVolume">>) -> {'DaemonService', 'AttachVolume'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"DetachVolume">>) -> {'DaemonService', 'DetachVolume'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"GetPortForwarding">>) -> {'DaemonService', 'GetPortForwarding'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"ListPortForwardings">>) -> {'DaemonService', 'ListPortForwardings'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"PutPortForwarding">>) -> {'DaemonService', 'PutPortForwarding'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"DeletePortForwarding">>) -> {'DaemonService', 'DeletePortForwarding'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"SyncRoutes">>) -> {'DaemonService', 'SyncRoutes'}; -fqbins_to_service_and_rpc_name(<<"DomainService">>, <<"GetDomain">>) -> {'DomainService', 'GetDomain'}; -fqbins_to_service_and_rpc_name(<<"DomainService">>, <<"ListDomains">>) -> {'DomainService', 'ListDomains'}; -fqbins_to_service_and_rpc_name(<<"DomainService">>, <<"CreateDomain">>) -> {'DomainService', 'CreateDomain'}; -fqbins_to_service_and_rpc_name(<<"DomainService">>, <<"DeleteDomain">>) -> {'DomainService', 'DeleteDomain'}; -fqbins_to_service_and_rpc_name(<<"DomainService">>, <<"DownloadImage">>) -> {'DomainService', 'DownloadImage'}; -fqbins_to_service_and_rpc_name(<<"DomainService">>, <<"GetNetwork">>) -> {'DomainService', 'GetNetwork'}; -fqbins_to_service_and_rpc_name(<<"DomainService">>, <<"ListNetworks">>) -> {'DomainService', 'ListNetworks'}; -fqbins_to_service_and_rpc_name(<<"DomainService">>, <<"CreateNetwork">>) -> {'DomainService', 'CreateNetwork'}; -fqbins_to_service_and_rpc_name(<<"DomainService">>, <<"DeleteNetwork">>) -> {'DomainService', 'DeleteNetwork'}; -fqbins_to_service_and_rpc_name(<<"VolumeService">>, <<"GetVolume">>) -> {'VolumeService', 'GetVolume'}; -fqbins_to_service_and_rpc_name(<<"VolumeService">>, <<"ListVolumes">>) -> {'VolumeService', 'ListVolumes'}; -fqbins_to_service_and_rpc_name(<<"VolumeService">>, <<"CreateVolume">>) -> {'VolumeService', 'CreateVolume'}; -fqbins_to_service_and_rpc_name(<<"VolumeService">>, <<"UpdateVolume">>) -> {'VolumeService', 'UpdateVolume'}; -fqbins_to_service_and_rpc_name(<<"VolumeService">>, <<"DeleteVolume">>) -> {'VolumeService', 'DeleteVolume'}; -fqbins_to_service_and_rpc_name(<<"VolumeService">>, <<"ListVolumeAttachments">>) -> {'VolumeService', 'ListVolumeAttachments'}; -fqbins_to_service_and_rpc_name(<<"VolumeService">>, <<"GetVolumeAttachment">>) -> {'VolumeService', 'GetVolumeAttachment'}; -fqbins_to_service_and_rpc_name(<<"VolumeService">>, <<"AttachVolume">>) -> {'VolumeService', 'AttachVolume'}; -fqbins_to_service_and_rpc_name(<<"VolumeService">>, <<"DetachVolume">>) -> {'VolumeService', 'DetachVolume'}; -fqbins_to_service_and_rpc_name(<<"PortForwardingService">>, <<"GetPortForwarding">>) -> {'PortForwardingService', 'GetPortForwarding'}; -fqbins_to_service_and_rpc_name(<<"PortForwardingService">>, <<"ListPortForwardings">>) -> {'PortForwardingService', 'ListPortForwardings'}; -fqbins_to_service_and_rpc_name(<<"PortForwardingService">>, <<"PutPortForwarding">>) -> {'PortForwardingService', 'PutPortForwarding'}; -fqbins_to_service_and_rpc_name(<<"PortForwardingService">>, <<"DeletePortForwarding">>) -> {'PortForwardingService', 'DeletePortForwarding'}; -fqbins_to_service_and_rpc_name(<<"DNS">>, <<"GetDNSRecord">>) -> {'DNS', 'GetDNSRecord'}; -fqbins_to_service_and_rpc_name(<<"DNS">>, <<"ListDNSRecords">>) -> {'DNS', 'ListDNSRecords'}; -fqbins_to_service_and_rpc_name(<<"DNS">>, <<"PutDNSRecord">>) -> {'DNS', 'PutDNSRecord'}; -fqbins_to_service_and_rpc_name(<<"DNS">>, <<"DeleteDNSRecord">>) -> {'DNS', 'DeleteDNSRecord'}; -fqbins_to_service_and_rpc_name(<<"RouteService">>, <<"GetRouteTable">>) -> {'RouteService', 'GetRouteTable'}; -fqbins_to_service_and_rpc_name(<<"RouteService">>, <<"ListRouteTables">>) -> {'RouteService', 'ListRouteTables'}; -fqbins_to_service_and_rpc_name(<<"RouteService">>, <<"CreateRouteTable">>) -> {'RouteService', 'CreateRouteTable'}; -fqbins_to_service_and_rpc_name(<<"RouteService">>, <<"DeleteRouteTable">>) -> {'RouteService', 'DeleteRouteTable'}; -fqbins_to_service_and_rpc_name(<<"RouteService">>, <<"GetRoute">>) -> {'RouteService', 'GetRoute'}; -fqbins_to_service_and_rpc_name(<<"RouteService">>, <<"ListRoutes">>) -> {'RouteService', 'ListRoutes'}; -fqbins_to_service_and_rpc_name(<<"RouteService">>, <<"PutRoute">>) -> {'RouteService', 'PutRoute'}; -fqbins_to_service_and_rpc_name(<<"RouteService">>, <<"DeleteRoute">>) -> {'RouteService', 'DeleteRoute'}; -fqbins_to_service_and_rpc_name(<<"RouteService">>, <<"Sync">>) -> {'RouteService', 'Sync'}; -fqbins_to_service_and_rpc_name(S, R) -> error({gpb_error, {badservice_or_rpc, {S, R}}}). - - -%% Convert a service name and an rpc name, both as atoms, -%% to a fully qualified (ie with package name) service name and -%% an rpc name as binaries. -service_and_rpc_name_to_fqbins('ControllerService', 'GetDNSRecord') -> {<<"ControllerService">>, <<"GetDNSRecord">>}; -service_and_rpc_name_to_fqbins('ControllerService', 'ListDNSRecords') -> {<<"ControllerService">>, <<"ListDNSRecords">>}; -service_and_rpc_name_to_fqbins('ControllerService', 'PutDNSRecord') -> {<<"ControllerService">>, <<"PutDNSRecord">>}; -service_and_rpc_name_to_fqbins('ControllerService', 'DeleteDNSRecord') -> {<<"ControllerService">>, <<"DeleteDNSRecord">>}; -service_and_rpc_name_to_fqbins('ControllerService', 'GetNetwork') -> {<<"ControllerService">>, <<"GetNetwork">>}; -service_and_rpc_name_to_fqbins('ControllerService', 'ListNetworks') -> {<<"ControllerService">>, <<"ListNetworks">>}; -service_and_rpc_name_to_fqbins('ControllerService', 'CreateNetwork') -> {<<"ControllerService">>, <<"CreateNetwork">>}; -service_and_rpc_name_to_fqbins('ControllerService', 'DeleteNetwork') -> {<<"ControllerService">>, <<"DeleteNetwork">>}; -service_and_rpc_name_to_fqbins('ControllerService', 'StartDomain') -> {<<"ControllerService">>, <<"StartDomain">>}; -service_and_rpc_name_to_fqbins('ControllerService', 'StopDomain') -> {<<"ControllerService">>, <<"StopDomain">>}; -service_and_rpc_name_to_fqbins('ControllerService', 'GetDomain') -> {<<"ControllerService">>, <<"GetDomain">>}; -service_and_rpc_name_to_fqbins('ControllerService', 'ListDomains') -> {<<"ControllerService">>, <<"ListDomains">>}; -service_and_rpc_name_to_fqbins('ControllerService', 'CreateDomain') -> {<<"ControllerService">>, <<"CreateDomain">>}; -service_and_rpc_name_to_fqbins('ControllerService', 'DeleteDomain') -> {<<"ControllerService">>, <<"DeleteDomain">>}; -service_and_rpc_name_to_fqbins('ControllerService', 'DownloadImage') -> {<<"ControllerService">>, <<"DownloadImage">>}; -service_and_rpc_name_to_fqbins('ControllerService', 'GetVolume') -> {<<"ControllerService">>, <<"GetVolume">>}; -service_and_rpc_name_to_fqbins('ControllerService', 'ListVolumes') -> {<<"ControllerService">>, <<"ListVolumes">>}; -service_and_rpc_name_to_fqbins('ControllerService', 'CreateVolume') -> {<<"ControllerService">>, <<"CreateVolume">>}; -service_and_rpc_name_to_fqbins('ControllerService', 'UpdateVolume') -> {<<"ControllerService">>, <<"UpdateVolume">>}; -service_and_rpc_name_to_fqbins('ControllerService', 'DeleteVolume') -> {<<"ControllerService">>, <<"DeleteVolume">>}; -service_and_rpc_name_to_fqbins('ControllerService', 'ListVolumeAttachments') -> {<<"ControllerService">>, <<"ListVolumeAttachments">>}; -service_and_rpc_name_to_fqbins('ControllerService', 'GetVolumeAttachment') -> {<<"ControllerService">>, <<"GetVolumeAttachment">>}; -service_and_rpc_name_to_fqbins('ControllerService', 'AttachVolume') -> {<<"ControllerService">>, <<"AttachVolume">>}; -service_and_rpc_name_to_fqbins('ControllerService', 'DetachVolume') -> {<<"ControllerService">>, <<"DetachVolume">>}; -service_and_rpc_name_to_fqbins('ControllerService', 'GetPortForwarding') -> {<<"ControllerService">>, <<"GetPortForwarding">>}; -service_and_rpc_name_to_fqbins('ControllerService', 'ListPortForwardings') -> {<<"ControllerService">>, <<"ListPortForwardings">>}; -service_and_rpc_name_to_fqbins('ControllerService', 'PutPortForwarding') -> {<<"ControllerService">>, <<"PutPortForwarding">>}; -service_and_rpc_name_to_fqbins('ControllerService', 'DeletePortForwarding') -> {<<"ControllerService">>, <<"DeletePortForwarding">>}; -service_and_rpc_name_to_fqbins('ControllerService', 'GetRouteTable') -> {<<"ControllerService">>, <<"GetRouteTable">>}; -service_and_rpc_name_to_fqbins('ControllerService', 'ListRouteTables') -> {<<"ControllerService">>, <<"ListRouteTables">>}; -service_and_rpc_name_to_fqbins('ControllerService', 'CreateRouteTable') -> {<<"ControllerService">>, <<"CreateRouteTable">>}; -service_and_rpc_name_to_fqbins('ControllerService', 'DeleteRouteTable') -> {<<"ControllerService">>, <<"DeleteRouteTable">>}; -service_and_rpc_name_to_fqbins('ControllerService', 'GetRoute') -> {<<"ControllerService">>, <<"GetRoute">>}; -service_and_rpc_name_to_fqbins('ControllerService', 'ListRoutes') -> {<<"ControllerService">>, <<"ListRoutes">>}; -service_and_rpc_name_to_fqbins('ControllerService', 'PutRoute') -> {<<"ControllerService">>, <<"PutRoute">>}; -service_and_rpc_name_to_fqbins('ControllerService', 'DeleteRoute') -> {<<"ControllerService">>, <<"DeleteRoute">>}; -service_and_rpc_name_to_fqbins('ControllerService', 'SyncRoutes') -> {<<"ControllerService">>, <<"SyncRoutes">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'GetNetwork') -> {<<"DaemonService">>, <<"GetNetwork">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'ListNetworks') -> {<<"DaemonService">>, <<"ListNetworks">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'CreateNetwork') -> {<<"DaemonService">>, <<"CreateNetwork">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'DeleteNetwork') -> {<<"DaemonService">>, <<"DeleteNetwork">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'StartDomain') -> {<<"DaemonService">>, <<"StartDomain">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'StopDomain') -> {<<"DaemonService">>, <<"StopDomain">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'GetDomain') -> {<<"DaemonService">>, <<"GetDomain">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'ListDomains') -> {<<"DaemonService">>, <<"ListDomains">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'CreateDomain') -> {<<"DaemonService">>, <<"CreateDomain">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'DeleteDomain') -> {<<"DaemonService">>, <<"DeleteDomain">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'DownloadImage') -> {<<"DaemonService">>, <<"DownloadImage">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'GetVolume') -> {<<"DaemonService">>, <<"GetVolume">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'ListVolumes') -> {<<"DaemonService">>, <<"ListVolumes">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'CreateVolume') -> {<<"DaemonService">>, <<"CreateVolume">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'UpdateVolume') -> {<<"DaemonService">>, <<"UpdateVolume">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'DeleteVolume') -> {<<"DaemonService">>, <<"DeleteVolume">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'ListVolumeAttachments') -> {<<"DaemonService">>, <<"ListVolumeAttachments">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'GetVolumeAttachment') -> {<<"DaemonService">>, <<"GetVolumeAttachment">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'AttachVolume') -> {<<"DaemonService">>, <<"AttachVolume">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'DetachVolume') -> {<<"DaemonService">>, <<"DetachVolume">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'GetPortForwarding') -> {<<"DaemonService">>, <<"GetPortForwarding">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'ListPortForwardings') -> {<<"DaemonService">>, <<"ListPortForwardings">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'PutPortForwarding') -> {<<"DaemonService">>, <<"PutPortForwarding">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'DeletePortForwarding') -> {<<"DaemonService">>, <<"DeletePortForwarding">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'SyncRoutes') -> {<<"DaemonService">>, <<"SyncRoutes">>}; -service_and_rpc_name_to_fqbins('DomainService', 'GetDomain') -> {<<"DomainService">>, <<"GetDomain">>}; -service_and_rpc_name_to_fqbins('DomainService', 'ListDomains') -> {<<"DomainService">>, <<"ListDomains">>}; -service_and_rpc_name_to_fqbins('DomainService', 'CreateDomain') -> {<<"DomainService">>, <<"CreateDomain">>}; -service_and_rpc_name_to_fqbins('DomainService', 'DeleteDomain') -> {<<"DomainService">>, <<"DeleteDomain">>}; -service_and_rpc_name_to_fqbins('DomainService', 'DownloadImage') -> {<<"DomainService">>, <<"DownloadImage">>}; -service_and_rpc_name_to_fqbins('DomainService', 'GetNetwork') -> {<<"DomainService">>, <<"GetNetwork">>}; -service_and_rpc_name_to_fqbins('DomainService', 'ListNetworks') -> {<<"DomainService">>, <<"ListNetworks">>}; -service_and_rpc_name_to_fqbins('DomainService', 'CreateNetwork') -> {<<"DomainService">>, <<"CreateNetwork">>}; -service_and_rpc_name_to_fqbins('DomainService', 'DeleteNetwork') -> {<<"DomainService">>, <<"DeleteNetwork">>}; -service_and_rpc_name_to_fqbins('VolumeService', 'GetVolume') -> {<<"VolumeService">>, <<"GetVolume">>}; -service_and_rpc_name_to_fqbins('VolumeService', 'ListVolumes') -> {<<"VolumeService">>, <<"ListVolumes">>}; -service_and_rpc_name_to_fqbins('VolumeService', 'CreateVolume') -> {<<"VolumeService">>, <<"CreateVolume">>}; -service_and_rpc_name_to_fqbins('VolumeService', 'UpdateVolume') -> {<<"VolumeService">>, <<"UpdateVolume">>}; -service_and_rpc_name_to_fqbins('VolumeService', 'DeleteVolume') -> {<<"VolumeService">>, <<"DeleteVolume">>}; -service_and_rpc_name_to_fqbins('VolumeService', 'ListVolumeAttachments') -> {<<"VolumeService">>, <<"ListVolumeAttachments">>}; -service_and_rpc_name_to_fqbins('VolumeService', 'GetVolumeAttachment') -> {<<"VolumeService">>, <<"GetVolumeAttachment">>}; -service_and_rpc_name_to_fqbins('VolumeService', 'AttachVolume') -> {<<"VolumeService">>, <<"AttachVolume">>}; -service_and_rpc_name_to_fqbins('VolumeService', 'DetachVolume') -> {<<"VolumeService">>, <<"DetachVolume">>}; -service_and_rpc_name_to_fqbins('PortForwardingService', 'GetPortForwarding') -> {<<"PortForwardingService">>, <<"GetPortForwarding">>}; -service_and_rpc_name_to_fqbins('PortForwardingService', 'ListPortForwardings') -> {<<"PortForwardingService">>, <<"ListPortForwardings">>}; -service_and_rpc_name_to_fqbins('PortForwardingService', 'PutPortForwarding') -> {<<"PortForwardingService">>, <<"PutPortForwarding">>}; -service_and_rpc_name_to_fqbins('PortForwardingService', 'DeletePortForwarding') -> {<<"PortForwardingService">>, <<"DeletePortForwarding">>}; -service_and_rpc_name_to_fqbins('DNS', 'GetDNSRecord') -> {<<"DNS">>, <<"GetDNSRecord">>}; -service_and_rpc_name_to_fqbins('DNS', 'ListDNSRecords') -> {<<"DNS">>, <<"ListDNSRecords">>}; -service_and_rpc_name_to_fqbins('DNS', 'PutDNSRecord') -> {<<"DNS">>, <<"PutDNSRecord">>}; -service_and_rpc_name_to_fqbins('DNS', 'DeleteDNSRecord') -> {<<"DNS">>, <<"DeleteDNSRecord">>}; -service_and_rpc_name_to_fqbins('RouteService', 'GetRouteTable') -> {<<"RouteService">>, <<"GetRouteTable">>}; -service_and_rpc_name_to_fqbins('RouteService', 'ListRouteTables') -> {<<"RouteService">>, <<"ListRouteTables">>}; -service_and_rpc_name_to_fqbins('RouteService', 'CreateRouteTable') -> {<<"RouteService">>, <<"CreateRouteTable">>}; -service_and_rpc_name_to_fqbins('RouteService', 'DeleteRouteTable') -> {<<"RouteService">>, <<"DeleteRouteTable">>}; -service_and_rpc_name_to_fqbins('RouteService', 'GetRoute') -> {<<"RouteService">>, <<"GetRoute">>}; -service_and_rpc_name_to_fqbins('RouteService', 'ListRoutes') -> {<<"RouteService">>, <<"ListRoutes">>}; -service_and_rpc_name_to_fqbins('RouteService', 'PutRoute') -> {<<"RouteService">>, <<"PutRoute">>}; -service_and_rpc_name_to_fqbins('RouteService', 'DeleteRoute') -> {<<"RouteService">>, <<"DeleteRoute">>}; -service_and_rpc_name_to_fqbins('RouteService', 'Sync') -> {<<"RouteService">>, <<"Sync">>}; -service_and_rpc_name_to_fqbins(S, R) -> error({gpb_error, {badservice_or_rpc, {S, R}}}). - - -fqbin_to_msg_name(<<"google.protobuf.Empty">>) -> empty; -fqbin_to_msg_name(<<"SyncRoutesRequest">>) -> sync_routes_request; -fqbin_to_msg_name(<<"StartDomainRequest">>) -> start_domain_request; -fqbin_to_msg_name(<<"StopDomainRequest">>) -> stop_domain_request; -fqbin_to_msg_name(<<"GetDomainRequest">>) -> get_domain_request; -fqbin_to_msg_name(<<"Domain">>) -> domain; -fqbin_to_msg_name(<<"ListDomainsRequest">>) -> list_domains_request; -fqbin_to_msg_name(<<"ListDomainsResponse">>) -> list_domains_response; -fqbin_to_msg_name(<<"CreateDomainRequest">>) -> create_domain_request; -fqbin_to_msg_name(<<"DeleteDomainRequest">>) -> delete_domain_request; -fqbin_to_msg_name(<<"DownloadImageRequest">>) -> download_image_request; -fqbin_to_msg_name(<<"ImageChunk">>) -> image_chunk; -fqbin_to_msg_name(<<"GetNetworkRequest">>) -> get_network_request; -fqbin_to_msg_name(<<"Network">>) -> network; -fqbin_to_msg_name(<<"ListNetworksRequest">>) -> list_networks_request; -fqbin_to_msg_name(<<"ListNetworksResponse">>) -> list_networks_response; -fqbin_to_msg_name(<<"CreateNetworkRequest">>) -> create_network_request; -fqbin_to_msg_name(<<"DeleteNetworkRequest">>) -> delete_network_request; -fqbin_to_msg_name(<<"GetVolumeRequest">>) -> get_volume_request; -fqbin_to_msg_name(<<"Volume">>) -> volume; -fqbin_to_msg_name(<<"ListVolumesRequest">>) -> list_volumes_request; -fqbin_to_msg_name(<<"ListVolumesResponse">>) -> list_volumes_response; -fqbin_to_msg_name(<<"CreateVolumeRequest">>) -> create_volume_request; -fqbin_to_msg_name(<<"UpdateVolumeRequest">>) -> update_volume_request; -fqbin_to_msg_name(<<"DeleteVolumeRequest">>) -> delete_volume_request; -fqbin_to_msg_name(<<"VolumeAttachmentIdentifier">>) -> volume_attachment_identifier; -fqbin_to_msg_name(<<"VolumeAttachment">>) -> volume_attachment; -fqbin_to_msg_name(<<"ListVolumeAttachmentsRequest">>) -> list_volume_attachments_request; -fqbin_to_msg_name(<<"ListVolumeAttachmentsResponse">>) -> list_volume_attachments_response; -fqbin_to_msg_name(<<"PortForwardingIdentifier">>) -> port_forwarding_identifier; -fqbin_to_msg_name(<<"PortForwarding">>) -> port_forwarding; -fqbin_to_msg_name(<<"ListPortForwardingsRequest">>) -> list_port_forwardings_request; -fqbin_to_msg_name(<<"ListPortForwardingsResponse">>) -> list_port_forwardings_response; -fqbin_to_msg_name(<<"PutPortForwardingRequest">>) -> put_port_forwarding_request; -fqbin_to_msg_name(<<"DNSRecordIdentifier">>) -> dns_record_identifier; -fqbin_to_msg_name(<<"DNSRecord">>) -> dns_record; -fqbin_to_msg_name(<<"ListDNSRecordsRequest">>) -> list_dns_records_request; -fqbin_to_msg_name(<<"ListDNSRecordsResponse">>) -> list_dns_records_response; -fqbin_to_msg_name(<<"PutDNSRecordRequest">>) -> put_dns_record_request; -fqbin_to_msg_name(<<"RouteTable">>) -> route_table; -fqbin_to_msg_name(<<"RouteTableIdentifier">>) -> route_table_identifier; -fqbin_to_msg_name(<<"ListRouteTablesRequest">>) -> list_route_tables_request; -fqbin_to_msg_name(<<"ListRouteTablesResponse">>) -> list_route_tables_response; -fqbin_to_msg_name(<<"CreateRouteTableRequest">>) -> create_route_table_request; -fqbin_to_msg_name(<<"RouteIdentifier">>) -> route_identifier; -fqbin_to_msg_name(<<"Route">>) -> route; -fqbin_to_msg_name(<<"ListRoutesRequest">>) -> list_routes_request; -fqbin_to_msg_name(<<"ListRoutesResponse">>) -> list_routes_response; -fqbin_to_msg_name(<<"PutRouteRequest">>) -> put_route_request; -fqbin_to_msg_name(<<"SyncRequest">>) -> sync_request; -fqbin_to_msg_name(<<"google.protobuf.Timestamp">>) -> timestamp; -fqbin_to_msg_name(E) -> error({gpb_error, {badmsg, E}}). - - -msg_name_to_fqbin(empty) -> <<"google.protobuf.Empty">>; -msg_name_to_fqbin(sync_routes_request) -> <<"SyncRoutesRequest">>; -msg_name_to_fqbin(start_domain_request) -> <<"StartDomainRequest">>; -msg_name_to_fqbin(stop_domain_request) -> <<"StopDomainRequest">>; -msg_name_to_fqbin(get_domain_request) -> <<"GetDomainRequest">>; -msg_name_to_fqbin(domain) -> <<"Domain">>; -msg_name_to_fqbin(list_domains_request) -> <<"ListDomainsRequest">>; -msg_name_to_fqbin(list_domains_response) -> <<"ListDomainsResponse">>; -msg_name_to_fqbin(create_domain_request) -> <<"CreateDomainRequest">>; -msg_name_to_fqbin(delete_domain_request) -> <<"DeleteDomainRequest">>; -msg_name_to_fqbin(download_image_request) -> <<"DownloadImageRequest">>; -msg_name_to_fqbin(image_chunk) -> <<"ImageChunk">>; -msg_name_to_fqbin(get_network_request) -> <<"GetNetworkRequest">>; -msg_name_to_fqbin(network) -> <<"Network">>; -msg_name_to_fqbin(list_networks_request) -> <<"ListNetworksRequest">>; -msg_name_to_fqbin(list_networks_response) -> <<"ListNetworksResponse">>; -msg_name_to_fqbin(create_network_request) -> <<"CreateNetworkRequest">>; -msg_name_to_fqbin(delete_network_request) -> <<"DeleteNetworkRequest">>; -msg_name_to_fqbin(get_volume_request) -> <<"GetVolumeRequest">>; -msg_name_to_fqbin(volume) -> <<"Volume">>; -msg_name_to_fqbin(list_volumes_request) -> <<"ListVolumesRequest">>; -msg_name_to_fqbin(list_volumes_response) -> <<"ListVolumesResponse">>; -msg_name_to_fqbin(create_volume_request) -> <<"CreateVolumeRequest">>; -msg_name_to_fqbin(update_volume_request) -> <<"UpdateVolumeRequest">>; -msg_name_to_fqbin(delete_volume_request) -> <<"DeleteVolumeRequest">>; -msg_name_to_fqbin(volume_attachment_identifier) -> <<"VolumeAttachmentIdentifier">>; -msg_name_to_fqbin(volume_attachment) -> <<"VolumeAttachment">>; -msg_name_to_fqbin(list_volume_attachments_request) -> <<"ListVolumeAttachmentsRequest">>; -msg_name_to_fqbin(list_volume_attachments_response) -> <<"ListVolumeAttachmentsResponse">>; -msg_name_to_fqbin(port_forwarding_identifier) -> <<"PortForwardingIdentifier">>; -msg_name_to_fqbin(port_forwarding) -> <<"PortForwarding">>; -msg_name_to_fqbin(list_port_forwardings_request) -> <<"ListPortForwardingsRequest">>; -msg_name_to_fqbin(list_port_forwardings_response) -> <<"ListPortForwardingsResponse">>; -msg_name_to_fqbin(put_port_forwarding_request) -> <<"PutPortForwardingRequest">>; -msg_name_to_fqbin(dns_record_identifier) -> <<"DNSRecordIdentifier">>; -msg_name_to_fqbin(dns_record) -> <<"DNSRecord">>; -msg_name_to_fqbin(list_dns_records_request) -> <<"ListDNSRecordsRequest">>; -msg_name_to_fqbin(list_dns_records_response) -> <<"ListDNSRecordsResponse">>; -msg_name_to_fqbin(put_dns_record_request) -> <<"PutDNSRecordRequest">>; -msg_name_to_fqbin(route_table) -> <<"RouteTable">>; -msg_name_to_fqbin(route_table_identifier) -> <<"RouteTableIdentifier">>; -msg_name_to_fqbin(list_route_tables_request) -> <<"ListRouteTablesRequest">>; -msg_name_to_fqbin(list_route_tables_response) -> <<"ListRouteTablesResponse">>; -msg_name_to_fqbin(create_route_table_request) -> <<"CreateRouteTableRequest">>; -msg_name_to_fqbin(route_identifier) -> <<"RouteIdentifier">>; -msg_name_to_fqbin(route) -> <<"Route">>; -msg_name_to_fqbin(list_routes_request) -> <<"ListRoutesRequest">>; -msg_name_to_fqbin(list_routes_response) -> <<"ListRoutesResponse">>; -msg_name_to_fqbin(put_route_request) -> <<"PutRouteRequest">>; -msg_name_to_fqbin(sync_request) -> <<"SyncRequest">>; -msg_name_to_fqbin(timestamp) -> <<"google.protobuf.Timestamp">>; -msg_name_to_fqbin(E) -> error({gpb_error, {badmsg, E}}). - - --spec fqbin_to_enum_name(_) -> no_return(). -fqbin_to_enum_name(E) -> error({gpb_error, {badenum, E}}). - - --spec enum_name_to_fqbin(_) -> no_return(). -enum_name_to_fqbin(E) -> error({gpb_error, {badenum, E}}). - - -get_package_name() -> 'google.protobuf'. - - -%% Whether or not the message names -%% are prepended with package name or not. -uses_packages() -> true. - - -source_basename() -> "controller.proto". - - -%% Retrieve all proto file names, also imported ones. -%% The order is top-down. The first element is always the main -%% source file. The files are returned with extension, -%% see get_all_proto_names/0 for a version that returns -%% the basenames sans extension -get_all_source_basenames() -> ["controller.proto", "empty.proto", "daemon.proto", "domain.proto", "volume.proto", "port_forwarding.proto", "dns.proto", "route.proto", "timestamp.proto"]. - - -%% Retrieve all proto file names, also imported ones. -%% The order is top-down. The first element is always the main -%% source file. The files are returned sans .proto extension, -%% to make it easier to use them with the various get_xyz_containment -%% functions. -get_all_proto_names() -> ["controller", "empty", "daemon", "domain", "volume", "port_forwarding", "dns", "route", "timestamp"]. - - -get_msg_containment("controller") -> []; -get_msg_containment("empty") -> [empty]; -get_msg_containment("daemon") -> [sync_routes_request]; -get_msg_containment("domain") -> - [create_domain_request, - create_network_request, - delete_domain_request, - delete_network_request, - domain, - download_image_request, - get_domain_request, - get_network_request, - image_chunk, - list_domains_request, - list_domains_response, - list_networks_request, - list_networks_response, - network, - start_domain_request, - stop_domain_request]; -get_msg_containment("volume") -> - [create_volume_request, - delete_volume_request, - get_volume_request, - list_volume_attachments_request, - list_volume_attachments_response, - list_volumes_request, - list_volumes_response, - update_volume_request, - volume, - volume_attachment, - volume_attachment_identifier]; -get_msg_containment("port_forwarding") -> [list_port_forwardings_request, list_port_forwardings_response, port_forwarding, port_forwarding_identifier, put_port_forwarding_request]; -get_msg_containment("dns") -> [dns_record, dns_record_identifier, list_dns_records_request, list_dns_records_response, put_dns_record_request]; -get_msg_containment("route") -> - [create_route_table_request, list_route_tables_request, list_route_tables_response, list_routes_request, list_routes_response, put_route_request, route, route_identifier, route_table, route_table_identifier, sync_request]; -get_msg_containment("timestamp") -> [timestamp]; -get_msg_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_pkg_containment("controller") -> undefined; -get_pkg_containment("empty") -> 'google.protobuf'; -get_pkg_containment("daemon") -> undefined; -get_pkg_containment("domain") -> undefined; -get_pkg_containment("volume") -> undefined; -get_pkg_containment("port_forwarding") -> undefined; -get_pkg_containment("dns") -> undefined; -get_pkg_containment("route") -> undefined; -get_pkg_containment("timestamp") -> 'google.protobuf'; -get_pkg_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_service_containment("controller") -> ['ControllerService']; -get_service_containment("empty") -> []; -get_service_containment("daemon") -> ['DaemonService']; -get_service_containment("domain") -> ['DomainService']; -get_service_containment("volume") -> ['VolumeService']; -get_service_containment("port_forwarding") -> ['PortForwardingService']; -get_service_containment("dns") -> ['DNS']; -get_service_containment("route") -> ['RouteService']; -get_service_containment("timestamp") -> []; -get_service_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_rpc_containment("controller") -> - [{'ControllerService', 'GetDNSRecord'}, - {'ControllerService', 'ListDNSRecords'}, - {'ControllerService', 'PutDNSRecord'}, - {'ControllerService', 'DeleteDNSRecord'}, - {'ControllerService', 'GetNetwork'}, - {'ControllerService', 'ListNetworks'}, - {'ControllerService', 'CreateNetwork'}, - {'ControllerService', 'DeleteNetwork'}, - {'ControllerService', 'StartDomain'}, - {'ControllerService', 'StopDomain'}, - {'ControllerService', 'GetDomain'}, - {'ControllerService', 'ListDomains'}, - {'ControllerService', 'CreateDomain'}, - {'ControllerService', 'DeleteDomain'}, - {'ControllerService', 'DownloadImage'}, - {'ControllerService', 'GetVolume'}, - {'ControllerService', 'ListVolumes'}, - {'ControllerService', 'CreateVolume'}, - {'ControllerService', 'UpdateVolume'}, - {'ControllerService', 'DeleteVolume'}, - {'ControllerService', 'ListVolumeAttachments'}, - {'ControllerService', 'GetVolumeAttachment'}, - {'ControllerService', 'AttachVolume'}, - {'ControllerService', 'DetachVolume'}, - {'ControllerService', 'GetPortForwarding'}, - {'ControllerService', 'ListPortForwardings'}, - {'ControllerService', 'PutPortForwarding'}, - {'ControllerService', 'DeletePortForwarding'}, - {'ControllerService', 'GetRouteTable'}, - {'ControllerService', 'ListRouteTables'}, - {'ControllerService', 'CreateRouteTable'}, - {'ControllerService', 'DeleteRouteTable'}, - {'ControllerService', 'GetRoute'}, - {'ControllerService', 'ListRoutes'}, - {'ControllerService', 'PutRoute'}, - {'ControllerService', 'DeleteRoute'}, - {'ControllerService', 'SyncRoutes'}]; -get_rpc_containment("empty") -> []; -get_rpc_containment("daemon") -> - [{'DaemonService', 'GetNetwork'}, - {'DaemonService', 'ListNetworks'}, - {'DaemonService', 'CreateNetwork'}, - {'DaemonService', 'DeleteNetwork'}, - {'DaemonService', 'StartDomain'}, - {'DaemonService', 'StopDomain'}, - {'DaemonService', 'GetDomain'}, - {'DaemonService', 'ListDomains'}, - {'DaemonService', 'CreateDomain'}, - {'DaemonService', 'DeleteDomain'}, - {'DaemonService', 'DownloadImage'}, - {'DaemonService', 'GetVolume'}, - {'DaemonService', 'ListVolumes'}, - {'DaemonService', 'CreateVolume'}, - {'DaemonService', 'UpdateVolume'}, - {'DaemonService', 'DeleteVolume'}, - {'DaemonService', 'ListVolumeAttachments'}, - {'DaemonService', 'GetVolumeAttachment'}, - {'DaemonService', 'AttachVolume'}, - {'DaemonService', 'DetachVolume'}, - {'DaemonService', 'GetPortForwarding'}, - {'DaemonService', 'ListPortForwardings'}, - {'DaemonService', 'PutPortForwarding'}, - {'DaemonService', 'DeletePortForwarding'}, - {'DaemonService', 'SyncRoutes'}]; -get_rpc_containment("domain") -> - [{'DomainService', 'GetDomain'}, - {'DomainService', 'ListDomains'}, - {'DomainService', 'CreateDomain'}, - {'DomainService', 'DeleteDomain'}, - {'DomainService', 'DownloadImage'}, - {'DomainService', 'GetNetwork'}, - {'DomainService', 'ListNetworks'}, - {'DomainService', 'CreateNetwork'}, - {'DomainService', 'DeleteNetwork'}]; -get_rpc_containment("volume") -> - [{'VolumeService', 'GetVolume'}, - {'VolumeService', 'ListVolumes'}, - {'VolumeService', 'CreateVolume'}, - {'VolumeService', 'UpdateVolume'}, - {'VolumeService', 'DeleteVolume'}, - {'VolumeService', 'ListVolumeAttachments'}, - {'VolumeService', 'GetVolumeAttachment'}, - {'VolumeService', 'AttachVolume'}, - {'VolumeService', 'DetachVolume'}]; -get_rpc_containment("port_forwarding") -> [{'PortForwardingService', 'GetPortForwarding'}, {'PortForwardingService', 'ListPortForwardings'}, {'PortForwardingService', 'PutPortForwarding'}, {'PortForwardingService', 'DeletePortForwarding'}]; -get_rpc_containment("dns") -> [{'DNS', 'GetDNSRecord'}, {'DNS', 'ListDNSRecords'}, {'DNS', 'PutDNSRecord'}, {'DNS', 'DeleteDNSRecord'}]; -get_rpc_containment("route") -> - [{'RouteService', 'GetRouteTable'}, - {'RouteService', 'ListRouteTables'}, - {'RouteService', 'CreateRouteTable'}, - {'RouteService', 'DeleteRouteTable'}, - {'RouteService', 'GetRoute'}, - {'RouteService', 'ListRoutes'}, - {'RouteService', 'PutRoute'}, - {'RouteService', 'DeleteRoute'}, - {'RouteService', 'Sync'}]; -get_rpc_containment("timestamp") -> []; -get_rpc_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_enum_containment("controller") -> []; -get_enum_containment("empty") -> []; -get_enum_containment("daemon") -> []; -get_enum_containment("domain") -> []; -get_enum_containment("volume") -> []; -get_enum_containment("port_forwarding") -> []; -get_enum_containment("dns") -> []; -get_enum_containment("route") -> []; -get_enum_containment("timestamp") -> []; -get_enum_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_proto_by_msg_name_as_fqbin(<<"google.protobuf.Timestamp">>) -> "timestamp"; -get_proto_by_msg_name_as_fqbin(<<"RouteTableIdentifier">>) -> "route"; -get_proto_by_msg_name_as_fqbin(<<"RouteIdentifier">>) -> "route"; -get_proto_by_msg_name_as_fqbin(<<"DNSRecordIdentifier">>) -> "dns"; -get_proto_by_msg_name_as_fqbin(<<"PortForwardingIdentifier">>) -> "port_forwarding"; -get_proto_by_msg_name_as_fqbin(<<"VolumeAttachmentIdentifier">>) -> "volume"; -get_proto_by_msg_name_as_fqbin(<<"SyncRequest">>) -> "route"; -get_proto_by_msg_name_as_fqbin(<<"PutRouteRequest">>) -> "route"; -get_proto_by_msg_name_as_fqbin(<<"ListRoutesRequest">>) -> "route"; -get_proto_by_msg_name_as_fqbin(<<"ListRouteTablesRequest">>) -> "route"; -get_proto_by_msg_name_as_fqbin(<<"CreateRouteTableRequest">>) -> "route"; -get_proto_by_msg_name_as_fqbin(<<"PutDNSRecordRequest">>) -> "dns"; -get_proto_by_msg_name_as_fqbin(<<"ListDNSRecordsRequest">>) -> "dns"; -get_proto_by_msg_name_as_fqbin(<<"DNSRecord">>) -> "dns"; -get_proto_by_msg_name_as_fqbin(<<"PutPortForwardingRequest">>) -> "port_forwarding"; -get_proto_by_msg_name_as_fqbin(<<"ListPortForwardingsRequest">>) -> "port_forwarding"; -get_proto_by_msg_name_as_fqbin(<<"VolumeAttachment">>) -> "volume"; -get_proto_by_msg_name_as_fqbin(<<"UpdateVolumeRequest">>) -> "volume"; -get_proto_by_msg_name_as_fqbin(<<"ListVolumesRequest">>) -> "volume"; -get_proto_by_msg_name_as_fqbin(<<"ListVolumeAttachmentsRequest">>) -> "volume"; -get_proto_by_msg_name_as_fqbin(<<"GetVolumeRequest">>) -> "volume"; -get_proto_by_msg_name_as_fqbin(<<"DeleteVolumeRequest">>) -> "volume"; -get_proto_by_msg_name_as_fqbin(<<"CreateVolumeRequest">>) -> "volume"; -get_proto_by_msg_name_as_fqbin(<<"StopDomainRequest">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"StartDomainRequest">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"ListNetworksRequest">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"ListDomainsRequest">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"GetNetworkRequest">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"GetDomainRequest">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"DownloadImageRequest">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"DeleteNetworkRequest">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"DeleteDomainRequest">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"CreateNetworkRequest">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"CreateDomainRequest">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"SyncRoutesRequest">>) -> "daemon"; -get_proto_by_msg_name_as_fqbin(<<"RouteTable">>) -> "route"; -get_proto_by_msg_name_as_fqbin(<<"Route">>) -> "route"; -get_proto_by_msg_name_as_fqbin(<<"ListRoutesResponse">>) -> "route"; -get_proto_by_msg_name_as_fqbin(<<"ListRouteTablesResponse">>) -> "route"; -get_proto_by_msg_name_as_fqbin(<<"ListDNSRecordsResponse">>) -> "dns"; -get_proto_by_msg_name_as_fqbin(<<"ListPortForwardingsResponse">>) -> "port_forwarding"; -get_proto_by_msg_name_as_fqbin(<<"Volume">>) -> "volume"; -get_proto_by_msg_name_as_fqbin(<<"ListVolumesResponse">>) -> "volume"; -get_proto_by_msg_name_as_fqbin(<<"ListVolumeAttachmentsResponse">>) -> "volume"; -get_proto_by_msg_name_as_fqbin(<<"ListNetworksResponse">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"ListDomainsResponse">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"PortForwarding">>) -> "port_forwarding"; -get_proto_by_msg_name_as_fqbin(<<"google.protobuf.Empty">>) -> "empty"; -get_proto_by_msg_name_as_fqbin(<<"Network">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"ImageChunk">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"Domain">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(E) -> error({gpb_error, {badmsg, E}}). - - -get_proto_by_service_name_as_fqbin(<<"DNS">>) -> "dns"; -get_proto_by_service_name_as_fqbin(<<"RouteService">>) -> "route"; -get_proto_by_service_name_as_fqbin(<<"PortForwardingService">>) -> "port_forwarding"; -get_proto_by_service_name_as_fqbin(<<"VolumeService">>) -> "volume"; -get_proto_by_service_name_as_fqbin(<<"DomainService">>) -> "domain"; -get_proto_by_service_name_as_fqbin(<<"DaemonService">>) -> "daemon"; -get_proto_by_service_name_as_fqbin(<<"ControllerService">>) -> "controller"; -get_proto_by_service_name_as_fqbin(E) -> error({gpb_error, {badservice, E}}). - - --spec get_proto_by_enum_name_as_fqbin(_) -> no_return(). -get_proto_by_enum_name_as_fqbin(E) -> error({gpb_error, {badenum, E}}). - - -get_protos_by_pkg_name_as_fqbin(<<"google.protobuf">>) -> ["empty", "timestamp"]; -get_protos_by_pkg_name_as_fqbin(E) -> error({gpb_error, {badpkg, E}}). - - - -gpb_version_as_string() -> - "4.19.8". - -gpb_version_as_list() -> - [4,19,8]. - -gpb_version_source() -> - "file". diff --git a/virtuerl/src/pb/controller_service_bhvr.erl b/virtuerl/src/pb/controller_service_bhvr.erl deleted file mode 100644 index 888c9f9..0000000 --- a/virtuerl/src/pb/controller_service_bhvr.erl +++ /dev/null @@ -1,157 +0,0 @@ -%%%------------------------------------------------------------------- -%% @doc Behaviour to implement for grpc service ControllerService. -%% @end -%%%------------------------------------------------------------------- - -%% this module was generated and should not be modified manually - --module(controller_service_bhvr). - -%% Unary RPC --callback get_dns_record(ctx:t(), controller_pb:dns_record_identifier()) -> - {ok, controller_pb:dns_record(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback list_dns_records(ctx:t(), controller_pb:list_dns_records_request()) -> - {ok, controller_pb:list_dns_records_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback put_dns_record(ctx:t(), controller_pb:put_dns_record_request()) -> - {ok, controller_pb:dns_record(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback delete_dns_record(ctx:t(), controller_pb:dns_record_identifier()) -> - {ok, controller_pb:empty(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback get_network(ctx:t(), controller_pb:get_network_request()) -> - {ok, controller_pb:network(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback list_networks(ctx:t(), controller_pb:list_networks_request()) -> - {ok, controller_pb:list_networks_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback create_network(ctx:t(), controller_pb:create_network_request()) -> - {ok, controller_pb:network(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback delete_network(ctx:t(), controller_pb:delete_network_request()) -> - {ok, controller_pb:empty(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback start_domain(ctx:t(), controller_pb:start_domain_request()) -> - {ok, controller_pb:empty(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback stop_domain(ctx:t(), controller_pb:stop_domain_request()) -> - {ok, controller_pb:empty(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback get_domain(ctx:t(), controller_pb:get_domain_request()) -> - {ok, controller_pb:domain(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback list_domains(ctx:t(), controller_pb:list_domains_request()) -> - {ok, controller_pb:list_domains_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback create_domain(ctx:t(), controller_pb:create_domain_request()) -> - {ok, controller_pb:domain(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback delete_domain(ctx:t(), controller_pb:delete_domain_request()) -> - {ok, controller_pb:empty(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% --callback download_image(controller_pb:download_image_request(), grpcbox_stream:t()) -> - ok | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback get_volume(ctx:t(), controller_pb:get_volume_request()) -> - {ok, controller_pb:volume(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback list_volumes(ctx:t(), controller_pb:list_volumes_request()) -> - {ok, controller_pb:list_volumes_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback create_volume(ctx:t(), controller_pb:create_volume_request()) -> - {ok, controller_pb:volume(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback update_volume(ctx:t(), controller_pb:update_volume_request()) -> - {ok, controller_pb:volume(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback delete_volume(ctx:t(), controller_pb:delete_volume_request()) -> - {ok, controller_pb:empty(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback list_volume_attachments(ctx:t(), controller_pb:list_volume_attachments_request()) -> - {ok, controller_pb:list_volume_attachments_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback get_volume_attachment(ctx:t(), controller_pb:volume_attachment_identifier()) -> - {ok, controller_pb:volume_attachment(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback attach_volume(ctx:t(), controller_pb:volume_attachment_identifier()) -> - {ok, controller_pb:volume_attachment(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback detach_volume(ctx:t(), controller_pb:volume_attachment_identifier()) -> - {ok, controller_pb:empty(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback get_port_forwarding(ctx:t(), controller_pb:port_forwarding_identifier()) -> - {ok, controller_pb:port_forwarding(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback list_port_forwardings(ctx:t(), controller_pb:list_port_forwardings_request()) -> - {ok, controller_pb:list_port_forwardings_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback put_port_forwarding(ctx:t(), controller_pb:put_port_forwarding_request()) -> - {ok, controller_pb:port_forwarding(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback delete_port_forwarding(ctx:t(), controller_pb:port_forwarding_identifier()) -> - {ok, controller_pb:empty(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback get_route_table(ctx:t(), controller_pb:route_table_identifier()) -> - {ok, controller_pb:route_table(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback list_route_tables(ctx:t(), controller_pb:list_route_tables_request()) -> - {ok, controller_pb:list_route_tables_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback create_route_table(ctx:t(), controller_pb:create_route_table_request()) -> - {ok, controller_pb:route_table(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback delete_route_table(ctx:t(), controller_pb:route_table_identifier()) -> - {ok, controller_pb:empty(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback get_route(ctx:t(), controller_pb:route_identifier()) -> - {ok, controller_pb:route(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback list_routes(ctx:t(), controller_pb:list_routes_request()) -> - {ok, controller_pb:list_routes_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback put_route(ctx:t(), controller_pb:put_route_request()) -> - {ok, controller_pb:route(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback delete_route(ctx:t(), controller_pb:route_identifier()) -> - {ok, controller_pb:empty(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback sync_routes(ctx:t(), controller_pb:sync_routes_request()) -> - {ok, controller_pb:empty(), ctx:t()} | grpcbox_stream:grpc_error_response(). - diff --git a/virtuerl/src/pb/controller_service_client.erl b/virtuerl/src/pb/controller_service_client.erl deleted file mode 100644 index c7ac599..0000000 --- a/virtuerl/src/pb/controller_service_client.erl +++ /dev/null @@ -1,691 +0,0 @@ -%%%------------------------------------------------------------------- -%% @doc Client module for grpc service ControllerService. -%% @end -%%%------------------------------------------------------------------- - -%% this module was generated and should not be modified manually - --module(controller_service_client). - --compile(export_all). --compile(nowarn_export_all). - --include_lib("grpcbox/include/grpcbox.hrl"). - --define(is_ctx(Ctx), is_tuple(Ctx) andalso element(1, Ctx) =:= ctx). - --define(SERVICE, 'ControllerService'). --define(PROTO_MODULE, 'controller_pb'). --define(MARSHAL_FUN(T), fun(I) -> ?PROTO_MODULE:encode_msg(I, T) end). --define(UNMARSHAL_FUN(T), fun(I) -> ?PROTO_MODULE:decode_msg(I, T) end). --define(DEF(Input, Output, MessageType), #grpcbox_def{service=?SERVICE, - message_type=MessageType, - marshal_fun=?MARSHAL_FUN(Input), - unmarshal_fun=?UNMARSHAL_FUN(Output)}). - -%% @doc Unary RPC --spec get_dns_record(controller_pb:dns_record_identifier()) -> - {ok, controller_pb:dns_record(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_dns_record(Input) -> - get_dns_record(ctx:new(), Input, #{}). - --spec get_dns_record(ctx:t() | controller_pb:dns_record_identifier(), controller_pb:dns_record_identifier() | grpcbox_client:options()) -> - {ok, controller_pb:dns_record(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_dns_record(Ctx, Input) when ?is_ctx(Ctx) -> - get_dns_record(Ctx, Input, #{}); -get_dns_record(Input, Options) -> - get_dns_record(ctx:new(), Input, Options). - --spec get_dns_record(ctx:t(), controller_pb:dns_record_identifier(), grpcbox_client:options()) -> - {ok, controller_pb:dns_record(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_dns_record(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/ControllerService/GetDNSRecord">>, Input, ?DEF(dns_record_identifier, dns_record, <<"DNSRecordIdentifier">>), Options). - -%% @doc Unary RPC --spec list_dns_records(controller_pb:list_dns_records_request()) -> - {ok, controller_pb:list_dns_records_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_dns_records(Input) -> - list_dns_records(ctx:new(), Input, #{}). - --spec list_dns_records(ctx:t() | controller_pb:list_dns_records_request(), controller_pb:list_dns_records_request() | grpcbox_client:options()) -> - {ok, controller_pb:list_dns_records_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_dns_records(Ctx, Input) when ?is_ctx(Ctx) -> - list_dns_records(Ctx, Input, #{}); -list_dns_records(Input, Options) -> - list_dns_records(ctx:new(), Input, Options). - --spec list_dns_records(ctx:t(), controller_pb:list_dns_records_request(), grpcbox_client:options()) -> - {ok, controller_pb:list_dns_records_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_dns_records(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/ControllerService/ListDNSRecords">>, Input, ?DEF(list_dns_records_request, list_dns_records_response, <<"ListDNSRecordsRequest">>), Options). - -%% @doc Unary RPC --spec put_dns_record(controller_pb:put_dns_record_request()) -> - {ok, controller_pb:dns_record(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -put_dns_record(Input) -> - put_dns_record(ctx:new(), Input, #{}). - --spec put_dns_record(ctx:t() | controller_pb:put_dns_record_request(), controller_pb:put_dns_record_request() | grpcbox_client:options()) -> - {ok, controller_pb:dns_record(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -put_dns_record(Ctx, Input) when ?is_ctx(Ctx) -> - put_dns_record(Ctx, Input, #{}); -put_dns_record(Input, Options) -> - put_dns_record(ctx:new(), Input, Options). - --spec put_dns_record(ctx:t(), controller_pb:put_dns_record_request(), grpcbox_client:options()) -> - {ok, controller_pb:dns_record(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -put_dns_record(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/ControllerService/PutDNSRecord">>, Input, ?DEF(put_dns_record_request, dns_record, <<"PutDNSRecordRequest">>), Options). - -%% @doc Unary RPC --spec delete_dns_record(controller_pb:dns_record_identifier()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_dns_record(Input) -> - delete_dns_record(ctx:new(), Input, #{}). - --spec delete_dns_record(ctx:t() | controller_pb:dns_record_identifier(), controller_pb:dns_record_identifier() | grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_dns_record(Ctx, Input) when ?is_ctx(Ctx) -> - delete_dns_record(Ctx, Input, #{}); -delete_dns_record(Input, Options) -> - delete_dns_record(ctx:new(), Input, Options). - --spec delete_dns_record(ctx:t(), controller_pb:dns_record_identifier(), grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_dns_record(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/ControllerService/DeleteDNSRecord">>, Input, ?DEF(dns_record_identifier, empty, <<"DNSRecordIdentifier">>), Options). - -%% @doc Unary RPC --spec get_network(controller_pb:get_network_request()) -> - {ok, controller_pb:network(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_network(Input) -> - get_network(ctx:new(), Input, #{}). - --spec get_network(ctx:t() | controller_pb:get_network_request(), controller_pb:get_network_request() | grpcbox_client:options()) -> - {ok, controller_pb:network(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_network(Ctx, Input) when ?is_ctx(Ctx) -> - get_network(Ctx, Input, #{}); -get_network(Input, Options) -> - get_network(ctx:new(), Input, Options). - --spec get_network(ctx:t(), controller_pb:get_network_request(), grpcbox_client:options()) -> - {ok, controller_pb:network(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_network(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/ControllerService/GetNetwork">>, Input, ?DEF(get_network_request, network, <<"GetNetworkRequest">>), Options). - -%% @doc Unary RPC --spec list_networks(controller_pb:list_networks_request()) -> - {ok, controller_pb:list_networks_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_networks(Input) -> - list_networks(ctx:new(), Input, #{}). - --spec list_networks(ctx:t() | controller_pb:list_networks_request(), controller_pb:list_networks_request() | grpcbox_client:options()) -> - {ok, controller_pb:list_networks_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_networks(Ctx, Input) when ?is_ctx(Ctx) -> - list_networks(Ctx, Input, #{}); -list_networks(Input, Options) -> - list_networks(ctx:new(), Input, Options). - --spec list_networks(ctx:t(), controller_pb:list_networks_request(), grpcbox_client:options()) -> - {ok, controller_pb:list_networks_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_networks(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/ControllerService/ListNetworks">>, Input, ?DEF(list_networks_request, list_networks_response, <<"ListNetworksRequest">>), Options). - -%% @doc Unary RPC --spec create_network(controller_pb:create_network_request()) -> - {ok, controller_pb:network(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -create_network(Input) -> - create_network(ctx:new(), Input, #{}). - --spec create_network(ctx:t() | controller_pb:create_network_request(), controller_pb:create_network_request() | grpcbox_client:options()) -> - {ok, controller_pb:network(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -create_network(Ctx, Input) when ?is_ctx(Ctx) -> - create_network(Ctx, Input, #{}); -create_network(Input, Options) -> - create_network(ctx:new(), Input, Options). - --spec create_network(ctx:t(), controller_pb:create_network_request(), grpcbox_client:options()) -> - {ok, controller_pb:network(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -create_network(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/ControllerService/CreateNetwork">>, Input, ?DEF(create_network_request, network, <<"CreateNetworkRequest">>), Options). - -%% @doc Unary RPC --spec delete_network(controller_pb:delete_network_request()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_network(Input) -> - delete_network(ctx:new(), Input, #{}). - --spec delete_network(ctx:t() | controller_pb:delete_network_request(), controller_pb:delete_network_request() | grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_network(Ctx, Input) when ?is_ctx(Ctx) -> - delete_network(Ctx, Input, #{}); -delete_network(Input, Options) -> - delete_network(ctx:new(), Input, Options). - --spec delete_network(ctx:t(), controller_pb:delete_network_request(), grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_network(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/ControllerService/DeleteNetwork">>, Input, ?DEF(delete_network_request, empty, <<"DeleteNetworkRequest">>), Options). - -%% @doc Unary RPC --spec start_domain(controller_pb:start_domain_request()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -start_domain(Input) -> - start_domain(ctx:new(), Input, #{}). - --spec start_domain(ctx:t() | controller_pb:start_domain_request(), controller_pb:start_domain_request() | grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -start_domain(Ctx, Input) when ?is_ctx(Ctx) -> - start_domain(Ctx, Input, #{}); -start_domain(Input, Options) -> - start_domain(ctx:new(), Input, Options). - --spec start_domain(ctx:t(), controller_pb:start_domain_request(), grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -start_domain(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/ControllerService/StartDomain">>, Input, ?DEF(start_domain_request, empty, <<"StartDomainRequest">>), Options). - -%% @doc Unary RPC --spec stop_domain(controller_pb:stop_domain_request()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -stop_domain(Input) -> - stop_domain(ctx:new(), Input, #{}). - --spec stop_domain(ctx:t() | controller_pb:stop_domain_request(), controller_pb:stop_domain_request() | grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -stop_domain(Ctx, Input) when ?is_ctx(Ctx) -> - stop_domain(Ctx, Input, #{}); -stop_domain(Input, Options) -> - stop_domain(ctx:new(), Input, Options). - --spec stop_domain(ctx:t(), controller_pb:stop_domain_request(), grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -stop_domain(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/ControllerService/StopDomain">>, Input, ?DEF(stop_domain_request, empty, <<"StopDomainRequest">>), Options). - -%% @doc Unary RPC --spec get_domain(controller_pb:get_domain_request()) -> - {ok, controller_pb:domain(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_domain(Input) -> - get_domain(ctx:new(), Input, #{}). - --spec get_domain(ctx:t() | controller_pb:get_domain_request(), controller_pb:get_domain_request() | grpcbox_client:options()) -> - {ok, controller_pb:domain(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_domain(Ctx, Input) when ?is_ctx(Ctx) -> - get_domain(Ctx, Input, #{}); -get_domain(Input, Options) -> - get_domain(ctx:new(), Input, Options). - --spec get_domain(ctx:t(), controller_pb:get_domain_request(), grpcbox_client:options()) -> - {ok, controller_pb:domain(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_domain(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/ControllerService/GetDomain">>, Input, ?DEF(get_domain_request, domain, <<"GetDomainRequest">>), Options). - -%% @doc Unary RPC --spec list_domains(controller_pb:list_domains_request()) -> - {ok, controller_pb:list_domains_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_domains(Input) -> - list_domains(ctx:new(), Input, #{}). - --spec list_domains(ctx:t() | controller_pb:list_domains_request(), controller_pb:list_domains_request() | grpcbox_client:options()) -> - {ok, controller_pb:list_domains_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_domains(Ctx, Input) when ?is_ctx(Ctx) -> - list_domains(Ctx, Input, #{}); -list_domains(Input, Options) -> - list_domains(ctx:new(), Input, Options). - --spec list_domains(ctx:t(), controller_pb:list_domains_request(), grpcbox_client:options()) -> - {ok, controller_pb:list_domains_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_domains(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/ControllerService/ListDomains">>, Input, ?DEF(list_domains_request, list_domains_response, <<"ListDomainsRequest">>), Options). - -%% @doc Unary RPC --spec create_domain(controller_pb:create_domain_request()) -> - {ok, controller_pb:domain(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -create_domain(Input) -> - create_domain(ctx:new(), Input, #{}). - --spec create_domain(ctx:t() | controller_pb:create_domain_request(), controller_pb:create_domain_request() | grpcbox_client:options()) -> - {ok, controller_pb:domain(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -create_domain(Ctx, Input) when ?is_ctx(Ctx) -> - create_domain(Ctx, Input, #{}); -create_domain(Input, Options) -> - create_domain(ctx:new(), Input, Options). - --spec create_domain(ctx:t(), controller_pb:create_domain_request(), grpcbox_client:options()) -> - {ok, controller_pb:domain(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -create_domain(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/ControllerService/CreateDomain">>, Input, ?DEF(create_domain_request, domain, <<"CreateDomainRequest">>), Options). - -%% @doc Unary RPC --spec delete_domain(controller_pb:delete_domain_request()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_domain(Input) -> - delete_domain(ctx:new(), Input, #{}). - --spec delete_domain(ctx:t() | controller_pb:delete_domain_request(), controller_pb:delete_domain_request() | grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_domain(Ctx, Input) when ?is_ctx(Ctx) -> - delete_domain(Ctx, Input, #{}); -delete_domain(Input, Options) -> - delete_domain(ctx:new(), Input, Options). - --spec delete_domain(ctx:t(), controller_pb:delete_domain_request(), grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_domain(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/ControllerService/DeleteDomain">>, Input, ?DEF(delete_domain_request, empty, <<"DeleteDomainRequest">>), Options). - -%% @doc --spec download_image(controller_pb:download_image_request()) -> - {ok, grpcbox_client:stream()} | grpcbox_stream:grpc_error_response() | {error, any()}. -download_image(Input) -> - download_image(ctx:new(), Input, #{}). - --spec download_image(ctx:t() | controller_pb:download_image_request(), controller_pb:download_image_request() | grpcbox_client:options()) -> - {ok, grpcbox_client:stream()} | grpcbox_stream:grpc_error_response() | {error, any()}. -download_image(Ctx, Input) when ?is_ctx(Ctx) -> - download_image(Ctx, Input, #{}); -download_image(Input, Options) -> - download_image(ctx:new(), Input, Options). - --spec download_image(ctx:t(), controller_pb:download_image_request(), grpcbox_client:options()) -> - {ok, grpcbox_client:stream()} | grpcbox_stream:grpc_error_response() | {error, any()}. -download_image(Ctx, Input, Options) -> - grpcbox_client:stream(Ctx, <<"/ControllerService/DownloadImage">>, Input, ?DEF(download_image_request, image_chunk, <<"DownloadImageRequest">>), Options). - -%% @doc Unary RPC --spec get_volume(controller_pb:get_volume_request()) -> - {ok, controller_pb:volume(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_volume(Input) -> - get_volume(ctx:new(), Input, #{}). - --spec get_volume(ctx:t() | controller_pb:get_volume_request(), controller_pb:get_volume_request() | grpcbox_client:options()) -> - {ok, controller_pb:volume(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_volume(Ctx, Input) when ?is_ctx(Ctx) -> - get_volume(Ctx, Input, #{}); -get_volume(Input, Options) -> - get_volume(ctx:new(), Input, Options). - --spec get_volume(ctx:t(), controller_pb:get_volume_request(), grpcbox_client:options()) -> - {ok, controller_pb:volume(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_volume(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/ControllerService/GetVolume">>, Input, ?DEF(get_volume_request, volume, <<"GetVolumeRequest">>), Options). - -%% @doc Unary RPC --spec list_volumes(controller_pb:list_volumes_request()) -> - {ok, controller_pb:list_volumes_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_volumes(Input) -> - list_volumes(ctx:new(), Input, #{}). - --spec list_volumes(ctx:t() | controller_pb:list_volumes_request(), controller_pb:list_volumes_request() | grpcbox_client:options()) -> - {ok, controller_pb:list_volumes_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_volumes(Ctx, Input) when ?is_ctx(Ctx) -> - list_volumes(Ctx, Input, #{}); -list_volumes(Input, Options) -> - list_volumes(ctx:new(), Input, Options). - --spec list_volumes(ctx:t(), controller_pb:list_volumes_request(), grpcbox_client:options()) -> - {ok, controller_pb:list_volumes_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_volumes(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/ControllerService/ListVolumes">>, Input, ?DEF(list_volumes_request, list_volumes_response, <<"ListVolumesRequest">>), Options). - -%% @doc Unary RPC --spec create_volume(controller_pb:create_volume_request()) -> - {ok, controller_pb:volume(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -create_volume(Input) -> - create_volume(ctx:new(), Input, #{}). - --spec create_volume(ctx:t() | controller_pb:create_volume_request(), controller_pb:create_volume_request() | grpcbox_client:options()) -> - {ok, controller_pb:volume(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -create_volume(Ctx, Input) when ?is_ctx(Ctx) -> - create_volume(Ctx, Input, #{}); -create_volume(Input, Options) -> - create_volume(ctx:new(), Input, Options). - --spec create_volume(ctx:t(), controller_pb:create_volume_request(), grpcbox_client:options()) -> - {ok, controller_pb:volume(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -create_volume(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/ControllerService/CreateVolume">>, Input, ?DEF(create_volume_request, volume, <<"CreateVolumeRequest">>), Options). - -%% @doc Unary RPC --spec update_volume(controller_pb:update_volume_request()) -> - {ok, controller_pb:volume(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -update_volume(Input) -> - update_volume(ctx:new(), Input, #{}). - --spec update_volume(ctx:t() | controller_pb:update_volume_request(), controller_pb:update_volume_request() | grpcbox_client:options()) -> - {ok, controller_pb:volume(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -update_volume(Ctx, Input) when ?is_ctx(Ctx) -> - update_volume(Ctx, Input, #{}); -update_volume(Input, Options) -> - update_volume(ctx:new(), Input, Options). - --spec update_volume(ctx:t(), controller_pb:update_volume_request(), grpcbox_client:options()) -> - {ok, controller_pb:volume(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -update_volume(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/ControllerService/UpdateVolume">>, Input, ?DEF(update_volume_request, volume, <<"UpdateVolumeRequest">>), Options). - -%% @doc Unary RPC --spec delete_volume(controller_pb:delete_volume_request()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_volume(Input) -> - delete_volume(ctx:new(), Input, #{}). - --spec delete_volume(ctx:t() | controller_pb:delete_volume_request(), controller_pb:delete_volume_request() | grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_volume(Ctx, Input) when ?is_ctx(Ctx) -> - delete_volume(Ctx, Input, #{}); -delete_volume(Input, Options) -> - delete_volume(ctx:new(), Input, Options). - --spec delete_volume(ctx:t(), controller_pb:delete_volume_request(), grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_volume(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/ControllerService/DeleteVolume">>, Input, ?DEF(delete_volume_request, empty, <<"DeleteVolumeRequest">>), Options). - -%% @doc Unary RPC --spec list_volume_attachments(controller_pb:list_volume_attachments_request()) -> - {ok, controller_pb:list_volume_attachments_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_volume_attachments(Input) -> - list_volume_attachments(ctx:new(), Input, #{}). - --spec list_volume_attachments(ctx:t() | controller_pb:list_volume_attachments_request(), controller_pb:list_volume_attachments_request() | grpcbox_client:options()) -> - {ok, controller_pb:list_volume_attachments_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_volume_attachments(Ctx, Input) when ?is_ctx(Ctx) -> - list_volume_attachments(Ctx, Input, #{}); -list_volume_attachments(Input, Options) -> - list_volume_attachments(ctx:new(), Input, Options). - --spec list_volume_attachments(ctx:t(), controller_pb:list_volume_attachments_request(), grpcbox_client:options()) -> - {ok, controller_pb:list_volume_attachments_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_volume_attachments(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/ControllerService/ListVolumeAttachments">>, Input, ?DEF(list_volume_attachments_request, list_volume_attachments_response, <<"ListVolumeAttachmentsRequest">>), Options). - -%% @doc Unary RPC --spec get_volume_attachment(controller_pb:volume_attachment_identifier()) -> - {ok, controller_pb:volume_attachment(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_volume_attachment(Input) -> - get_volume_attachment(ctx:new(), Input, #{}). - --spec get_volume_attachment(ctx:t() | controller_pb:volume_attachment_identifier(), controller_pb:volume_attachment_identifier() | grpcbox_client:options()) -> - {ok, controller_pb:volume_attachment(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_volume_attachment(Ctx, Input) when ?is_ctx(Ctx) -> - get_volume_attachment(Ctx, Input, #{}); -get_volume_attachment(Input, Options) -> - get_volume_attachment(ctx:new(), Input, Options). - --spec get_volume_attachment(ctx:t(), controller_pb:volume_attachment_identifier(), grpcbox_client:options()) -> - {ok, controller_pb:volume_attachment(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_volume_attachment(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/ControllerService/GetVolumeAttachment">>, Input, ?DEF(volume_attachment_identifier, volume_attachment, <<"VolumeAttachmentIdentifier">>), Options). - -%% @doc Unary RPC --spec attach_volume(controller_pb:volume_attachment_identifier()) -> - {ok, controller_pb:volume_attachment(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -attach_volume(Input) -> - attach_volume(ctx:new(), Input, #{}). - --spec attach_volume(ctx:t() | controller_pb:volume_attachment_identifier(), controller_pb:volume_attachment_identifier() | grpcbox_client:options()) -> - {ok, controller_pb:volume_attachment(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -attach_volume(Ctx, Input) when ?is_ctx(Ctx) -> - attach_volume(Ctx, Input, #{}); -attach_volume(Input, Options) -> - attach_volume(ctx:new(), Input, Options). - --spec attach_volume(ctx:t(), controller_pb:volume_attachment_identifier(), grpcbox_client:options()) -> - {ok, controller_pb:volume_attachment(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -attach_volume(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/ControllerService/AttachVolume">>, Input, ?DEF(volume_attachment_identifier, volume_attachment, <<"VolumeAttachmentIdentifier">>), Options). - -%% @doc Unary RPC --spec detach_volume(controller_pb:volume_attachment_identifier()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -detach_volume(Input) -> - detach_volume(ctx:new(), Input, #{}). - --spec detach_volume(ctx:t() | controller_pb:volume_attachment_identifier(), controller_pb:volume_attachment_identifier() | grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -detach_volume(Ctx, Input) when ?is_ctx(Ctx) -> - detach_volume(Ctx, Input, #{}); -detach_volume(Input, Options) -> - detach_volume(ctx:new(), Input, Options). - --spec detach_volume(ctx:t(), controller_pb:volume_attachment_identifier(), grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -detach_volume(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/ControllerService/DetachVolume">>, Input, ?DEF(volume_attachment_identifier, empty, <<"VolumeAttachmentIdentifier">>), Options). - -%% @doc Unary RPC --spec get_port_forwarding(controller_pb:port_forwarding_identifier()) -> - {ok, controller_pb:port_forwarding(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_port_forwarding(Input) -> - get_port_forwarding(ctx:new(), Input, #{}). - --spec get_port_forwarding(ctx:t() | controller_pb:port_forwarding_identifier(), controller_pb:port_forwarding_identifier() | grpcbox_client:options()) -> - {ok, controller_pb:port_forwarding(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_port_forwarding(Ctx, Input) when ?is_ctx(Ctx) -> - get_port_forwarding(Ctx, Input, #{}); -get_port_forwarding(Input, Options) -> - get_port_forwarding(ctx:new(), Input, Options). - --spec get_port_forwarding(ctx:t(), controller_pb:port_forwarding_identifier(), grpcbox_client:options()) -> - {ok, controller_pb:port_forwarding(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_port_forwarding(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/ControllerService/GetPortForwarding">>, Input, ?DEF(port_forwarding_identifier, port_forwarding, <<"PortForwardingIdentifier">>), Options). - -%% @doc Unary RPC --spec list_port_forwardings(controller_pb:list_port_forwardings_request()) -> - {ok, controller_pb:list_port_forwardings_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_port_forwardings(Input) -> - list_port_forwardings(ctx:new(), Input, #{}). - --spec list_port_forwardings(ctx:t() | controller_pb:list_port_forwardings_request(), controller_pb:list_port_forwardings_request() | grpcbox_client:options()) -> - {ok, controller_pb:list_port_forwardings_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_port_forwardings(Ctx, Input) when ?is_ctx(Ctx) -> - list_port_forwardings(Ctx, Input, #{}); -list_port_forwardings(Input, Options) -> - list_port_forwardings(ctx:new(), Input, Options). - --spec list_port_forwardings(ctx:t(), controller_pb:list_port_forwardings_request(), grpcbox_client:options()) -> - {ok, controller_pb:list_port_forwardings_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_port_forwardings(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/ControllerService/ListPortForwardings">>, Input, ?DEF(list_port_forwardings_request, list_port_forwardings_response, <<"ListPortForwardingsRequest">>), Options). - -%% @doc Unary RPC --spec put_port_forwarding(controller_pb:put_port_forwarding_request()) -> - {ok, controller_pb:port_forwarding(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -put_port_forwarding(Input) -> - put_port_forwarding(ctx:new(), Input, #{}). - --spec put_port_forwarding(ctx:t() | controller_pb:put_port_forwarding_request(), controller_pb:put_port_forwarding_request() | grpcbox_client:options()) -> - {ok, controller_pb:port_forwarding(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -put_port_forwarding(Ctx, Input) when ?is_ctx(Ctx) -> - put_port_forwarding(Ctx, Input, #{}); -put_port_forwarding(Input, Options) -> - put_port_forwarding(ctx:new(), Input, Options). - --spec put_port_forwarding(ctx:t(), controller_pb:put_port_forwarding_request(), grpcbox_client:options()) -> - {ok, controller_pb:port_forwarding(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -put_port_forwarding(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/ControllerService/PutPortForwarding">>, Input, ?DEF(put_port_forwarding_request, port_forwarding, <<"PutPortForwardingRequest">>), Options). - -%% @doc Unary RPC --spec delete_port_forwarding(controller_pb:port_forwarding_identifier()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_port_forwarding(Input) -> - delete_port_forwarding(ctx:new(), Input, #{}). - --spec delete_port_forwarding(ctx:t() | controller_pb:port_forwarding_identifier(), controller_pb:port_forwarding_identifier() | grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_port_forwarding(Ctx, Input) when ?is_ctx(Ctx) -> - delete_port_forwarding(Ctx, Input, #{}); -delete_port_forwarding(Input, Options) -> - delete_port_forwarding(ctx:new(), Input, Options). - --spec delete_port_forwarding(ctx:t(), controller_pb:port_forwarding_identifier(), grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_port_forwarding(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/ControllerService/DeletePortForwarding">>, Input, ?DEF(port_forwarding_identifier, empty, <<"PortForwardingIdentifier">>), Options). - -%% @doc Unary RPC --spec get_route_table(controller_pb:route_table_identifier()) -> - {ok, controller_pb:route_table(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_route_table(Input) -> - get_route_table(ctx:new(), Input, #{}). - --spec get_route_table(ctx:t() | controller_pb:route_table_identifier(), controller_pb:route_table_identifier() | grpcbox_client:options()) -> - {ok, controller_pb:route_table(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_route_table(Ctx, Input) when ?is_ctx(Ctx) -> - get_route_table(Ctx, Input, #{}); -get_route_table(Input, Options) -> - get_route_table(ctx:new(), Input, Options). - --spec get_route_table(ctx:t(), controller_pb:route_table_identifier(), grpcbox_client:options()) -> - {ok, controller_pb:route_table(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_route_table(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/ControllerService/GetRouteTable">>, Input, ?DEF(route_table_identifier, route_table, <<"RouteTableIdentifier">>), Options). - -%% @doc Unary RPC --spec list_route_tables(controller_pb:list_route_tables_request()) -> - {ok, controller_pb:list_route_tables_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_route_tables(Input) -> - list_route_tables(ctx:new(), Input, #{}). - --spec list_route_tables(ctx:t() | controller_pb:list_route_tables_request(), controller_pb:list_route_tables_request() | grpcbox_client:options()) -> - {ok, controller_pb:list_route_tables_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_route_tables(Ctx, Input) when ?is_ctx(Ctx) -> - list_route_tables(Ctx, Input, #{}); -list_route_tables(Input, Options) -> - list_route_tables(ctx:new(), Input, Options). - --spec list_route_tables(ctx:t(), controller_pb:list_route_tables_request(), grpcbox_client:options()) -> - {ok, controller_pb:list_route_tables_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_route_tables(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/ControllerService/ListRouteTables">>, Input, ?DEF(list_route_tables_request, list_route_tables_response, <<"ListRouteTablesRequest">>), Options). - -%% @doc Unary RPC --spec create_route_table(controller_pb:create_route_table_request()) -> - {ok, controller_pb:route_table(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -create_route_table(Input) -> - create_route_table(ctx:new(), Input, #{}). - --spec create_route_table(ctx:t() | controller_pb:create_route_table_request(), controller_pb:create_route_table_request() | grpcbox_client:options()) -> - {ok, controller_pb:route_table(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -create_route_table(Ctx, Input) when ?is_ctx(Ctx) -> - create_route_table(Ctx, Input, #{}); -create_route_table(Input, Options) -> - create_route_table(ctx:new(), Input, Options). - --spec create_route_table(ctx:t(), controller_pb:create_route_table_request(), grpcbox_client:options()) -> - {ok, controller_pb:route_table(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -create_route_table(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/ControllerService/CreateRouteTable">>, Input, ?DEF(create_route_table_request, route_table, <<"CreateRouteTableRequest">>), Options). - -%% @doc Unary RPC --spec delete_route_table(controller_pb:route_table_identifier()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_route_table(Input) -> - delete_route_table(ctx:new(), Input, #{}). - --spec delete_route_table(ctx:t() | controller_pb:route_table_identifier(), controller_pb:route_table_identifier() | grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_route_table(Ctx, Input) when ?is_ctx(Ctx) -> - delete_route_table(Ctx, Input, #{}); -delete_route_table(Input, Options) -> - delete_route_table(ctx:new(), Input, Options). - --spec delete_route_table(ctx:t(), controller_pb:route_table_identifier(), grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_route_table(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/ControllerService/DeleteRouteTable">>, Input, ?DEF(route_table_identifier, empty, <<"RouteTableIdentifier">>), Options). - -%% @doc Unary RPC --spec get_route(controller_pb:route_identifier()) -> - {ok, controller_pb:route(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_route(Input) -> - get_route(ctx:new(), Input, #{}). - --spec get_route(ctx:t() | controller_pb:route_identifier(), controller_pb:route_identifier() | grpcbox_client:options()) -> - {ok, controller_pb:route(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_route(Ctx, Input) when ?is_ctx(Ctx) -> - get_route(Ctx, Input, #{}); -get_route(Input, Options) -> - get_route(ctx:new(), Input, Options). - --spec get_route(ctx:t(), controller_pb:route_identifier(), grpcbox_client:options()) -> - {ok, controller_pb:route(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_route(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/ControllerService/GetRoute">>, Input, ?DEF(route_identifier, route, <<"RouteIdentifier">>), Options). - -%% @doc Unary RPC --spec list_routes(controller_pb:list_routes_request()) -> - {ok, controller_pb:list_routes_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_routes(Input) -> - list_routes(ctx:new(), Input, #{}). - --spec list_routes(ctx:t() | controller_pb:list_routes_request(), controller_pb:list_routes_request() | grpcbox_client:options()) -> - {ok, controller_pb:list_routes_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_routes(Ctx, Input) when ?is_ctx(Ctx) -> - list_routes(Ctx, Input, #{}); -list_routes(Input, Options) -> - list_routes(ctx:new(), Input, Options). - --spec list_routes(ctx:t(), controller_pb:list_routes_request(), grpcbox_client:options()) -> - {ok, controller_pb:list_routes_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_routes(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/ControllerService/ListRoutes">>, Input, ?DEF(list_routes_request, list_routes_response, <<"ListRoutesRequest">>), Options). - -%% @doc Unary RPC --spec put_route(controller_pb:put_route_request()) -> - {ok, controller_pb:route(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -put_route(Input) -> - put_route(ctx:new(), Input, #{}). - --spec put_route(ctx:t() | controller_pb:put_route_request(), controller_pb:put_route_request() | grpcbox_client:options()) -> - {ok, controller_pb:route(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -put_route(Ctx, Input) when ?is_ctx(Ctx) -> - put_route(Ctx, Input, #{}); -put_route(Input, Options) -> - put_route(ctx:new(), Input, Options). - --spec put_route(ctx:t(), controller_pb:put_route_request(), grpcbox_client:options()) -> - {ok, controller_pb:route(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -put_route(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/ControllerService/PutRoute">>, Input, ?DEF(put_route_request, route, <<"PutRouteRequest">>), Options). - -%% @doc Unary RPC --spec delete_route(controller_pb:route_identifier()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_route(Input) -> - delete_route(ctx:new(), Input, #{}). - --spec delete_route(ctx:t() | controller_pb:route_identifier(), controller_pb:route_identifier() | grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_route(Ctx, Input) when ?is_ctx(Ctx) -> - delete_route(Ctx, Input, #{}); -delete_route(Input, Options) -> - delete_route(ctx:new(), Input, Options). - --spec delete_route(ctx:t(), controller_pb:route_identifier(), grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_route(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/ControllerService/DeleteRoute">>, Input, ?DEF(route_identifier, empty, <<"RouteIdentifier">>), Options). - -%% @doc Unary RPC --spec sync_routes(controller_pb:sync_routes_request()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -sync_routes(Input) -> - sync_routes(ctx:new(), Input, #{}). - --spec sync_routes(ctx:t() | controller_pb:sync_routes_request(), controller_pb:sync_routes_request() | grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -sync_routes(Ctx, Input) when ?is_ctx(Ctx) -> - sync_routes(Ctx, Input, #{}); -sync_routes(Input, Options) -> - sync_routes(ctx:new(), Input, Options). - --spec sync_routes(ctx:t(), controller_pb:sync_routes_request(), grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -sync_routes(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/ControllerService/SyncRoutes">>, Input, ?DEF(sync_routes_request, empty, <<"SyncRoutesRequest">>), Options). - diff --git a/virtuerl/src/pb/daemon_pb.erl b/virtuerl/src/pb/daemon_pb.erl deleted file mode 100644 index 47d53fc..0000000 --- a/virtuerl/src/pb/daemon_pb.erl +++ /dev/null @@ -1,5962 +0,0 @@ -%% -*- coding: utf-8 -*- -%% @private -%% Automatically generated, do not edit -%% Generated by gpb_compile version 4.19.8 -%% Version source: file --module(daemon_pb). - --export([encode_msg/2, encode_msg/3]). --export([decode_msg/2, decode_msg/3]). --export([merge_msgs/3, merge_msgs/4]). --export([verify_msg/2, verify_msg/3]). --export([get_msg_defs/0]). --export([get_msg_names/0]). --export([get_group_names/0]). --export([get_msg_or_group_names/0]). --export([get_enum_names/0]). --export([find_msg_def/1, fetch_msg_def/1]). --export([find_enum_def/1, fetch_enum_def/1]). --export([enum_symbol_by_value/2, enum_value_by_symbol/2]). --export([get_service_names/0]). --export([get_service_def/1]). --export([get_rpc_names/1]). --export([find_rpc_def/2, fetch_rpc_def/2]). --export([fqbin_to_service_name/1]). --export([service_name_to_fqbin/1]). --export([fqbins_to_service_and_rpc_name/2]). --export([service_and_rpc_name_to_fqbins/2]). --export([fqbin_to_msg_name/1]). --export([msg_name_to_fqbin/1]). --export([fqbin_to_enum_name/1]). --export([enum_name_to_fqbin/1]). --export([get_package_name/0]). --export([uses_packages/0]). --export([source_basename/0]). --export([get_all_source_basenames/0]). --export([get_all_proto_names/0]). --export([get_msg_containment/1]). --export([get_pkg_containment/1]). --export([get_service_containment/1]). --export([get_rpc_containment/1]). --export([get_enum_containment/1]). --export([get_proto_by_msg_name_as_fqbin/1]). --export([get_proto_by_service_name_as_fqbin/1]). --export([get_proto_by_enum_name_as_fqbin/1]). --export([get_protos_by_pkg_name_as_fqbin/1]). --export([gpb_version_as_string/0, gpb_version_as_list/0]). --export([gpb_version_source/0]). - - -%% enumerated types - --export_type([]). - -%% message types --type sync_routes_request() :: - #{ - }. - --type empty() :: - #{ - }. - --type start_domain_request() :: - #{host => unicode:chardata(), % = 1, optional - uuid => unicode:chardata() % = 2, optional - }. - --type stop_domain_request() :: - #{host => unicode:chardata(), % = 1, optional - uuid => unicode:chardata(), % = 2, optional - force => boolean() | 0 | 1 % = 3, optional - }. - --type get_domain_request() :: - #{uuid => unicode:chardata(), % = 1, optional - host => unicode:chardata() % = 2, optional - }. - --type domain() :: - #{id => non_neg_integer(), % = 1, optional, 64 bits - uuid => unicode:chardata(), % = 2, optional - name => unicode:chardata(), % = 3, optional - vcpu => non_neg_integer(), % = 4, optional, 32 bits - memory => non_neg_integer(), % = 5, optional, 64 bits - network => unicode:chardata(), % = 6, optional - bridge => unicode:chardata(), % = 7, optional - state => unicode:chardata(), % = 8, optional - private_ip => unicode:chardata(), % = 9, optional - ipv6_address => unicode:chardata(), % = 15, optional - user_data => unicode:chardata(), % = 10, optional - nested_virtualization => boolean() | 0 | 1, % = 11, optional - base_image => unicode:chardata(), % = 12, optional - created_at => timestamp(), % = 13, optional - os_type => unicode:chardata() % = 14, optional - }. - --type list_domains_request() :: - #{host => unicode:chardata() % = 1, optional - }. - --type list_domains_response() :: - #{domains => [domain()] % = 1, repeated - }. - --type create_domain_request() :: - #{domain => domain(), % = 1, optional - host => unicode:chardata() % = 2, optional - }. - --type delete_domain_request() :: - #{uuid => unicode:chardata(), % = 1, optional - host => unicode:chardata() % = 2, optional - }. - --type download_image_request() :: - #{domain_id => unicode:chardata(), % = 1, optional - host => unicode:chardata() % = 2, optional - }. - --type image_chunk() :: - #{bytes => iodata() % = 1, optional - }. - --type get_network_request() :: - #{uuid => unicode:chardata(), % = 1, optional - host => unicode:chardata() % = 2, optional - }. - --type network() :: - #{uuid => unicode:chardata(), % = 1, optional - name => unicode:chardata(), % = 2, optional - cidr => unicode:chardata(), % = 3, optional - cidr6 => unicode:chardata() % = 4, optional - }. - --type list_networks_request() :: - #{host => unicode:chardata() % = 1, optional - }. - --type list_networks_response() :: - #{networks => [network()] % = 1, repeated - }. - --type create_network_request() :: - #{network => network(), % = 1, optional - host => unicode:chardata() % = 2, optional - }. - --type delete_network_request() :: - #{uuid => unicode:chardata(), % = 1, optional - host => unicode:chardata() % = 2, optional - }. - --type get_volume_request() :: - #{uuid => unicode:chardata(), % = 1, optional - host => unicode:chardata() % = 2, optional - }. - --type volume() :: - #{id => unicode:chardata(), % = 1, optional - name => unicode:chardata(), % = 2, optional - size => non_neg_integer() % = 3, optional, 64 bits - }. - --type list_volumes_request() :: - #{host => unicode:chardata() % = 1, optional - }. - --type list_volumes_response() :: - #{volumes => [volume()] % = 1, repeated - }. - --type create_volume_request() :: - #{volume => volume(), % = 1, optional - host => unicode:chardata() % = 2, optional - }. - --type update_volume_request() :: - #{host => unicode:chardata(), % = 1, optional - volume => volume() % = 2, optional - }. - --type delete_volume_request() :: - #{uuid => unicode:chardata(), % = 1, optional - host => unicode:chardata() % = 2, optional - }. - --type volume_attachment_identifier() :: - #{domain_id => unicode:chardata(), % = 1, optional - volume_id => unicode:chardata(), % = 2, optional - host => unicode:chardata() % = 3, optional - }. - --type volume_attachment() :: - #{domain_id => unicode:chardata(), % = 1, optional - volume_id => unicode:chardata(), % = 2, optional - disk_address => unicode:chardata() % = 3, optional - }. - --type list_volume_attachments_request() :: - #{domain_id => unicode:chardata(), % = 1, optional - host => unicode:chardata() % = 2, optional - }. - --type list_volume_attachments_response() :: - #{attachments => [volume_attachment()] % = 1, repeated - }. - --type port_forwarding_identifier() :: - #{host => unicode:chardata(), % = 1, optional - protocol => unicode:chardata(), % = 2, optional - source_port => non_neg_integer() % = 3, optional, 32 bits - }. - --type port_forwarding() :: - #{protocol => unicode:chardata(), % = 2, optional - source_port => non_neg_integer(), % = 3, optional, 32 bits - target_ip => unicode:chardata(), % = 4, optional - target_port => non_neg_integer() % = 5, optional, 32 bits - }. - --type list_port_forwardings_request() :: - #{host => unicode:chardata() % = 1, optional - }. - --type list_port_forwardings_response() :: - #{port_forwardings => [port_forwarding()] % = 1, repeated - }. - --type put_port_forwarding_request() :: - #{port_forwarding => port_forwarding(), % = 1, optional - host => unicode:chardata() % = 2, optional - }. - --type timestamp() :: - #{seconds => integer(), % = 1, optional, 64 bits - nanos => integer() % = 2, optional, 32 bits - }. - --export_type(['sync_routes_request'/0, 'empty'/0, 'start_domain_request'/0, 'stop_domain_request'/0, 'get_domain_request'/0, 'domain'/0, 'list_domains_request'/0, 'list_domains_response'/0, 'create_domain_request'/0, 'delete_domain_request'/0, 'download_image_request'/0, 'image_chunk'/0, 'get_network_request'/0, 'network'/0, 'list_networks_request'/0, 'list_networks_response'/0, 'create_network_request'/0, 'delete_network_request'/0, 'get_volume_request'/0, 'volume'/0, 'list_volumes_request'/0, 'list_volumes_response'/0, 'create_volume_request'/0, 'update_volume_request'/0, 'delete_volume_request'/0, 'volume_attachment_identifier'/0, 'volume_attachment'/0, 'list_volume_attachments_request'/0, 'list_volume_attachments_response'/0, 'port_forwarding_identifier'/0, 'port_forwarding'/0, 'list_port_forwardings_request'/0, 'list_port_forwardings_response'/0, 'put_port_forwarding_request'/0, 'timestamp'/0]). --type '$msg_name'() :: sync_routes_request | empty | start_domain_request | stop_domain_request | get_domain_request | domain | list_domains_request | list_domains_response | create_domain_request | delete_domain_request | download_image_request | image_chunk | get_network_request | network | list_networks_request | list_networks_response | create_network_request | delete_network_request | get_volume_request | volume | list_volumes_request | list_volumes_response | create_volume_request | update_volume_request | delete_volume_request | volume_attachment_identifier | volume_attachment | list_volume_attachments_request | list_volume_attachments_response | port_forwarding_identifier | port_forwarding | list_port_forwardings_request | list_port_forwardings_response | put_port_forwarding_request | timestamp. --type '$msg'() :: sync_routes_request() | empty() | start_domain_request() | stop_domain_request() | get_domain_request() | domain() | list_domains_request() | list_domains_response() | create_domain_request() | delete_domain_request() | download_image_request() | image_chunk() | get_network_request() | network() | list_networks_request() | list_networks_response() | create_network_request() | delete_network_request() | get_volume_request() | volume() | list_volumes_request() | list_volumes_response() | create_volume_request() | update_volume_request() | delete_volume_request() | volume_attachment_identifier() | volume_attachment() | list_volume_attachments_request() | list_volume_attachments_response() | port_forwarding_identifier() | port_forwarding() | list_port_forwardings_request() | list_port_forwardings_response() | put_port_forwarding_request() | timestamp(). --export_type(['$msg_name'/0, '$msg'/0]). - --if(?OTP_RELEASE >= 24). --dialyzer({no_underspecs, encode_msg/2}). --endif. --spec encode_msg('$msg'(), '$msg_name'()) -> binary(). -encode_msg(Msg, MsgName) when is_atom(MsgName) -> encode_msg(Msg, MsgName, []). - --if(?OTP_RELEASE >= 24). --dialyzer({no_underspecs, encode_msg/3}). --endif. --spec encode_msg('$msg'(), '$msg_name'(), list()) -> binary(). -encode_msg(Msg, MsgName, Opts) -> - case proplists:get_bool(verify, Opts) of - true -> verify_msg(Msg, MsgName, Opts); - false -> ok - end, - TrUserData = proplists:get_value(user_data, Opts), - case MsgName of - sync_routes_request -> encode_msg_sync_routes_request(id(Msg, TrUserData), TrUserData); - empty -> encode_msg_empty(id(Msg, TrUserData), TrUserData); - start_domain_request -> encode_msg_start_domain_request(id(Msg, TrUserData), TrUserData); - stop_domain_request -> encode_msg_stop_domain_request(id(Msg, TrUserData), TrUserData); - get_domain_request -> encode_msg_get_domain_request(id(Msg, TrUserData), TrUserData); - domain -> encode_msg_domain(id(Msg, TrUserData), TrUserData); - list_domains_request -> encode_msg_list_domains_request(id(Msg, TrUserData), TrUserData); - list_domains_response -> encode_msg_list_domains_response(id(Msg, TrUserData), TrUserData); - create_domain_request -> encode_msg_create_domain_request(id(Msg, TrUserData), TrUserData); - delete_domain_request -> encode_msg_delete_domain_request(id(Msg, TrUserData), TrUserData); - download_image_request -> encode_msg_download_image_request(id(Msg, TrUserData), TrUserData); - image_chunk -> encode_msg_image_chunk(id(Msg, TrUserData), TrUserData); - get_network_request -> encode_msg_get_network_request(id(Msg, TrUserData), TrUserData); - network -> encode_msg_network(id(Msg, TrUserData), TrUserData); - list_networks_request -> encode_msg_list_networks_request(id(Msg, TrUserData), TrUserData); - list_networks_response -> encode_msg_list_networks_response(id(Msg, TrUserData), TrUserData); - create_network_request -> encode_msg_create_network_request(id(Msg, TrUserData), TrUserData); - delete_network_request -> encode_msg_delete_network_request(id(Msg, TrUserData), TrUserData); - get_volume_request -> encode_msg_get_volume_request(id(Msg, TrUserData), TrUserData); - volume -> encode_msg_volume(id(Msg, TrUserData), TrUserData); - list_volumes_request -> encode_msg_list_volumes_request(id(Msg, TrUserData), TrUserData); - list_volumes_response -> encode_msg_list_volumes_response(id(Msg, TrUserData), TrUserData); - create_volume_request -> encode_msg_create_volume_request(id(Msg, TrUserData), TrUserData); - update_volume_request -> encode_msg_update_volume_request(id(Msg, TrUserData), TrUserData); - delete_volume_request -> encode_msg_delete_volume_request(id(Msg, TrUserData), TrUserData); - volume_attachment_identifier -> encode_msg_volume_attachment_identifier(id(Msg, TrUserData), TrUserData); - volume_attachment -> encode_msg_volume_attachment(id(Msg, TrUserData), TrUserData); - list_volume_attachments_request -> encode_msg_list_volume_attachments_request(id(Msg, TrUserData), TrUserData); - list_volume_attachments_response -> encode_msg_list_volume_attachments_response(id(Msg, TrUserData), TrUserData); - port_forwarding_identifier -> encode_msg_port_forwarding_identifier(id(Msg, TrUserData), TrUserData); - port_forwarding -> encode_msg_port_forwarding(id(Msg, TrUserData), TrUserData); - list_port_forwardings_request -> encode_msg_list_port_forwardings_request(id(Msg, TrUserData), TrUserData); - list_port_forwardings_response -> encode_msg_list_port_forwardings_response(id(Msg, TrUserData), TrUserData); - put_port_forwarding_request -> encode_msg_put_port_forwarding_request(id(Msg, TrUserData), TrUserData); - timestamp -> encode_msg_timestamp(id(Msg, TrUserData), TrUserData) - end. - - -encode_msg_sync_routes_request(_Msg, _TrUserData) -> <<>>. - -encode_msg_empty(_Msg, _TrUserData) -> <<>>. - -encode_msg_start_domain_request(Msg, TrUserData) -> encode_msg_start_domain_request(Msg, <<>>, TrUserData). - - -encode_msg_start_domain_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{host := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{uuid := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_stop_domain_request(Msg, TrUserData) -> encode_msg_stop_domain_request(Msg, <<>>, TrUserData). - - -encode_msg_stop_domain_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{host := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - B2 = case M of - #{uuid := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end, - case M of - #{force := F3} -> - begin - TrF3 = id(F3, TrUserData), - if TrF3 =:= false -> B2; - true -> e_type_bool(TrF3, <>, TrUserData) - end - end; - _ -> B2 - end. - -encode_msg_get_domain_request(Msg, TrUserData) -> encode_msg_get_domain_request(Msg, <<>>, TrUserData). - - -encode_msg_get_domain_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{uuid := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{host := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_domain(Msg, TrUserData) -> encode_msg_domain(Msg, <<>>, TrUserData). - - -encode_msg_domain(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{id := F1} -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= 0 -> Bin; - true -> e_varint(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - B2 = case M of - #{uuid := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end, - B3 = case M of - #{name := F3} -> - begin - TrF3 = id(F3, TrUserData), - case is_empty_string(TrF3) of - true -> B2; - false -> e_type_string(TrF3, <>, TrUserData) - end - end; - _ -> B2 - end, - B4 = case M of - #{vcpu := F4} -> - begin - TrF4 = id(F4, TrUserData), - if TrF4 =:= 0 -> B3; - true -> e_varint(TrF4, <>, TrUserData) - end - end; - _ -> B3 - end, - B5 = case M of - #{memory := F5} -> - begin - TrF5 = id(F5, TrUserData), - if TrF5 =:= 0 -> B4; - true -> e_varint(TrF5, <>, TrUserData) - end - end; - _ -> B4 - end, - B6 = case M of - #{network := F6} -> - begin - TrF6 = id(F6, TrUserData), - case is_empty_string(TrF6) of - true -> B5; - false -> e_type_string(TrF6, <>, TrUserData) - end - end; - _ -> B5 - end, - B7 = case M of - #{bridge := F7} -> - begin - TrF7 = id(F7, TrUserData), - case is_empty_string(TrF7) of - true -> B6; - false -> e_type_string(TrF7, <>, TrUserData) - end - end; - _ -> B6 - end, - B8 = case M of - #{state := F8} -> - begin - TrF8 = id(F8, TrUserData), - case is_empty_string(TrF8) of - true -> B7; - false -> e_type_string(TrF8, <>, TrUserData) - end - end; - _ -> B7 - end, - B9 = case M of - #{private_ip := F9} -> - begin - TrF9 = id(F9, TrUserData), - case is_empty_string(TrF9) of - true -> B8; - false -> e_type_string(TrF9, <>, TrUserData) - end - end; - _ -> B8 - end, - B10 = case M of - #{ipv6_address := F10} -> - begin - TrF10 = id(F10, TrUserData), - case is_empty_string(TrF10) of - true -> B9; - false -> e_type_string(TrF10, <>, TrUserData) - end - end; - _ -> B9 - end, - B11 = case M of - #{user_data := F11} -> - begin - TrF11 = id(F11, TrUserData), - case is_empty_string(TrF11) of - true -> B10; - false -> e_type_string(TrF11, <>, TrUserData) - end - end; - _ -> B10 - end, - B12 = case M of - #{nested_virtualization := F12} -> - begin - TrF12 = id(F12, TrUserData), - if TrF12 =:= false -> B11; - true -> e_type_bool(TrF12, <>, TrUserData) - end - end; - _ -> B11 - end, - B13 = case M of - #{base_image := F13} -> - begin - TrF13 = id(F13, TrUserData), - case is_empty_string(TrF13) of - true -> B12; - false -> e_type_string(TrF13, <>, TrUserData) - end - end; - _ -> B12 - end, - B14 = case M of - #{created_at := F14} -> - begin - TrF14 = id(F14, TrUserData), - if TrF14 =:= undefined -> B13; - true -> e_mfield_domain_created_at(TrF14, <>, TrUserData) - end - end; - _ -> B13 - end, - case M of - #{os_type := F15} -> - begin - TrF15 = id(F15, TrUserData), - case is_empty_string(TrF15) of - true -> B14; - false -> e_type_string(TrF15, <>, TrUserData) - end - end; - _ -> B14 - end. - -encode_msg_list_domains_request(Msg, TrUserData) -> encode_msg_list_domains_request(Msg, <<>>, TrUserData). - - -encode_msg_list_domains_request(#{} = M, Bin, TrUserData) -> - case M of - #{host := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end. - -encode_msg_list_domains_response(Msg, TrUserData) -> encode_msg_list_domains_response(Msg, <<>>, TrUserData). - - -encode_msg_list_domains_response(#{} = M, Bin, TrUserData) -> - case M of - #{domains := F1} -> - TrF1 = id(F1, TrUserData), - if TrF1 == [] -> Bin; - true -> e_field_list_domains_response_domains(TrF1, Bin, TrUserData) - end; - _ -> Bin - end. - -encode_msg_create_domain_request(Msg, TrUserData) -> encode_msg_create_domain_request(Msg, <<>>, TrUserData). - - -encode_msg_create_domain_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{domain := F1} -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= undefined -> Bin; - true -> e_mfield_create_domain_request_domain(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{host := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_delete_domain_request(Msg, TrUserData) -> encode_msg_delete_domain_request(Msg, <<>>, TrUserData). - - -encode_msg_delete_domain_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{uuid := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{host := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_download_image_request(Msg, TrUserData) -> encode_msg_download_image_request(Msg, <<>>, TrUserData). - - -encode_msg_download_image_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{domain_id := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{host := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_image_chunk(Msg, TrUserData) -> encode_msg_image_chunk(Msg, <<>>, TrUserData). - - -encode_msg_image_chunk(#{} = M, Bin, TrUserData) -> - case M of - #{bytes := F1} -> - begin - TrF1 = id(F1, TrUserData), - case iolist_size(TrF1) of - 0 -> Bin; - _ -> e_type_bytes(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end. - -encode_msg_get_network_request(Msg, TrUserData) -> encode_msg_get_network_request(Msg, <<>>, TrUserData). - - -encode_msg_get_network_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{uuid := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{host := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_network(Msg, TrUserData) -> encode_msg_network(Msg, <<>>, TrUserData). - - -encode_msg_network(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{uuid := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - B2 = case M of - #{name := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end, - B3 = case M of - #{cidr := F3} -> - begin - TrF3 = id(F3, TrUserData), - case is_empty_string(TrF3) of - true -> B2; - false -> e_type_string(TrF3, <>, TrUserData) - end - end; - _ -> B2 - end, - case M of - #{cidr6 := F4} -> - begin - TrF4 = id(F4, TrUserData), - case is_empty_string(TrF4) of - true -> B3; - false -> e_type_string(TrF4, <>, TrUserData) - end - end; - _ -> B3 - end. - -encode_msg_list_networks_request(Msg, TrUserData) -> encode_msg_list_networks_request(Msg, <<>>, TrUserData). - - -encode_msg_list_networks_request(#{} = M, Bin, TrUserData) -> - case M of - #{host := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end. - -encode_msg_list_networks_response(Msg, TrUserData) -> encode_msg_list_networks_response(Msg, <<>>, TrUserData). - - -encode_msg_list_networks_response(#{} = M, Bin, TrUserData) -> - case M of - #{networks := F1} -> - TrF1 = id(F1, TrUserData), - if TrF1 == [] -> Bin; - true -> e_field_list_networks_response_networks(TrF1, Bin, TrUserData) - end; - _ -> Bin - end. - -encode_msg_create_network_request(Msg, TrUserData) -> encode_msg_create_network_request(Msg, <<>>, TrUserData). - - -encode_msg_create_network_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{network := F1} -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= undefined -> Bin; - true -> e_mfield_create_network_request_network(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{host := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_delete_network_request(Msg, TrUserData) -> encode_msg_delete_network_request(Msg, <<>>, TrUserData). - - -encode_msg_delete_network_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{uuid := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{host := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_get_volume_request(Msg, TrUserData) -> encode_msg_get_volume_request(Msg, <<>>, TrUserData). - - -encode_msg_get_volume_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{uuid := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{host := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_volume(Msg, TrUserData) -> encode_msg_volume(Msg, <<>>, TrUserData). - - -encode_msg_volume(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{id := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - B2 = case M of - #{name := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end, - case M of - #{size := F3} -> - begin - TrF3 = id(F3, TrUserData), - if TrF3 =:= 0 -> B2; - true -> e_varint(TrF3, <>, TrUserData) - end - end; - _ -> B2 - end. - -encode_msg_list_volumes_request(Msg, TrUserData) -> encode_msg_list_volumes_request(Msg, <<>>, TrUserData). - - -encode_msg_list_volumes_request(#{} = M, Bin, TrUserData) -> - case M of - #{host := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end. - -encode_msg_list_volumes_response(Msg, TrUserData) -> encode_msg_list_volumes_response(Msg, <<>>, TrUserData). - - -encode_msg_list_volumes_response(#{} = M, Bin, TrUserData) -> - case M of - #{volumes := F1} -> - TrF1 = id(F1, TrUserData), - if TrF1 == [] -> Bin; - true -> e_field_list_volumes_response_volumes(TrF1, Bin, TrUserData) - end; - _ -> Bin - end. - -encode_msg_create_volume_request(Msg, TrUserData) -> encode_msg_create_volume_request(Msg, <<>>, TrUserData). - - -encode_msg_create_volume_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{volume := F1} -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= undefined -> Bin; - true -> e_mfield_create_volume_request_volume(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{host := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_update_volume_request(Msg, TrUserData) -> encode_msg_update_volume_request(Msg, <<>>, TrUserData). - - -encode_msg_update_volume_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{host := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{volume := F2} -> - begin - TrF2 = id(F2, TrUserData), - if TrF2 =:= undefined -> B1; - true -> e_mfield_update_volume_request_volume(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_delete_volume_request(Msg, TrUserData) -> encode_msg_delete_volume_request(Msg, <<>>, TrUserData). - - -encode_msg_delete_volume_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{uuid := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{host := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_volume_attachment_identifier(Msg, TrUserData) -> encode_msg_volume_attachment_identifier(Msg, <<>>, TrUserData). - - -encode_msg_volume_attachment_identifier(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{domain_id := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - B2 = case M of - #{volume_id := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end, - case M of - #{host := F3} -> - begin - TrF3 = id(F3, TrUserData), - case is_empty_string(TrF3) of - true -> B2; - false -> e_type_string(TrF3, <>, TrUserData) - end - end; - _ -> B2 - end. - -encode_msg_volume_attachment(Msg, TrUserData) -> encode_msg_volume_attachment(Msg, <<>>, TrUserData). - - -encode_msg_volume_attachment(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{domain_id := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - B2 = case M of - #{volume_id := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end, - case M of - #{disk_address := F3} -> - begin - TrF3 = id(F3, TrUserData), - case is_empty_string(TrF3) of - true -> B2; - false -> e_type_string(TrF3, <>, TrUserData) - end - end; - _ -> B2 - end. - -encode_msg_list_volume_attachments_request(Msg, TrUserData) -> encode_msg_list_volume_attachments_request(Msg, <<>>, TrUserData). - - -encode_msg_list_volume_attachments_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{domain_id := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{host := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_list_volume_attachments_response(Msg, TrUserData) -> encode_msg_list_volume_attachments_response(Msg, <<>>, TrUserData). - - -encode_msg_list_volume_attachments_response(#{} = M, Bin, TrUserData) -> - case M of - #{attachments := F1} -> - TrF1 = id(F1, TrUserData), - if TrF1 == [] -> Bin; - true -> e_field_list_volume_attachments_response_attachments(TrF1, Bin, TrUserData) - end; - _ -> Bin - end. - -encode_msg_port_forwarding_identifier(Msg, TrUserData) -> encode_msg_port_forwarding_identifier(Msg, <<>>, TrUserData). - - -encode_msg_port_forwarding_identifier(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{host := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - B2 = case M of - #{protocol := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end, - case M of - #{source_port := F3} -> - begin - TrF3 = id(F3, TrUserData), - if TrF3 =:= 0 -> B2; - true -> e_varint(TrF3, <>, TrUserData) - end - end; - _ -> B2 - end. - -encode_msg_port_forwarding(Msg, TrUserData) -> encode_msg_port_forwarding(Msg, <<>>, TrUserData). - - -encode_msg_port_forwarding(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{protocol := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - B2 = case M of - #{source_port := F2} -> - begin - TrF2 = id(F2, TrUserData), - if TrF2 =:= 0 -> B1; - true -> e_varint(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end, - B3 = case M of - #{target_ip := F3} -> - begin - TrF3 = id(F3, TrUserData), - case is_empty_string(TrF3) of - true -> B2; - false -> e_type_string(TrF3, <>, TrUserData) - end - end; - _ -> B2 - end, - case M of - #{target_port := F4} -> - begin - TrF4 = id(F4, TrUserData), - if TrF4 =:= 0 -> B3; - true -> e_varint(TrF4, <>, TrUserData) - end - end; - _ -> B3 - end. - -encode_msg_list_port_forwardings_request(Msg, TrUserData) -> encode_msg_list_port_forwardings_request(Msg, <<>>, TrUserData). - - -encode_msg_list_port_forwardings_request(#{} = M, Bin, TrUserData) -> - case M of - #{host := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end. - -encode_msg_list_port_forwardings_response(Msg, TrUserData) -> encode_msg_list_port_forwardings_response(Msg, <<>>, TrUserData). - - -encode_msg_list_port_forwardings_response(#{} = M, Bin, TrUserData) -> - case M of - #{port_forwardings := F1} -> - TrF1 = id(F1, TrUserData), - if TrF1 == [] -> Bin; - true -> e_field_list_port_forwardings_response_port_forwardings(TrF1, Bin, TrUserData) - end; - _ -> Bin - end. - -encode_msg_put_port_forwarding_request(Msg, TrUserData) -> encode_msg_put_port_forwarding_request(Msg, <<>>, TrUserData). - - -encode_msg_put_port_forwarding_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{port_forwarding := F1} -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= undefined -> Bin; - true -> e_mfield_put_port_forwarding_request_port_forwarding(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{host := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_timestamp(Msg, TrUserData) -> encode_msg_timestamp(Msg, <<>>, TrUserData). - - -encode_msg_timestamp(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{seconds := F1} -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= 0 -> Bin; - true -> e_type_int64(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{nanos := F2} -> - begin - TrF2 = id(F2, TrUserData), - if TrF2 =:= 0 -> B1; - true -> e_type_int32(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -e_mfield_domain_created_at(Msg, Bin, TrUserData) -> - SubBin = encode_msg_timestamp(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_mfield_list_domains_response_domains(Msg, Bin, TrUserData) -> - SubBin = encode_msg_domain(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_field_list_domains_response_domains([Elem | Rest], Bin, TrUserData) -> - Bin2 = <>, - Bin3 = e_mfield_list_domains_response_domains(id(Elem, TrUserData), Bin2, TrUserData), - e_field_list_domains_response_domains(Rest, Bin3, TrUserData); -e_field_list_domains_response_domains([], Bin, _TrUserData) -> Bin. - -e_mfield_create_domain_request_domain(Msg, Bin, TrUserData) -> - SubBin = encode_msg_domain(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_mfield_list_networks_response_networks(Msg, Bin, TrUserData) -> - SubBin = encode_msg_network(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_field_list_networks_response_networks([Elem | Rest], Bin, TrUserData) -> - Bin2 = <>, - Bin3 = e_mfield_list_networks_response_networks(id(Elem, TrUserData), Bin2, TrUserData), - e_field_list_networks_response_networks(Rest, Bin3, TrUserData); -e_field_list_networks_response_networks([], Bin, _TrUserData) -> Bin. - -e_mfield_create_network_request_network(Msg, Bin, TrUserData) -> - SubBin = encode_msg_network(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_mfield_list_volumes_response_volumes(Msg, Bin, TrUserData) -> - SubBin = encode_msg_volume(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_field_list_volumes_response_volumes([Elem | Rest], Bin, TrUserData) -> - Bin2 = <>, - Bin3 = e_mfield_list_volumes_response_volumes(id(Elem, TrUserData), Bin2, TrUserData), - e_field_list_volumes_response_volumes(Rest, Bin3, TrUserData); -e_field_list_volumes_response_volumes([], Bin, _TrUserData) -> Bin. - -e_mfield_create_volume_request_volume(Msg, Bin, TrUserData) -> - SubBin = encode_msg_volume(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_mfield_update_volume_request_volume(Msg, Bin, TrUserData) -> - SubBin = encode_msg_volume(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_mfield_list_volume_attachments_response_attachments(Msg, Bin, TrUserData) -> - SubBin = encode_msg_volume_attachment(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_field_list_volume_attachments_response_attachments([Elem | Rest], Bin, TrUserData) -> - Bin2 = <>, - Bin3 = e_mfield_list_volume_attachments_response_attachments(id(Elem, TrUserData), Bin2, TrUserData), - e_field_list_volume_attachments_response_attachments(Rest, Bin3, TrUserData); -e_field_list_volume_attachments_response_attachments([], Bin, _TrUserData) -> Bin. - -e_mfield_list_port_forwardings_response_port_forwardings(Msg, Bin, TrUserData) -> - SubBin = encode_msg_port_forwarding(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_field_list_port_forwardings_response_port_forwardings([Elem | Rest], Bin, TrUserData) -> - Bin2 = <>, - Bin3 = e_mfield_list_port_forwardings_response_port_forwardings(id(Elem, TrUserData), Bin2, TrUserData), - e_field_list_port_forwardings_response_port_forwardings(Rest, Bin3, TrUserData); -e_field_list_port_forwardings_response_port_forwardings([], Bin, _TrUserData) -> Bin. - -e_mfield_put_port_forwarding_request_port_forwarding(Msg, Bin, TrUserData) -> - SubBin = encode_msg_port_forwarding(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - --compile({nowarn_unused_function,e_type_sint/3}). -e_type_sint(Value, Bin, _TrUserData) when Value >= 0 -> e_varint(Value * 2, Bin); -e_type_sint(Value, Bin, _TrUserData) -> e_varint(Value * -2 - 1, Bin). - --compile({nowarn_unused_function,e_type_int32/3}). -e_type_int32(Value, Bin, _TrUserData) when 0 =< Value, Value =< 127 -> <>; -e_type_int32(Value, Bin, _TrUserData) -> - <> = <>, - e_varint(N, Bin). - --compile({nowarn_unused_function,e_type_int64/3}). -e_type_int64(Value, Bin, _TrUserData) when 0 =< Value, Value =< 127 -> <>; -e_type_int64(Value, Bin, _TrUserData) -> - <> = <>, - e_varint(N, Bin). - --compile({nowarn_unused_function,e_type_bool/3}). -e_type_bool(true, Bin, _TrUserData) -> <>; -e_type_bool(false, Bin, _TrUserData) -> <>; -e_type_bool(1, Bin, _TrUserData) -> <>; -e_type_bool(0, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_string/3}). -e_type_string(S, Bin, _TrUserData) -> - Utf8 = unicode:characters_to_binary(S), - Bin2 = e_varint(byte_size(Utf8), Bin), - <>. - --compile({nowarn_unused_function,e_type_bytes/3}). -e_type_bytes(Bytes, Bin, _TrUserData) when is_binary(Bytes) -> - Bin2 = e_varint(byte_size(Bytes), Bin), - <>; -e_type_bytes(Bytes, Bin, _TrUserData) when is_list(Bytes) -> - BytesBin = iolist_to_binary(Bytes), - Bin2 = e_varint(byte_size(BytesBin), Bin), - <>. - --compile({nowarn_unused_function,e_type_fixed32/3}). -e_type_fixed32(Value, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_sfixed32/3}). -e_type_sfixed32(Value, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_fixed64/3}). -e_type_fixed64(Value, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_sfixed64/3}). -e_type_sfixed64(Value, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_float/3}). -e_type_float(V, Bin, _) when is_number(V) -> <>; -e_type_float(infinity, Bin, _) -> <>; -e_type_float('-infinity', Bin, _) -> <>; -e_type_float(nan, Bin, _) -> <>. - --compile({nowarn_unused_function,e_type_double/3}). -e_type_double(V, Bin, _) when is_number(V) -> <>; -e_type_double(infinity, Bin, _) -> <>; -e_type_double('-infinity', Bin, _) -> <>; -e_type_double(nan, Bin, _) -> <>. - --compile({nowarn_unused_function,e_unknown_elems/2}). -e_unknown_elems([Elem | Rest], Bin) -> - BinR = case Elem of - {varint, FNum, N} -> - BinF = e_varint(FNum bsl 3, Bin), - e_varint(N, BinF); - {length_delimited, FNum, Data} -> - BinF = e_varint(FNum bsl 3 bor 2, Bin), - BinL = e_varint(byte_size(Data), BinF), - <>; - {group, FNum, GroupFields} -> - Bin1 = e_varint(FNum bsl 3 bor 3, Bin), - Bin2 = e_unknown_elems(GroupFields, Bin1), - e_varint(FNum bsl 3 bor 4, Bin2); - {fixed32, FNum, V} -> - BinF = e_varint(FNum bsl 3 bor 5, Bin), - <>; - {fixed64, FNum, V} -> - BinF = e_varint(FNum bsl 3 bor 1, Bin), - <> - end, - e_unknown_elems(Rest, BinR); -e_unknown_elems([], Bin) -> Bin. - --compile({nowarn_unused_function,e_varint/3}). -e_varint(N, Bin, _TrUserData) -> e_varint(N, Bin). - --compile({nowarn_unused_function,e_varint/2}). -e_varint(N, Bin) when N =< 127 -> <>; -e_varint(N, Bin) -> - Bin2 = <>, - e_varint(N bsr 7, Bin2). - -is_empty_string("") -> true; -is_empty_string(<<>>) -> true; -is_empty_string(L) when is_list(L) -> not string_has_chars(L); -is_empty_string(B) when is_binary(B) -> false. - -string_has_chars([C | _]) when is_integer(C) -> true; -string_has_chars([H | T]) -> - case string_has_chars(H) of - true -> true; - false -> string_has_chars(T) - end; -string_has_chars(B) when is_binary(B), byte_size(B) =/= 0 -> true; -string_has_chars(C) when is_integer(C) -> true; -string_has_chars(<<>>) -> false; -string_has_chars([]) -> false. - - -decode_msg(Bin, MsgName) when is_binary(Bin) -> decode_msg(Bin, MsgName, []). - -decode_msg(Bin, MsgName, Opts) when is_binary(Bin) -> - TrUserData = proplists:get_value(user_data, Opts), - decode_msg_1_catch(Bin, MsgName, TrUserData). - --ifdef('OTP_RELEASE'). -decode_msg_1_catch(Bin, MsgName, TrUserData) -> - try decode_msg_2_doit(MsgName, Bin, TrUserData) - catch - error:{gpb_error,_}=Reason:StackTrace -> - erlang:raise(error, Reason, StackTrace); - Class:Reason:StackTrace -> error({gpb_error,{decoding_failure, {Bin, MsgName, {Class, Reason, StackTrace}}}}) - end. --else. -decode_msg_1_catch(Bin, MsgName, TrUserData) -> - try decode_msg_2_doit(MsgName, Bin, TrUserData) - catch - error:{gpb_error,_}=Reason -> - erlang:raise(error, Reason, - erlang:get_stacktrace()); - Class:Reason -> - StackTrace = erlang:get_stacktrace(), - error({gpb_error,{decoding_failure, {Bin, MsgName, {Class, Reason, StackTrace}}}}) - end. --endif. - -decode_msg_2_doit(sync_routes_request, Bin, TrUserData) -> id(decode_msg_sync_routes_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(empty, Bin, TrUserData) -> id(decode_msg_empty(Bin, TrUserData), TrUserData); -decode_msg_2_doit(start_domain_request, Bin, TrUserData) -> id(decode_msg_start_domain_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(stop_domain_request, Bin, TrUserData) -> id(decode_msg_stop_domain_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(get_domain_request, Bin, TrUserData) -> id(decode_msg_get_domain_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(domain, Bin, TrUserData) -> id(decode_msg_domain(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_domains_request, Bin, TrUserData) -> id(decode_msg_list_domains_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_domains_response, Bin, TrUserData) -> id(decode_msg_list_domains_response(Bin, TrUserData), TrUserData); -decode_msg_2_doit(create_domain_request, Bin, TrUserData) -> id(decode_msg_create_domain_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(delete_domain_request, Bin, TrUserData) -> id(decode_msg_delete_domain_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(download_image_request, Bin, TrUserData) -> id(decode_msg_download_image_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(image_chunk, Bin, TrUserData) -> id(decode_msg_image_chunk(Bin, TrUserData), TrUserData); -decode_msg_2_doit(get_network_request, Bin, TrUserData) -> id(decode_msg_get_network_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(network, Bin, TrUserData) -> id(decode_msg_network(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_networks_request, Bin, TrUserData) -> id(decode_msg_list_networks_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_networks_response, Bin, TrUserData) -> id(decode_msg_list_networks_response(Bin, TrUserData), TrUserData); -decode_msg_2_doit(create_network_request, Bin, TrUserData) -> id(decode_msg_create_network_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(delete_network_request, Bin, TrUserData) -> id(decode_msg_delete_network_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(get_volume_request, Bin, TrUserData) -> id(decode_msg_get_volume_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(volume, Bin, TrUserData) -> id(decode_msg_volume(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_volumes_request, Bin, TrUserData) -> id(decode_msg_list_volumes_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_volumes_response, Bin, TrUserData) -> id(decode_msg_list_volumes_response(Bin, TrUserData), TrUserData); -decode_msg_2_doit(create_volume_request, Bin, TrUserData) -> id(decode_msg_create_volume_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(update_volume_request, Bin, TrUserData) -> id(decode_msg_update_volume_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(delete_volume_request, Bin, TrUserData) -> id(decode_msg_delete_volume_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(volume_attachment_identifier, Bin, TrUserData) -> id(decode_msg_volume_attachment_identifier(Bin, TrUserData), TrUserData); -decode_msg_2_doit(volume_attachment, Bin, TrUserData) -> id(decode_msg_volume_attachment(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_volume_attachments_request, Bin, TrUserData) -> id(decode_msg_list_volume_attachments_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_volume_attachments_response, Bin, TrUserData) -> id(decode_msg_list_volume_attachments_response(Bin, TrUserData), TrUserData); -decode_msg_2_doit(port_forwarding_identifier, Bin, TrUserData) -> id(decode_msg_port_forwarding_identifier(Bin, TrUserData), TrUserData); -decode_msg_2_doit(port_forwarding, Bin, TrUserData) -> id(decode_msg_port_forwarding(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_port_forwardings_request, Bin, TrUserData) -> id(decode_msg_list_port_forwardings_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_port_forwardings_response, Bin, TrUserData) -> id(decode_msg_list_port_forwardings_response(Bin, TrUserData), TrUserData); -decode_msg_2_doit(put_port_forwarding_request, Bin, TrUserData) -> id(decode_msg_put_port_forwarding_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(timestamp, Bin, TrUserData) -> id(decode_msg_timestamp(Bin, TrUserData), TrUserData). - - - -decode_msg_sync_routes_request(Bin, TrUserData) -> dfp_read_field_def_sync_routes_request(Bin, 0, 0, 0, TrUserData). - -dfp_read_field_def_sync_routes_request(<<>>, 0, 0, _, _) -> #{}; -dfp_read_field_def_sync_routes_request(Other, Z1, Z2, F, TrUserData) -> dg_read_field_def_sync_routes_request(Other, Z1, Z2, F, TrUserData). - -dg_read_field_def_sync_routes_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 32 - 7 -> dg_read_field_def_sync_routes_request(Rest, N + 7, X bsl N + Acc, F, TrUserData); -dg_read_field_def_sync_routes_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, TrUserData) -> - Key = X bsl N + Acc, - case Key band 7 of - 0 -> skip_varint_sync_routes_request(Rest, 0, 0, Key bsr 3, TrUserData); - 1 -> skip_64_sync_routes_request(Rest, 0, 0, Key bsr 3, TrUserData); - 2 -> skip_length_delimited_sync_routes_request(Rest, 0, 0, Key bsr 3, TrUserData); - 3 -> skip_group_sync_routes_request(Rest, 0, 0, Key bsr 3, TrUserData); - 5 -> skip_32_sync_routes_request(Rest, 0, 0, Key bsr 3, TrUserData) - end; -dg_read_field_def_sync_routes_request(<<>>, 0, 0, _, _) -> #{}. - -skip_varint_sync_routes_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> skip_varint_sync_routes_request(Rest, Z1, Z2, F, TrUserData); -skip_varint_sync_routes_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_sync_routes_request(Rest, Z1, Z2, F, TrUserData). - -skip_length_delimited_sync_routes_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 57 -> skip_length_delimited_sync_routes_request(Rest, N + 7, X bsl N + Acc, F, TrUserData); -skip_length_delimited_sync_routes_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_sync_routes_request(Rest2, 0, 0, F, TrUserData). - -skip_group_sync_routes_request(Bin, _, Z2, FNum, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_sync_routes_request(Rest, 0, Z2, FNum, TrUserData). - -skip_32_sync_routes_request(<<_:32, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_sync_routes_request(Rest, Z1, Z2, F, TrUserData). - -skip_64_sync_routes_request(<<_:64, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_sync_routes_request(Rest, Z1, Z2, F, TrUserData). - -decode_msg_empty(Bin, TrUserData) -> dfp_read_field_def_empty(Bin, 0, 0, 0, TrUserData). - -dfp_read_field_def_empty(<<>>, 0, 0, _, _) -> #{}; -dfp_read_field_def_empty(Other, Z1, Z2, F, TrUserData) -> dg_read_field_def_empty(Other, Z1, Z2, F, TrUserData). - -dg_read_field_def_empty(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 32 - 7 -> dg_read_field_def_empty(Rest, N + 7, X bsl N + Acc, F, TrUserData); -dg_read_field_def_empty(<<0:1, X:7, Rest/binary>>, N, Acc, _, TrUserData) -> - Key = X bsl N + Acc, - case Key band 7 of - 0 -> skip_varint_empty(Rest, 0, 0, Key bsr 3, TrUserData); - 1 -> skip_64_empty(Rest, 0, 0, Key bsr 3, TrUserData); - 2 -> skip_length_delimited_empty(Rest, 0, 0, Key bsr 3, TrUserData); - 3 -> skip_group_empty(Rest, 0, 0, Key bsr 3, TrUserData); - 5 -> skip_32_empty(Rest, 0, 0, Key bsr 3, TrUserData) - end; -dg_read_field_def_empty(<<>>, 0, 0, _, _) -> #{}. - -skip_varint_empty(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> skip_varint_empty(Rest, Z1, Z2, F, TrUserData); -skip_varint_empty(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_empty(Rest, Z1, Z2, F, TrUserData). - -skip_length_delimited_empty(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 57 -> skip_length_delimited_empty(Rest, N + 7, X bsl N + Acc, F, TrUserData); -skip_length_delimited_empty(<<0:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_empty(Rest2, 0, 0, F, TrUserData). - -skip_group_empty(Bin, _, Z2, FNum, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_empty(Rest, 0, Z2, FNum, TrUserData). - -skip_32_empty(<<_:32, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_empty(Rest, Z1, Z2, F, TrUserData). - -skip_64_empty(<<_:64, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_empty(Rest, Z1, Z2, F, TrUserData). - -decode_msg_start_domain_request(Bin, TrUserData) -> dfp_read_field_def_start_domain_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_start_domain_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_start_domain_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_start_domain_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_start_domain_request_uuid(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_start_domain_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{host => F@_1, uuid => F@_2}; -dfp_read_field_def_start_domain_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_start_domain_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_start_domain_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_start_domain_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_start_domain_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_start_domain_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_start_domain_request_uuid(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_start_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_start_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_start_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_start_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_start_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_start_domain_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{host => F@_1, uuid => F@_2}. - -d_field_start_domain_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_start_domain_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_start_domain_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_start_domain_request(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_start_domain_request_uuid(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_start_domain_request_uuid(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_start_domain_request_uuid(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_start_domain_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_start_domain_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_start_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_start_domain_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_start_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_start_domain_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_start_domain_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_start_domain_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_start_domain_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_start_domain_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_start_domain_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_start_domain_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_start_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_start_domain_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_start_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_stop_domain_request(Bin, TrUserData) -> dfp_read_field_def_stop_domain_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), id(false, TrUserData), TrUserData). - -dfp_read_field_def_stop_domain_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_stop_domain_request_host(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_stop_domain_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_stop_domain_request_uuid(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_stop_domain_request(<<24, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_stop_domain_request_force(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_stop_domain_request(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{host => F@_1, uuid => F@_2, force => F@_3}; -dfp_read_field_def_stop_domain_request(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dg_read_field_def_stop_domain_request(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -dg_read_field_def_stop_domain_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 32 - 7 -> dg_read_field_def_stop_domain_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -dg_read_field_def_stop_domain_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_stop_domain_request_host(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 18 -> d_field_stop_domain_request_uuid(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 24 -> d_field_stop_domain_request_force(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_stop_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 1 -> skip_64_stop_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 2 -> skip_length_delimited_stop_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 3 -> skip_group_stop_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 5 -> skip_32_stop_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData) - end - end; -dg_read_field_def_stop_domain_request(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{host => F@_1, uuid => F@_2, force => F@_3}. - -d_field_stop_domain_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_stop_domain_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_stop_domain_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_stop_domain_request(RestF, 0, 0, F, NewFValue, F@_2, F@_3, TrUserData). - -d_field_stop_domain_request_uuid(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_stop_domain_request_uuid(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_stop_domain_request_uuid(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_stop_domain_request(RestF, 0, 0, F, F@_1, NewFValue, F@_3, TrUserData). - -d_field_stop_domain_request_force(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_stop_domain_request_force(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_stop_domain_request_force(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, TrUserData) -> - {NewFValue, RestF} = {id(X bsl N + Acc =/= 0, TrUserData), Rest}, - dfp_read_field_def_stop_domain_request(RestF, 0, 0, F, F@_1, F@_2, NewFValue, TrUserData). - -skip_varint_stop_domain_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> skip_varint_stop_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -skip_varint_stop_domain_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_stop_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_length_delimited_stop_domain_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> skip_length_delimited_stop_domain_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -skip_length_delimited_stop_domain_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_stop_domain_request(Rest2, 0, 0, F, F@_1, F@_2, F@_3, TrUserData). - -skip_group_stop_domain_request(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_stop_domain_request(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, TrUserData). - -skip_32_stop_domain_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_stop_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_64_stop_domain_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_stop_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -decode_msg_get_domain_request(Bin, TrUserData) -> dfp_read_field_def_get_domain_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_get_domain_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_get_domain_request_uuid(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_get_domain_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_get_domain_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_get_domain_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{uuid => F@_1, host => F@_2}; -dfp_read_field_def_get_domain_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_get_domain_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_get_domain_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_get_domain_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_get_domain_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_get_domain_request_uuid(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_get_domain_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_get_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_get_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_get_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_get_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_get_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_get_domain_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{uuid => F@_1, host => F@_2}. - -d_field_get_domain_request_uuid(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_get_domain_request_uuid(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_get_domain_request_uuid(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_get_domain_request(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_get_domain_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_get_domain_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_get_domain_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_get_domain_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_get_domain_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_get_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_get_domain_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_get_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_get_domain_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_get_domain_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_get_domain_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_get_domain_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_get_domain_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_get_domain_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_get_domain_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_get_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_get_domain_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_get_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_domain(Bin, TrUserData) -> - dfp_read_field_def_domain(Bin, - 0, - 0, - 0, - id(0, TrUserData), - id(<<>>, TrUserData), - id(<<>>, TrUserData), - id(0, TrUserData), - id(0, TrUserData), - id(<<>>, TrUserData), - id(<<>>, TrUserData), - id(<<>>, TrUserData), - id(<<>>, TrUserData), - id(<<>>, TrUserData), - id(<<>>, TrUserData), - id(false, TrUserData), - id(<<>>, TrUserData), - id('$undef', TrUserData), - id(<<>>, TrUserData), - TrUserData). - -dfp_read_field_def_domain(<<8, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_id(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_uuid(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<26, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_name(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_vcpu(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<40, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_memory(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<50, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_network(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<58, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_bridge(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<66, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_state(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<74, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_private_ip(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<122, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_ipv6_address(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<82, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_user_data(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<88, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_nested_virtualization(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<98, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_base_image(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<106, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_created_at(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<114, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_os_type(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, _) -> - S1 = #{id => F@_1, uuid => F@_2, name => F@_3, vcpu => F@_4, memory => F@_5, network => F@_6, bridge => F@_7, state => F@_8, private_ip => F@_9, ipv6_address => F@_10, user_data => F@_11, nested_virtualization => F@_12, base_image => F@_13, - os_type => F@_15}, - if F@_14 == '$undef' -> S1; - true -> S1#{created_at => F@_14} - end; -dfp_read_field_def_domain(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - dg_read_field_def_domain(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -dg_read_field_def_domain(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 32 - 7 -> - dg_read_field_def_domain(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dg_read_field_def_domain(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 8 -> d_field_domain_id(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 18 -> d_field_domain_uuid(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 26 -> d_field_domain_name(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 32 -> d_field_domain_vcpu(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 40 -> d_field_domain_memory(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 50 -> d_field_domain_network(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 58 -> d_field_domain_bridge(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 66 -> d_field_domain_state(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 74 -> d_field_domain_private_ip(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 122 -> d_field_domain_ipv6_address(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 82 -> d_field_domain_user_data(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 88 -> d_field_domain_nested_virtualization(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 98 -> d_field_domain_base_image(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 106 -> d_field_domain_created_at(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 114 -> d_field_domain_os_type(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_domain(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 1 -> skip_64_domain(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 2 -> skip_length_delimited_domain(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 3 -> skip_group_domain(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 5 -> skip_32_domain(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) - end - end; -dg_read_field_def_domain(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, _) -> - S1 = #{id => F@_1, uuid => F@_2, name => F@_3, vcpu => F@_4, memory => F@_5, network => F@_6, bridge => F@_7, state => F@_8, private_ip => F@_9, ipv6_address => F@_10, user_data => F@_11, nested_virtualization => F@_12, base_image => F@_13, - os_type => F@_15}, - if F@_14 == '$undef' -> S1; - true -> S1#{created_at => F@_14} - end. - -d_field_domain_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - {NewFValue, RestF} = {id((X bsl N + Acc) band 18446744073709551615, TrUserData), Rest}, - dfp_read_field_def_domain(RestF, 0, 0, F, NewFValue, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -d_field_domain_uuid(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_uuid(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_uuid(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_domain(RestF, 0, 0, F, F@_1, NewFValue, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -d_field_domain_name(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_name(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_name(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_domain(RestF, 0, 0, F, F@_1, F@_2, NewFValue, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -d_field_domain_vcpu(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_vcpu(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_vcpu(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, _, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - {NewFValue, RestF} = {id((X bsl N + Acc) band 4294967295, TrUserData), Rest}, - dfp_read_field_def_domain(RestF, 0, 0, F, F@_1, F@_2, F@_3, NewFValue, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -d_field_domain_memory(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_memory(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_memory(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, _, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - {NewFValue, RestF} = {id((X bsl N + Acc) band 18446744073709551615, TrUserData), Rest}, - dfp_read_field_def_domain(RestF, 0, 0, F, F@_1, F@_2, F@_3, F@_4, NewFValue, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -d_field_domain_network(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_network(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_network(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, _, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_domain(RestF, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, NewFValue, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -d_field_domain_bridge(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_bridge(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_bridge(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, _, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_domain(RestF, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, NewFValue, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -d_field_domain_state(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_state(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_state(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, _, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_domain(RestF, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, NewFValue, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -d_field_domain_private_ip(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_private_ip(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_private_ip(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, _, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_domain(RestF, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, NewFValue, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -d_field_domain_ipv6_address(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_ipv6_address(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_ipv6_address(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, _, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_domain(RestF, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, NewFValue, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -d_field_domain_user_data(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_user_data(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_user_data(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, _, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_domain(RestF, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, NewFValue, F@_12, F@_13, F@_14, F@_15, TrUserData). - -d_field_domain_nested_virtualization(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_nested_virtualization(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_nested_virtualization(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, _, F@_13, F@_14, F@_15, TrUserData) -> - {NewFValue, RestF} = {id(X bsl N + Acc =/= 0, TrUserData), Rest}, - dfp_read_field_def_domain(RestF, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, NewFValue, F@_13, F@_14, F@_15, TrUserData). - -d_field_domain_base_image(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_base_image(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_base_image(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, _, F@_14, F@_15, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_domain(RestF, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, NewFValue, F@_14, F@_15, TrUserData). - -d_field_domain_created_at(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_created_at(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_created_at(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, Prev, F@_15, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_timestamp(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_domain(RestF, - 0, - 0, - F, - F@_1, - F@_2, - F@_3, - F@_4, - F@_5, - F@_6, - F@_7, - F@_8, - F@_9, - F@_10, - F@_11, - F@_12, - F@_13, - if Prev == '$undef' -> NewFValue; - true -> merge_msg_timestamp(Prev, NewFValue, TrUserData) - end, - F@_15, - TrUserData). - -d_field_domain_os_type(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_os_type(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_os_type(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_domain(RestF, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, NewFValue, TrUserData). - -skip_varint_domain(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - skip_varint_domain(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -skip_varint_domain(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - dfp_read_field_def_domain(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -skip_length_delimited_domain(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - skip_length_delimited_domain(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -skip_length_delimited_domain(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_domain(Rest2, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -skip_group_domain(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_domain(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -skip_32_domain(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - dfp_read_field_def_domain(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -skip_64_domain(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - dfp_read_field_def_domain(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -decode_msg_list_domains_request(Bin, TrUserData) -> dfp_read_field_def_list_domains_request(Bin, 0, 0, 0, id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_list_domains_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_domains_request_host(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_list_domains_request(<<>>, 0, 0, _, F@_1, _) -> #{host => F@_1}; -dfp_read_field_def_list_domains_request(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_domains_request(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_list_domains_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_domains_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_list_domains_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_domains_request_host(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_domains_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_list_domains_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_list_domains_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_list_domains_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_list_domains_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_list_domains_request(<<>>, 0, 0, _, F@_1, _) -> #{host => F@_1}. - -d_field_list_domains_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_domains_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_list_domains_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_list_domains_request(RestF, 0, 0, F, NewFValue, TrUserData). - -skip_varint_list_domains_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_domains_request(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_list_domains_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_domains_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_list_domains_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_domains_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_list_domains_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_domains_request(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_list_domains_request(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_domains_request(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_list_domains_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_domains_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_list_domains_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_domains_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_list_domains_response(Bin, TrUserData) -> dfp_read_field_def_list_domains_response(Bin, 0, 0, 0, id([], TrUserData), TrUserData). - -dfp_read_field_def_list_domains_response(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_domains_response_domains(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_list_domains_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{domains => lists_reverse(R1, TrUserData)} - end; -dfp_read_field_def_list_domains_response(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_domains_response(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_list_domains_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_domains_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_list_domains_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_domains_response_domains(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_domains_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_list_domains_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_list_domains_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_list_domains_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_list_domains_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_list_domains_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{domains => lists_reverse(R1, TrUserData)} - end. - -d_field_list_domains_response_domains(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_domains_response_domains(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_list_domains_response_domains(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_domain(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_list_domains_response(RestF, 0, 0, F, cons(NewFValue, Prev, TrUserData), TrUserData). - -skip_varint_list_domains_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_domains_response(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_list_domains_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_domains_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_list_domains_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_domains_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_list_domains_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_domains_response(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_list_domains_response(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_domains_response(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_list_domains_response(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_domains_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_list_domains_response(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_domains_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_create_domain_request(Bin, TrUserData) -> dfp_read_field_def_create_domain_request(Bin, 0, 0, 0, id('$undef', TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_create_domain_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_create_domain_request_domain(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_create_domain_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_create_domain_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_create_domain_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> - S1 = #{host => F@_2}, - if F@_1 == '$undef' -> S1; - true -> S1#{domain => F@_1} - end; -dfp_read_field_def_create_domain_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_create_domain_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_create_domain_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_create_domain_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_create_domain_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_create_domain_request_domain(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_create_domain_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_create_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_create_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_create_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_create_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_create_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_create_domain_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> - S1 = #{host => F@_2}, - if F@_1 == '$undef' -> S1; - true -> S1#{domain => F@_1} - end. - -d_field_create_domain_request_domain(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_create_domain_request_domain(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_create_domain_request_domain(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_domain(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_create_domain_request(RestF, - 0, - 0, - F, - if Prev == '$undef' -> NewFValue; - true -> merge_msg_domain(Prev, NewFValue, TrUserData) - end, - F@_2, - TrUserData). - -d_field_create_domain_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_create_domain_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_create_domain_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_create_domain_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_create_domain_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_create_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_create_domain_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_create_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_create_domain_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_create_domain_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_create_domain_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_create_domain_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_create_domain_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_create_domain_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_create_domain_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_create_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_create_domain_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_create_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_delete_domain_request(Bin, TrUserData) -> dfp_read_field_def_delete_domain_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_delete_domain_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_delete_domain_request_uuid(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_delete_domain_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_delete_domain_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_delete_domain_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{uuid => F@_1, host => F@_2}; -dfp_read_field_def_delete_domain_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_delete_domain_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_delete_domain_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_delete_domain_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_delete_domain_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_delete_domain_request_uuid(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_delete_domain_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_delete_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_delete_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_delete_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_delete_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_delete_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_delete_domain_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{uuid => F@_1, host => F@_2}. - -d_field_delete_domain_request_uuid(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_delete_domain_request_uuid(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_delete_domain_request_uuid(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_delete_domain_request(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_delete_domain_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_delete_domain_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_delete_domain_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_delete_domain_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_delete_domain_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_delete_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_delete_domain_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_delete_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_delete_domain_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_delete_domain_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_delete_domain_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_delete_domain_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_delete_domain_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_delete_domain_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_delete_domain_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_delete_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_delete_domain_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_delete_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_download_image_request(Bin, TrUserData) -> dfp_read_field_def_download_image_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_download_image_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_download_image_request_domain_id(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_download_image_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_download_image_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_download_image_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{domain_id => F@_1, host => F@_2}; -dfp_read_field_def_download_image_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_download_image_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_download_image_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_download_image_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_download_image_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_download_image_request_domain_id(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_download_image_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_download_image_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_download_image_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_download_image_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_download_image_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_download_image_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_download_image_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{domain_id => F@_1, host => F@_2}. - -d_field_download_image_request_domain_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_download_image_request_domain_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_download_image_request_domain_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_download_image_request(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_download_image_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_download_image_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_download_image_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_download_image_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_download_image_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_download_image_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_download_image_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_download_image_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_download_image_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_download_image_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_download_image_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_download_image_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_download_image_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_download_image_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_download_image_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_download_image_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_download_image_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_download_image_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_image_chunk(Bin, TrUserData) -> dfp_read_field_def_image_chunk(Bin, 0, 0, 0, id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_image_chunk(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_image_chunk_bytes(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_image_chunk(<<>>, 0, 0, _, F@_1, _) -> #{bytes => F@_1}; -dfp_read_field_def_image_chunk(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_image_chunk(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_image_chunk(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_image_chunk(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_image_chunk(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_image_chunk_bytes(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_image_chunk(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_image_chunk(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_image_chunk(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_image_chunk(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_image_chunk(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_image_chunk(<<>>, 0, 0, _, F@_1, _) -> #{bytes => F@_1}. - -d_field_image_chunk_bytes(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_image_chunk_bytes(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_image_chunk_bytes(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_image_chunk(RestF, 0, 0, F, NewFValue, TrUserData). - -skip_varint_image_chunk(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_image_chunk(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_image_chunk(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_image_chunk(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_image_chunk(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_image_chunk(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_image_chunk(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_image_chunk(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_image_chunk(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_image_chunk(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_image_chunk(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_image_chunk(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_image_chunk(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_image_chunk(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_get_network_request(Bin, TrUserData) -> dfp_read_field_def_get_network_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_get_network_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_get_network_request_uuid(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_get_network_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_get_network_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_get_network_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{uuid => F@_1, host => F@_2}; -dfp_read_field_def_get_network_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_get_network_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_get_network_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_get_network_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_get_network_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_get_network_request_uuid(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_get_network_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_get_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_get_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_get_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_get_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_get_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_get_network_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{uuid => F@_1, host => F@_2}. - -d_field_get_network_request_uuid(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_get_network_request_uuid(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_get_network_request_uuid(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_get_network_request(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_get_network_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_get_network_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_get_network_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_get_network_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_get_network_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_get_network_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_get_network_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_get_network_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_get_network_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_get_network_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_get_network_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_get_network_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_get_network_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_get_network_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_get_network_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_get_network_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_get_network_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_get_network_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_network(Bin, TrUserData) -> dfp_read_field_def_network(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_network(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_network_uuid(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dfp_read_field_def_network(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_network_name(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dfp_read_field_def_network(<<26, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_network_cidr(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dfp_read_field_def_network(<<34, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_network_cidr6(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dfp_read_field_def_network(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, _) -> #{uuid => F@_1, name => F@_2, cidr => F@_3, cidr6 => F@_4}; -dfp_read_field_def_network(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dg_read_field_def_network(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -dg_read_field_def_network(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 32 - 7 -> dg_read_field_def_network(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dg_read_field_def_network(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, F@_4, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_network_uuid(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); - 18 -> d_field_network_name(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); - 26 -> d_field_network_cidr(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); - 34 -> d_field_network_cidr6(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_network(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); - 1 -> skip_64_network(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); - 2 -> skip_length_delimited_network(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); - 3 -> skip_group_network(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); - 5 -> skip_32_network(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData) - end - end; -dg_read_field_def_network(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, _) -> #{uuid => F@_1, name => F@_2, cidr => F@_3, cidr6 => F@_4}. - -d_field_network_uuid(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_network_uuid(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -d_field_network_uuid(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, F@_4, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_network(RestF, 0, 0, F, NewFValue, F@_2, F@_3, F@_4, TrUserData). - -d_field_network_name(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_network_name(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -d_field_network_name(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, F@_4, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_network(RestF, 0, 0, F, F@_1, NewFValue, F@_3, F@_4, TrUserData). - -d_field_network_cidr(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_network_cidr(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -d_field_network_cidr(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, F@_4, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_network(RestF, 0, 0, F, F@_1, F@_2, NewFValue, F@_4, TrUserData). - -d_field_network_cidr6(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_network_cidr6(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -d_field_network_cidr6(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_network(RestF, 0, 0, F, F@_1, F@_2, F@_3, NewFValue, TrUserData). - -skip_varint_network(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> skip_varint_network(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -skip_varint_network(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dfp_read_field_def_network(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -skip_length_delimited_network(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> skip_length_delimited_network(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -skip_length_delimited_network(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_network(Rest2, 0, 0, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -skip_group_network(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, F@_4, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_network(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, F@_4, TrUserData). - -skip_32_network(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dfp_read_field_def_network(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -skip_64_network(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dfp_read_field_def_network(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -decode_msg_list_networks_request(Bin, TrUserData) -> dfp_read_field_def_list_networks_request(Bin, 0, 0, 0, id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_list_networks_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_networks_request_host(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_list_networks_request(<<>>, 0, 0, _, F@_1, _) -> #{host => F@_1}; -dfp_read_field_def_list_networks_request(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_networks_request(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_list_networks_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_networks_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_list_networks_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_networks_request_host(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_networks_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_list_networks_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_list_networks_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_list_networks_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_list_networks_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_list_networks_request(<<>>, 0, 0, _, F@_1, _) -> #{host => F@_1}. - -d_field_list_networks_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_networks_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_list_networks_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_list_networks_request(RestF, 0, 0, F, NewFValue, TrUserData). - -skip_varint_list_networks_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_networks_request(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_list_networks_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_networks_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_list_networks_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_networks_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_list_networks_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_networks_request(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_list_networks_request(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_networks_request(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_list_networks_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_networks_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_list_networks_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_networks_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_list_networks_response(Bin, TrUserData) -> dfp_read_field_def_list_networks_response(Bin, 0, 0, 0, id([], TrUserData), TrUserData). - -dfp_read_field_def_list_networks_response(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_networks_response_networks(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_list_networks_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{networks => lists_reverse(R1, TrUserData)} - end; -dfp_read_field_def_list_networks_response(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_networks_response(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_list_networks_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_networks_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_list_networks_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_networks_response_networks(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_networks_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_list_networks_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_list_networks_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_list_networks_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_list_networks_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_list_networks_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{networks => lists_reverse(R1, TrUserData)} - end. - -d_field_list_networks_response_networks(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_networks_response_networks(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_list_networks_response_networks(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_network(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_list_networks_response(RestF, 0, 0, F, cons(NewFValue, Prev, TrUserData), TrUserData). - -skip_varint_list_networks_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_networks_response(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_list_networks_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_networks_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_list_networks_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_networks_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_list_networks_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_networks_response(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_list_networks_response(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_networks_response(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_list_networks_response(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_networks_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_list_networks_response(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_networks_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_create_network_request(Bin, TrUserData) -> dfp_read_field_def_create_network_request(Bin, 0, 0, 0, id('$undef', TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_create_network_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_create_network_request_network(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_create_network_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_create_network_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_create_network_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> - S1 = #{host => F@_2}, - if F@_1 == '$undef' -> S1; - true -> S1#{network => F@_1} - end; -dfp_read_field_def_create_network_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_create_network_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_create_network_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_create_network_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_create_network_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_create_network_request_network(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_create_network_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_create_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_create_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_create_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_create_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_create_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_create_network_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> - S1 = #{host => F@_2}, - if F@_1 == '$undef' -> S1; - true -> S1#{network => F@_1} - end. - -d_field_create_network_request_network(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_create_network_request_network(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_create_network_request_network(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_network(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_create_network_request(RestF, - 0, - 0, - F, - if Prev == '$undef' -> NewFValue; - true -> merge_msg_network(Prev, NewFValue, TrUserData) - end, - F@_2, - TrUserData). - -d_field_create_network_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_create_network_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_create_network_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_create_network_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_create_network_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_create_network_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_create_network_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_create_network_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_create_network_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_create_network_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_create_network_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_create_network_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_create_network_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_create_network_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_create_network_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_create_network_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_create_network_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_create_network_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_delete_network_request(Bin, TrUserData) -> dfp_read_field_def_delete_network_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_delete_network_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_delete_network_request_uuid(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_delete_network_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_delete_network_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_delete_network_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{uuid => F@_1, host => F@_2}; -dfp_read_field_def_delete_network_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_delete_network_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_delete_network_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_delete_network_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_delete_network_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_delete_network_request_uuid(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_delete_network_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_delete_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_delete_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_delete_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_delete_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_delete_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_delete_network_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{uuid => F@_1, host => F@_2}. - -d_field_delete_network_request_uuid(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_delete_network_request_uuid(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_delete_network_request_uuid(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_delete_network_request(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_delete_network_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_delete_network_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_delete_network_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_delete_network_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_delete_network_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_delete_network_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_delete_network_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_delete_network_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_delete_network_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_delete_network_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_delete_network_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_delete_network_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_delete_network_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_delete_network_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_delete_network_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_delete_network_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_delete_network_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_delete_network_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_get_volume_request(Bin, TrUserData) -> dfp_read_field_def_get_volume_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_get_volume_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_get_volume_request_uuid(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_get_volume_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_get_volume_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_get_volume_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{uuid => F@_1, host => F@_2}; -dfp_read_field_def_get_volume_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_get_volume_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_get_volume_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_get_volume_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_get_volume_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_get_volume_request_uuid(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_get_volume_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_get_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_get_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_get_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_get_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_get_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_get_volume_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{uuid => F@_1, host => F@_2}. - -d_field_get_volume_request_uuid(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_get_volume_request_uuid(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_get_volume_request_uuid(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_get_volume_request(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_get_volume_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_get_volume_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_get_volume_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_get_volume_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_get_volume_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_get_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_get_volume_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_get_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_get_volume_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_get_volume_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_get_volume_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_get_volume_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_get_volume_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_get_volume_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_get_volume_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_get_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_get_volume_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_get_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_volume(Bin, TrUserData) -> dfp_read_field_def_volume(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), id(0, TrUserData), TrUserData). - -dfp_read_field_def_volume(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_volume_id(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_volume(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_volume_name(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_volume(<<24, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_volume_size(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_volume(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{id => F@_1, name => F@_2, size => F@_3}; -dfp_read_field_def_volume(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dg_read_field_def_volume(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -dg_read_field_def_volume(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 32 - 7 -> dg_read_field_def_volume(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -dg_read_field_def_volume(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_volume_id(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 18 -> d_field_volume_name(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 24 -> d_field_volume_size(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_volume(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 1 -> skip_64_volume(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 2 -> skip_length_delimited_volume(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 3 -> skip_group_volume(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 5 -> skip_32_volume(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData) - end - end; -dg_read_field_def_volume(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{id => F@_1, name => F@_2, size => F@_3}. - -d_field_volume_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_volume_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_volume_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_volume(RestF, 0, 0, F, NewFValue, F@_2, F@_3, TrUserData). - -d_field_volume_name(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_volume_name(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_volume_name(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_volume(RestF, 0, 0, F, F@_1, NewFValue, F@_3, TrUserData). - -d_field_volume_size(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_volume_size(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_volume_size(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, TrUserData) -> - {NewFValue, RestF} = {id((X bsl N + Acc) band 18446744073709551615, TrUserData), Rest}, - dfp_read_field_def_volume(RestF, 0, 0, F, F@_1, F@_2, NewFValue, TrUserData). - -skip_varint_volume(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> skip_varint_volume(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -skip_varint_volume(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_volume(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_length_delimited_volume(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> skip_length_delimited_volume(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -skip_length_delimited_volume(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_volume(Rest2, 0, 0, F, F@_1, F@_2, F@_3, TrUserData). - -skip_group_volume(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_volume(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, TrUserData). - -skip_32_volume(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_volume(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_64_volume(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_volume(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -decode_msg_list_volumes_request(Bin, TrUserData) -> dfp_read_field_def_list_volumes_request(Bin, 0, 0, 0, id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_list_volumes_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_volumes_request_host(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_list_volumes_request(<<>>, 0, 0, _, F@_1, _) -> #{host => F@_1}; -dfp_read_field_def_list_volumes_request(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_volumes_request(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_list_volumes_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_volumes_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_list_volumes_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_volumes_request_host(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_volumes_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_list_volumes_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_list_volumes_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_list_volumes_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_list_volumes_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_list_volumes_request(<<>>, 0, 0, _, F@_1, _) -> #{host => F@_1}. - -d_field_list_volumes_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_volumes_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_list_volumes_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_list_volumes_request(RestF, 0, 0, F, NewFValue, TrUserData). - -skip_varint_list_volumes_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_volumes_request(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_list_volumes_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_volumes_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_list_volumes_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_volumes_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_list_volumes_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_volumes_request(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_list_volumes_request(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_volumes_request(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_list_volumes_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_volumes_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_list_volumes_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_volumes_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_list_volumes_response(Bin, TrUserData) -> dfp_read_field_def_list_volumes_response(Bin, 0, 0, 0, id([], TrUserData), TrUserData). - -dfp_read_field_def_list_volumes_response(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_volumes_response_volumes(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_list_volumes_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{volumes => lists_reverse(R1, TrUserData)} - end; -dfp_read_field_def_list_volumes_response(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_volumes_response(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_list_volumes_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_volumes_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_list_volumes_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_volumes_response_volumes(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_volumes_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_list_volumes_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_list_volumes_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_list_volumes_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_list_volumes_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_list_volumes_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{volumes => lists_reverse(R1, TrUserData)} - end. - -d_field_list_volumes_response_volumes(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_volumes_response_volumes(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_list_volumes_response_volumes(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_volume(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_list_volumes_response(RestF, 0, 0, F, cons(NewFValue, Prev, TrUserData), TrUserData). - -skip_varint_list_volumes_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_volumes_response(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_list_volumes_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_volumes_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_list_volumes_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_volumes_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_list_volumes_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_volumes_response(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_list_volumes_response(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_volumes_response(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_list_volumes_response(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_volumes_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_list_volumes_response(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_volumes_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_create_volume_request(Bin, TrUserData) -> dfp_read_field_def_create_volume_request(Bin, 0, 0, 0, id('$undef', TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_create_volume_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_create_volume_request_volume(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_create_volume_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_create_volume_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_create_volume_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> - S1 = #{host => F@_2}, - if F@_1 == '$undef' -> S1; - true -> S1#{volume => F@_1} - end; -dfp_read_field_def_create_volume_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_create_volume_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_create_volume_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_create_volume_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_create_volume_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_create_volume_request_volume(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_create_volume_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_create_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_create_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_create_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_create_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_create_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_create_volume_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> - S1 = #{host => F@_2}, - if F@_1 == '$undef' -> S1; - true -> S1#{volume => F@_1} - end. - -d_field_create_volume_request_volume(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_create_volume_request_volume(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_create_volume_request_volume(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_volume(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_create_volume_request(RestF, - 0, - 0, - F, - if Prev == '$undef' -> NewFValue; - true -> merge_msg_volume(Prev, NewFValue, TrUserData) - end, - F@_2, - TrUserData). - -d_field_create_volume_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_create_volume_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_create_volume_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_create_volume_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_create_volume_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_create_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_create_volume_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_create_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_create_volume_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_create_volume_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_create_volume_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_create_volume_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_create_volume_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_create_volume_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_create_volume_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_create_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_create_volume_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_create_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_update_volume_request(Bin, TrUserData) -> dfp_read_field_def_update_volume_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id('$undef', TrUserData), TrUserData). - -dfp_read_field_def_update_volume_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_update_volume_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_update_volume_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_update_volume_request_volume(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_update_volume_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> - S1 = #{host => F@_1}, - if F@_2 == '$undef' -> S1; - true -> S1#{volume => F@_2} - end; -dfp_read_field_def_update_volume_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_update_volume_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_update_volume_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_update_volume_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_update_volume_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_update_volume_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_update_volume_request_volume(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_update_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_update_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_update_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_update_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_update_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_update_volume_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> - S1 = #{host => F@_1}, - if F@_2 == '$undef' -> S1; - true -> S1#{volume => F@_2} - end. - -d_field_update_volume_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_update_volume_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_update_volume_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_update_volume_request(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_update_volume_request_volume(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_update_volume_request_volume(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_update_volume_request_volume(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_volume(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_update_volume_request(RestF, - 0, - 0, - F, - F@_1, - if Prev == '$undef' -> NewFValue; - true -> merge_msg_volume(Prev, NewFValue, TrUserData) - end, - TrUserData). - -skip_varint_update_volume_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_update_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_update_volume_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_update_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_update_volume_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_update_volume_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_update_volume_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_update_volume_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_update_volume_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_update_volume_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_update_volume_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_update_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_update_volume_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_update_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_delete_volume_request(Bin, TrUserData) -> dfp_read_field_def_delete_volume_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_delete_volume_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_delete_volume_request_uuid(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_delete_volume_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_delete_volume_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_delete_volume_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{uuid => F@_1, host => F@_2}; -dfp_read_field_def_delete_volume_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_delete_volume_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_delete_volume_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_delete_volume_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_delete_volume_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_delete_volume_request_uuid(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_delete_volume_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_delete_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_delete_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_delete_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_delete_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_delete_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_delete_volume_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{uuid => F@_1, host => F@_2}. - -d_field_delete_volume_request_uuid(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_delete_volume_request_uuid(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_delete_volume_request_uuid(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_delete_volume_request(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_delete_volume_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_delete_volume_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_delete_volume_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_delete_volume_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_delete_volume_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_delete_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_delete_volume_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_delete_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_delete_volume_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_delete_volume_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_delete_volume_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_delete_volume_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_delete_volume_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_delete_volume_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_delete_volume_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_delete_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_delete_volume_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_delete_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_volume_attachment_identifier(Bin, TrUserData) -> dfp_read_field_def_volume_attachment_identifier(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_volume_attachment_identifier(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_volume_attachment_identifier_domain_id(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_volume_attachment_identifier(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_volume_attachment_identifier_volume_id(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_volume_attachment_identifier(<<26, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_volume_attachment_identifier_host(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_volume_attachment_identifier(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{domain_id => F@_1, volume_id => F@_2, host => F@_3}; -dfp_read_field_def_volume_attachment_identifier(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dg_read_field_def_volume_attachment_identifier(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -dg_read_field_def_volume_attachment_identifier(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 32 - 7 -> dg_read_field_def_volume_attachment_identifier(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -dg_read_field_def_volume_attachment_identifier(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_volume_attachment_identifier_domain_id(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 18 -> d_field_volume_attachment_identifier_volume_id(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 26 -> d_field_volume_attachment_identifier_host(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_volume_attachment_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 1 -> skip_64_volume_attachment_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 2 -> skip_length_delimited_volume_attachment_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 3 -> skip_group_volume_attachment_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 5 -> skip_32_volume_attachment_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData) - end - end; -dg_read_field_def_volume_attachment_identifier(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{domain_id => F@_1, volume_id => F@_2, host => F@_3}. - -d_field_volume_attachment_identifier_domain_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_volume_attachment_identifier_domain_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_volume_attachment_identifier_domain_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_volume_attachment_identifier(RestF, 0, 0, F, NewFValue, F@_2, F@_3, TrUserData). - -d_field_volume_attachment_identifier_volume_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_volume_attachment_identifier_volume_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_volume_attachment_identifier_volume_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_volume_attachment_identifier(RestF, 0, 0, F, F@_1, NewFValue, F@_3, TrUserData). - -d_field_volume_attachment_identifier_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_volume_attachment_identifier_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_volume_attachment_identifier_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_volume_attachment_identifier(RestF, 0, 0, F, F@_1, F@_2, NewFValue, TrUserData). - -skip_varint_volume_attachment_identifier(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> skip_varint_volume_attachment_identifier(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -skip_varint_volume_attachment_identifier(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_volume_attachment_identifier(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_length_delimited_volume_attachment_identifier(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> skip_length_delimited_volume_attachment_identifier(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -skip_length_delimited_volume_attachment_identifier(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_volume_attachment_identifier(Rest2, 0, 0, F, F@_1, F@_2, F@_3, TrUserData). - -skip_group_volume_attachment_identifier(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_volume_attachment_identifier(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, TrUserData). - -skip_32_volume_attachment_identifier(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_volume_attachment_identifier(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_64_volume_attachment_identifier(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_volume_attachment_identifier(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -decode_msg_volume_attachment(Bin, TrUserData) -> dfp_read_field_def_volume_attachment(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_volume_attachment(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_volume_attachment_domain_id(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_volume_attachment(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_volume_attachment_volume_id(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_volume_attachment(<<26, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_volume_attachment_disk_address(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_volume_attachment(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{domain_id => F@_1, volume_id => F@_2, disk_address => F@_3}; -dfp_read_field_def_volume_attachment(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dg_read_field_def_volume_attachment(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -dg_read_field_def_volume_attachment(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 32 - 7 -> dg_read_field_def_volume_attachment(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -dg_read_field_def_volume_attachment(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_volume_attachment_domain_id(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 18 -> d_field_volume_attachment_volume_id(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 26 -> d_field_volume_attachment_disk_address(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_volume_attachment(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 1 -> skip_64_volume_attachment(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 2 -> skip_length_delimited_volume_attachment(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 3 -> skip_group_volume_attachment(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 5 -> skip_32_volume_attachment(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData) - end - end; -dg_read_field_def_volume_attachment(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{domain_id => F@_1, volume_id => F@_2, disk_address => F@_3}. - -d_field_volume_attachment_domain_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_volume_attachment_domain_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_volume_attachment_domain_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_volume_attachment(RestF, 0, 0, F, NewFValue, F@_2, F@_3, TrUserData). - -d_field_volume_attachment_volume_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_volume_attachment_volume_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_volume_attachment_volume_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_volume_attachment(RestF, 0, 0, F, F@_1, NewFValue, F@_3, TrUserData). - -d_field_volume_attachment_disk_address(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_volume_attachment_disk_address(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_volume_attachment_disk_address(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_volume_attachment(RestF, 0, 0, F, F@_1, F@_2, NewFValue, TrUserData). - -skip_varint_volume_attachment(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> skip_varint_volume_attachment(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -skip_varint_volume_attachment(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_volume_attachment(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_length_delimited_volume_attachment(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> skip_length_delimited_volume_attachment(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -skip_length_delimited_volume_attachment(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_volume_attachment(Rest2, 0, 0, F, F@_1, F@_2, F@_3, TrUserData). - -skip_group_volume_attachment(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_volume_attachment(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, TrUserData). - -skip_32_volume_attachment(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_volume_attachment(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_64_volume_attachment(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_volume_attachment(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -decode_msg_list_volume_attachments_request(Bin, TrUserData) -> dfp_read_field_def_list_volume_attachments_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_list_volume_attachments_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_list_volume_attachments_request_domain_id(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_list_volume_attachments_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_list_volume_attachments_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_list_volume_attachments_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{domain_id => F@_1, host => F@_2}; -dfp_read_field_def_list_volume_attachments_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_list_volume_attachments_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_list_volume_attachments_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_volume_attachments_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_list_volume_attachments_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_volume_attachments_request_domain_id(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_list_volume_attachments_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_volume_attachments_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_list_volume_attachments_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_list_volume_attachments_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_list_volume_attachments_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_list_volume_attachments_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_list_volume_attachments_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{domain_id => F@_1, host => F@_2}. - -d_field_list_volume_attachments_request_domain_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_list_volume_attachments_request_domain_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_list_volume_attachments_request_domain_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_list_volume_attachments_request(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_list_volume_attachments_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_list_volume_attachments_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_list_volume_attachments_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_list_volume_attachments_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_list_volume_attachments_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_list_volume_attachments_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_list_volume_attachments_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_list_volume_attachments_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_list_volume_attachments_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_list_volume_attachments_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_list_volume_attachments_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_volume_attachments_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_list_volume_attachments_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_volume_attachments_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_list_volume_attachments_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_list_volume_attachments_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_list_volume_attachments_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_list_volume_attachments_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_list_volume_attachments_response(Bin, TrUserData) -> dfp_read_field_def_list_volume_attachments_response(Bin, 0, 0, 0, id([], TrUserData), TrUserData). - -dfp_read_field_def_list_volume_attachments_response(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_volume_attachments_response_attachments(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_list_volume_attachments_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{attachments => lists_reverse(R1, TrUserData)} - end; -dfp_read_field_def_list_volume_attachments_response(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_volume_attachments_response(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_list_volume_attachments_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_volume_attachments_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_list_volume_attachments_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_volume_attachments_response_attachments(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_volume_attachments_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_list_volume_attachments_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_list_volume_attachments_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_list_volume_attachments_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_list_volume_attachments_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_list_volume_attachments_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{attachments => lists_reverse(R1, TrUserData)} - end. - -d_field_list_volume_attachments_response_attachments(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_volume_attachments_response_attachments(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_list_volume_attachments_response_attachments(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_volume_attachment(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_list_volume_attachments_response(RestF, 0, 0, F, cons(NewFValue, Prev, TrUserData), TrUserData). - -skip_varint_list_volume_attachments_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_volume_attachments_response(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_list_volume_attachments_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_volume_attachments_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_list_volume_attachments_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_volume_attachments_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_list_volume_attachments_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_volume_attachments_response(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_list_volume_attachments_response(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_volume_attachments_response(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_list_volume_attachments_response(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_volume_attachments_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_list_volume_attachments_response(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_volume_attachments_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_port_forwarding_identifier(Bin, TrUserData) -> dfp_read_field_def_port_forwarding_identifier(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), id(0, TrUserData), TrUserData). - -dfp_read_field_def_port_forwarding_identifier(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_port_forwarding_identifier_host(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_port_forwarding_identifier(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_port_forwarding_identifier_protocol(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_port_forwarding_identifier(<<24, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_port_forwarding_identifier_source_port(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_port_forwarding_identifier(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{host => F@_1, protocol => F@_2, source_port => F@_3}; -dfp_read_field_def_port_forwarding_identifier(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dg_read_field_def_port_forwarding_identifier(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -dg_read_field_def_port_forwarding_identifier(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 32 - 7 -> dg_read_field_def_port_forwarding_identifier(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -dg_read_field_def_port_forwarding_identifier(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_port_forwarding_identifier_host(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 18 -> d_field_port_forwarding_identifier_protocol(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 24 -> d_field_port_forwarding_identifier_source_port(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_port_forwarding_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 1 -> skip_64_port_forwarding_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 2 -> skip_length_delimited_port_forwarding_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 3 -> skip_group_port_forwarding_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 5 -> skip_32_port_forwarding_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData) - end - end; -dg_read_field_def_port_forwarding_identifier(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{host => F@_1, protocol => F@_2, source_port => F@_3}. - -d_field_port_forwarding_identifier_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_port_forwarding_identifier_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_port_forwarding_identifier_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_port_forwarding_identifier(RestF, 0, 0, F, NewFValue, F@_2, F@_3, TrUserData). - -d_field_port_forwarding_identifier_protocol(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_port_forwarding_identifier_protocol(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_port_forwarding_identifier_protocol(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_port_forwarding_identifier(RestF, 0, 0, F, F@_1, NewFValue, F@_3, TrUserData). - -d_field_port_forwarding_identifier_source_port(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_port_forwarding_identifier_source_port(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_port_forwarding_identifier_source_port(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, TrUserData) -> - {NewFValue, RestF} = {id((X bsl N + Acc) band 4294967295, TrUserData), Rest}, - dfp_read_field_def_port_forwarding_identifier(RestF, 0, 0, F, F@_1, F@_2, NewFValue, TrUserData). - -skip_varint_port_forwarding_identifier(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> skip_varint_port_forwarding_identifier(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -skip_varint_port_forwarding_identifier(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_port_forwarding_identifier(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_length_delimited_port_forwarding_identifier(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> skip_length_delimited_port_forwarding_identifier(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -skip_length_delimited_port_forwarding_identifier(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_port_forwarding_identifier(Rest2, 0, 0, F, F@_1, F@_2, F@_3, TrUserData). - -skip_group_port_forwarding_identifier(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_port_forwarding_identifier(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, TrUserData). - -skip_32_port_forwarding_identifier(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_port_forwarding_identifier(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_64_port_forwarding_identifier(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_port_forwarding_identifier(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -decode_msg_port_forwarding(Bin, TrUserData) -> dfp_read_field_def_port_forwarding(Bin, 0, 0, 0, id(<<>>, TrUserData), id(0, TrUserData), id(<<>>, TrUserData), id(0, TrUserData), TrUserData). - -dfp_read_field_def_port_forwarding(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_port_forwarding_protocol(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dfp_read_field_def_port_forwarding(<<24, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_port_forwarding_source_port(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dfp_read_field_def_port_forwarding(<<34, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_port_forwarding_target_ip(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dfp_read_field_def_port_forwarding(<<40, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_port_forwarding_target_port(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dfp_read_field_def_port_forwarding(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, _) -> #{protocol => F@_1, source_port => F@_2, target_ip => F@_3, target_port => F@_4}; -dfp_read_field_def_port_forwarding(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dg_read_field_def_port_forwarding(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -dg_read_field_def_port_forwarding(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 32 - 7 -> dg_read_field_def_port_forwarding(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dg_read_field_def_port_forwarding(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, F@_4, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 18 -> d_field_port_forwarding_protocol(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); - 24 -> d_field_port_forwarding_source_port(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); - 34 -> d_field_port_forwarding_target_ip(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); - 40 -> d_field_port_forwarding_target_port(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_port_forwarding(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); - 1 -> skip_64_port_forwarding(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); - 2 -> skip_length_delimited_port_forwarding(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); - 3 -> skip_group_port_forwarding(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); - 5 -> skip_32_port_forwarding(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData) - end - end; -dg_read_field_def_port_forwarding(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, _) -> #{protocol => F@_1, source_port => F@_2, target_ip => F@_3, target_port => F@_4}. - -d_field_port_forwarding_protocol(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_port_forwarding_protocol(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -d_field_port_forwarding_protocol(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, F@_4, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_port_forwarding(RestF, 0, 0, F, NewFValue, F@_2, F@_3, F@_4, TrUserData). - -d_field_port_forwarding_source_port(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_port_forwarding_source_port(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -d_field_port_forwarding_source_port(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, F@_4, TrUserData) -> - {NewFValue, RestF} = {id((X bsl N + Acc) band 4294967295, TrUserData), Rest}, - dfp_read_field_def_port_forwarding(RestF, 0, 0, F, F@_1, NewFValue, F@_3, F@_4, TrUserData). - -d_field_port_forwarding_target_ip(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_port_forwarding_target_ip(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -d_field_port_forwarding_target_ip(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, F@_4, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_port_forwarding(RestF, 0, 0, F, F@_1, F@_2, NewFValue, F@_4, TrUserData). - -d_field_port_forwarding_target_port(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_port_forwarding_target_port(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -d_field_port_forwarding_target_port(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, _, TrUserData) -> - {NewFValue, RestF} = {id((X bsl N + Acc) band 4294967295, TrUserData), Rest}, - dfp_read_field_def_port_forwarding(RestF, 0, 0, F, F@_1, F@_2, F@_3, NewFValue, TrUserData). - -skip_varint_port_forwarding(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> skip_varint_port_forwarding(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -skip_varint_port_forwarding(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dfp_read_field_def_port_forwarding(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -skip_length_delimited_port_forwarding(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> skip_length_delimited_port_forwarding(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -skip_length_delimited_port_forwarding(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_port_forwarding(Rest2, 0, 0, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -skip_group_port_forwarding(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, F@_4, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_port_forwarding(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, F@_4, TrUserData). - -skip_32_port_forwarding(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dfp_read_field_def_port_forwarding(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -skip_64_port_forwarding(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dfp_read_field_def_port_forwarding(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -decode_msg_list_port_forwardings_request(Bin, TrUserData) -> dfp_read_field_def_list_port_forwardings_request(Bin, 0, 0, 0, id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_list_port_forwardings_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_port_forwardings_request_host(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_list_port_forwardings_request(<<>>, 0, 0, _, F@_1, _) -> #{host => F@_1}; -dfp_read_field_def_list_port_forwardings_request(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_port_forwardings_request(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_list_port_forwardings_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_port_forwardings_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_list_port_forwardings_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_port_forwardings_request_host(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_port_forwardings_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_list_port_forwardings_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_list_port_forwardings_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_list_port_forwardings_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_list_port_forwardings_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_list_port_forwardings_request(<<>>, 0, 0, _, F@_1, _) -> #{host => F@_1}. - -d_field_list_port_forwardings_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_port_forwardings_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_list_port_forwardings_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_list_port_forwardings_request(RestF, 0, 0, F, NewFValue, TrUserData). - -skip_varint_list_port_forwardings_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_port_forwardings_request(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_list_port_forwardings_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_port_forwardings_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_list_port_forwardings_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_port_forwardings_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_list_port_forwardings_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_port_forwardings_request(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_list_port_forwardings_request(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_port_forwardings_request(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_list_port_forwardings_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_port_forwardings_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_list_port_forwardings_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_port_forwardings_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_list_port_forwardings_response(Bin, TrUserData) -> dfp_read_field_def_list_port_forwardings_response(Bin, 0, 0, 0, id([], TrUserData), TrUserData). - -dfp_read_field_def_list_port_forwardings_response(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_port_forwardings_response_port_forwardings(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_list_port_forwardings_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{port_forwardings => lists_reverse(R1, TrUserData)} - end; -dfp_read_field_def_list_port_forwardings_response(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_port_forwardings_response(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_list_port_forwardings_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_port_forwardings_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_list_port_forwardings_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_port_forwardings_response_port_forwardings(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_port_forwardings_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_list_port_forwardings_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_list_port_forwardings_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_list_port_forwardings_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_list_port_forwardings_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_list_port_forwardings_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{port_forwardings => lists_reverse(R1, TrUserData)} - end. - -d_field_list_port_forwardings_response_port_forwardings(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_port_forwardings_response_port_forwardings(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_list_port_forwardings_response_port_forwardings(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_port_forwarding(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_list_port_forwardings_response(RestF, 0, 0, F, cons(NewFValue, Prev, TrUserData), TrUserData). - -skip_varint_list_port_forwardings_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_port_forwardings_response(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_list_port_forwardings_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_port_forwardings_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_list_port_forwardings_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_port_forwardings_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_list_port_forwardings_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_port_forwardings_response(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_list_port_forwardings_response(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_port_forwardings_response(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_list_port_forwardings_response(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_port_forwardings_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_list_port_forwardings_response(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_port_forwardings_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_put_port_forwarding_request(Bin, TrUserData) -> dfp_read_field_def_put_port_forwarding_request(Bin, 0, 0, 0, id('$undef', TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_put_port_forwarding_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_put_port_forwarding_request_port_forwarding(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_put_port_forwarding_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_put_port_forwarding_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_put_port_forwarding_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> - S1 = #{host => F@_2}, - if F@_1 == '$undef' -> S1; - true -> S1#{port_forwarding => F@_1} - end; -dfp_read_field_def_put_port_forwarding_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_put_port_forwarding_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_put_port_forwarding_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_put_port_forwarding_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_put_port_forwarding_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_put_port_forwarding_request_port_forwarding(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_put_port_forwarding_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_put_port_forwarding_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_put_port_forwarding_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_put_port_forwarding_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_put_port_forwarding_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_put_port_forwarding_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_put_port_forwarding_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> - S1 = #{host => F@_2}, - if F@_1 == '$undef' -> S1; - true -> S1#{port_forwarding => F@_1} - end. - -d_field_put_port_forwarding_request_port_forwarding(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_put_port_forwarding_request_port_forwarding(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_put_port_forwarding_request_port_forwarding(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_port_forwarding(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_put_port_forwarding_request(RestF, - 0, - 0, - F, - if Prev == '$undef' -> NewFValue; - true -> merge_msg_port_forwarding(Prev, NewFValue, TrUserData) - end, - F@_2, - TrUserData). - -d_field_put_port_forwarding_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_put_port_forwarding_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_put_port_forwarding_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_put_port_forwarding_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_put_port_forwarding_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_put_port_forwarding_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_put_port_forwarding_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_put_port_forwarding_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_put_port_forwarding_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_put_port_forwarding_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_put_port_forwarding_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_put_port_forwarding_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_put_port_forwarding_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_put_port_forwarding_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_put_port_forwarding_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_put_port_forwarding_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_put_port_forwarding_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_put_port_forwarding_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_timestamp(Bin, TrUserData) -> dfp_read_field_def_timestamp(Bin, 0, 0, 0, id(0, TrUserData), id(0, TrUserData), TrUserData). - -dfp_read_field_def_timestamp(<<8, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_timestamp_seconds(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_timestamp(<<16, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_timestamp_nanos(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_timestamp(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{seconds => F@_1, nanos => F@_2}; -dfp_read_field_def_timestamp(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_timestamp(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_timestamp(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_timestamp(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_timestamp(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 8 -> d_field_timestamp_seconds(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 16 -> d_field_timestamp_nanos(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_timestamp(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_timestamp(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_timestamp(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_timestamp(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_timestamp(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_timestamp(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{seconds => F@_1, nanos => F@_2}. - -d_field_timestamp_seconds(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_timestamp_seconds(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_timestamp_seconds(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = {begin <> = <<(X bsl N + Acc):64/unsigned-native>>, id(Res, TrUserData) end, Rest}, - dfp_read_field_def_timestamp(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_timestamp_nanos(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_timestamp_nanos(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_timestamp_nanos(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = {begin <> = <<(X bsl N + Acc):32/unsigned-native>>, id(Res, TrUserData) end, Rest}, - dfp_read_field_def_timestamp(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_timestamp(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_timestamp(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_timestamp(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_timestamp(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_timestamp(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_timestamp(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_timestamp(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_timestamp(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_timestamp(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_timestamp(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_timestamp(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_timestamp(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_timestamp(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_timestamp(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -read_group(Bin, FieldNum) -> - {NumBytes, EndTagLen} = read_gr_b(Bin, 0, 0, 0, 0, FieldNum), - <> = Bin, - {Group, Rest}. - -%% Like skipping over fields, but record the total length, -%% Each field is <(FieldNum bsl 3) bor FieldType> ++ -%% Record the length because varints may be non-optimally encoded. -%% -%% Groups can be nested, but assume the same FieldNum cannot be nested -%% because group field numbers are shared with the rest of the fields -%% numbers. Thus we can search just for an group-end with the same -%% field number. -%% -%% (The only time the same group field number could occur would -%% be in a nested sub message, but then it would be inside a -%% length-delimited entry, which we skip-read by length.) -read_gr_b(<<1:1, X:7, Tl/binary>>, N, Acc, NumBytes, TagLen, FieldNum) - when N < (32-7) -> - read_gr_b(Tl, N+7, X bsl N + Acc, NumBytes, TagLen+1, FieldNum); -read_gr_b(<<0:1, X:7, Tl/binary>>, N, Acc, NumBytes, TagLen, - FieldNum) -> - Key = X bsl N + Acc, - TagLen1 = TagLen + 1, - case {Key bsr 3, Key band 7} of - {FieldNum, 4} -> % 4 = group_end - {NumBytes, TagLen1}; - {_, 0} -> % 0 = varint - read_gr_vi(Tl, 0, NumBytes + TagLen1, FieldNum); - {_, 1} -> % 1 = bits64 - <<_:64, Tl2/binary>> = Tl, - read_gr_b(Tl2, 0, 0, NumBytes + TagLen1 + 8, 0, FieldNum); - {_, 2} -> % 2 = length_delimited - read_gr_ld(Tl, 0, 0, NumBytes + TagLen1, FieldNum); - {_, 3} -> % 3 = group_start - read_gr_b(Tl, 0, 0, NumBytes + TagLen1, 0, FieldNum); - {_, 4} -> % 4 = group_end - read_gr_b(Tl, 0, 0, NumBytes + TagLen1, 0, FieldNum); - {_, 5} -> % 5 = bits32 - <<_:32, Tl2/binary>> = Tl, - read_gr_b(Tl2, 0, 0, NumBytes + TagLen1 + 4, 0, FieldNum) - end. - -read_gr_vi(<<1:1, _:7, Tl/binary>>, N, NumBytes, FieldNum) - when N < (64-7) -> - read_gr_vi(Tl, N+7, NumBytes+1, FieldNum); -read_gr_vi(<<0:1, _:7, Tl/binary>>, _, NumBytes, FieldNum) -> - read_gr_b(Tl, 0, 0, NumBytes+1, 0, FieldNum). - -read_gr_ld(<<1:1, X:7, Tl/binary>>, N, Acc, NumBytes, FieldNum) - when N < (64-7) -> - read_gr_ld(Tl, N+7, X bsl N + Acc, NumBytes+1, FieldNum); -read_gr_ld(<<0:1, X:7, Tl/binary>>, N, Acc, NumBytes, FieldNum) -> - Len = X bsl N + Acc, - NumBytes1 = NumBytes + 1, - <<_:Len/binary, Tl2/binary>> = Tl, - read_gr_b(Tl2, 0, 0, NumBytes1 + Len, 0, FieldNum). - -merge_msgs(Prev, New, MsgName) when is_atom(MsgName) -> merge_msgs(Prev, New, MsgName, []). - -merge_msgs(Prev, New, MsgName, Opts) -> - TrUserData = proplists:get_value(user_data, Opts), - case MsgName of - sync_routes_request -> merge_msg_sync_routes_request(Prev, New, TrUserData); - empty -> merge_msg_empty(Prev, New, TrUserData); - start_domain_request -> merge_msg_start_domain_request(Prev, New, TrUserData); - stop_domain_request -> merge_msg_stop_domain_request(Prev, New, TrUserData); - get_domain_request -> merge_msg_get_domain_request(Prev, New, TrUserData); - domain -> merge_msg_domain(Prev, New, TrUserData); - list_domains_request -> merge_msg_list_domains_request(Prev, New, TrUserData); - list_domains_response -> merge_msg_list_domains_response(Prev, New, TrUserData); - create_domain_request -> merge_msg_create_domain_request(Prev, New, TrUserData); - delete_domain_request -> merge_msg_delete_domain_request(Prev, New, TrUserData); - download_image_request -> merge_msg_download_image_request(Prev, New, TrUserData); - image_chunk -> merge_msg_image_chunk(Prev, New, TrUserData); - get_network_request -> merge_msg_get_network_request(Prev, New, TrUserData); - network -> merge_msg_network(Prev, New, TrUserData); - list_networks_request -> merge_msg_list_networks_request(Prev, New, TrUserData); - list_networks_response -> merge_msg_list_networks_response(Prev, New, TrUserData); - create_network_request -> merge_msg_create_network_request(Prev, New, TrUserData); - delete_network_request -> merge_msg_delete_network_request(Prev, New, TrUserData); - get_volume_request -> merge_msg_get_volume_request(Prev, New, TrUserData); - volume -> merge_msg_volume(Prev, New, TrUserData); - list_volumes_request -> merge_msg_list_volumes_request(Prev, New, TrUserData); - list_volumes_response -> merge_msg_list_volumes_response(Prev, New, TrUserData); - create_volume_request -> merge_msg_create_volume_request(Prev, New, TrUserData); - update_volume_request -> merge_msg_update_volume_request(Prev, New, TrUserData); - delete_volume_request -> merge_msg_delete_volume_request(Prev, New, TrUserData); - volume_attachment_identifier -> merge_msg_volume_attachment_identifier(Prev, New, TrUserData); - volume_attachment -> merge_msg_volume_attachment(Prev, New, TrUserData); - list_volume_attachments_request -> merge_msg_list_volume_attachments_request(Prev, New, TrUserData); - list_volume_attachments_response -> merge_msg_list_volume_attachments_response(Prev, New, TrUserData); - port_forwarding_identifier -> merge_msg_port_forwarding_identifier(Prev, New, TrUserData); - port_forwarding -> merge_msg_port_forwarding(Prev, New, TrUserData); - list_port_forwardings_request -> merge_msg_list_port_forwardings_request(Prev, New, TrUserData); - list_port_forwardings_response -> merge_msg_list_port_forwardings_response(Prev, New, TrUserData); - put_port_forwarding_request -> merge_msg_put_port_forwarding_request(Prev, New, TrUserData); - timestamp -> merge_msg_timestamp(Prev, New, TrUserData) - end. - --compile({nowarn_unused_function,merge_msg_sync_routes_request/3}). -merge_msg_sync_routes_request(_Prev, New, _TrUserData) -> New. - --compile({nowarn_unused_function,merge_msg_empty/3}). -merge_msg_empty(_Prev, New, _TrUserData) -> New. - --compile({nowarn_unused_function,merge_msg_start_domain_request/3}). -merge_msg_start_domain_request(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S1#{host => NFhost}; - {#{host := PFhost}, _} -> S1#{host => PFhost}; - _ -> S1 - end, - case {PMsg, NMsg} of - {_, #{uuid := NFuuid}} -> S2#{uuid => NFuuid}; - {#{uuid := PFuuid}, _} -> S2#{uuid => PFuuid}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_stop_domain_request/3}). -merge_msg_stop_domain_request(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S1#{host => NFhost}; - {#{host := PFhost}, _} -> S1#{host => PFhost}; - _ -> S1 - end, - S3 = case {PMsg, NMsg} of - {_, #{uuid := NFuuid}} -> S2#{uuid => NFuuid}; - {#{uuid := PFuuid}, _} -> S2#{uuid => PFuuid}; - _ -> S2 - end, - case {PMsg, NMsg} of - {_, #{force := NFforce}} -> S3#{force => NFforce}; - {#{force := PFforce}, _} -> S3#{force => PFforce}; - _ -> S3 - end. - --compile({nowarn_unused_function,merge_msg_get_domain_request/3}). -merge_msg_get_domain_request(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{uuid := NFuuid}} -> S1#{uuid => NFuuid}; - {#{uuid := PFuuid}, _} -> S1#{uuid => PFuuid}; - _ -> S1 - end, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S2#{host => NFhost}; - {#{host := PFhost}, _} -> S2#{host => PFhost}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_domain/3}). -merge_msg_domain(PMsg, NMsg, TrUserData) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{id := NFid}} -> S1#{id => NFid}; - {#{id := PFid}, _} -> S1#{id => PFid}; - _ -> S1 - end, - S3 = case {PMsg, NMsg} of - {_, #{uuid := NFuuid}} -> S2#{uuid => NFuuid}; - {#{uuid := PFuuid}, _} -> S2#{uuid => PFuuid}; - _ -> S2 - end, - S4 = case {PMsg, NMsg} of - {_, #{name := NFname}} -> S3#{name => NFname}; - {#{name := PFname}, _} -> S3#{name => PFname}; - _ -> S3 - end, - S5 = case {PMsg, NMsg} of - {_, #{vcpu := NFvcpu}} -> S4#{vcpu => NFvcpu}; - {#{vcpu := PFvcpu}, _} -> S4#{vcpu => PFvcpu}; - _ -> S4 - end, - S6 = case {PMsg, NMsg} of - {_, #{memory := NFmemory}} -> S5#{memory => NFmemory}; - {#{memory := PFmemory}, _} -> S5#{memory => PFmemory}; - _ -> S5 - end, - S7 = case {PMsg, NMsg} of - {_, #{network := NFnetwork}} -> S6#{network => NFnetwork}; - {#{network := PFnetwork}, _} -> S6#{network => PFnetwork}; - _ -> S6 - end, - S8 = case {PMsg, NMsg} of - {_, #{bridge := NFbridge}} -> S7#{bridge => NFbridge}; - {#{bridge := PFbridge}, _} -> S7#{bridge => PFbridge}; - _ -> S7 - end, - S9 = case {PMsg, NMsg} of - {_, #{state := NFstate}} -> S8#{state => NFstate}; - {#{state := PFstate}, _} -> S8#{state => PFstate}; - _ -> S8 - end, - S10 = case {PMsg, NMsg} of - {_, #{private_ip := NFprivate_ip}} -> S9#{private_ip => NFprivate_ip}; - {#{private_ip := PFprivate_ip}, _} -> S9#{private_ip => PFprivate_ip}; - _ -> S9 - end, - S11 = case {PMsg, NMsg} of - {_, #{ipv6_address := NFipv6_address}} -> S10#{ipv6_address => NFipv6_address}; - {#{ipv6_address := PFipv6_address}, _} -> S10#{ipv6_address => PFipv6_address}; - _ -> S10 - end, - S12 = case {PMsg, NMsg} of - {_, #{user_data := NFuser_data}} -> S11#{user_data => NFuser_data}; - {#{user_data := PFuser_data}, _} -> S11#{user_data => PFuser_data}; - _ -> S11 - end, - S13 = case {PMsg, NMsg} of - {_, #{nested_virtualization := NFnested_virtualization}} -> S12#{nested_virtualization => NFnested_virtualization}; - {#{nested_virtualization := PFnested_virtualization}, _} -> S12#{nested_virtualization => PFnested_virtualization}; - _ -> S12 - end, - S14 = case {PMsg, NMsg} of - {_, #{base_image := NFbase_image}} -> S13#{base_image => NFbase_image}; - {#{base_image := PFbase_image}, _} -> S13#{base_image => PFbase_image}; - _ -> S13 - end, - S15 = case {PMsg, NMsg} of - {#{created_at := PFcreated_at}, #{created_at := NFcreated_at}} -> S14#{created_at => merge_msg_timestamp(PFcreated_at, NFcreated_at, TrUserData)}; - {_, #{created_at := NFcreated_at}} -> S14#{created_at => NFcreated_at}; - {#{created_at := PFcreated_at}, _} -> S14#{created_at => PFcreated_at}; - {_, _} -> S14 - end, - case {PMsg, NMsg} of - {_, #{os_type := NFos_type}} -> S15#{os_type => NFos_type}; - {#{os_type := PFos_type}, _} -> S15#{os_type => PFos_type}; - _ -> S15 - end. - --compile({nowarn_unused_function,merge_msg_list_domains_request/3}). -merge_msg_list_domains_request(PMsg, NMsg, _) -> - S1 = #{}, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S1#{host => NFhost}; - {#{host := PFhost}, _} -> S1#{host => PFhost}; - _ -> S1 - end. - --compile({nowarn_unused_function,merge_msg_list_domains_response/3}). -merge_msg_list_domains_response(PMsg, NMsg, TrUserData) -> - S1 = #{}, - case {PMsg, NMsg} of - {#{domains := PFdomains}, #{domains := NFdomains}} -> S1#{domains => 'erlang_++'(PFdomains, NFdomains, TrUserData)}; - {_, #{domains := NFdomains}} -> S1#{domains => NFdomains}; - {#{domains := PFdomains}, _} -> S1#{domains => PFdomains}; - {_, _} -> S1 - end. - --compile({nowarn_unused_function,merge_msg_create_domain_request/3}). -merge_msg_create_domain_request(PMsg, NMsg, TrUserData) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {#{domain := PFdomain}, #{domain := NFdomain}} -> S1#{domain => merge_msg_domain(PFdomain, NFdomain, TrUserData)}; - {_, #{domain := NFdomain}} -> S1#{domain => NFdomain}; - {#{domain := PFdomain}, _} -> S1#{domain => PFdomain}; - {_, _} -> S1 - end, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S2#{host => NFhost}; - {#{host := PFhost}, _} -> S2#{host => PFhost}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_delete_domain_request/3}). -merge_msg_delete_domain_request(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{uuid := NFuuid}} -> S1#{uuid => NFuuid}; - {#{uuid := PFuuid}, _} -> S1#{uuid => PFuuid}; - _ -> S1 - end, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S2#{host => NFhost}; - {#{host := PFhost}, _} -> S2#{host => PFhost}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_download_image_request/3}). -merge_msg_download_image_request(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{domain_id := NFdomain_id}} -> S1#{domain_id => NFdomain_id}; - {#{domain_id := PFdomain_id}, _} -> S1#{domain_id => PFdomain_id}; - _ -> S1 - end, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S2#{host => NFhost}; - {#{host := PFhost}, _} -> S2#{host => PFhost}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_image_chunk/3}). -merge_msg_image_chunk(PMsg, NMsg, _) -> - S1 = #{}, - case {PMsg, NMsg} of - {_, #{bytes := NFbytes}} -> S1#{bytes => NFbytes}; - {#{bytes := PFbytes}, _} -> S1#{bytes => PFbytes}; - _ -> S1 - end. - --compile({nowarn_unused_function,merge_msg_get_network_request/3}). -merge_msg_get_network_request(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{uuid := NFuuid}} -> S1#{uuid => NFuuid}; - {#{uuid := PFuuid}, _} -> S1#{uuid => PFuuid}; - _ -> S1 - end, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S2#{host => NFhost}; - {#{host := PFhost}, _} -> S2#{host => PFhost}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_network/3}). -merge_msg_network(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{uuid := NFuuid}} -> S1#{uuid => NFuuid}; - {#{uuid := PFuuid}, _} -> S1#{uuid => PFuuid}; - _ -> S1 - end, - S3 = case {PMsg, NMsg} of - {_, #{name := NFname}} -> S2#{name => NFname}; - {#{name := PFname}, _} -> S2#{name => PFname}; - _ -> S2 - end, - S4 = case {PMsg, NMsg} of - {_, #{cidr := NFcidr}} -> S3#{cidr => NFcidr}; - {#{cidr := PFcidr}, _} -> S3#{cidr => PFcidr}; - _ -> S3 - end, - case {PMsg, NMsg} of - {_, #{cidr6 := NFcidr6}} -> S4#{cidr6 => NFcidr6}; - {#{cidr6 := PFcidr6}, _} -> S4#{cidr6 => PFcidr6}; - _ -> S4 - end. - --compile({nowarn_unused_function,merge_msg_list_networks_request/3}). -merge_msg_list_networks_request(PMsg, NMsg, _) -> - S1 = #{}, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S1#{host => NFhost}; - {#{host := PFhost}, _} -> S1#{host => PFhost}; - _ -> S1 - end. - --compile({nowarn_unused_function,merge_msg_list_networks_response/3}). -merge_msg_list_networks_response(PMsg, NMsg, TrUserData) -> - S1 = #{}, - case {PMsg, NMsg} of - {#{networks := PFnetworks}, #{networks := NFnetworks}} -> S1#{networks => 'erlang_++'(PFnetworks, NFnetworks, TrUserData)}; - {_, #{networks := NFnetworks}} -> S1#{networks => NFnetworks}; - {#{networks := PFnetworks}, _} -> S1#{networks => PFnetworks}; - {_, _} -> S1 - end. - --compile({nowarn_unused_function,merge_msg_create_network_request/3}). -merge_msg_create_network_request(PMsg, NMsg, TrUserData) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {#{network := PFnetwork}, #{network := NFnetwork}} -> S1#{network => merge_msg_network(PFnetwork, NFnetwork, TrUserData)}; - {_, #{network := NFnetwork}} -> S1#{network => NFnetwork}; - {#{network := PFnetwork}, _} -> S1#{network => PFnetwork}; - {_, _} -> S1 - end, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S2#{host => NFhost}; - {#{host := PFhost}, _} -> S2#{host => PFhost}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_delete_network_request/3}). -merge_msg_delete_network_request(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{uuid := NFuuid}} -> S1#{uuid => NFuuid}; - {#{uuid := PFuuid}, _} -> S1#{uuid => PFuuid}; - _ -> S1 - end, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S2#{host => NFhost}; - {#{host := PFhost}, _} -> S2#{host => PFhost}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_get_volume_request/3}). -merge_msg_get_volume_request(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{uuid := NFuuid}} -> S1#{uuid => NFuuid}; - {#{uuid := PFuuid}, _} -> S1#{uuid => PFuuid}; - _ -> S1 - end, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S2#{host => NFhost}; - {#{host := PFhost}, _} -> S2#{host => PFhost}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_volume/3}). -merge_msg_volume(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{id := NFid}} -> S1#{id => NFid}; - {#{id := PFid}, _} -> S1#{id => PFid}; - _ -> S1 - end, - S3 = case {PMsg, NMsg} of - {_, #{name := NFname}} -> S2#{name => NFname}; - {#{name := PFname}, _} -> S2#{name => PFname}; - _ -> S2 - end, - case {PMsg, NMsg} of - {_, #{size := NFsize}} -> S3#{size => NFsize}; - {#{size := PFsize}, _} -> S3#{size => PFsize}; - _ -> S3 - end. - --compile({nowarn_unused_function,merge_msg_list_volumes_request/3}). -merge_msg_list_volumes_request(PMsg, NMsg, _) -> - S1 = #{}, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S1#{host => NFhost}; - {#{host := PFhost}, _} -> S1#{host => PFhost}; - _ -> S1 - end. - --compile({nowarn_unused_function,merge_msg_list_volumes_response/3}). -merge_msg_list_volumes_response(PMsg, NMsg, TrUserData) -> - S1 = #{}, - case {PMsg, NMsg} of - {#{volumes := PFvolumes}, #{volumes := NFvolumes}} -> S1#{volumes => 'erlang_++'(PFvolumes, NFvolumes, TrUserData)}; - {_, #{volumes := NFvolumes}} -> S1#{volumes => NFvolumes}; - {#{volumes := PFvolumes}, _} -> S1#{volumes => PFvolumes}; - {_, _} -> S1 - end. - --compile({nowarn_unused_function,merge_msg_create_volume_request/3}). -merge_msg_create_volume_request(PMsg, NMsg, TrUserData) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {#{volume := PFvolume}, #{volume := NFvolume}} -> S1#{volume => merge_msg_volume(PFvolume, NFvolume, TrUserData)}; - {_, #{volume := NFvolume}} -> S1#{volume => NFvolume}; - {#{volume := PFvolume}, _} -> S1#{volume => PFvolume}; - {_, _} -> S1 - end, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S2#{host => NFhost}; - {#{host := PFhost}, _} -> S2#{host => PFhost}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_update_volume_request/3}). -merge_msg_update_volume_request(PMsg, NMsg, TrUserData) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S1#{host => NFhost}; - {#{host := PFhost}, _} -> S1#{host => PFhost}; - _ -> S1 - end, - case {PMsg, NMsg} of - {#{volume := PFvolume}, #{volume := NFvolume}} -> S2#{volume => merge_msg_volume(PFvolume, NFvolume, TrUserData)}; - {_, #{volume := NFvolume}} -> S2#{volume => NFvolume}; - {#{volume := PFvolume}, _} -> S2#{volume => PFvolume}; - {_, _} -> S2 - end. - --compile({nowarn_unused_function,merge_msg_delete_volume_request/3}). -merge_msg_delete_volume_request(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{uuid := NFuuid}} -> S1#{uuid => NFuuid}; - {#{uuid := PFuuid}, _} -> S1#{uuid => PFuuid}; - _ -> S1 - end, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S2#{host => NFhost}; - {#{host := PFhost}, _} -> S2#{host => PFhost}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_volume_attachment_identifier/3}). -merge_msg_volume_attachment_identifier(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{domain_id := NFdomain_id}} -> S1#{domain_id => NFdomain_id}; - {#{domain_id := PFdomain_id}, _} -> S1#{domain_id => PFdomain_id}; - _ -> S1 - end, - S3 = case {PMsg, NMsg} of - {_, #{volume_id := NFvolume_id}} -> S2#{volume_id => NFvolume_id}; - {#{volume_id := PFvolume_id}, _} -> S2#{volume_id => PFvolume_id}; - _ -> S2 - end, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S3#{host => NFhost}; - {#{host := PFhost}, _} -> S3#{host => PFhost}; - _ -> S3 - end. - --compile({nowarn_unused_function,merge_msg_volume_attachment/3}). -merge_msg_volume_attachment(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{domain_id := NFdomain_id}} -> S1#{domain_id => NFdomain_id}; - {#{domain_id := PFdomain_id}, _} -> S1#{domain_id => PFdomain_id}; - _ -> S1 - end, - S3 = case {PMsg, NMsg} of - {_, #{volume_id := NFvolume_id}} -> S2#{volume_id => NFvolume_id}; - {#{volume_id := PFvolume_id}, _} -> S2#{volume_id => PFvolume_id}; - _ -> S2 - end, - case {PMsg, NMsg} of - {_, #{disk_address := NFdisk_address}} -> S3#{disk_address => NFdisk_address}; - {#{disk_address := PFdisk_address}, _} -> S3#{disk_address => PFdisk_address}; - _ -> S3 - end. - --compile({nowarn_unused_function,merge_msg_list_volume_attachments_request/3}). -merge_msg_list_volume_attachments_request(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{domain_id := NFdomain_id}} -> S1#{domain_id => NFdomain_id}; - {#{domain_id := PFdomain_id}, _} -> S1#{domain_id => PFdomain_id}; - _ -> S1 - end, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S2#{host => NFhost}; - {#{host := PFhost}, _} -> S2#{host => PFhost}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_list_volume_attachments_response/3}). -merge_msg_list_volume_attachments_response(PMsg, NMsg, TrUserData) -> - S1 = #{}, - case {PMsg, NMsg} of - {#{attachments := PFattachments}, #{attachments := NFattachments}} -> S1#{attachments => 'erlang_++'(PFattachments, NFattachments, TrUserData)}; - {_, #{attachments := NFattachments}} -> S1#{attachments => NFattachments}; - {#{attachments := PFattachments}, _} -> S1#{attachments => PFattachments}; - {_, _} -> S1 - end. - --compile({nowarn_unused_function,merge_msg_port_forwarding_identifier/3}). -merge_msg_port_forwarding_identifier(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S1#{host => NFhost}; - {#{host := PFhost}, _} -> S1#{host => PFhost}; - _ -> S1 - end, - S3 = case {PMsg, NMsg} of - {_, #{protocol := NFprotocol}} -> S2#{protocol => NFprotocol}; - {#{protocol := PFprotocol}, _} -> S2#{protocol => PFprotocol}; - _ -> S2 - end, - case {PMsg, NMsg} of - {_, #{source_port := NFsource_port}} -> S3#{source_port => NFsource_port}; - {#{source_port := PFsource_port}, _} -> S3#{source_port => PFsource_port}; - _ -> S3 - end. - --compile({nowarn_unused_function,merge_msg_port_forwarding/3}). -merge_msg_port_forwarding(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{protocol := NFprotocol}} -> S1#{protocol => NFprotocol}; - {#{protocol := PFprotocol}, _} -> S1#{protocol => PFprotocol}; - _ -> S1 - end, - S3 = case {PMsg, NMsg} of - {_, #{source_port := NFsource_port}} -> S2#{source_port => NFsource_port}; - {#{source_port := PFsource_port}, _} -> S2#{source_port => PFsource_port}; - _ -> S2 - end, - S4 = case {PMsg, NMsg} of - {_, #{target_ip := NFtarget_ip}} -> S3#{target_ip => NFtarget_ip}; - {#{target_ip := PFtarget_ip}, _} -> S3#{target_ip => PFtarget_ip}; - _ -> S3 - end, - case {PMsg, NMsg} of - {_, #{target_port := NFtarget_port}} -> S4#{target_port => NFtarget_port}; - {#{target_port := PFtarget_port}, _} -> S4#{target_port => PFtarget_port}; - _ -> S4 - end. - --compile({nowarn_unused_function,merge_msg_list_port_forwardings_request/3}). -merge_msg_list_port_forwardings_request(PMsg, NMsg, _) -> - S1 = #{}, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S1#{host => NFhost}; - {#{host := PFhost}, _} -> S1#{host => PFhost}; - _ -> S1 - end. - --compile({nowarn_unused_function,merge_msg_list_port_forwardings_response/3}). -merge_msg_list_port_forwardings_response(PMsg, NMsg, TrUserData) -> - S1 = #{}, - case {PMsg, NMsg} of - {#{port_forwardings := PFport_forwardings}, #{port_forwardings := NFport_forwardings}} -> S1#{port_forwardings => 'erlang_++'(PFport_forwardings, NFport_forwardings, TrUserData)}; - {_, #{port_forwardings := NFport_forwardings}} -> S1#{port_forwardings => NFport_forwardings}; - {#{port_forwardings := PFport_forwardings}, _} -> S1#{port_forwardings => PFport_forwardings}; - {_, _} -> S1 - end. - --compile({nowarn_unused_function,merge_msg_put_port_forwarding_request/3}). -merge_msg_put_port_forwarding_request(PMsg, NMsg, TrUserData) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {#{port_forwarding := PFport_forwarding}, #{port_forwarding := NFport_forwarding}} -> S1#{port_forwarding => merge_msg_port_forwarding(PFport_forwarding, NFport_forwarding, TrUserData)}; - {_, #{port_forwarding := NFport_forwarding}} -> S1#{port_forwarding => NFport_forwarding}; - {#{port_forwarding := PFport_forwarding}, _} -> S1#{port_forwarding => PFport_forwarding}; - {_, _} -> S1 - end, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S2#{host => NFhost}; - {#{host := PFhost}, _} -> S2#{host => PFhost}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_timestamp/3}). -merge_msg_timestamp(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{seconds := NFseconds}} -> S1#{seconds => NFseconds}; - {#{seconds := PFseconds}, _} -> S1#{seconds => PFseconds}; - _ -> S1 - end, - case {PMsg, NMsg} of - {_, #{nanos := NFnanos}} -> S2#{nanos => NFnanos}; - {#{nanos := PFnanos}, _} -> S2#{nanos => PFnanos}; - _ -> S2 - end. - - -verify_msg(Msg, MsgName) when is_atom(MsgName) -> verify_msg(Msg, MsgName, []). - -verify_msg(Msg, MsgName, Opts) -> - TrUserData = proplists:get_value(user_data, Opts), - case MsgName of - sync_routes_request -> v_msg_sync_routes_request(Msg, [MsgName], TrUserData); - empty -> v_msg_empty(Msg, [MsgName], TrUserData); - start_domain_request -> v_msg_start_domain_request(Msg, [MsgName], TrUserData); - stop_domain_request -> v_msg_stop_domain_request(Msg, [MsgName], TrUserData); - get_domain_request -> v_msg_get_domain_request(Msg, [MsgName], TrUserData); - domain -> v_msg_domain(Msg, [MsgName], TrUserData); - list_domains_request -> v_msg_list_domains_request(Msg, [MsgName], TrUserData); - list_domains_response -> v_msg_list_domains_response(Msg, [MsgName], TrUserData); - create_domain_request -> v_msg_create_domain_request(Msg, [MsgName], TrUserData); - delete_domain_request -> v_msg_delete_domain_request(Msg, [MsgName], TrUserData); - download_image_request -> v_msg_download_image_request(Msg, [MsgName], TrUserData); - image_chunk -> v_msg_image_chunk(Msg, [MsgName], TrUserData); - get_network_request -> v_msg_get_network_request(Msg, [MsgName], TrUserData); - network -> v_msg_network(Msg, [MsgName], TrUserData); - list_networks_request -> v_msg_list_networks_request(Msg, [MsgName], TrUserData); - list_networks_response -> v_msg_list_networks_response(Msg, [MsgName], TrUserData); - create_network_request -> v_msg_create_network_request(Msg, [MsgName], TrUserData); - delete_network_request -> v_msg_delete_network_request(Msg, [MsgName], TrUserData); - get_volume_request -> v_msg_get_volume_request(Msg, [MsgName], TrUserData); - volume -> v_msg_volume(Msg, [MsgName], TrUserData); - list_volumes_request -> v_msg_list_volumes_request(Msg, [MsgName], TrUserData); - list_volumes_response -> v_msg_list_volumes_response(Msg, [MsgName], TrUserData); - create_volume_request -> v_msg_create_volume_request(Msg, [MsgName], TrUserData); - update_volume_request -> v_msg_update_volume_request(Msg, [MsgName], TrUserData); - delete_volume_request -> v_msg_delete_volume_request(Msg, [MsgName], TrUserData); - volume_attachment_identifier -> v_msg_volume_attachment_identifier(Msg, [MsgName], TrUserData); - volume_attachment -> v_msg_volume_attachment(Msg, [MsgName], TrUserData); - list_volume_attachments_request -> v_msg_list_volume_attachments_request(Msg, [MsgName], TrUserData); - list_volume_attachments_response -> v_msg_list_volume_attachments_response(Msg, [MsgName], TrUserData); - port_forwarding_identifier -> v_msg_port_forwarding_identifier(Msg, [MsgName], TrUserData); - port_forwarding -> v_msg_port_forwarding(Msg, [MsgName], TrUserData); - list_port_forwardings_request -> v_msg_list_port_forwardings_request(Msg, [MsgName], TrUserData); - list_port_forwardings_response -> v_msg_list_port_forwardings_response(Msg, [MsgName], TrUserData); - put_port_forwarding_request -> v_msg_put_port_forwarding_request(Msg, [MsgName], TrUserData); - timestamp -> v_msg_timestamp(Msg, [MsgName], TrUserData); - _ -> mk_type_error(not_a_known_message, Msg, []) - end. - - --compile({nowarn_unused_function,v_msg_sync_routes_request/3}). --dialyzer({nowarn_function,v_msg_sync_routes_request/3}). -v_msg_sync_routes_request(#{} = M, Path, _) -> - lists:foreach(fun (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) end, maps:keys(M)), - ok; -v_msg_sync_routes_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), sync_routes_request}, M, Path); -v_msg_sync_routes_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, sync_routes_request}, X, Path). - --compile({nowarn_unused_function,v_msg_empty/3}). --dialyzer({nowarn_function,v_msg_empty/3}). -v_msg_empty(#{} = M, Path, _) -> - lists:foreach(fun (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) end, maps:keys(M)), - ok; -v_msg_empty(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), empty}, M, Path); -v_msg_empty(X, Path, _TrUserData) -> mk_type_error({expected_msg, empty}, X, Path). - --compile({nowarn_unused_function,v_msg_start_domain_request/3}). --dialyzer({nowarn_function,v_msg_start_domain_request/3}). -v_msg_start_domain_request(#{} = M, Path, TrUserData) -> - case M of - #{host := F1} -> v_type_string(F1, [host | Path], TrUserData); - _ -> ok - end, - case M of - #{uuid := F2} -> v_type_string(F2, [uuid | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (host) -> ok; - (uuid) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_start_domain_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), start_domain_request}, M, Path); -v_msg_start_domain_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, start_domain_request}, X, Path). - --compile({nowarn_unused_function,v_msg_stop_domain_request/3}). --dialyzer({nowarn_function,v_msg_stop_domain_request/3}). -v_msg_stop_domain_request(#{} = M, Path, TrUserData) -> - case M of - #{host := F1} -> v_type_string(F1, [host | Path], TrUserData); - _ -> ok - end, - case M of - #{uuid := F2} -> v_type_string(F2, [uuid | Path], TrUserData); - _ -> ok - end, - case M of - #{force := F3} -> v_type_bool(F3, [force | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (host) -> ok; - (uuid) -> ok; - (force) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_stop_domain_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), stop_domain_request}, M, Path); -v_msg_stop_domain_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, stop_domain_request}, X, Path). - --compile({nowarn_unused_function,v_msg_get_domain_request/3}). --dialyzer({nowarn_function,v_msg_get_domain_request/3}). -v_msg_get_domain_request(#{} = M, Path, TrUserData) -> - case M of - #{uuid := F1} -> v_type_string(F1, [uuid | Path], TrUserData); - _ -> ok - end, - case M of - #{host := F2} -> v_type_string(F2, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (uuid) -> ok; - (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_get_domain_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), get_domain_request}, M, Path); -v_msg_get_domain_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, get_domain_request}, X, Path). - --compile({nowarn_unused_function,v_msg_domain/3}). --dialyzer({nowarn_function,v_msg_domain/3}). -v_msg_domain(#{} = M, Path, TrUserData) -> - case M of - #{id := F1} -> v_type_uint64(F1, [id | Path], TrUserData); - _ -> ok - end, - case M of - #{uuid := F2} -> v_type_string(F2, [uuid | Path], TrUserData); - _ -> ok - end, - case M of - #{name := F3} -> v_type_string(F3, [name | Path], TrUserData); - _ -> ok - end, - case M of - #{vcpu := F4} -> v_type_uint32(F4, [vcpu | Path], TrUserData); - _ -> ok - end, - case M of - #{memory := F5} -> v_type_uint64(F5, [memory | Path], TrUserData); - _ -> ok - end, - case M of - #{network := F6} -> v_type_string(F6, [network | Path], TrUserData); - _ -> ok - end, - case M of - #{bridge := F7} -> v_type_string(F7, [bridge | Path], TrUserData); - _ -> ok - end, - case M of - #{state := F8} -> v_type_string(F8, [state | Path], TrUserData); - _ -> ok - end, - case M of - #{private_ip := F9} -> v_type_string(F9, [private_ip | Path], TrUserData); - _ -> ok - end, - case M of - #{ipv6_address := F10} -> v_type_string(F10, [ipv6_address | Path], TrUserData); - _ -> ok - end, - case M of - #{user_data := F11} -> v_type_string(F11, [user_data | Path], TrUserData); - _ -> ok - end, - case M of - #{nested_virtualization := F12} -> v_type_bool(F12, [nested_virtualization | Path], TrUserData); - _ -> ok - end, - case M of - #{base_image := F13} -> v_type_string(F13, [base_image | Path], TrUserData); - _ -> ok - end, - case M of - #{created_at := F14} -> v_msg_timestamp(F14, [created_at | Path], TrUserData); - _ -> ok - end, - case M of - #{os_type := F15} -> v_type_string(F15, [os_type | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (id) -> ok; - (uuid) -> ok; - (name) -> ok; - (vcpu) -> ok; - (memory) -> ok; - (network) -> ok; - (bridge) -> ok; - (state) -> ok; - (private_ip) -> ok; - (ipv6_address) -> ok; - (user_data) -> ok; - (nested_virtualization) -> ok; - (base_image) -> ok; - (created_at) -> ok; - (os_type) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_domain(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), domain}, M, Path); -v_msg_domain(X, Path, _TrUserData) -> mk_type_error({expected_msg, domain}, X, Path). - --compile({nowarn_unused_function,v_msg_list_domains_request/3}). --dialyzer({nowarn_function,v_msg_list_domains_request/3}). -v_msg_list_domains_request(#{} = M, Path, TrUserData) -> - case M of - #{host := F1} -> v_type_string(F1, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_domains_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_domains_request}, M, Path); -v_msg_list_domains_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_domains_request}, X, Path). - --compile({nowarn_unused_function,v_msg_list_domains_response/3}). --dialyzer({nowarn_function,v_msg_list_domains_response/3}). -v_msg_list_domains_response(#{} = M, Path, TrUserData) -> - case M of - #{domains := F1} -> - if is_list(F1) -> - _ = [v_msg_domain(Elem, [domains | Path], TrUserData) || Elem <- F1], - ok; - true -> mk_type_error({invalid_list_of, {msg, domain}}, F1, [domains | Path]) - end; - _ -> ok - end, - lists:foreach(fun (domains) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_domains_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_domains_response}, M, Path); -v_msg_list_domains_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_domains_response}, X, Path). - --compile({nowarn_unused_function,v_msg_create_domain_request/3}). --dialyzer({nowarn_function,v_msg_create_domain_request/3}). -v_msg_create_domain_request(#{} = M, Path, TrUserData) -> - case M of - #{domain := F1} -> v_msg_domain(F1, [domain | Path], TrUserData); - _ -> ok - end, - case M of - #{host := F2} -> v_type_string(F2, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (domain) -> ok; - (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_create_domain_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), create_domain_request}, M, Path); -v_msg_create_domain_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, create_domain_request}, X, Path). - --compile({nowarn_unused_function,v_msg_delete_domain_request/3}). --dialyzer({nowarn_function,v_msg_delete_domain_request/3}). -v_msg_delete_domain_request(#{} = M, Path, TrUserData) -> - case M of - #{uuid := F1} -> v_type_string(F1, [uuid | Path], TrUserData); - _ -> ok - end, - case M of - #{host := F2} -> v_type_string(F2, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (uuid) -> ok; - (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_delete_domain_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), delete_domain_request}, M, Path); -v_msg_delete_domain_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, delete_domain_request}, X, Path). - --compile({nowarn_unused_function,v_msg_download_image_request/3}). --dialyzer({nowarn_function,v_msg_download_image_request/3}). -v_msg_download_image_request(#{} = M, Path, TrUserData) -> - case M of - #{domain_id := F1} -> v_type_string(F1, [domain_id | Path], TrUserData); - _ -> ok - end, - case M of - #{host := F2} -> v_type_string(F2, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (domain_id) -> ok; - (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_download_image_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), download_image_request}, M, Path); -v_msg_download_image_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, download_image_request}, X, Path). - --compile({nowarn_unused_function,v_msg_image_chunk/3}). --dialyzer({nowarn_function,v_msg_image_chunk/3}). -v_msg_image_chunk(#{} = M, Path, TrUserData) -> - case M of - #{bytes := F1} -> v_type_bytes(F1, [bytes | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (bytes) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_image_chunk(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), image_chunk}, M, Path); -v_msg_image_chunk(X, Path, _TrUserData) -> mk_type_error({expected_msg, image_chunk}, X, Path). - --compile({nowarn_unused_function,v_msg_get_network_request/3}). --dialyzer({nowarn_function,v_msg_get_network_request/3}). -v_msg_get_network_request(#{} = M, Path, TrUserData) -> - case M of - #{uuid := F1} -> v_type_string(F1, [uuid | Path], TrUserData); - _ -> ok - end, - case M of - #{host := F2} -> v_type_string(F2, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (uuid) -> ok; - (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_get_network_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), get_network_request}, M, Path); -v_msg_get_network_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, get_network_request}, X, Path). - --compile({nowarn_unused_function,v_msg_network/3}). --dialyzer({nowarn_function,v_msg_network/3}). -v_msg_network(#{} = M, Path, TrUserData) -> - case M of - #{uuid := F1} -> v_type_string(F1, [uuid | Path], TrUserData); - _ -> ok - end, - case M of - #{name := F2} -> v_type_string(F2, [name | Path], TrUserData); - _ -> ok - end, - case M of - #{cidr := F3} -> v_type_string(F3, [cidr | Path], TrUserData); - _ -> ok - end, - case M of - #{cidr6 := F4} -> v_type_string(F4, [cidr6 | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (uuid) -> ok; - (name) -> ok; - (cidr) -> ok; - (cidr6) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_network(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), network}, M, Path); -v_msg_network(X, Path, _TrUserData) -> mk_type_error({expected_msg, network}, X, Path). - --compile({nowarn_unused_function,v_msg_list_networks_request/3}). --dialyzer({nowarn_function,v_msg_list_networks_request/3}). -v_msg_list_networks_request(#{} = M, Path, TrUserData) -> - case M of - #{host := F1} -> v_type_string(F1, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_networks_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_networks_request}, M, Path); -v_msg_list_networks_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_networks_request}, X, Path). - --compile({nowarn_unused_function,v_msg_list_networks_response/3}). --dialyzer({nowarn_function,v_msg_list_networks_response/3}). -v_msg_list_networks_response(#{} = M, Path, TrUserData) -> - case M of - #{networks := F1} -> - if is_list(F1) -> - _ = [v_msg_network(Elem, [networks | Path], TrUserData) || Elem <- F1], - ok; - true -> mk_type_error({invalid_list_of, {msg, network}}, F1, [networks | Path]) - end; - _ -> ok - end, - lists:foreach(fun (networks) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_networks_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_networks_response}, M, Path); -v_msg_list_networks_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_networks_response}, X, Path). - --compile({nowarn_unused_function,v_msg_create_network_request/3}). --dialyzer({nowarn_function,v_msg_create_network_request/3}). -v_msg_create_network_request(#{} = M, Path, TrUserData) -> - case M of - #{network := F1} -> v_msg_network(F1, [network | Path], TrUserData); - _ -> ok - end, - case M of - #{host := F2} -> v_type_string(F2, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (network) -> ok; - (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_create_network_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), create_network_request}, M, Path); -v_msg_create_network_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, create_network_request}, X, Path). - --compile({nowarn_unused_function,v_msg_delete_network_request/3}). --dialyzer({nowarn_function,v_msg_delete_network_request/3}). -v_msg_delete_network_request(#{} = M, Path, TrUserData) -> - case M of - #{uuid := F1} -> v_type_string(F1, [uuid | Path], TrUserData); - _ -> ok - end, - case M of - #{host := F2} -> v_type_string(F2, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (uuid) -> ok; - (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_delete_network_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), delete_network_request}, M, Path); -v_msg_delete_network_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, delete_network_request}, X, Path). - --compile({nowarn_unused_function,v_msg_get_volume_request/3}). --dialyzer({nowarn_function,v_msg_get_volume_request/3}). -v_msg_get_volume_request(#{} = M, Path, TrUserData) -> - case M of - #{uuid := F1} -> v_type_string(F1, [uuid | Path], TrUserData); - _ -> ok - end, - case M of - #{host := F2} -> v_type_string(F2, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (uuid) -> ok; - (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_get_volume_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), get_volume_request}, M, Path); -v_msg_get_volume_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, get_volume_request}, X, Path). - --compile({nowarn_unused_function,v_msg_volume/3}). --dialyzer({nowarn_function,v_msg_volume/3}). -v_msg_volume(#{} = M, Path, TrUserData) -> - case M of - #{id := F1} -> v_type_string(F1, [id | Path], TrUserData); - _ -> ok - end, - case M of - #{name := F2} -> v_type_string(F2, [name | Path], TrUserData); - _ -> ok - end, - case M of - #{size := F3} -> v_type_uint64(F3, [size | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (id) -> ok; - (name) -> ok; - (size) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_volume(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), volume}, M, Path); -v_msg_volume(X, Path, _TrUserData) -> mk_type_error({expected_msg, volume}, X, Path). - --compile({nowarn_unused_function,v_msg_list_volumes_request/3}). --dialyzer({nowarn_function,v_msg_list_volumes_request/3}). -v_msg_list_volumes_request(#{} = M, Path, TrUserData) -> - case M of - #{host := F1} -> v_type_string(F1, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_volumes_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_volumes_request}, M, Path); -v_msg_list_volumes_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_volumes_request}, X, Path). - --compile({nowarn_unused_function,v_msg_list_volumes_response/3}). --dialyzer({nowarn_function,v_msg_list_volumes_response/3}). -v_msg_list_volumes_response(#{} = M, Path, TrUserData) -> - case M of - #{volumes := F1} -> - if is_list(F1) -> - _ = [v_msg_volume(Elem, [volumes | Path], TrUserData) || Elem <- F1], - ok; - true -> mk_type_error({invalid_list_of, {msg, volume}}, F1, [volumes | Path]) - end; - _ -> ok - end, - lists:foreach(fun (volumes) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_volumes_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_volumes_response}, M, Path); -v_msg_list_volumes_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_volumes_response}, X, Path). - --compile({nowarn_unused_function,v_msg_create_volume_request/3}). --dialyzer({nowarn_function,v_msg_create_volume_request/3}). -v_msg_create_volume_request(#{} = M, Path, TrUserData) -> - case M of - #{volume := F1} -> v_msg_volume(F1, [volume | Path], TrUserData); - _ -> ok - end, - case M of - #{host := F2} -> v_type_string(F2, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (volume) -> ok; - (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_create_volume_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), create_volume_request}, M, Path); -v_msg_create_volume_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, create_volume_request}, X, Path). - --compile({nowarn_unused_function,v_msg_update_volume_request/3}). --dialyzer({nowarn_function,v_msg_update_volume_request/3}). -v_msg_update_volume_request(#{} = M, Path, TrUserData) -> - case M of - #{host := F1} -> v_type_string(F1, [host | Path], TrUserData); - _ -> ok - end, - case M of - #{volume := F2} -> v_msg_volume(F2, [volume | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (host) -> ok; - (volume) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_update_volume_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), update_volume_request}, M, Path); -v_msg_update_volume_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, update_volume_request}, X, Path). - --compile({nowarn_unused_function,v_msg_delete_volume_request/3}). --dialyzer({nowarn_function,v_msg_delete_volume_request/3}). -v_msg_delete_volume_request(#{} = M, Path, TrUserData) -> - case M of - #{uuid := F1} -> v_type_string(F1, [uuid | Path], TrUserData); - _ -> ok - end, - case M of - #{host := F2} -> v_type_string(F2, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (uuid) -> ok; - (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_delete_volume_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), delete_volume_request}, M, Path); -v_msg_delete_volume_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, delete_volume_request}, X, Path). - --compile({nowarn_unused_function,v_msg_volume_attachment_identifier/3}). --dialyzer({nowarn_function,v_msg_volume_attachment_identifier/3}). -v_msg_volume_attachment_identifier(#{} = M, Path, TrUserData) -> - case M of - #{domain_id := F1} -> v_type_string(F1, [domain_id | Path], TrUserData); - _ -> ok - end, - case M of - #{volume_id := F2} -> v_type_string(F2, [volume_id | Path], TrUserData); - _ -> ok - end, - case M of - #{host := F3} -> v_type_string(F3, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (domain_id) -> ok; - (volume_id) -> ok; - (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_volume_attachment_identifier(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), volume_attachment_identifier}, M, Path); -v_msg_volume_attachment_identifier(X, Path, _TrUserData) -> mk_type_error({expected_msg, volume_attachment_identifier}, X, Path). - --compile({nowarn_unused_function,v_msg_volume_attachment/3}). --dialyzer({nowarn_function,v_msg_volume_attachment/3}). -v_msg_volume_attachment(#{} = M, Path, TrUserData) -> - case M of - #{domain_id := F1} -> v_type_string(F1, [domain_id | Path], TrUserData); - _ -> ok - end, - case M of - #{volume_id := F2} -> v_type_string(F2, [volume_id | Path], TrUserData); - _ -> ok - end, - case M of - #{disk_address := F3} -> v_type_string(F3, [disk_address | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (domain_id) -> ok; - (volume_id) -> ok; - (disk_address) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_volume_attachment(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), volume_attachment}, M, Path); -v_msg_volume_attachment(X, Path, _TrUserData) -> mk_type_error({expected_msg, volume_attachment}, X, Path). - --compile({nowarn_unused_function,v_msg_list_volume_attachments_request/3}). --dialyzer({nowarn_function,v_msg_list_volume_attachments_request/3}). -v_msg_list_volume_attachments_request(#{} = M, Path, TrUserData) -> - case M of - #{domain_id := F1} -> v_type_string(F1, [domain_id | Path], TrUserData); - _ -> ok - end, - case M of - #{host := F2} -> v_type_string(F2, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (domain_id) -> ok; - (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_volume_attachments_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_volume_attachments_request}, M, Path); -v_msg_list_volume_attachments_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_volume_attachments_request}, X, Path). - --compile({nowarn_unused_function,v_msg_list_volume_attachments_response/3}). --dialyzer({nowarn_function,v_msg_list_volume_attachments_response/3}). -v_msg_list_volume_attachments_response(#{} = M, Path, TrUserData) -> - case M of - #{attachments := F1} -> - if is_list(F1) -> - _ = [v_msg_volume_attachment(Elem, [attachments | Path], TrUserData) || Elem <- F1], - ok; - true -> mk_type_error({invalid_list_of, {msg, volume_attachment}}, F1, [attachments | Path]) - end; - _ -> ok - end, - lists:foreach(fun (attachments) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_volume_attachments_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_volume_attachments_response}, M, Path); -v_msg_list_volume_attachments_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_volume_attachments_response}, X, Path). - --compile({nowarn_unused_function,v_msg_port_forwarding_identifier/3}). --dialyzer({nowarn_function,v_msg_port_forwarding_identifier/3}). -v_msg_port_forwarding_identifier(#{} = M, Path, TrUserData) -> - case M of - #{host := F1} -> v_type_string(F1, [host | Path], TrUserData); - _ -> ok - end, - case M of - #{protocol := F2} -> v_type_string(F2, [protocol | Path], TrUserData); - _ -> ok - end, - case M of - #{source_port := F3} -> v_type_uint32(F3, [source_port | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (host) -> ok; - (protocol) -> ok; - (source_port) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_port_forwarding_identifier(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), port_forwarding_identifier}, M, Path); -v_msg_port_forwarding_identifier(X, Path, _TrUserData) -> mk_type_error({expected_msg, port_forwarding_identifier}, X, Path). - --compile({nowarn_unused_function,v_msg_port_forwarding/3}). --dialyzer({nowarn_function,v_msg_port_forwarding/3}). -v_msg_port_forwarding(#{} = M, Path, TrUserData) -> - case M of - #{protocol := F1} -> v_type_string(F1, [protocol | Path], TrUserData); - _ -> ok - end, - case M of - #{source_port := F2} -> v_type_uint32(F2, [source_port | Path], TrUserData); - _ -> ok - end, - case M of - #{target_ip := F3} -> v_type_string(F3, [target_ip | Path], TrUserData); - _ -> ok - end, - case M of - #{target_port := F4} -> v_type_uint32(F4, [target_port | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (protocol) -> ok; - (source_port) -> ok; - (target_ip) -> ok; - (target_port) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_port_forwarding(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), port_forwarding}, M, Path); -v_msg_port_forwarding(X, Path, _TrUserData) -> mk_type_error({expected_msg, port_forwarding}, X, Path). - --compile({nowarn_unused_function,v_msg_list_port_forwardings_request/3}). --dialyzer({nowarn_function,v_msg_list_port_forwardings_request/3}). -v_msg_list_port_forwardings_request(#{} = M, Path, TrUserData) -> - case M of - #{host := F1} -> v_type_string(F1, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_port_forwardings_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_port_forwardings_request}, M, Path); -v_msg_list_port_forwardings_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_port_forwardings_request}, X, Path). - --compile({nowarn_unused_function,v_msg_list_port_forwardings_response/3}). --dialyzer({nowarn_function,v_msg_list_port_forwardings_response/3}). -v_msg_list_port_forwardings_response(#{} = M, Path, TrUserData) -> - case M of - #{port_forwardings := F1} -> - if is_list(F1) -> - _ = [v_msg_port_forwarding(Elem, [port_forwardings | Path], TrUserData) || Elem <- F1], - ok; - true -> mk_type_error({invalid_list_of, {msg, port_forwarding}}, F1, [port_forwardings | Path]) - end; - _ -> ok - end, - lists:foreach(fun (port_forwardings) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_port_forwardings_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_port_forwardings_response}, M, Path); -v_msg_list_port_forwardings_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_port_forwardings_response}, X, Path). - --compile({nowarn_unused_function,v_msg_put_port_forwarding_request/3}). --dialyzer({nowarn_function,v_msg_put_port_forwarding_request/3}). -v_msg_put_port_forwarding_request(#{} = M, Path, TrUserData) -> - case M of - #{port_forwarding := F1} -> v_msg_port_forwarding(F1, [port_forwarding | Path], TrUserData); - _ -> ok - end, - case M of - #{host := F2} -> v_type_string(F2, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (port_forwarding) -> ok; - (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_put_port_forwarding_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), put_port_forwarding_request}, M, Path); -v_msg_put_port_forwarding_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, put_port_forwarding_request}, X, Path). - --compile({nowarn_unused_function,v_msg_timestamp/3}). --dialyzer({nowarn_function,v_msg_timestamp/3}). -v_msg_timestamp(#{} = M, Path, TrUserData) -> - case M of - #{seconds := F1} -> v_type_int64(F1, [seconds | Path], TrUserData); - _ -> ok - end, - case M of - #{nanos := F2} -> v_type_int32(F2, [nanos | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (seconds) -> ok; - (nanos) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_timestamp(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), timestamp}, M, Path); -v_msg_timestamp(X, Path, _TrUserData) -> mk_type_error({expected_msg, timestamp}, X, Path). - --compile({nowarn_unused_function,v_type_int32/3}). --dialyzer({nowarn_function,v_type_int32/3}). -v_type_int32(N, _Path, _TrUserData) when -2147483648 =< N, N =< 2147483647 -> ok; -v_type_int32(N, Path, _TrUserData) when is_integer(N) -> mk_type_error({value_out_of_range, int32, signed, 32}, N, Path); -v_type_int32(X, Path, _TrUserData) -> mk_type_error({bad_integer, int32, signed, 32}, X, Path). - --compile({nowarn_unused_function,v_type_int64/3}). --dialyzer({nowarn_function,v_type_int64/3}). -v_type_int64(N, _Path, _TrUserData) when -9223372036854775808 =< N, N =< 9223372036854775807 -> ok; -v_type_int64(N, Path, _TrUserData) when is_integer(N) -> mk_type_error({value_out_of_range, int64, signed, 64}, N, Path); -v_type_int64(X, Path, _TrUserData) -> mk_type_error({bad_integer, int64, signed, 64}, X, Path). - --compile({nowarn_unused_function,v_type_uint32/3}). --dialyzer({nowarn_function,v_type_uint32/3}). -v_type_uint32(N, _Path, _TrUserData) when 0 =< N, N =< 4294967295 -> ok; -v_type_uint32(N, Path, _TrUserData) when is_integer(N) -> mk_type_error({value_out_of_range, uint32, unsigned, 32}, N, Path); -v_type_uint32(X, Path, _TrUserData) -> mk_type_error({bad_integer, uint32, unsigned, 32}, X, Path). - --compile({nowarn_unused_function,v_type_uint64/3}). --dialyzer({nowarn_function,v_type_uint64/3}). -v_type_uint64(N, _Path, _TrUserData) when 0 =< N, N =< 18446744073709551615 -> ok; -v_type_uint64(N, Path, _TrUserData) when is_integer(N) -> mk_type_error({value_out_of_range, uint64, unsigned, 64}, N, Path); -v_type_uint64(X, Path, _TrUserData) -> mk_type_error({bad_integer, uint64, unsigned, 64}, X, Path). - --compile({nowarn_unused_function,v_type_bool/3}). --dialyzer({nowarn_function,v_type_bool/3}). -v_type_bool(false, _Path, _TrUserData) -> ok; -v_type_bool(true, _Path, _TrUserData) -> ok; -v_type_bool(0, _Path, _TrUserData) -> ok; -v_type_bool(1, _Path, _TrUserData) -> ok; -v_type_bool(X, Path, _TrUserData) -> mk_type_error(bad_boolean_value, X, Path). - --compile({nowarn_unused_function,v_type_string/3}). --dialyzer({nowarn_function,v_type_string/3}). -v_type_string(S, Path, _TrUserData) when is_list(S); is_binary(S) -> - try unicode:characters_to_binary(S) of - B when is_binary(B) -> ok; - {error, _, _} -> mk_type_error(bad_unicode_string, S, Path) - catch - error:badarg -> mk_type_error(bad_unicode_string, S, Path) - end; -v_type_string(X, Path, _TrUserData) -> mk_type_error(bad_unicode_string, X, Path). - --compile({nowarn_unused_function,v_type_bytes/3}). --dialyzer({nowarn_function,v_type_bytes/3}). -v_type_bytes(B, _Path, _TrUserData) when is_binary(B) -> ok; -v_type_bytes(B, _Path, _TrUserData) when is_list(B) -> ok; -v_type_bytes(X, Path, _TrUserData) -> mk_type_error(bad_binary_value, X, Path). - --compile({nowarn_unused_function,mk_type_error/3}). --spec mk_type_error(_, _, list()) -> no_return(). -mk_type_error(Error, ValueSeen, Path) -> - Path2 = prettify_path(Path), - erlang:error({gpb_type_error, {Error, [{value, ValueSeen}, {path, Path2}]}}). - - --compile({nowarn_unused_function,prettify_path/1}). --dialyzer({nowarn_function,prettify_path/1}). -prettify_path([]) -> top_level; -prettify_path(PathR) -> lists:append(lists:join(".", lists:map(fun atom_to_list/1, lists:reverse(PathR)))). - - --compile({nowarn_unused_function,id/2}). --compile({inline,id/2}). -id(X, _TrUserData) -> X. - --compile({nowarn_unused_function,v_ok/3}). --compile({inline,v_ok/3}). -v_ok(_Value, _Path, _TrUserData) -> ok. - --compile({nowarn_unused_function,m_overwrite/3}). --compile({inline,m_overwrite/3}). -m_overwrite(_Prev, New, _TrUserData) -> New. - --compile({nowarn_unused_function,cons/3}). --compile({inline,cons/3}). -cons(Elem, Acc, _TrUserData) -> [Elem | Acc]. - --compile({nowarn_unused_function,lists_reverse/2}). --compile({inline,lists_reverse/2}). -'lists_reverse'(L, _TrUserData) -> lists:reverse(L). --compile({nowarn_unused_function,'erlang_++'/3}). --compile({inline,'erlang_++'/3}). -'erlang_++'(A, B, _TrUserData) -> A ++ B. - - -get_msg_defs() -> - [{{msg, sync_routes_request}, []}, - {{msg, empty}, []}, - {{msg, start_domain_request}, [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => uuid, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, stop_domain_request}, - [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => uuid, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => force, fnum => 3, rnum => 4, type => bool, occurrence => optional, opts => []}]}, - {{msg, get_domain_request}, [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, domain}, - [#{name => id, fnum => 1, rnum => 2, type => uint64, occurrence => optional, opts => []}, - #{name => uuid, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => name, fnum => 3, rnum => 4, type => string, occurrence => optional, opts => []}, - #{name => vcpu, fnum => 4, rnum => 5, type => uint32, occurrence => optional, opts => []}, - #{name => memory, fnum => 5, rnum => 6, type => uint64, occurrence => optional, opts => []}, - #{name => network, fnum => 6, rnum => 7, type => string, occurrence => optional, opts => []}, - #{name => bridge, fnum => 7, rnum => 8, type => string, occurrence => optional, opts => []}, - #{name => state, fnum => 8, rnum => 9, type => string, occurrence => optional, opts => []}, - #{name => private_ip, fnum => 9, rnum => 10, type => string, occurrence => optional, opts => []}, - #{name => ipv6_address, fnum => 15, rnum => 11, type => string, occurrence => optional, opts => []}, - #{name => user_data, fnum => 10, rnum => 12, type => string, occurrence => optional, opts => []}, - #{name => nested_virtualization, fnum => 11, rnum => 13, type => bool, occurrence => optional, opts => []}, - #{name => base_image, fnum => 12, rnum => 14, type => string, occurrence => optional, opts => []}, - #{name => created_at, fnum => 13, rnum => 15, type => {msg, timestamp}, occurrence => optional, opts => []}, - #{name => os_type, fnum => 14, rnum => 16, type => string, occurrence => optional, opts => []}]}, - {{msg, list_domains_request}, [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]}, - {{msg, list_domains_response}, [#{name => domains, fnum => 1, rnum => 2, type => {msg, domain}, occurrence => repeated, opts => []}]}, - {{msg, create_domain_request}, [#{name => domain, fnum => 1, rnum => 2, type => {msg, domain}, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, delete_domain_request}, [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, download_image_request}, [#{name => domain_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, image_chunk}, [#{name => bytes, fnum => 1, rnum => 2, type => bytes, occurrence => optional, opts => []}]}, - {{msg, get_network_request}, [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, network}, - [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => name, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => cidr, fnum => 3, rnum => 4, type => string, occurrence => optional, opts => []}, - #{name => cidr6, fnum => 4, rnum => 5, type => string, occurrence => optional, opts => []}]}, - {{msg, list_networks_request}, [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]}, - {{msg, list_networks_response}, [#{name => networks, fnum => 1, rnum => 2, type => {msg, network}, occurrence => repeated, opts => []}]}, - {{msg, create_network_request}, [#{name => network, fnum => 1, rnum => 2, type => {msg, network}, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, delete_network_request}, [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, get_volume_request}, [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, volume}, - [#{name => id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => name, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => size, fnum => 3, rnum => 4, type => uint64, occurrence => optional, opts => []}]}, - {{msg, list_volumes_request}, [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]}, - {{msg, list_volumes_response}, [#{name => volumes, fnum => 1, rnum => 2, type => {msg, volume}, occurrence => repeated, opts => []}]}, - {{msg, create_volume_request}, [#{name => volume, fnum => 1, rnum => 2, type => {msg, volume}, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, update_volume_request}, [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => volume, fnum => 2, rnum => 3, type => {msg, volume}, occurrence => optional, opts => []}]}, - {{msg, delete_volume_request}, [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, volume_attachment_identifier}, - [#{name => domain_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => volume_id, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => host, fnum => 3, rnum => 4, type => string, occurrence => optional, opts => []}]}, - {{msg, volume_attachment}, - [#{name => domain_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => volume_id, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => disk_address, fnum => 3, rnum => 4, type => string, occurrence => optional, opts => []}]}, - {{msg, list_volume_attachments_request}, [#{name => domain_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, list_volume_attachments_response}, [#{name => attachments, fnum => 1, rnum => 2, type => {msg, volume_attachment}, occurrence => repeated, opts => []}]}, - {{msg, port_forwarding_identifier}, - [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => protocol, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => source_port, fnum => 3, rnum => 4, type => uint32, occurrence => optional, opts => []}]}, - {{msg, port_forwarding}, - [#{name => protocol, fnum => 2, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => source_port, fnum => 3, rnum => 3, type => uint32, occurrence => optional, opts => []}, - #{name => target_ip, fnum => 4, rnum => 4, type => string, occurrence => optional, opts => []}, - #{name => target_port, fnum => 5, rnum => 5, type => uint32, occurrence => optional, opts => []}]}, - {{msg, list_port_forwardings_request}, [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]}, - {{msg, list_port_forwardings_response}, [#{name => port_forwardings, fnum => 1, rnum => 2, type => {msg, port_forwarding}, occurrence => repeated, opts => []}]}, - {{msg, put_port_forwarding_request}, [#{name => port_forwarding, fnum => 1, rnum => 2, type => {msg, port_forwarding}, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, timestamp}, [#{name => seconds, fnum => 1, rnum => 2, type => int64, occurrence => optional, opts => []}, #{name => nanos, fnum => 2, rnum => 3, type => int32, occurrence => optional, opts => []}]}]. - - -get_msg_names() -> - [sync_routes_request, - empty, - start_domain_request, - stop_domain_request, - get_domain_request, - domain, - list_domains_request, - list_domains_response, - create_domain_request, - delete_domain_request, - download_image_request, - image_chunk, - get_network_request, - network, - list_networks_request, - list_networks_response, - create_network_request, - delete_network_request, - get_volume_request, - volume, - list_volumes_request, - list_volumes_response, - create_volume_request, - update_volume_request, - delete_volume_request, - volume_attachment_identifier, - volume_attachment, - list_volume_attachments_request, - list_volume_attachments_response, - port_forwarding_identifier, - port_forwarding, - list_port_forwardings_request, - list_port_forwardings_response, - put_port_forwarding_request, - timestamp]. - - -get_group_names() -> []. - - -get_msg_or_group_names() -> - [sync_routes_request, - empty, - start_domain_request, - stop_domain_request, - get_domain_request, - domain, - list_domains_request, - list_domains_response, - create_domain_request, - delete_domain_request, - download_image_request, - image_chunk, - get_network_request, - network, - list_networks_request, - list_networks_response, - create_network_request, - delete_network_request, - get_volume_request, - volume, - list_volumes_request, - list_volumes_response, - create_volume_request, - update_volume_request, - delete_volume_request, - volume_attachment_identifier, - volume_attachment, - list_volume_attachments_request, - list_volume_attachments_response, - port_forwarding_identifier, - port_forwarding, - list_port_forwardings_request, - list_port_forwardings_response, - put_port_forwarding_request, - timestamp]. - - -get_enum_names() -> []. - - -fetch_msg_def(MsgName) -> - case find_msg_def(MsgName) of - Fs when is_list(Fs) -> Fs; - error -> erlang:error({no_such_msg, MsgName}) - end. - - --spec fetch_enum_def(_) -> no_return(). -fetch_enum_def(EnumName) -> erlang:error({no_such_enum, EnumName}). - - -find_msg_def(sync_routes_request) -> []; -find_msg_def(empty) -> []; -find_msg_def(start_domain_request) -> [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => uuid, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(stop_domain_request) -> - [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => uuid, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => force, fnum => 3, rnum => 4, type => bool, occurrence => optional, opts => []}]; -find_msg_def(get_domain_request) -> [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(domain) -> - [#{name => id, fnum => 1, rnum => 2, type => uint64, occurrence => optional, opts => []}, - #{name => uuid, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => name, fnum => 3, rnum => 4, type => string, occurrence => optional, opts => []}, - #{name => vcpu, fnum => 4, rnum => 5, type => uint32, occurrence => optional, opts => []}, - #{name => memory, fnum => 5, rnum => 6, type => uint64, occurrence => optional, opts => []}, - #{name => network, fnum => 6, rnum => 7, type => string, occurrence => optional, opts => []}, - #{name => bridge, fnum => 7, rnum => 8, type => string, occurrence => optional, opts => []}, - #{name => state, fnum => 8, rnum => 9, type => string, occurrence => optional, opts => []}, - #{name => private_ip, fnum => 9, rnum => 10, type => string, occurrence => optional, opts => []}, - #{name => ipv6_address, fnum => 15, rnum => 11, type => string, occurrence => optional, opts => []}, - #{name => user_data, fnum => 10, rnum => 12, type => string, occurrence => optional, opts => []}, - #{name => nested_virtualization, fnum => 11, rnum => 13, type => bool, occurrence => optional, opts => []}, - #{name => base_image, fnum => 12, rnum => 14, type => string, occurrence => optional, opts => []}, - #{name => created_at, fnum => 13, rnum => 15, type => {msg, timestamp}, occurrence => optional, opts => []}, - #{name => os_type, fnum => 14, rnum => 16, type => string, occurrence => optional, opts => []}]; -find_msg_def(list_domains_request) -> [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]; -find_msg_def(list_domains_response) -> [#{name => domains, fnum => 1, rnum => 2, type => {msg, domain}, occurrence => repeated, opts => []}]; -find_msg_def(create_domain_request) -> [#{name => domain, fnum => 1, rnum => 2, type => {msg, domain}, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(delete_domain_request) -> [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(download_image_request) -> [#{name => domain_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(image_chunk) -> [#{name => bytes, fnum => 1, rnum => 2, type => bytes, occurrence => optional, opts => []}]; -find_msg_def(get_network_request) -> [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(network) -> - [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => name, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => cidr, fnum => 3, rnum => 4, type => string, occurrence => optional, opts => []}, - #{name => cidr6, fnum => 4, rnum => 5, type => string, occurrence => optional, opts => []}]; -find_msg_def(list_networks_request) -> [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]; -find_msg_def(list_networks_response) -> [#{name => networks, fnum => 1, rnum => 2, type => {msg, network}, occurrence => repeated, opts => []}]; -find_msg_def(create_network_request) -> [#{name => network, fnum => 1, rnum => 2, type => {msg, network}, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(delete_network_request) -> [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(get_volume_request) -> [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(volume) -> - [#{name => id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => name, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => size, fnum => 3, rnum => 4, type => uint64, occurrence => optional, opts => []}]; -find_msg_def(list_volumes_request) -> [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]; -find_msg_def(list_volumes_response) -> [#{name => volumes, fnum => 1, rnum => 2, type => {msg, volume}, occurrence => repeated, opts => []}]; -find_msg_def(create_volume_request) -> [#{name => volume, fnum => 1, rnum => 2, type => {msg, volume}, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(update_volume_request) -> [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => volume, fnum => 2, rnum => 3, type => {msg, volume}, occurrence => optional, opts => []}]; -find_msg_def(delete_volume_request) -> [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(volume_attachment_identifier) -> - [#{name => domain_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => volume_id, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => host, fnum => 3, rnum => 4, type => string, occurrence => optional, opts => []}]; -find_msg_def(volume_attachment) -> - [#{name => domain_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => volume_id, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => disk_address, fnum => 3, rnum => 4, type => string, occurrence => optional, opts => []}]; -find_msg_def(list_volume_attachments_request) -> [#{name => domain_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(list_volume_attachments_response) -> [#{name => attachments, fnum => 1, rnum => 2, type => {msg, volume_attachment}, occurrence => repeated, opts => []}]; -find_msg_def(port_forwarding_identifier) -> - [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => protocol, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => source_port, fnum => 3, rnum => 4, type => uint32, occurrence => optional, opts => []}]; -find_msg_def(port_forwarding) -> - [#{name => protocol, fnum => 2, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => source_port, fnum => 3, rnum => 3, type => uint32, occurrence => optional, opts => []}, - #{name => target_ip, fnum => 4, rnum => 4, type => string, occurrence => optional, opts => []}, - #{name => target_port, fnum => 5, rnum => 5, type => uint32, occurrence => optional, opts => []}]; -find_msg_def(list_port_forwardings_request) -> [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]; -find_msg_def(list_port_forwardings_response) -> [#{name => port_forwardings, fnum => 1, rnum => 2, type => {msg, port_forwarding}, occurrence => repeated, opts => []}]; -find_msg_def(put_port_forwarding_request) -> - [#{name => port_forwarding, fnum => 1, rnum => 2, type => {msg, port_forwarding}, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(timestamp) -> [#{name => seconds, fnum => 1, rnum => 2, type => int64, occurrence => optional, opts => []}, #{name => nanos, fnum => 2, rnum => 3, type => int32, occurrence => optional, opts => []}]; -find_msg_def(_) -> error. - - -find_enum_def(_) -> error. - - --spec enum_symbol_by_value(_, _) -> no_return(). -enum_symbol_by_value(E, V) -> erlang:error({no_enum_defs, E, V}). - - --spec enum_value_by_symbol(_, _) -> no_return(). -enum_value_by_symbol(E, V) -> erlang:error({no_enum_defs, E, V}). - - - -get_service_names() -> ['DaemonService', 'DomainService', 'VolumeService', 'PortForwardingService']. - - -get_service_def('DaemonService') -> - {{service, 'DaemonService'}, - [#{name => 'GetNetwork', input => get_network_request, output => network, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListNetworks', input => list_networks_request, output => list_networks_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'CreateNetwork', input => create_network_request, output => network, input_stream => false, output_stream => false, opts => []}, - #{name => 'DeleteNetwork', input => delete_network_request, output => empty, input_stream => false, output_stream => false, opts => []}, - #{name => 'StartDomain', input => start_domain_request, output => empty, input_stream => false, output_stream => false, opts => []}, - #{name => 'StopDomain', input => stop_domain_request, output => empty, input_stream => false, output_stream => false, opts => []}, - #{name => 'GetDomain', input => get_domain_request, output => domain, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListDomains', input => list_domains_request, output => list_domains_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'CreateDomain', input => create_domain_request, output => domain, input_stream => false, output_stream => false, opts => []}, - #{name => 'DeleteDomain', input => delete_domain_request, output => empty, input_stream => false, output_stream => false, opts => []}, - #{name => 'DownloadImage', input => download_image_request, output => image_chunk, input_stream => false, output_stream => true, opts => []}, - #{name => 'GetVolume', input => get_volume_request, output => volume, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListVolumes', input => list_volumes_request, output => list_volumes_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'CreateVolume', input => create_volume_request, output => volume, input_stream => false, output_stream => false, opts => []}, - #{name => 'UpdateVolume', input => update_volume_request, output => volume, input_stream => false, output_stream => false, opts => []}, - #{name => 'DeleteVolume', input => delete_volume_request, output => empty, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListVolumeAttachments', input => list_volume_attachments_request, output => list_volume_attachments_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'GetVolumeAttachment', input => volume_attachment_identifier, output => volume_attachment, input_stream => false, output_stream => false, opts => []}, - #{name => 'AttachVolume', input => volume_attachment_identifier, output => volume_attachment, input_stream => false, output_stream => false, opts => []}, - #{name => 'DetachVolume', input => volume_attachment_identifier, output => empty, input_stream => false, output_stream => false, opts => []}, - #{name => 'GetPortForwarding', input => port_forwarding_identifier, output => port_forwarding, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListPortForwardings', input => list_port_forwardings_request, output => list_port_forwardings_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'PutPortForwarding', input => put_port_forwarding_request, output => port_forwarding, input_stream => false, output_stream => false, opts => []}, - #{name => 'DeletePortForwarding', input => port_forwarding_identifier, output => empty, input_stream => false, output_stream => false, opts => []}, - #{name => 'SyncRoutes', input => sync_routes_request, output => empty, input_stream => false, output_stream => false, opts => []}]}; -get_service_def('DomainService') -> - {{service, 'DomainService'}, - [#{name => 'GetDomain', input => get_domain_request, output => domain, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListDomains', input => list_domains_request, output => list_domains_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'CreateDomain', input => create_domain_request, output => domain, input_stream => false, output_stream => false, opts => []}, - #{name => 'DeleteDomain', input => delete_domain_request, output => empty, input_stream => false, output_stream => false, opts => []}, - #{name => 'DownloadImage', input => download_image_request, output => image_chunk, input_stream => false, output_stream => true, opts => []}, - #{name => 'GetNetwork', input => get_network_request, output => network, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListNetworks', input => list_networks_request, output => list_networks_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'CreateNetwork', input => create_network_request, output => network, input_stream => false, output_stream => false, opts => []}, - #{name => 'DeleteNetwork', input => delete_network_request, output => empty, input_stream => false, output_stream => false, opts => []}]}; -get_service_def('VolumeService') -> - {{service, 'VolumeService'}, - [#{name => 'GetVolume', input => get_volume_request, output => volume, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListVolumes', input => list_volumes_request, output => list_volumes_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'CreateVolume', input => create_volume_request, output => volume, input_stream => false, output_stream => false, opts => []}, - #{name => 'UpdateVolume', input => update_volume_request, output => volume, input_stream => false, output_stream => false, opts => []}, - #{name => 'DeleteVolume', input => delete_volume_request, output => empty, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListVolumeAttachments', input => list_volume_attachments_request, output => list_volume_attachments_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'GetVolumeAttachment', input => volume_attachment_identifier, output => volume_attachment, input_stream => false, output_stream => false, opts => []}, - #{name => 'AttachVolume', input => volume_attachment_identifier, output => volume_attachment, input_stream => false, output_stream => false, opts => []}, - #{name => 'DetachVolume', input => volume_attachment_identifier, output => empty, input_stream => false, output_stream => false, opts => []}]}; -get_service_def('PortForwardingService') -> - {{service, 'PortForwardingService'}, - [#{name => 'GetPortForwarding', input => port_forwarding_identifier, output => port_forwarding, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListPortForwardings', input => list_port_forwardings_request, output => list_port_forwardings_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'PutPortForwarding', input => put_port_forwarding_request, output => port_forwarding, input_stream => false, output_stream => false, opts => []}, - #{name => 'DeletePortForwarding', input => port_forwarding_identifier, output => empty, input_stream => false, output_stream => false, opts => []}]}; -get_service_def(_) -> error. - - -get_rpc_names('DaemonService') -> - ['GetNetwork', - 'ListNetworks', - 'CreateNetwork', - 'DeleteNetwork', - 'StartDomain', - 'StopDomain', - 'GetDomain', - 'ListDomains', - 'CreateDomain', - 'DeleteDomain', - 'DownloadImage', - 'GetVolume', - 'ListVolumes', - 'CreateVolume', - 'UpdateVolume', - 'DeleteVolume', - 'ListVolumeAttachments', - 'GetVolumeAttachment', - 'AttachVolume', - 'DetachVolume', - 'GetPortForwarding', - 'ListPortForwardings', - 'PutPortForwarding', - 'DeletePortForwarding', - 'SyncRoutes']; -get_rpc_names('DomainService') -> ['GetDomain', 'ListDomains', 'CreateDomain', 'DeleteDomain', 'DownloadImage', 'GetNetwork', 'ListNetworks', 'CreateNetwork', 'DeleteNetwork']; -get_rpc_names('VolumeService') -> ['GetVolume', 'ListVolumes', 'CreateVolume', 'UpdateVolume', 'DeleteVolume', 'ListVolumeAttachments', 'GetVolumeAttachment', 'AttachVolume', 'DetachVolume']; -get_rpc_names('PortForwardingService') -> ['GetPortForwarding', 'ListPortForwardings', 'PutPortForwarding', 'DeletePortForwarding']; -get_rpc_names(_) -> error. - - -find_rpc_def('DaemonService', RpcName) -> find_rpc_def_DaemonService(RpcName); -find_rpc_def('DomainService', RpcName) -> find_rpc_def_DomainService(RpcName); -find_rpc_def('VolumeService', RpcName) -> find_rpc_def_VolumeService(RpcName); -find_rpc_def('PortForwardingService', RpcName) -> find_rpc_def_PortForwardingService(RpcName); -find_rpc_def(_, _) -> error. - - -find_rpc_def_DaemonService('GetNetwork') -> #{name => 'GetNetwork', input => get_network_request, output => network, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('ListNetworks') -> #{name => 'ListNetworks', input => list_networks_request, output => list_networks_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('CreateNetwork') -> #{name => 'CreateNetwork', input => create_network_request, output => network, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('DeleteNetwork') -> #{name => 'DeleteNetwork', input => delete_network_request, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('StartDomain') -> #{name => 'StartDomain', input => start_domain_request, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('StopDomain') -> #{name => 'StopDomain', input => stop_domain_request, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('GetDomain') -> #{name => 'GetDomain', input => get_domain_request, output => domain, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('ListDomains') -> #{name => 'ListDomains', input => list_domains_request, output => list_domains_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('CreateDomain') -> #{name => 'CreateDomain', input => create_domain_request, output => domain, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('DeleteDomain') -> #{name => 'DeleteDomain', input => delete_domain_request, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('DownloadImage') -> #{name => 'DownloadImage', input => download_image_request, output => image_chunk, input_stream => false, output_stream => true, opts => []}; -find_rpc_def_DaemonService('GetVolume') -> #{name => 'GetVolume', input => get_volume_request, output => volume, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('ListVolumes') -> #{name => 'ListVolumes', input => list_volumes_request, output => list_volumes_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('CreateVolume') -> #{name => 'CreateVolume', input => create_volume_request, output => volume, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('UpdateVolume') -> #{name => 'UpdateVolume', input => update_volume_request, output => volume, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('DeleteVolume') -> #{name => 'DeleteVolume', input => delete_volume_request, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('ListVolumeAttachments') -> #{name => 'ListVolumeAttachments', input => list_volume_attachments_request, output => list_volume_attachments_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('GetVolumeAttachment') -> #{name => 'GetVolumeAttachment', input => volume_attachment_identifier, output => volume_attachment, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('AttachVolume') -> #{name => 'AttachVolume', input => volume_attachment_identifier, output => volume_attachment, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('DetachVolume') -> #{name => 'DetachVolume', input => volume_attachment_identifier, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('GetPortForwarding') -> #{name => 'GetPortForwarding', input => port_forwarding_identifier, output => port_forwarding, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('ListPortForwardings') -> #{name => 'ListPortForwardings', input => list_port_forwardings_request, output => list_port_forwardings_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('PutPortForwarding') -> #{name => 'PutPortForwarding', input => put_port_forwarding_request, output => port_forwarding, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('DeletePortForwarding') -> #{name => 'DeletePortForwarding', input => port_forwarding_identifier, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService('SyncRoutes') -> #{name => 'SyncRoutes', input => sync_routes_request, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DaemonService(_) -> error. - -find_rpc_def_DomainService('GetDomain') -> #{name => 'GetDomain', input => get_domain_request, output => domain, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DomainService('ListDomains') -> #{name => 'ListDomains', input => list_domains_request, output => list_domains_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DomainService('CreateDomain') -> #{name => 'CreateDomain', input => create_domain_request, output => domain, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DomainService('DeleteDomain') -> #{name => 'DeleteDomain', input => delete_domain_request, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DomainService('DownloadImage') -> #{name => 'DownloadImage', input => download_image_request, output => image_chunk, input_stream => false, output_stream => true, opts => []}; -find_rpc_def_DomainService('GetNetwork') -> #{name => 'GetNetwork', input => get_network_request, output => network, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DomainService('ListNetworks') -> #{name => 'ListNetworks', input => list_networks_request, output => list_networks_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DomainService('CreateNetwork') -> #{name => 'CreateNetwork', input => create_network_request, output => network, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DomainService('DeleteNetwork') -> #{name => 'DeleteNetwork', input => delete_network_request, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DomainService(_) -> error. - -find_rpc_def_VolumeService('GetVolume') -> #{name => 'GetVolume', input => get_volume_request, output => volume, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_VolumeService('ListVolumes') -> #{name => 'ListVolumes', input => list_volumes_request, output => list_volumes_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_VolumeService('CreateVolume') -> #{name => 'CreateVolume', input => create_volume_request, output => volume, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_VolumeService('UpdateVolume') -> #{name => 'UpdateVolume', input => update_volume_request, output => volume, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_VolumeService('DeleteVolume') -> #{name => 'DeleteVolume', input => delete_volume_request, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_VolumeService('ListVolumeAttachments') -> #{name => 'ListVolumeAttachments', input => list_volume_attachments_request, output => list_volume_attachments_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_VolumeService('GetVolumeAttachment') -> #{name => 'GetVolumeAttachment', input => volume_attachment_identifier, output => volume_attachment, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_VolumeService('AttachVolume') -> #{name => 'AttachVolume', input => volume_attachment_identifier, output => volume_attachment, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_VolumeService('DetachVolume') -> #{name => 'DetachVolume', input => volume_attachment_identifier, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_VolumeService(_) -> error. - -find_rpc_def_PortForwardingService('GetPortForwarding') -> #{name => 'GetPortForwarding', input => port_forwarding_identifier, output => port_forwarding, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_PortForwardingService('ListPortForwardings') -> #{name => 'ListPortForwardings', input => list_port_forwardings_request, output => list_port_forwardings_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_PortForwardingService('PutPortForwarding') -> #{name => 'PutPortForwarding', input => put_port_forwarding_request, output => port_forwarding, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_PortForwardingService('DeletePortForwarding') -> #{name => 'DeletePortForwarding', input => port_forwarding_identifier, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_PortForwardingService(_) -> error. - - -fetch_rpc_def(ServiceName, RpcName) -> - case find_rpc_def(ServiceName, RpcName) of - Def when is_map(Def) -> Def; - error -> erlang:error({no_such_rpc, ServiceName, RpcName}) - end. - - -%% Convert a a fully qualified (ie with package name) service name -%% as a binary to a service name as an atom. -fqbin_to_service_name(<<"DaemonService">>) -> 'DaemonService'; -fqbin_to_service_name(<<"DomainService">>) -> 'DomainService'; -fqbin_to_service_name(<<"VolumeService">>) -> 'VolumeService'; -fqbin_to_service_name(<<"PortForwardingService">>) -> 'PortForwardingService'; -fqbin_to_service_name(X) -> error({gpb_error, {badservice, X}}). - - -%% Convert a service name as an atom to a fully qualified -%% (ie with package name) name as a binary. -service_name_to_fqbin('DaemonService') -> <<"DaemonService">>; -service_name_to_fqbin('DomainService') -> <<"DomainService">>; -service_name_to_fqbin('VolumeService') -> <<"VolumeService">>; -service_name_to_fqbin('PortForwardingService') -> <<"PortForwardingService">>; -service_name_to_fqbin(X) -> error({gpb_error, {badservice, X}}). - - -%% Convert a a fully qualified (ie with package name) service name -%% and an rpc name, both as binaries to a service name and an rpc -%% name, as atoms. -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"GetNetwork">>) -> {'DaemonService', 'GetNetwork'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"ListNetworks">>) -> {'DaemonService', 'ListNetworks'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"CreateNetwork">>) -> {'DaemonService', 'CreateNetwork'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"DeleteNetwork">>) -> {'DaemonService', 'DeleteNetwork'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"StartDomain">>) -> {'DaemonService', 'StartDomain'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"StopDomain">>) -> {'DaemonService', 'StopDomain'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"GetDomain">>) -> {'DaemonService', 'GetDomain'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"ListDomains">>) -> {'DaemonService', 'ListDomains'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"CreateDomain">>) -> {'DaemonService', 'CreateDomain'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"DeleteDomain">>) -> {'DaemonService', 'DeleteDomain'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"DownloadImage">>) -> {'DaemonService', 'DownloadImage'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"GetVolume">>) -> {'DaemonService', 'GetVolume'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"ListVolumes">>) -> {'DaemonService', 'ListVolumes'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"CreateVolume">>) -> {'DaemonService', 'CreateVolume'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"UpdateVolume">>) -> {'DaemonService', 'UpdateVolume'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"DeleteVolume">>) -> {'DaemonService', 'DeleteVolume'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"ListVolumeAttachments">>) -> {'DaemonService', 'ListVolumeAttachments'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"GetVolumeAttachment">>) -> {'DaemonService', 'GetVolumeAttachment'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"AttachVolume">>) -> {'DaemonService', 'AttachVolume'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"DetachVolume">>) -> {'DaemonService', 'DetachVolume'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"GetPortForwarding">>) -> {'DaemonService', 'GetPortForwarding'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"ListPortForwardings">>) -> {'DaemonService', 'ListPortForwardings'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"PutPortForwarding">>) -> {'DaemonService', 'PutPortForwarding'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"DeletePortForwarding">>) -> {'DaemonService', 'DeletePortForwarding'}; -fqbins_to_service_and_rpc_name(<<"DaemonService">>, <<"SyncRoutes">>) -> {'DaemonService', 'SyncRoutes'}; -fqbins_to_service_and_rpc_name(<<"DomainService">>, <<"GetDomain">>) -> {'DomainService', 'GetDomain'}; -fqbins_to_service_and_rpc_name(<<"DomainService">>, <<"ListDomains">>) -> {'DomainService', 'ListDomains'}; -fqbins_to_service_and_rpc_name(<<"DomainService">>, <<"CreateDomain">>) -> {'DomainService', 'CreateDomain'}; -fqbins_to_service_and_rpc_name(<<"DomainService">>, <<"DeleteDomain">>) -> {'DomainService', 'DeleteDomain'}; -fqbins_to_service_and_rpc_name(<<"DomainService">>, <<"DownloadImage">>) -> {'DomainService', 'DownloadImage'}; -fqbins_to_service_and_rpc_name(<<"DomainService">>, <<"GetNetwork">>) -> {'DomainService', 'GetNetwork'}; -fqbins_to_service_and_rpc_name(<<"DomainService">>, <<"ListNetworks">>) -> {'DomainService', 'ListNetworks'}; -fqbins_to_service_and_rpc_name(<<"DomainService">>, <<"CreateNetwork">>) -> {'DomainService', 'CreateNetwork'}; -fqbins_to_service_and_rpc_name(<<"DomainService">>, <<"DeleteNetwork">>) -> {'DomainService', 'DeleteNetwork'}; -fqbins_to_service_and_rpc_name(<<"VolumeService">>, <<"GetVolume">>) -> {'VolumeService', 'GetVolume'}; -fqbins_to_service_and_rpc_name(<<"VolumeService">>, <<"ListVolumes">>) -> {'VolumeService', 'ListVolumes'}; -fqbins_to_service_and_rpc_name(<<"VolumeService">>, <<"CreateVolume">>) -> {'VolumeService', 'CreateVolume'}; -fqbins_to_service_and_rpc_name(<<"VolumeService">>, <<"UpdateVolume">>) -> {'VolumeService', 'UpdateVolume'}; -fqbins_to_service_and_rpc_name(<<"VolumeService">>, <<"DeleteVolume">>) -> {'VolumeService', 'DeleteVolume'}; -fqbins_to_service_and_rpc_name(<<"VolumeService">>, <<"ListVolumeAttachments">>) -> {'VolumeService', 'ListVolumeAttachments'}; -fqbins_to_service_and_rpc_name(<<"VolumeService">>, <<"GetVolumeAttachment">>) -> {'VolumeService', 'GetVolumeAttachment'}; -fqbins_to_service_and_rpc_name(<<"VolumeService">>, <<"AttachVolume">>) -> {'VolumeService', 'AttachVolume'}; -fqbins_to_service_and_rpc_name(<<"VolumeService">>, <<"DetachVolume">>) -> {'VolumeService', 'DetachVolume'}; -fqbins_to_service_and_rpc_name(<<"PortForwardingService">>, <<"GetPortForwarding">>) -> {'PortForwardingService', 'GetPortForwarding'}; -fqbins_to_service_and_rpc_name(<<"PortForwardingService">>, <<"ListPortForwardings">>) -> {'PortForwardingService', 'ListPortForwardings'}; -fqbins_to_service_and_rpc_name(<<"PortForwardingService">>, <<"PutPortForwarding">>) -> {'PortForwardingService', 'PutPortForwarding'}; -fqbins_to_service_and_rpc_name(<<"PortForwardingService">>, <<"DeletePortForwarding">>) -> {'PortForwardingService', 'DeletePortForwarding'}; -fqbins_to_service_and_rpc_name(S, R) -> error({gpb_error, {badservice_or_rpc, {S, R}}}). - - -%% Convert a service name and an rpc name, both as atoms, -%% to a fully qualified (ie with package name) service name and -%% an rpc name as binaries. -service_and_rpc_name_to_fqbins('DaemonService', 'GetNetwork') -> {<<"DaemonService">>, <<"GetNetwork">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'ListNetworks') -> {<<"DaemonService">>, <<"ListNetworks">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'CreateNetwork') -> {<<"DaemonService">>, <<"CreateNetwork">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'DeleteNetwork') -> {<<"DaemonService">>, <<"DeleteNetwork">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'StartDomain') -> {<<"DaemonService">>, <<"StartDomain">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'StopDomain') -> {<<"DaemonService">>, <<"StopDomain">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'GetDomain') -> {<<"DaemonService">>, <<"GetDomain">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'ListDomains') -> {<<"DaemonService">>, <<"ListDomains">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'CreateDomain') -> {<<"DaemonService">>, <<"CreateDomain">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'DeleteDomain') -> {<<"DaemonService">>, <<"DeleteDomain">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'DownloadImage') -> {<<"DaemonService">>, <<"DownloadImage">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'GetVolume') -> {<<"DaemonService">>, <<"GetVolume">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'ListVolumes') -> {<<"DaemonService">>, <<"ListVolumes">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'CreateVolume') -> {<<"DaemonService">>, <<"CreateVolume">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'UpdateVolume') -> {<<"DaemonService">>, <<"UpdateVolume">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'DeleteVolume') -> {<<"DaemonService">>, <<"DeleteVolume">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'ListVolumeAttachments') -> {<<"DaemonService">>, <<"ListVolumeAttachments">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'GetVolumeAttachment') -> {<<"DaemonService">>, <<"GetVolumeAttachment">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'AttachVolume') -> {<<"DaemonService">>, <<"AttachVolume">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'DetachVolume') -> {<<"DaemonService">>, <<"DetachVolume">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'GetPortForwarding') -> {<<"DaemonService">>, <<"GetPortForwarding">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'ListPortForwardings') -> {<<"DaemonService">>, <<"ListPortForwardings">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'PutPortForwarding') -> {<<"DaemonService">>, <<"PutPortForwarding">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'DeletePortForwarding') -> {<<"DaemonService">>, <<"DeletePortForwarding">>}; -service_and_rpc_name_to_fqbins('DaemonService', 'SyncRoutes') -> {<<"DaemonService">>, <<"SyncRoutes">>}; -service_and_rpc_name_to_fqbins('DomainService', 'GetDomain') -> {<<"DomainService">>, <<"GetDomain">>}; -service_and_rpc_name_to_fqbins('DomainService', 'ListDomains') -> {<<"DomainService">>, <<"ListDomains">>}; -service_and_rpc_name_to_fqbins('DomainService', 'CreateDomain') -> {<<"DomainService">>, <<"CreateDomain">>}; -service_and_rpc_name_to_fqbins('DomainService', 'DeleteDomain') -> {<<"DomainService">>, <<"DeleteDomain">>}; -service_and_rpc_name_to_fqbins('DomainService', 'DownloadImage') -> {<<"DomainService">>, <<"DownloadImage">>}; -service_and_rpc_name_to_fqbins('DomainService', 'GetNetwork') -> {<<"DomainService">>, <<"GetNetwork">>}; -service_and_rpc_name_to_fqbins('DomainService', 'ListNetworks') -> {<<"DomainService">>, <<"ListNetworks">>}; -service_and_rpc_name_to_fqbins('DomainService', 'CreateNetwork') -> {<<"DomainService">>, <<"CreateNetwork">>}; -service_and_rpc_name_to_fqbins('DomainService', 'DeleteNetwork') -> {<<"DomainService">>, <<"DeleteNetwork">>}; -service_and_rpc_name_to_fqbins('VolumeService', 'GetVolume') -> {<<"VolumeService">>, <<"GetVolume">>}; -service_and_rpc_name_to_fqbins('VolumeService', 'ListVolumes') -> {<<"VolumeService">>, <<"ListVolumes">>}; -service_and_rpc_name_to_fqbins('VolumeService', 'CreateVolume') -> {<<"VolumeService">>, <<"CreateVolume">>}; -service_and_rpc_name_to_fqbins('VolumeService', 'UpdateVolume') -> {<<"VolumeService">>, <<"UpdateVolume">>}; -service_and_rpc_name_to_fqbins('VolumeService', 'DeleteVolume') -> {<<"VolumeService">>, <<"DeleteVolume">>}; -service_and_rpc_name_to_fqbins('VolumeService', 'ListVolumeAttachments') -> {<<"VolumeService">>, <<"ListVolumeAttachments">>}; -service_and_rpc_name_to_fqbins('VolumeService', 'GetVolumeAttachment') -> {<<"VolumeService">>, <<"GetVolumeAttachment">>}; -service_and_rpc_name_to_fqbins('VolumeService', 'AttachVolume') -> {<<"VolumeService">>, <<"AttachVolume">>}; -service_and_rpc_name_to_fqbins('VolumeService', 'DetachVolume') -> {<<"VolumeService">>, <<"DetachVolume">>}; -service_and_rpc_name_to_fqbins('PortForwardingService', 'GetPortForwarding') -> {<<"PortForwardingService">>, <<"GetPortForwarding">>}; -service_and_rpc_name_to_fqbins('PortForwardingService', 'ListPortForwardings') -> {<<"PortForwardingService">>, <<"ListPortForwardings">>}; -service_and_rpc_name_to_fqbins('PortForwardingService', 'PutPortForwarding') -> {<<"PortForwardingService">>, <<"PutPortForwarding">>}; -service_and_rpc_name_to_fqbins('PortForwardingService', 'DeletePortForwarding') -> {<<"PortForwardingService">>, <<"DeletePortForwarding">>}; -service_and_rpc_name_to_fqbins(S, R) -> error({gpb_error, {badservice_or_rpc, {S, R}}}). - - -fqbin_to_msg_name(<<"SyncRoutesRequest">>) -> sync_routes_request; -fqbin_to_msg_name(<<"google.protobuf.Empty">>) -> empty; -fqbin_to_msg_name(<<"StartDomainRequest">>) -> start_domain_request; -fqbin_to_msg_name(<<"StopDomainRequest">>) -> stop_domain_request; -fqbin_to_msg_name(<<"GetDomainRequest">>) -> get_domain_request; -fqbin_to_msg_name(<<"Domain">>) -> domain; -fqbin_to_msg_name(<<"ListDomainsRequest">>) -> list_domains_request; -fqbin_to_msg_name(<<"ListDomainsResponse">>) -> list_domains_response; -fqbin_to_msg_name(<<"CreateDomainRequest">>) -> create_domain_request; -fqbin_to_msg_name(<<"DeleteDomainRequest">>) -> delete_domain_request; -fqbin_to_msg_name(<<"DownloadImageRequest">>) -> download_image_request; -fqbin_to_msg_name(<<"ImageChunk">>) -> image_chunk; -fqbin_to_msg_name(<<"GetNetworkRequest">>) -> get_network_request; -fqbin_to_msg_name(<<"Network">>) -> network; -fqbin_to_msg_name(<<"ListNetworksRequest">>) -> list_networks_request; -fqbin_to_msg_name(<<"ListNetworksResponse">>) -> list_networks_response; -fqbin_to_msg_name(<<"CreateNetworkRequest">>) -> create_network_request; -fqbin_to_msg_name(<<"DeleteNetworkRequest">>) -> delete_network_request; -fqbin_to_msg_name(<<"GetVolumeRequest">>) -> get_volume_request; -fqbin_to_msg_name(<<"Volume">>) -> volume; -fqbin_to_msg_name(<<"ListVolumesRequest">>) -> list_volumes_request; -fqbin_to_msg_name(<<"ListVolumesResponse">>) -> list_volumes_response; -fqbin_to_msg_name(<<"CreateVolumeRequest">>) -> create_volume_request; -fqbin_to_msg_name(<<"UpdateVolumeRequest">>) -> update_volume_request; -fqbin_to_msg_name(<<"DeleteVolumeRequest">>) -> delete_volume_request; -fqbin_to_msg_name(<<"VolumeAttachmentIdentifier">>) -> volume_attachment_identifier; -fqbin_to_msg_name(<<"VolumeAttachment">>) -> volume_attachment; -fqbin_to_msg_name(<<"ListVolumeAttachmentsRequest">>) -> list_volume_attachments_request; -fqbin_to_msg_name(<<"ListVolumeAttachmentsResponse">>) -> list_volume_attachments_response; -fqbin_to_msg_name(<<"PortForwardingIdentifier">>) -> port_forwarding_identifier; -fqbin_to_msg_name(<<"PortForwarding">>) -> port_forwarding; -fqbin_to_msg_name(<<"ListPortForwardingsRequest">>) -> list_port_forwardings_request; -fqbin_to_msg_name(<<"ListPortForwardingsResponse">>) -> list_port_forwardings_response; -fqbin_to_msg_name(<<"PutPortForwardingRequest">>) -> put_port_forwarding_request; -fqbin_to_msg_name(<<"google.protobuf.Timestamp">>) -> timestamp; -fqbin_to_msg_name(E) -> error({gpb_error, {badmsg, E}}). - - -msg_name_to_fqbin(sync_routes_request) -> <<"SyncRoutesRequest">>; -msg_name_to_fqbin(empty) -> <<"google.protobuf.Empty">>; -msg_name_to_fqbin(start_domain_request) -> <<"StartDomainRequest">>; -msg_name_to_fqbin(stop_domain_request) -> <<"StopDomainRequest">>; -msg_name_to_fqbin(get_domain_request) -> <<"GetDomainRequest">>; -msg_name_to_fqbin(domain) -> <<"Domain">>; -msg_name_to_fqbin(list_domains_request) -> <<"ListDomainsRequest">>; -msg_name_to_fqbin(list_domains_response) -> <<"ListDomainsResponse">>; -msg_name_to_fqbin(create_domain_request) -> <<"CreateDomainRequest">>; -msg_name_to_fqbin(delete_domain_request) -> <<"DeleteDomainRequest">>; -msg_name_to_fqbin(download_image_request) -> <<"DownloadImageRequest">>; -msg_name_to_fqbin(image_chunk) -> <<"ImageChunk">>; -msg_name_to_fqbin(get_network_request) -> <<"GetNetworkRequest">>; -msg_name_to_fqbin(network) -> <<"Network">>; -msg_name_to_fqbin(list_networks_request) -> <<"ListNetworksRequest">>; -msg_name_to_fqbin(list_networks_response) -> <<"ListNetworksResponse">>; -msg_name_to_fqbin(create_network_request) -> <<"CreateNetworkRequest">>; -msg_name_to_fqbin(delete_network_request) -> <<"DeleteNetworkRequest">>; -msg_name_to_fqbin(get_volume_request) -> <<"GetVolumeRequest">>; -msg_name_to_fqbin(volume) -> <<"Volume">>; -msg_name_to_fqbin(list_volumes_request) -> <<"ListVolumesRequest">>; -msg_name_to_fqbin(list_volumes_response) -> <<"ListVolumesResponse">>; -msg_name_to_fqbin(create_volume_request) -> <<"CreateVolumeRequest">>; -msg_name_to_fqbin(update_volume_request) -> <<"UpdateVolumeRequest">>; -msg_name_to_fqbin(delete_volume_request) -> <<"DeleteVolumeRequest">>; -msg_name_to_fqbin(volume_attachment_identifier) -> <<"VolumeAttachmentIdentifier">>; -msg_name_to_fqbin(volume_attachment) -> <<"VolumeAttachment">>; -msg_name_to_fqbin(list_volume_attachments_request) -> <<"ListVolumeAttachmentsRequest">>; -msg_name_to_fqbin(list_volume_attachments_response) -> <<"ListVolumeAttachmentsResponse">>; -msg_name_to_fqbin(port_forwarding_identifier) -> <<"PortForwardingIdentifier">>; -msg_name_to_fqbin(port_forwarding) -> <<"PortForwarding">>; -msg_name_to_fqbin(list_port_forwardings_request) -> <<"ListPortForwardingsRequest">>; -msg_name_to_fqbin(list_port_forwardings_response) -> <<"ListPortForwardingsResponse">>; -msg_name_to_fqbin(put_port_forwarding_request) -> <<"PutPortForwardingRequest">>; -msg_name_to_fqbin(timestamp) -> <<"google.protobuf.Timestamp">>; -msg_name_to_fqbin(E) -> error({gpb_error, {badmsg, E}}). - - --spec fqbin_to_enum_name(_) -> no_return(). -fqbin_to_enum_name(E) -> error({gpb_error, {badenum, E}}). - - --spec enum_name_to_fqbin(_) -> no_return(). -enum_name_to_fqbin(E) -> error({gpb_error, {badenum, E}}). - - -get_package_name() -> 'google.protobuf'. - - -%% Whether or not the message names -%% are prepended with package name or not. -uses_packages() -> true. - - -source_basename() -> "daemon.proto". - - -%% Retrieve all proto file names, also imported ones. -%% The order is top-down. The first element is always the main -%% source file. The files are returned with extension, -%% see get_all_proto_names/0 for a version that returns -%% the basenames sans extension -get_all_source_basenames() -> ["daemon.proto", "empty.proto", "domain.proto", "volume.proto", "port_forwarding.proto", "timestamp.proto"]. - - -%% Retrieve all proto file names, also imported ones. -%% The order is top-down. The first element is always the main -%% source file. The files are returned sans .proto extension, -%% to make it easier to use them with the various get_xyz_containment -%% functions. -get_all_proto_names() -> ["daemon", "empty", "domain", "volume", "port_forwarding", "timestamp"]. - - -get_msg_containment("daemon") -> [sync_routes_request]; -get_msg_containment("empty") -> [empty]; -get_msg_containment("domain") -> - [create_domain_request, - create_network_request, - delete_domain_request, - delete_network_request, - domain, - download_image_request, - get_domain_request, - get_network_request, - image_chunk, - list_domains_request, - list_domains_response, - list_networks_request, - list_networks_response, - network, - start_domain_request, - stop_domain_request]; -get_msg_containment("volume") -> - [create_volume_request, - delete_volume_request, - get_volume_request, - list_volume_attachments_request, - list_volume_attachments_response, - list_volumes_request, - list_volumes_response, - update_volume_request, - volume, - volume_attachment, - volume_attachment_identifier]; -get_msg_containment("port_forwarding") -> [list_port_forwardings_request, list_port_forwardings_response, port_forwarding, port_forwarding_identifier, put_port_forwarding_request]; -get_msg_containment("timestamp") -> [timestamp]; -get_msg_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_pkg_containment("daemon") -> undefined; -get_pkg_containment("empty") -> 'google.protobuf'; -get_pkg_containment("domain") -> undefined; -get_pkg_containment("volume") -> undefined; -get_pkg_containment("port_forwarding") -> undefined; -get_pkg_containment("timestamp") -> 'google.protobuf'; -get_pkg_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_service_containment("daemon") -> ['DaemonService']; -get_service_containment("empty") -> []; -get_service_containment("domain") -> ['DomainService']; -get_service_containment("volume") -> ['VolumeService']; -get_service_containment("port_forwarding") -> ['PortForwardingService']; -get_service_containment("timestamp") -> []; -get_service_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_rpc_containment("daemon") -> - [{'DaemonService', 'GetNetwork'}, - {'DaemonService', 'ListNetworks'}, - {'DaemonService', 'CreateNetwork'}, - {'DaemonService', 'DeleteNetwork'}, - {'DaemonService', 'StartDomain'}, - {'DaemonService', 'StopDomain'}, - {'DaemonService', 'GetDomain'}, - {'DaemonService', 'ListDomains'}, - {'DaemonService', 'CreateDomain'}, - {'DaemonService', 'DeleteDomain'}, - {'DaemonService', 'DownloadImage'}, - {'DaemonService', 'GetVolume'}, - {'DaemonService', 'ListVolumes'}, - {'DaemonService', 'CreateVolume'}, - {'DaemonService', 'UpdateVolume'}, - {'DaemonService', 'DeleteVolume'}, - {'DaemonService', 'ListVolumeAttachments'}, - {'DaemonService', 'GetVolumeAttachment'}, - {'DaemonService', 'AttachVolume'}, - {'DaemonService', 'DetachVolume'}, - {'DaemonService', 'GetPortForwarding'}, - {'DaemonService', 'ListPortForwardings'}, - {'DaemonService', 'PutPortForwarding'}, - {'DaemonService', 'DeletePortForwarding'}, - {'DaemonService', 'SyncRoutes'}]; -get_rpc_containment("empty") -> []; -get_rpc_containment("domain") -> - [{'DomainService', 'GetDomain'}, - {'DomainService', 'ListDomains'}, - {'DomainService', 'CreateDomain'}, - {'DomainService', 'DeleteDomain'}, - {'DomainService', 'DownloadImage'}, - {'DomainService', 'GetNetwork'}, - {'DomainService', 'ListNetworks'}, - {'DomainService', 'CreateNetwork'}, - {'DomainService', 'DeleteNetwork'}]; -get_rpc_containment("volume") -> - [{'VolumeService', 'GetVolume'}, - {'VolumeService', 'ListVolumes'}, - {'VolumeService', 'CreateVolume'}, - {'VolumeService', 'UpdateVolume'}, - {'VolumeService', 'DeleteVolume'}, - {'VolumeService', 'ListVolumeAttachments'}, - {'VolumeService', 'GetVolumeAttachment'}, - {'VolumeService', 'AttachVolume'}, - {'VolumeService', 'DetachVolume'}]; -get_rpc_containment("port_forwarding") -> [{'PortForwardingService', 'GetPortForwarding'}, {'PortForwardingService', 'ListPortForwardings'}, {'PortForwardingService', 'PutPortForwarding'}, {'PortForwardingService', 'DeletePortForwarding'}]; -get_rpc_containment("timestamp") -> []; -get_rpc_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_enum_containment("daemon") -> []; -get_enum_containment("empty") -> []; -get_enum_containment("domain") -> []; -get_enum_containment("volume") -> []; -get_enum_containment("port_forwarding") -> []; -get_enum_containment("timestamp") -> []; -get_enum_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_proto_by_msg_name_as_fqbin(<<"google.protobuf.Timestamp">>) -> "timestamp"; -get_proto_by_msg_name_as_fqbin(<<"PortForwardingIdentifier">>) -> "port_forwarding"; -get_proto_by_msg_name_as_fqbin(<<"VolumeAttachmentIdentifier">>) -> "volume"; -get_proto_by_msg_name_as_fqbin(<<"PutPortForwardingRequest">>) -> "port_forwarding"; -get_proto_by_msg_name_as_fqbin(<<"ListPortForwardingsRequest">>) -> "port_forwarding"; -get_proto_by_msg_name_as_fqbin(<<"VolumeAttachment">>) -> "volume"; -get_proto_by_msg_name_as_fqbin(<<"UpdateVolumeRequest">>) -> "volume"; -get_proto_by_msg_name_as_fqbin(<<"ListVolumesRequest">>) -> "volume"; -get_proto_by_msg_name_as_fqbin(<<"ListVolumeAttachmentsRequest">>) -> "volume"; -get_proto_by_msg_name_as_fqbin(<<"GetVolumeRequest">>) -> "volume"; -get_proto_by_msg_name_as_fqbin(<<"DeleteVolumeRequest">>) -> "volume"; -get_proto_by_msg_name_as_fqbin(<<"CreateVolumeRequest">>) -> "volume"; -get_proto_by_msg_name_as_fqbin(<<"StopDomainRequest">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"StartDomainRequest">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"ListNetworksRequest">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"ListDomainsRequest">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"GetNetworkRequest">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"GetDomainRequest">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"DownloadImageRequest">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"DeleteNetworkRequest">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"DeleteDomainRequest">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"CreateNetworkRequest">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"CreateDomainRequest">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"SyncRoutesRequest">>) -> "daemon"; -get_proto_by_msg_name_as_fqbin(<<"ListPortForwardingsResponse">>) -> "port_forwarding"; -get_proto_by_msg_name_as_fqbin(<<"Volume">>) -> "volume"; -get_proto_by_msg_name_as_fqbin(<<"ListVolumesResponse">>) -> "volume"; -get_proto_by_msg_name_as_fqbin(<<"ListVolumeAttachmentsResponse">>) -> "volume"; -get_proto_by_msg_name_as_fqbin(<<"ListNetworksResponse">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"ListDomainsResponse">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"PortForwarding">>) -> "port_forwarding"; -get_proto_by_msg_name_as_fqbin(<<"google.protobuf.Empty">>) -> "empty"; -get_proto_by_msg_name_as_fqbin(<<"Network">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"ImageChunk">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"Domain">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(E) -> error({gpb_error, {badmsg, E}}). - - -get_proto_by_service_name_as_fqbin(<<"PortForwardingService">>) -> "port_forwarding"; -get_proto_by_service_name_as_fqbin(<<"VolumeService">>) -> "volume"; -get_proto_by_service_name_as_fqbin(<<"DomainService">>) -> "domain"; -get_proto_by_service_name_as_fqbin(<<"DaemonService">>) -> "daemon"; -get_proto_by_service_name_as_fqbin(E) -> error({gpb_error, {badservice, E}}). - - --spec get_proto_by_enum_name_as_fqbin(_) -> no_return(). -get_proto_by_enum_name_as_fqbin(E) -> error({gpb_error, {badenum, E}}). - - -get_protos_by_pkg_name_as_fqbin(<<"google.protobuf">>) -> ["empty", "timestamp"]; -get_protos_by_pkg_name_as_fqbin(E) -> error({gpb_error, {badpkg, E}}). - - - -gpb_version_as_string() -> - "4.19.8". - -gpb_version_as_list() -> - [4,19,8]. - -gpb_version_source() -> - "file". diff --git a/virtuerl/src/pb/daemon_service_bhvr.erl b/virtuerl/src/pb/daemon_service_bhvr.erl deleted file mode 100644 index a722be8..0000000 --- a/virtuerl/src/pb/daemon_service_bhvr.erl +++ /dev/null @@ -1,109 +0,0 @@ -%%%------------------------------------------------------------------- -%% @doc Behaviour to implement for grpc service DaemonService. -%% @end -%%%------------------------------------------------------------------- - -%% this module was generated and should not be modified manually - --module(daemon_service_bhvr). - -%% Unary RPC --callback get_network(ctx:t(), controller_pb:get_network_request()) -> - {ok, controller_pb:network(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback list_networks(ctx:t(), controller_pb:list_networks_request()) -> - {ok, controller_pb:list_networks_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback create_network(ctx:t(), controller_pb:create_network_request()) -> - {ok, controller_pb:network(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback delete_network(ctx:t(), controller_pb:delete_network_request()) -> - {ok, controller_pb:empty(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback start_domain(ctx:t(), controller_pb:start_domain_request()) -> - {ok, controller_pb:empty(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback stop_domain(ctx:t(), controller_pb:stop_domain_request()) -> - {ok, controller_pb:empty(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback get_domain(ctx:t(), controller_pb:get_domain_request()) -> - {ok, controller_pb:domain(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback list_domains(ctx:t(), controller_pb:list_domains_request()) -> - {ok, controller_pb:list_domains_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback create_domain(ctx:t(), controller_pb:create_domain_request()) -> - {ok, controller_pb:domain(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback delete_domain(ctx:t(), controller_pb:delete_domain_request()) -> - {ok, controller_pb:empty(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% --callback download_image(controller_pb:download_image_request(), grpcbox_stream:t()) -> - ok | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback get_volume(ctx:t(), controller_pb:get_volume_request()) -> - {ok, controller_pb:volume(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback list_volumes(ctx:t(), controller_pb:list_volumes_request()) -> - {ok, controller_pb:list_volumes_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback create_volume(ctx:t(), controller_pb:create_volume_request()) -> - {ok, controller_pb:volume(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback update_volume(ctx:t(), controller_pb:update_volume_request()) -> - {ok, controller_pb:volume(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback delete_volume(ctx:t(), controller_pb:delete_volume_request()) -> - {ok, controller_pb:empty(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback list_volume_attachments(ctx:t(), controller_pb:list_volume_attachments_request()) -> - {ok, controller_pb:list_volume_attachments_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback get_volume_attachment(ctx:t(), controller_pb:volume_attachment_identifier()) -> - {ok, controller_pb:volume_attachment(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback attach_volume(ctx:t(), controller_pb:volume_attachment_identifier()) -> - {ok, controller_pb:volume_attachment(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback detach_volume(ctx:t(), controller_pb:volume_attachment_identifier()) -> - {ok, controller_pb:empty(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback get_port_forwarding(ctx:t(), controller_pb:port_forwarding_identifier()) -> - {ok, controller_pb:port_forwarding(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback list_port_forwardings(ctx:t(), controller_pb:list_port_forwardings_request()) -> - {ok, controller_pb:list_port_forwardings_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback put_port_forwarding(ctx:t(), controller_pb:put_port_forwarding_request()) -> - {ok, controller_pb:port_forwarding(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback delete_port_forwarding(ctx:t(), controller_pb:port_forwarding_identifier()) -> - {ok, controller_pb:empty(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback sync_routes(ctx:t(), controller_pb:sync_routes_request()) -> - {ok, controller_pb:empty(), ctx:t()} | grpcbox_stream:grpc_error_response(). - diff --git a/virtuerl/src/pb/daemon_service_client.erl b/virtuerl/src/pb/daemon_service_client.erl deleted file mode 100644 index d02ee59..0000000 --- a/virtuerl/src/pb/daemon_service_client.erl +++ /dev/null @@ -1,475 +0,0 @@ -%%%------------------------------------------------------------------- -%% @doc Client module for grpc service DaemonService. -%% @end -%%%------------------------------------------------------------------- - -%% this module was generated and should not be modified manually - --module(daemon_service_client). - --compile(export_all). --compile(nowarn_export_all). - --include_lib("grpcbox/include/grpcbox.hrl"). - --define(is_ctx(Ctx), is_tuple(Ctx) andalso element(1, Ctx) =:= ctx). - --define(SERVICE, 'DaemonService'). --define(PROTO_MODULE, 'controller_pb'). --define(MARSHAL_FUN(T), fun(I) -> ?PROTO_MODULE:encode_msg(I, T) end). --define(UNMARSHAL_FUN(T), fun(I) -> ?PROTO_MODULE:decode_msg(I, T) end). --define(DEF(Input, Output, MessageType), #grpcbox_def{service=?SERVICE, - message_type=MessageType, - marshal_fun=?MARSHAL_FUN(Input), - unmarshal_fun=?UNMARSHAL_FUN(Output)}). - -%% @doc Unary RPC --spec get_network(controller_pb:get_network_request()) -> - {ok, controller_pb:network(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_network(Input) -> - get_network(ctx:new(), Input, #{}). - --spec get_network(ctx:t() | controller_pb:get_network_request(), controller_pb:get_network_request() | grpcbox_client:options()) -> - {ok, controller_pb:network(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_network(Ctx, Input) when ?is_ctx(Ctx) -> - get_network(Ctx, Input, #{}); -get_network(Input, Options) -> - get_network(ctx:new(), Input, Options). - --spec get_network(ctx:t(), controller_pb:get_network_request(), grpcbox_client:options()) -> - {ok, controller_pb:network(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_network(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/DaemonService/GetNetwork">>, Input, ?DEF(get_network_request, network, <<"GetNetworkRequest">>), Options). - -%% @doc Unary RPC --spec list_networks(controller_pb:list_networks_request()) -> - {ok, controller_pb:list_networks_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_networks(Input) -> - list_networks(ctx:new(), Input, #{}). - --spec list_networks(ctx:t() | controller_pb:list_networks_request(), controller_pb:list_networks_request() | grpcbox_client:options()) -> - {ok, controller_pb:list_networks_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_networks(Ctx, Input) when ?is_ctx(Ctx) -> - list_networks(Ctx, Input, #{}); -list_networks(Input, Options) -> - list_networks(ctx:new(), Input, Options). - --spec list_networks(ctx:t(), controller_pb:list_networks_request(), grpcbox_client:options()) -> - {ok, controller_pb:list_networks_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_networks(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/DaemonService/ListNetworks">>, Input, ?DEF(list_networks_request, list_networks_response, <<"ListNetworksRequest">>), Options). - -%% @doc Unary RPC --spec create_network(controller_pb:create_network_request()) -> - {ok, controller_pb:network(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -create_network(Input) -> - create_network(ctx:new(), Input, #{}). - --spec create_network(ctx:t() | controller_pb:create_network_request(), controller_pb:create_network_request() | grpcbox_client:options()) -> - {ok, controller_pb:network(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -create_network(Ctx, Input) when ?is_ctx(Ctx) -> - create_network(Ctx, Input, #{}); -create_network(Input, Options) -> - create_network(ctx:new(), Input, Options). - --spec create_network(ctx:t(), controller_pb:create_network_request(), grpcbox_client:options()) -> - {ok, controller_pb:network(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -create_network(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/DaemonService/CreateNetwork">>, Input, ?DEF(create_network_request, network, <<"CreateNetworkRequest">>), Options). - -%% @doc Unary RPC --spec delete_network(controller_pb:delete_network_request()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_network(Input) -> - delete_network(ctx:new(), Input, #{}). - --spec delete_network(ctx:t() | controller_pb:delete_network_request(), controller_pb:delete_network_request() | grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_network(Ctx, Input) when ?is_ctx(Ctx) -> - delete_network(Ctx, Input, #{}); -delete_network(Input, Options) -> - delete_network(ctx:new(), Input, Options). - --spec delete_network(ctx:t(), controller_pb:delete_network_request(), grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_network(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/DaemonService/DeleteNetwork">>, Input, ?DEF(delete_network_request, empty, <<"DeleteNetworkRequest">>), Options). - -%% @doc Unary RPC --spec start_domain(controller_pb:start_domain_request()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -start_domain(Input) -> - start_domain(ctx:new(), Input, #{}). - --spec start_domain(ctx:t() | controller_pb:start_domain_request(), controller_pb:start_domain_request() | grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -start_domain(Ctx, Input) when ?is_ctx(Ctx) -> - start_domain(Ctx, Input, #{}); -start_domain(Input, Options) -> - start_domain(ctx:new(), Input, Options). - --spec start_domain(ctx:t(), controller_pb:start_domain_request(), grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -start_domain(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/DaemonService/StartDomain">>, Input, ?DEF(start_domain_request, empty, <<"StartDomainRequest">>), Options). - -%% @doc Unary RPC --spec stop_domain(controller_pb:stop_domain_request()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -stop_domain(Input) -> - stop_domain(ctx:new(), Input, #{}). - --spec stop_domain(ctx:t() | controller_pb:stop_domain_request(), controller_pb:stop_domain_request() | grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -stop_domain(Ctx, Input) when ?is_ctx(Ctx) -> - stop_domain(Ctx, Input, #{}); -stop_domain(Input, Options) -> - stop_domain(ctx:new(), Input, Options). - --spec stop_domain(ctx:t(), controller_pb:stop_domain_request(), grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -stop_domain(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/DaemonService/StopDomain">>, Input, ?DEF(stop_domain_request, empty, <<"StopDomainRequest">>), Options). - -%% @doc Unary RPC --spec get_domain(controller_pb:get_domain_request()) -> - {ok, controller_pb:domain(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_domain(Input) -> - get_domain(ctx:new(), Input, #{}). - --spec get_domain(ctx:t() | controller_pb:get_domain_request(), controller_pb:get_domain_request() | grpcbox_client:options()) -> - {ok, controller_pb:domain(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_domain(Ctx, Input) when ?is_ctx(Ctx) -> - get_domain(Ctx, Input, #{}); -get_domain(Input, Options) -> - get_domain(ctx:new(), Input, Options). - --spec get_domain(ctx:t(), controller_pb:get_domain_request(), grpcbox_client:options()) -> - {ok, controller_pb:domain(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_domain(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/DaemonService/GetDomain">>, Input, ?DEF(get_domain_request, domain, <<"GetDomainRequest">>), Options). - -%% @doc Unary RPC --spec list_domains(controller_pb:list_domains_request()) -> - {ok, controller_pb:list_domains_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_domains(Input) -> - list_domains(ctx:new(), Input, #{}). - --spec list_domains(ctx:t() | controller_pb:list_domains_request(), controller_pb:list_domains_request() | grpcbox_client:options()) -> - {ok, controller_pb:list_domains_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_domains(Ctx, Input) when ?is_ctx(Ctx) -> - list_domains(Ctx, Input, #{}); -list_domains(Input, Options) -> - list_domains(ctx:new(), Input, Options). - --spec list_domains(ctx:t(), controller_pb:list_domains_request(), grpcbox_client:options()) -> - {ok, controller_pb:list_domains_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_domains(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/DaemonService/ListDomains">>, Input, ?DEF(list_domains_request, list_domains_response, <<"ListDomainsRequest">>), Options). - -%% @doc Unary RPC --spec create_domain(controller_pb:create_domain_request()) -> - {ok, controller_pb:domain(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -create_domain(Input) -> - create_domain(ctx:new(), Input, #{}). - --spec create_domain(ctx:t() | controller_pb:create_domain_request(), controller_pb:create_domain_request() | grpcbox_client:options()) -> - {ok, controller_pb:domain(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -create_domain(Ctx, Input) when ?is_ctx(Ctx) -> - create_domain(Ctx, Input, #{}); -create_domain(Input, Options) -> - create_domain(ctx:new(), Input, Options). - --spec create_domain(ctx:t(), controller_pb:create_domain_request(), grpcbox_client:options()) -> - {ok, controller_pb:domain(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -create_domain(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/DaemonService/CreateDomain">>, Input, ?DEF(create_domain_request, domain, <<"CreateDomainRequest">>), Options). - -%% @doc Unary RPC --spec delete_domain(controller_pb:delete_domain_request()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_domain(Input) -> - delete_domain(ctx:new(), Input, #{}). - --spec delete_domain(ctx:t() | controller_pb:delete_domain_request(), controller_pb:delete_domain_request() | grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_domain(Ctx, Input) when ?is_ctx(Ctx) -> - delete_domain(Ctx, Input, #{}); -delete_domain(Input, Options) -> - delete_domain(ctx:new(), Input, Options). - --spec delete_domain(ctx:t(), controller_pb:delete_domain_request(), grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_domain(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/DaemonService/DeleteDomain">>, Input, ?DEF(delete_domain_request, empty, <<"DeleteDomainRequest">>), Options). - -%% @doc --spec download_image(controller_pb:download_image_request()) -> - {ok, grpcbox_client:stream()} | grpcbox_stream:grpc_error_response() | {error, any()}. -download_image(Input) -> - download_image(ctx:new(), Input, #{}). - --spec download_image(ctx:t() | controller_pb:download_image_request(), controller_pb:download_image_request() | grpcbox_client:options()) -> - {ok, grpcbox_client:stream()} | grpcbox_stream:grpc_error_response() | {error, any()}. -download_image(Ctx, Input) when ?is_ctx(Ctx) -> - download_image(Ctx, Input, #{}); -download_image(Input, Options) -> - download_image(ctx:new(), Input, Options). - --spec download_image(ctx:t(), controller_pb:download_image_request(), grpcbox_client:options()) -> - {ok, grpcbox_client:stream()} | grpcbox_stream:grpc_error_response() | {error, any()}. -download_image(Ctx, Input, Options) -> - grpcbox_client:stream(Ctx, <<"/DaemonService/DownloadImage">>, Input, ?DEF(download_image_request, image_chunk, <<"DownloadImageRequest">>), Options). - -%% @doc Unary RPC --spec get_volume(controller_pb:get_volume_request()) -> - {ok, controller_pb:volume(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_volume(Input) -> - get_volume(ctx:new(), Input, #{}). - --spec get_volume(ctx:t() | controller_pb:get_volume_request(), controller_pb:get_volume_request() | grpcbox_client:options()) -> - {ok, controller_pb:volume(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_volume(Ctx, Input) when ?is_ctx(Ctx) -> - get_volume(Ctx, Input, #{}); -get_volume(Input, Options) -> - get_volume(ctx:new(), Input, Options). - --spec get_volume(ctx:t(), controller_pb:get_volume_request(), grpcbox_client:options()) -> - {ok, controller_pb:volume(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_volume(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/DaemonService/GetVolume">>, Input, ?DEF(get_volume_request, volume, <<"GetVolumeRequest">>), Options). - -%% @doc Unary RPC --spec list_volumes(controller_pb:list_volumes_request()) -> - {ok, controller_pb:list_volumes_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_volumes(Input) -> - list_volumes(ctx:new(), Input, #{}). - --spec list_volumes(ctx:t() | controller_pb:list_volumes_request(), controller_pb:list_volumes_request() | grpcbox_client:options()) -> - {ok, controller_pb:list_volumes_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_volumes(Ctx, Input) when ?is_ctx(Ctx) -> - list_volumes(Ctx, Input, #{}); -list_volumes(Input, Options) -> - list_volumes(ctx:new(), Input, Options). - --spec list_volumes(ctx:t(), controller_pb:list_volumes_request(), grpcbox_client:options()) -> - {ok, controller_pb:list_volumes_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_volumes(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/DaemonService/ListVolumes">>, Input, ?DEF(list_volumes_request, list_volumes_response, <<"ListVolumesRequest">>), Options). - -%% @doc Unary RPC --spec create_volume(controller_pb:create_volume_request()) -> - {ok, controller_pb:volume(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -create_volume(Input) -> - create_volume(ctx:new(), Input, #{}). - --spec create_volume(ctx:t() | controller_pb:create_volume_request(), controller_pb:create_volume_request() | grpcbox_client:options()) -> - {ok, controller_pb:volume(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -create_volume(Ctx, Input) when ?is_ctx(Ctx) -> - create_volume(Ctx, Input, #{}); -create_volume(Input, Options) -> - create_volume(ctx:new(), Input, Options). - --spec create_volume(ctx:t(), controller_pb:create_volume_request(), grpcbox_client:options()) -> - {ok, controller_pb:volume(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -create_volume(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/DaemonService/CreateVolume">>, Input, ?DEF(create_volume_request, volume, <<"CreateVolumeRequest">>), Options). - -%% @doc Unary RPC --spec update_volume(controller_pb:update_volume_request()) -> - {ok, controller_pb:volume(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -update_volume(Input) -> - update_volume(ctx:new(), Input, #{}). - --spec update_volume(ctx:t() | controller_pb:update_volume_request(), controller_pb:update_volume_request() | grpcbox_client:options()) -> - {ok, controller_pb:volume(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -update_volume(Ctx, Input) when ?is_ctx(Ctx) -> - update_volume(Ctx, Input, #{}); -update_volume(Input, Options) -> - update_volume(ctx:new(), Input, Options). - --spec update_volume(ctx:t(), controller_pb:update_volume_request(), grpcbox_client:options()) -> - {ok, controller_pb:volume(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -update_volume(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/DaemonService/UpdateVolume">>, Input, ?DEF(update_volume_request, volume, <<"UpdateVolumeRequest">>), Options). - -%% @doc Unary RPC --spec delete_volume(controller_pb:delete_volume_request()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_volume(Input) -> - delete_volume(ctx:new(), Input, #{}). - --spec delete_volume(ctx:t() | controller_pb:delete_volume_request(), controller_pb:delete_volume_request() | grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_volume(Ctx, Input) when ?is_ctx(Ctx) -> - delete_volume(Ctx, Input, #{}); -delete_volume(Input, Options) -> - delete_volume(ctx:new(), Input, Options). - --spec delete_volume(ctx:t(), controller_pb:delete_volume_request(), grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_volume(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/DaemonService/DeleteVolume">>, Input, ?DEF(delete_volume_request, empty, <<"DeleteVolumeRequest">>), Options). - -%% @doc Unary RPC --spec list_volume_attachments(controller_pb:list_volume_attachments_request()) -> - {ok, controller_pb:list_volume_attachments_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_volume_attachments(Input) -> - list_volume_attachments(ctx:new(), Input, #{}). - --spec list_volume_attachments(ctx:t() | controller_pb:list_volume_attachments_request(), controller_pb:list_volume_attachments_request() | grpcbox_client:options()) -> - {ok, controller_pb:list_volume_attachments_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_volume_attachments(Ctx, Input) when ?is_ctx(Ctx) -> - list_volume_attachments(Ctx, Input, #{}); -list_volume_attachments(Input, Options) -> - list_volume_attachments(ctx:new(), Input, Options). - --spec list_volume_attachments(ctx:t(), controller_pb:list_volume_attachments_request(), grpcbox_client:options()) -> - {ok, controller_pb:list_volume_attachments_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_volume_attachments(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/DaemonService/ListVolumeAttachments">>, Input, ?DEF(list_volume_attachments_request, list_volume_attachments_response, <<"ListVolumeAttachmentsRequest">>), Options). - -%% @doc Unary RPC --spec get_volume_attachment(controller_pb:volume_attachment_identifier()) -> - {ok, controller_pb:volume_attachment(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_volume_attachment(Input) -> - get_volume_attachment(ctx:new(), Input, #{}). - --spec get_volume_attachment(ctx:t() | controller_pb:volume_attachment_identifier(), controller_pb:volume_attachment_identifier() | grpcbox_client:options()) -> - {ok, controller_pb:volume_attachment(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_volume_attachment(Ctx, Input) when ?is_ctx(Ctx) -> - get_volume_attachment(Ctx, Input, #{}); -get_volume_attachment(Input, Options) -> - get_volume_attachment(ctx:new(), Input, Options). - --spec get_volume_attachment(ctx:t(), controller_pb:volume_attachment_identifier(), grpcbox_client:options()) -> - {ok, controller_pb:volume_attachment(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_volume_attachment(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/DaemonService/GetVolumeAttachment">>, Input, ?DEF(volume_attachment_identifier, volume_attachment, <<"VolumeAttachmentIdentifier">>), Options). - -%% @doc Unary RPC --spec attach_volume(controller_pb:volume_attachment_identifier()) -> - {ok, controller_pb:volume_attachment(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -attach_volume(Input) -> - attach_volume(ctx:new(), Input, #{}). - --spec attach_volume(ctx:t() | controller_pb:volume_attachment_identifier(), controller_pb:volume_attachment_identifier() | grpcbox_client:options()) -> - {ok, controller_pb:volume_attachment(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -attach_volume(Ctx, Input) when ?is_ctx(Ctx) -> - attach_volume(Ctx, Input, #{}); -attach_volume(Input, Options) -> - attach_volume(ctx:new(), Input, Options). - --spec attach_volume(ctx:t(), controller_pb:volume_attachment_identifier(), grpcbox_client:options()) -> - {ok, controller_pb:volume_attachment(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -attach_volume(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/DaemonService/AttachVolume">>, Input, ?DEF(volume_attachment_identifier, volume_attachment, <<"VolumeAttachmentIdentifier">>), Options). - -%% @doc Unary RPC --spec detach_volume(controller_pb:volume_attachment_identifier()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -detach_volume(Input) -> - detach_volume(ctx:new(), Input, #{}). - --spec detach_volume(ctx:t() | controller_pb:volume_attachment_identifier(), controller_pb:volume_attachment_identifier() | grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -detach_volume(Ctx, Input) when ?is_ctx(Ctx) -> - detach_volume(Ctx, Input, #{}); -detach_volume(Input, Options) -> - detach_volume(ctx:new(), Input, Options). - --spec detach_volume(ctx:t(), controller_pb:volume_attachment_identifier(), grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -detach_volume(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/DaemonService/DetachVolume">>, Input, ?DEF(volume_attachment_identifier, empty, <<"VolumeAttachmentIdentifier">>), Options). - -%% @doc Unary RPC --spec get_port_forwarding(controller_pb:port_forwarding_identifier()) -> - {ok, controller_pb:port_forwarding(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_port_forwarding(Input) -> - get_port_forwarding(ctx:new(), Input, #{}). - --spec get_port_forwarding(ctx:t() | controller_pb:port_forwarding_identifier(), controller_pb:port_forwarding_identifier() | grpcbox_client:options()) -> - {ok, controller_pb:port_forwarding(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_port_forwarding(Ctx, Input) when ?is_ctx(Ctx) -> - get_port_forwarding(Ctx, Input, #{}); -get_port_forwarding(Input, Options) -> - get_port_forwarding(ctx:new(), Input, Options). - --spec get_port_forwarding(ctx:t(), controller_pb:port_forwarding_identifier(), grpcbox_client:options()) -> - {ok, controller_pb:port_forwarding(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_port_forwarding(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/DaemonService/GetPortForwarding">>, Input, ?DEF(port_forwarding_identifier, port_forwarding, <<"PortForwardingIdentifier">>), Options). - -%% @doc Unary RPC --spec list_port_forwardings(controller_pb:list_port_forwardings_request()) -> - {ok, controller_pb:list_port_forwardings_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_port_forwardings(Input) -> - list_port_forwardings(ctx:new(), Input, #{}). - --spec list_port_forwardings(ctx:t() | controller_pb:list_port_forwardings_request(), controller_pb:list_port_forwardings_request() | grpcbox_client:options()) -> - {ok, controller_pb:list_port_forwardings_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_port_forwardings(Ctx, Input) when ?is_ctx(Ctx) -> - list_port_forwardings(Ctx, Input, #{}); -list_port_forwardings(Input, Options) -> - list_port_forwardings(ctx:new(), Input, Options). - --spec list_port_forwardings(ctx:t(), controller_pb:list_port_forwardings_request(), grpcbox_client:options()) -> - {ok, controller_pb:list_port_forwardings_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_port_forwardings(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/DaemonService/ListPortForwardings">>, Input, ?DEF(list_port_forwardings_request, list_port_forwardings_response, <<"ListPortForwardingsRequest">>), Options). - -%% @doc Unary RPC --spec put_port_forwarding(controller_pb:put_port_forwarding_request()) -> - {ok, controller_pb:port_forwarding(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -put_port_forwarding(Input) -> - put_port_forwarding(ctx:new(), Input, #{}). - --spec put_port_forwarding(ctx:t() | controller_pb:put_port_forwarding_request(), controller_pb:put_port_forwarding_request() | grpcbox_client:options()) -> - {ok, controller_pb:port_forwarding(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -put_port_forwarding(Ctx, Input) when ?is_ctx(Ctx) -> - put_port_forwarding(Ctx, Input, #{}); -put_port_forwarding(Input, Options) -> - put_port_forwarding(ctx:new(), Input, Options). - --spec put_port_forwarding(ctx:t(), controller_pb:put_port_forwarding_request(), grpcbox_client:options()) -> - {ok, controller_pb:port_forwarding(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -put_port_forwarding(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/DaemonService/PutPortForwarding">>, Input, ?DEF(put_port_forwarding_request, port_forwarding, <<"PutPortForwardingRequest">>), Options). - -%% @doc Unary RPC --spec delete_port_forwarding(controller_pb:port_forwarding_identifier()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_port_forwarding(Input) -> - delete_port_forwarding(ctx:new(), Input, #{}). - --spec delete_port_forwarding(ctx:t() | controller_pb:port_forwarding_identifier(), controller_pb:port_forwarding_identifier() | grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_port_forwarding(Ctx, Input) when ?is_ctx(Ctx) -> - delete_port_forwarding(Ctx, Input, #{}); -delete_port_forwarding(Input, Options) -> - delete_port_forwarding(ctx:new(), Input, Options). - --spec delete_port_forwarding(ctx:t(), controller_pb:port_forwarding_identifier(), grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_port_forwarding(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/DaemonService/DeletePortForwarding">>, Input, ?DEF(port_forwarding_identifier, empty, <<"PortForwardingIdentifier">>), Options). - -%% @doc Unary RPC --spec sync_routes(controller_pb:sync_routes_request()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -sync_routes(Input) -> - sync_routes(ctx:new(), Input, #{}). - --spec sync_routes(ctx:t() | controller_pb:sync_routes_request(), controller_pb:sync_routes_request() | grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -sync_routes(Ctx, Input) when ?is_ctx(Ctx) -> - sync_routes(Ctx, Input, #{}); -sync_routes(Input, Options) -> - sync_routes(ctx:new(), Input, Options). - --spec sync_routes(ctx:t(), controller_pb:sync_routes_request(), grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -sync_routes(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/DaemonService/SyncRoutes">>, Input, ?DEF(sync_routes_request, empty, <<"SyncRoutesRequest">>), Options). - diff --git a/virtuerl/src/pb/dns_bhvr.erl b/virtuerl/src/pb/dns_bhvr.erl deleted file mode 100644 index 6c26475..0000000 --- a/virtuerl/src/pb/dns_bhvr.erl +++ /dev/null @@ -1,25 +0,0 @@ -%%%------------------------------------------------------------------- -%% @doc Behaviour to implement for grpc service DNS. -%% @end -%%%------------------------------------------------------------------- - -%% this module was generated and should not be modified manually - --module(dns_bhvr). - -%% Unary RPC --callback get_dns_record(ctx:t(), controller_pb:dns_record_identifier()) -> - {ok, controller_pb:dns_record(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback list_dns_records(ctx:t(), controller_pb:list_dns_records_request()) -> - {ok, controller_pb:list_dns_records_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback put_dns_record(ctx:t(), controller_pb:put_dns_record_request()) -> - {ok, controller_pb:dns_record(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback delete_dns_record(ctx:t(), controller_pb:dns_record_identifier()) -> - {ok, controller_pb:empty(), ctx:t()} | grpcbox_stream:grpc_error_response(). - diff --git a/virtuerl/src/pb/dns_client.erl b/virtuerl/src/pb/dns_client.erl deleted file mode 100644 index 527d371..0000000 --- a/virtuerl/src/pb/dns_client.erl +++ /dev/null @@ -1,97 +0,0 @@ -%%%------------------------------------------------------------------- -%% @doc Client module for grpc service DNS. -%% @end -%%%------------------------------------------------------------------- - -%% this module was generated and should not be modified manually - --module(dns_client). - --compile(export_all). --compile(nowarn_export_all). - --include_lib("grpcbox/include/grpcbox.hrl"). - --define(is_ctx(Ctx), is_tuple(Ctx) andalso element(1, Ctx) =:= ctx). - --define(SERVICE, 'DNS'). --define(PROTO_MODULE, 'controller_pb'). --define(MARSHAL_FUN(T), fun(I) -> ?PROTO_MODULE:encode_msg(I, T) end). --define(UNMARSHAL_FUN(T), fun(I) -> ?PROTO_MODULE:decode_msg(I, T) end). --define(DEF(Input, Output, MessageType), #grpcbox_def{service=?SERVICE, - message_type=MessageType, - marshal_fun=?MARSHAL_FUN(Input), - unmarshal_fun=?UNMARSHAL_FUN(Output)}). - -%% @doc Unary RPC --spec get_dns_record(controller_pb:dns_record_identifier()) -> - {ok, controller_pb:dns_record(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_dns_record(Input) -> - get_dns_record(ctx:new(), Input, #{}). - --spec get_dns_record(ctx:t() | controller_pb:dns_record_identifier(), controller_pb:dns_record_identifier() | grpcbox_client:options()) -> - {ok, controller_pb:dns_record(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_dns_record(Ctx, Input) when ?is_ctx(Ctx) -> - get_dns_record(Ctx, Input, #{}); -get_dns_record(Input, Options) -> - get_dns_record(ctx:new(), Input, Options). - --spec get_dns_record(ctx:t(), controller_pb:dns_record_identifier(), grpcbox_client:options()) -> - {ok, controller_pb:dns_record(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_dns_record(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/DNS/GetDNSRecord">>, Input, ?DEF(dns_record_identifier, dns_record, <<"DNSRecordIdentifier">>), Options). - -%% @doc Unary RPC --spec list_dns_records(controller_pb:list_dns_records_request()) -> - {ok, controller_pb:list_dns_records_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_dns_records(Input) -> - list_dns_records(ctx:new(), Input, #{}). - --spec list_dns_records(ctx:t() | controller_pb:list_dns_records_request(), controller_pb:list_dns_records_request() | grpcbox_client:options()) -> - {ok, controller_pb:list_dns_records_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_dns_records(Ctx, Input) when ?is_ctx(Ctx) -> - list_dns_records(Ctx, Input, #{}); -list_dns_records(Input, Options) -> - list_dns_records(ctx:new(), Input, Options). - --spec list_dns_records(ctx:t(), controller_pb:list_dns_records_request(), grpcbox_client:options()) -> - {ok, controller_pb:list_dns_records_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_dns_records(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/DNS/ListDNSRecords">>, Input, ?DEF(list_dns_records_request, list_dns_records_response, <<"ListDNSRecordsRequest">>), Options). - -%% @doc Unary RPC --spec put_dns_record(controller_pb:put_dns_record_request()) -> - {ok, controller_pb:dns_record(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -put_dns_record(Input) -> - put_dns_record(ctx:new(), Input, #{}). - --spec put_dns_record(ctx:t() | controller_pb:put_dns_record_request(), controller_pb:put_dns_record_request() | grpcbox_client:options()) -> - {ok, controller_pb:dns_record(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -put_dns_record(Ctx, Input) when ?is_ctx(Ctx) -> - put_dns_record(Ctx, Input, #{}); -put_dns_record(Input, Options) -> - put_dns_record(ctx:new(), Input, Options). - --spec put_dns_record(ctx:t(), controller_pb:put_dns_record_request(), grpcbox_client:options()) -> - {ok, controller_pb:dns_record(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -put_dns_record(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/DNS/PutDNSRecord">>, Input, ?DEF(put_dns_record_request, dns_record, <<"PutDNSRecordRequest">>), Options). - -%% @doc Unary RPC --spec delete_dns_record(controller_pb:dns_record_identifier()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_dns_record(Input) -> - delete_dns_record(ctx:new(), Input, #{}). - --spec delete_dns_record(ctx:t() | controller_pb:dns_record_identifier(), controller_pb:dns_record_identifier() | grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_dns_record(Ctx, Input) when ?is_ctx(Ctx) -> - delete_dns_record(Ctx, Input, #{}); -delete_dns_record(Input, Options) -> - delete_dns_record(ctx:new(), Input, Options). - --spec delete_dns_record(ctx:t(), controller_pb:dns_record_identifier(), grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_dns_record(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/DNS/DeleteDNSRecord">>, Input, ?DEF(dns_record_identifier, empty, <<"DNSRecordIdentifier">>), Options). - diff --git a/virtuerl/src/pb/dns_pb.erl b/virtuerl/src/pb/dns_pb.erl deleted file mode 100644 index 3f91d8a..0000000 --- a/virtuerl/src/pb/dns_pb.erl +++ /dev/null @@ -1,1228 +0,0 @@ -%% -*- coding: utf-8 -*- -%% @private -%% Automatically generated, do not edit -%% Generated by gpb_compile version 4.19.8 -%% Version source: file --module(dns_pb). - --export([encode_msg/2, encode_msg/3]). --export([decode_msg/2, decode_msg/3]). --export([merge_msgs/3, merge_msgs/4]). --export([verify_msg/2, verify_msg/3]). --export([get_msg_defs/0]). --export([get_msg_names/0]). --export([get_group_names/0]). --export([get_msg_or_group_names/0]). --export([get_enum_names/0]). --export([find_msg_def/1, fetch_msg_def/1]). --export([find_enum_def/1, fetch_enum_def/1]). --export([enum_symbol_by_value/2, enum_value_by_symbol/2]). --export([get_service_names/0]). --export([get_service_def/1]). --export([get_rpc_names/1]). --export([find_rpc_def/2, fetch_rpc_def/2]). --export([fqbin_to_service_name/1]). --export([service_name_to_fqbin/1]). --export([fqbins_to_service_and_rpc_name/2]). --export([service_and_rpc_name_to_fqbins/2]). --export([fqbin_to_msg_name/1]). --export([msg_name_to_fqbin/1]). --export([fqbin_to_enum_name/1]). --export([enum_name_to_fqbin/1]). --export([get_package_name/0]). --export([uses_packages/0]). --export([source_basename/0]). --export([get_all_source_basenames/0]). --export([get_all_proto_names/0]). --export([get_msg_containment/1]). --export([get_pkg_containment/1]). --export([get_service_containment/1]). --export([get_rpc_containment/1]). --export([get_enum_containment/1]). --export([get_proto_by_msg_name_as_fqbin/1]). --export([get_proto_by_service_name_as_fqbin/1]). --export([get_proto_by_enum_name_as_fqbin/1]). --export([get_protos_by_pkg_name_as_fqbin/1]). --export([gpb_version_as_string/0, gpb_version_as_list/0]). --export([gpb_version_source/0]). - - -%% enumerated types - --export_type([]). - -%% message types --type dns_record_identifier() :: - #{name => unicode:chardata(), % = 1, optional - type => unicode:chardata() % = 2, optional - }. - --type dns_record() :: - #{name => unicode:chardata(), % = 1, optional - type => unicode:chardata(), % = 2, optional - ttl => non_neg_integer(), % = 3, optional, 64 bits - records => [unicode:chardata()] % = 4, repeated - }. - --type list_dns_records_request() :: - #{ - }. - --type list_dns_records_response() :: - #{dns_records => [dns_record()] % = 1, repeated - }. - --type put_dns_record_request() :: - #{dns_record => dns_record() % = 1, optional - }. - --type empty() :: - #{ - }. - --export_type(['dns_record_identifier'/0, 'dns_record'/0, 'list_dns_records_request'/0, 'list_dns_records_response'/0, 'put_dns_record_request'/0, 'empty'/0]). --type '$msg_name'() :: dns_record_identifier | dns_record | list_dns_records_request | list_dns_records_response | put_dns_record_request | empty. --type '$msg'() :: dns_record_identifier() | dns_record() | list_dns_records_request() | list_dns_records_response() | put_dns_record_request() | empty(). --export_type(['$msg_name'/0, '$msg'/0]). - --if(?OTP_RELEASE >= 24). --dialyzer({no_underspecs, encode_msg/2}). --endif. --spec encode_msg('$msg'(), '$msg_name'()) -> binary(). -encode_msg(Msg, MsgName) when is_atom(MsgName) -> encode_msg(Msg, MsgName, []). - --if(?OTP_RELEASE >= 24). --dialyzer({no_underspecs, encode_msg/3}). --endif. --spec encode_msg('$msg'(), '$msg_name'(), list()) -> binary(). -encode_msg(Msg, MsgName, Opts) -> - case proplists:get_bool(verify, Opts) of - true -> verify_msg(Msg, MsgName, Opts); - false -> ok - end, - TrUserData = proplists:get_value(user_data, Opts), - case MsgName of - dns_record_identifier -> encode_msg_dns_record_identifier(id(Msg, TrUserData), TrUserData); - dns_record -> encode_msg_dns_record(id(Msg, TrUserData), TrUserData); - list_dns_records_request -> encode_msg_list_dns_records_request(id(Msg, TrUserData), TrUserData); - list_dns_records_response -> encode_msg_list_dns_records_response(id(Msg, TrUserData), TrUserData); - put_dns_record_request -> encode_msg_put_dns_record_request(id(Msg, TrUserData), TrUserData); - empty -> encode_msg_empty(id(Msg, TrUserData), TrUserData) - end. - - -encode_msg_dns_record_identifier(Msg, TrUserData) -> encode_msg_dns_record_identifier(Msg, <<>>, TrUserData). - - -encode_msg_dns_record_identifier(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{name := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{type := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_dns_record(Msg, TrUserData) -> encode_msg_dns_record(Msg, <<>>, TrUserData). - - -encode_msg_dns_record(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{name := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - B2 = case M of - #{type := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end, - B3 = case M of - #{ttl := F3} -> - begin - TrF3 = id(F3, TrUserData), - if TrF3 =:= 0 -> B2; - true -> e_varint(TrF3, <>, TrUserData) - end - end; - _ -> B2 - end, - case M of - #{records := F4} -> - TrF4 = id(F4, TrUserData), - if TrF4 == [] -> B3; - true -> e_field_dns_record_records(TrF4, B3, TrUserData) - end; - _ -> B3 - end. - -encode_msg_list_dns_records_request(_Msg, _TrUserData) -> <<>>. - -encode_msg_list_dns_records_response(Msg, TrUserData) -> encode_msg_list_dns_records_response(Msg, <<>>, TrUserData). - - -encode_msg_list_dns_records_response(#{} = M, Bin, TrUserData) -> - case M of - #{dns_records := F1} -> - TrF1 = id(F1, TrUserData), - if TrF1 == [] -> Bin; - true -> e_field_list_dns_records_response_dns_records(TrF1, Bin, TrUserData) - end; - _ -> Bin - end. - -encode_msg_put_dns_record_request(Msg, TrUserData) -> encode_msg_put_dns_record_request(Msg, <<>>, TrUserData). - - -encode_msg_put_dns_record_request(#{} = M, Bin, TrUserData) -> - case M of - #{dns_record := F1} -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= undefined -> Bin; - true -> e_mfield_put_dns_record_request_dns_record(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end. - -encode_msg_empty(_Msg, _TrUserData) -> <<>>. - -e_field_dns_record_records([Elem | Rest], Bin, TrUserData) -> - Bin2 = <>, - Bin3 = e_type_string(id(Elem, TrUserData), Bin2, TrUserData), - e_field_dns_record_records(Rest, Bin3, TrUserData); -e_field_dns_record_records([], Bin, _TrUserData) -> Bin. - -e_mfield_list_dns_records_response_dns_records(Msg, Bin, TrUserData) -> - SubBin = encode_msg_dns_record(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_field_list_dns_records_response_dns_records([Elem | Rest], Bin, TrUserData) -> - Bin2 = <>, - Bin3 = e_mfield_list_dns_records_response_dns_records(id(Elem, TrUserData), Bin2, TrUserData), - e_field_list_dns_records_response_dns_records(Rest, Bin3, TrUserData); -e_field_list_dns_records_response_dns_records([], Bin, _TrUserData) -> Bin. - -e_mfield_put_dns_record_request_dns_record(Msg, Bin, TrUserData) -> - SubBin = encode_msg_dns_record(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - --compile({nowarn_unused_function,e_type_sint/3}). -e_type_sint(Value, Bin, _TrUserData) when Value >= 0 -> e_varint(Value * 2, Bin); -e_type_sint(Value, Bin, _TrUserData) -> e_varint(Value * -2 - 1, Bin). - --compile({nowarn_unused_function,e_type_int32/3}). -e_type_int32(Value, Bin, _TrUserData) when 0 =< Value, Value =< 127 -> <>; -e_type_int32(Value, Bin, _TrUserData) -> - <> = <>, - e_varint(N, Bin). - --compile({nowarn_unused_function,e_type_int64/3}). -e_type_int64(Value, Bin, _TrUserData) when 0 =< Value, Value =< 127 -> <>; -e_type_int64(Value, Bin, _TrUserData) -> - <> = <>, - e_varint(N, Bin). - --compile({nowarn_unused_function,e_type_bool/3}). -e_type_bool(true, Bin, _TrUserData) -> <>; -e_type_bool(false, Bin, _TrUserData) -> <>; -e_type_bool(1, Bin, _TrUserData) -> <>; -e_type_bool(0, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_string/3}). -e_type_string(S, Bin, _TrUserData) -> - Utf8 = unicode:characters_to_binary(S), - Bin2 = e_varint(byte_size(Utf8), Bin), - <>. - --compile({nowarn_unused_function,e_type_bytes/3}). -e_type_bytes(Bytes, Bin, _TrUserData) when is_binary(Bytes) -> - Bin2 = e_varint(byte_size(Bytes), Bin), - <>; -e_type_bytes(Bytes, Bin, _TrUserData) when is_list(Bytes) -> - BytesBin = iolist_to_binary(Bytes), - Bin2 = e_varint(byte_size(BytesBin), Bin), - <>. - --compile({nowarn_unused_function,e_type_fixed32/3}). -e_type_fixed32(Value, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_sfixed32/3}). -e_type_sfixed32(Value, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_fixed64/3}). -e_type_fixed64(Value, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_sfixed64/3}). -e_type_sfixed64(Value, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_float/3}). -e_type_float(V, Bin, _) when is_number(V) -> <>; -e_type_float(infinity, Bin, _) -> <>; -e_type_float('-infinity', Bin, _) -> <>; -e_type_float(nan, Bin, _) -> <>. - --compile({nowarn_unused_function,e_type_double/3}). -e_type_double(V, Bin, _) when is_number(V) -> <>; -e_type_double(infinity, Bin, _) -> <>; -e_type_double('-infinity', Bin, _) -> <>; -e_type_double(nan, Bin, _) -> <>. - --compile({nowarn_unused_function,e_unknown_elems/2}). -e_unknown_elems([Elem | Rest], Bin) -> - BinR = case Elem of - {varint, FNum, N} -> - BinF = e_varint(FNum bsl 3, Bin), - e_varint(N, BinF); - {length_delimited, FNum, Data} -> - BinF = e_varint(FNum bsl 3 bor 2, Bin), - BinL = e_varint(byte_size(Data), BinF), - <>; - {group, FNum, GroupFields} -> - Bin1 = e_varint(FNum bsl 3 bor 3, Bin), - Bin2 = e_unknown_elems(GroupFields, Bin1), - e_varint(FNum bsl 3 bor 4, Bin2); - {fixed32, FNum, V} -> - BinF = e_varint(FNum bsl 3 bor 5, Bin), - <>; - {fixed64, FNum, V} -> - BinF = e_varint(FNum bsl 3 bor 1, Bin), - <> - end, - e_unknown_elems(Rest, BinR); -e_unknown_elems([], Bin) -> Bin. - --compile({nowarn_unused_function,e_varint/3}). -e_varint(N, Bin, _TrUserData) -> e_varint(N, Bin). - --compile({nowarn_unused_function,e_varint/2}). -e_varint(N, Bin) when N =< 127 -> <>; -e_varint(N, Bin) -> - Bin2 = <>, - e_varint(N bsr 7, Bin2). - -is_empty_string("") -> true; -is_empty_string(<<>>) -> true; -is_empty_string(L) when is_list(L) -> not string_has_chars(L); -is_empty_string(B) when is_binary(B) -> false. - -string_has_chars([C | _]) when is_integer(C) -> true; -string_has_chars([H | T]) -> - case string_has_chars(H) of - true -> true; - false -> string_has_chars(T) - end; -string_has_chars(B) when is_binary(B), byte_size(B) =/= 0 -> true; -string_has_chars(C) when is_integer(C) -> true; -string_has_chars(<<>>) -> false; -string_has_chars([]) -> false. - - -decode_msg(Bin, MsgName) when is_binary(Bin) -> decode_msg(Bin, MsgName, []). - -decode_msg(Bin, MsgName, Opts) when is_binary(Bin) -> - TrUserData = proplists:get_value(user_data, Opts), - decode_msg_1_catch(Bin, MsgName, TrUserData). - --ifdef('OTP_RELEASE'). -decode_msg_1_catch(Bin, MsgName, TrUserData) -> - try decode_msg_2_doit(MsgName, Bin, TrUserData) - catch - error:{gpb_error,_}=Reason:StackTrace -> - erlang:raise(error, Reason, StackTrace); - Class:Reason:StackTrace -> error({gpb_error,{decoding_failure, {Bin, MsgName, {Class, Reason, StackTrace}}}}) - end. --else. -decode_msg_1_catch(Bin, MsgName, TrUserData) -> - try decode_msg_2_doit(MsgName, Bin, TrUserData) - catch - error:{gpb_error,_}=Reason -> - erlang:raise(error, Reason, - erlang:get_stacktrace()); - Class:Reason -> - StackTrace = erlang:get_stacktrace(), - error({gpb_error,{decoding_failure, {Bin, MsgName, {Class, Reason, StackTrace}}}}) - end. --endif. - -decode_msg_2_doit(dns_record_identifier, Bin, TrUserData) -> id(decode_msg_dns_record_identifier(Bin, TrUserData), TrUserData); -decode_msg_2_doit(dns_record, Bin, TrUserData) -> id(decode_msg_dns_record(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_dns_records_request, Bin, TrUserData) -> id(decode_msg_list_dns_records_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_dns_records_response, Bin, TrUserData) -> id(decode_msg_list_dns_records_response(Bin, TrUserData), TrUserData); -decode_msg_2_doit(put_dns_record_request, Bin, TrUserData) -> id(decode_msg_put_dns_record_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(empty, Bin, TrUserData) -> id(decode_msg_empty(Bin, TrUserData), TrUserData). - - - -decode_msg_dns_record_identifier(Bin, TrUserData) -> dfp_read_field_def_dns_record_identifier(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_dns_record_identifier(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_dns_record_identifier_name(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_dns_record_identifier(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_dns_record_identifier_type(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_dns_record_identifier(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{name => F@_1, type => F@_2}; -dfp_read_field_def_dns_record_identifier(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_dns_record_identifier(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_dns_record_identifier(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_dns_record_identifier(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_dns_record_identifier(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_dns_record_identifier_name(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_dns_record_identifier_type(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_dns_record_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_dns_record_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_dns_record_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_dns_record_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_dns_record_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_dns_record_identifier(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{name => F@_1, type => F@_2}. - -d_field_dns_record_identifier_name(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_dns_record_identifier_name(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_dns_record_identifier_name(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_dns_record_identifier(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_dns_record_identifier_type(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_dns_record_identifier_type(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_dns_record_identifier_type(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_dns_record_identifier(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_dns_record_identifier(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_dns_record_identifier(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_dns_record_identifier(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_dns_record_identifier(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_dns_record_identifier(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_dns_record_identifier(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_dns_record_identifier(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_dns_record_identifier(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_dns_record_identifier(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_dns_record_identifier(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_dns_record_identifier(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_dns_record_identifier(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_dns_record_identifier(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_dns_record_identifier(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_dns_record(Bin, TrUserData) -> dfp_read_field_def_dns_record(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), id(0, TrUserData), id([], TrUserData), TrUserData). - -dfp_read_field_def_dns_record(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_dns_record_name(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dfp_read_field_def_dns_record(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_dns_record_type(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dfp_read_field_def_dns_record(<<24, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_dns_record_ttl(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dfp_read_field_def_dns_record(<<34, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_dns_record_records(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dfp_read_field_def_dns_record(<<>>, 0, 0, _, F@_1, F@_2, F@_3, R1, TrUserData) -> #{name => F@_1, type => F@_2, ttl => F@_3, records => lists_reverse(R1, TrUserData)}; -dfp_read_field_def_dns_record(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dg_read_field_def_dns_record(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -dg_read_field_def_dns_record(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 32 - 7 -> dg_read_field_def_dns_record(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dg_read_field_def_dns_record(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, F@_4, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_dns_record_name(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); - 18 -> d_field_dns_record_type(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); - 24 -> d_field_dns_record_ttl(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); - 34 -> d_field_dns_record_records(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_dns_record(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); - 1 -> skip_64_dns_record(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); - 2 -> skip_length_delimited_dns_record(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); - 3 -> skip_group_dns_record(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); - 5 -> skip_32_dns_record(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData) - end - end; -dg_read_field_def_dns_record(<<>>, 0, 0, _, F@_1, F@_2, F@_3, R1, TrUserData) -> #{name => F@_1, type => F@_2, ttl => F@_3, records => lists_reverse(R1, TrUserData)}. - -d_field_dns_record_name(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_dns_record_name(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -d_field_dns_record_name(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, F@_4, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_dns_record(RestF, 0, 0, F, NewFValue, F@_2, F@_3, F@_4, TrUserData). - -d_field_dns_record_type(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_dns_record_type(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -d_field_dns_record_type(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, F@_4, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_dns_record(RestF, 0, 0, F, F@_1, NewFValue, F@_3, F@_4, TrUserData). - -d_field_dns_record_ttl(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_dns_record_ttl(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -d_field_dns_record_ttl(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, F@_4, TrUserData) -> - {NewFValue, RestF} = {id((X bsl N + Acc) band 18446744073709551615, TrUserData), Rest}, - dfp_read_field_def_dns_record(RestF, 0, 0, F, F@_1, F@_2, NewFValue, F@_4, TrUserData). - -d_field_dns_record_records(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_dns_record_records(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -d_field_dns_record_records(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_dns_record(RestF, 0, 0, F, F@_1, F@_2, F@_3, cons(NewFValue, Prev, TrUserData), TrUserData). - -skip_varint_dns_record(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> skip_varint_dns_record(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -skip_varint_dns_record(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dfp_read_field_def_dns_record(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -skip_length_delimited_dns_record(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> skip_length_delimited_dns_record(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -skip_length_delimited_dns_record(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_dns_record(Rest2, 0, 0, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -skip_group_dns_record(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, F@_4, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_dns_record(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, F@_4, TrUserData). - -skip_32_dns_record(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dfp_read_field_def_dns_record(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -skip_64_dns_record(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dfp_read_field_def_dns_record(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -decode_msg_list_dns_records_request(Bin, TrUserData) -> dfp_read_field_def_list_dns_records_request(Bin, 0, 0, 0, TrUserData). - -dfp_read_field_def_list_dns_records_request(<<>>, 0, 0, _, _) -> #{}; -dfp_read_field_def_list_dns_records_request(Other, Z1, Z2, F, TrUserData) -> dg_read_field_def_list_dns_records_request(Other, Z1, Z2, F, TrUserData). - -dg_read_field_def_list_dns_records_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_dns_records_request(Rest, N + 7, X bsl N + Acc, F, TrUserData); -dg_read_field_def_list_dns_records_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, TrUserData) -> - Key = X bsl N + Acc, - case Key band 7 of - 0 -> skip_varint_list_dns_records_request(Rest, 0, 0, Key bsr 3, TrUserData); - 1 -> skip_64_list_dns_records_request(Rest, 0, 0, Key bsr 3, TrUserData); - 2 -> skip_length_delimited_list_dns_records_request(Rest, 0, 0, Key bsr 3, TrUserData); - 3 -> skip_group_list_dns_records_request(Rest, 0, 0, Key bsr 3, TrUserData); - 5 -> skip_32_list_dns_records_request(Rest, 0, 0, Key bsr 3, TrUserData) - end; -dg_read_field_def_list_dns_records_request(<<>>, 0, 0, _, _) -> #{}. - -skip_varint_list_dns_records_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> skip_varint_list_dns_records_request(Rest, Z1, Z2, F, TrUserData); -skip_varint_list_dns_records_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_list_dns_records_request(Rest, Z1, Z2, F, TrUserData). - -skip_length_delimited_list_dns_records_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 57 -> skip_length_delimited_list_dns_records_request(Rest, N + 7, X bsl N + Acc, F, TrUserData); -skip_length_delimited_list_dns_records_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_dns_records_request(Rest2, 0, 0, F, TrUserData). - -skip_group_list_dns_records_request(Bin, _, Z2, FNum, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_dns_records_request(Rest, 0, Z2, FNum, TrUserData). - -skip_32_list_dns_records_request(<<_:32, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_list_dns_records_request(Rest, Z1, Z2, F, TrUserData). - -skip_64_list_dns_records_request(<<_:64, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_list_dns_records_request(Rest, Z1, Z2, F, TrUserData). - -decode_msg_list_dns_records_response(Bin, TrUserData) -> dfp_read_field_def_list_dns_records_response(Bin, 0, 0, 0, id([], TrUserData), TrUserData). - -dfp_read_field_def_list_dns_records_response(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_dns_records_response_dns_records(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_list_dns_records_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{dns_records => lists_reverse(R1, TrUserData)} - end; -dfp_read_field_def_list_dns_records_response(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_dns_records_response(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_list_dns_records_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_dns_records_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_list_dns_records_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_dns_records_response_dns_records(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_dns_records_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_list_dns_records_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_list_dns_records_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_list_dns_records_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_list_dns_records_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_list_dns_records_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{dns_records => lists_reverse(R1, TrUserData)} - end. - -d_field_list_dns_records_response_dns_records(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_dns_records_response_dns_records(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_list_dns_records_response_dns_records(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_dns_record(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_list_dns_records_response(RestF, 0, 0, F, cons(NewFValue, Prev, TrUserData), TrUserData). - -skip_varint_list_dns_records_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_dns_records_response(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_list_dns_records_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_dns_records_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_list_dns_records_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_dns_records_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_list_dns_records_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_dns_records_response(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_list_dns_records_response(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_dns_records_response(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_list_dns_records_response(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_dns_records_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_list_dns_records_response(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_dns_records_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_put_dns_record_request(Bin, TrUserData) -> dfp_read_field_def_put_dns_record_request(Bin, 0, 0, 0, id('$undef', TrUserData), TrUserData). - -dfp_read_field_def_put_dns_record_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_put_dns_record_request_dns_record(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_put_dns_record_request(<<>>, 0, 0, _, F@_1, _) -> - S1 = #{}, - if F@_1 == '$undef' -> S1; - true -> S1#{dns_record => F@_1} - end; -dfp_read_field_def_put_dns_record_request(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_put_dns_record_request(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_put_dns_record_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_put_dns_record_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_put_dns_record_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_put_dns_record_request_dns_record(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_put_dns_record_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_put_dns_record_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_put_dns_record_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_put_dns_record_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_put_dns_record_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_put_dns_record_request(<<>>, 0, 0, _, F@_1, _) -> - S1 = #{}, - if F@_1 == '$undef' -> S1; - true -> S1#{dns_record => F@_1} - end. - -d_field_put_dns_record_request_dns_record(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_put_dns_record_request_dns_record(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_put_dns_record_request_dns_record(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_dns_record(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_put_dns_record_request(RestF, - 0, - 0, - F, - if Prev == '$undef' -> NewFValue; - true -> merge_msg_dns_record(Prev, NewFValue, TrUserData) - end, - TrUserData). - -skip_varint_put_dns_record_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_put_dns_record_request(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_put_dns_record_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_put_dns_record_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_put_dns_record_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_put_dns_record_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_put_dns_record_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_put_dns_record_request(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_put_dns_record_request(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_put_dns_record_request(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_put_dns_record_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_put_dns_record_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_put_dns_record_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_put_dns_record_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_empty(Bin, TrUserData) -> dfp_read_field_def_empty(Bin, 0, 0, 0, TrUserData). - -dfp_read_field_def_empty(<<>>, 0, 0, _, _) -> #{}; -dfp_read_field_def_empty(Other, Z1, Z2, F, TrUserData) -> dg_read_field_def_empty(Other, Z1, Z2, F, TrUserData). - -dg_read_field_def_empty(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 32 - 7 -> dg_read_field_def_empty(Rest, N + 7, X bsl N + Acc, F, TrUserData); -dg_read_field_def_empty(<<0:1, X:7, Rest/binary>>, N, Acc, _, TrUserData) -> - Key = X bsl N + Acc, - case Key band 7 of - 0 -> skip_varint_empty(Rest, 0, 0, Key bsr 3, TrUserData); - 1 -> skip_64_empty(Rest, 0, 0, Key bsr 3, TrUserData); - 2 -> skip_length_delimited_empty(Rest, 0, 0, Key bsr 3, TrUserData); - 3 -> skip_group_empty(Rest, 0, 0, Key bsr 3, TrUserData); - 5 -> skip_32_empty(Rest, 0, 0, Key bsr 3, TrUserData) - end; -dg_read_field_def_empty(<<>>, 0, 0, _, _) -> #{}. - -skip_varint_empty(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> skip_varint_empty(Rest, Z1, Z2, F, TrUserData); -skip_varint_empty(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_empty(Rest, Z1, Z2, F, TrUserData). - -skip_length_delimited_empty(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 57 -> skip_length_delimited_empty(Rest, N + 7, X bsl N + Acc, F, TrUserData); -skip_length_delimited_empty(<<0:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_empty(Rest2, 0, 0, F, TrUserData). - -skip_group_empty(Bin, _, Z2, FNum, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_empty(Rest, 0, Z2, FNum, TrUserData). - -skip_32_empty(<<_:32, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_empty(Rest, Z1, Z2, F, TrUserData). - -skip_64_empty(<<_:64, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_empty(Rest, Z1, Z2, F, TrUserData). - -read_group(Bin, FieldNum) -> - {NumBytes, EndTagLen} = read_gr_b(Bin, 0, 0, 0, 0, FieldNum), - <> = Bin, - {Group, Rest}. - -%% Like skipping over fields, but record the total length, -%% Each field is <(FieldNum bsl 3) bor FieldType> ++ -%% Record the length because varints may be non-optimally encoded. -%% -%% Groups can be nested, but assume the same FieldNum cannot be nested -%% because group field numbers are shared with the rest of the fields -%% numbers. Thus we can search just for an group-end with the same -%% field number. -%% -%% (The only time the same group field number could occur would -%% be in a nested sub message, but then it would be inside a -%% length-delimited entry, which we skip-read by length.) -read_gr_b(<<1:1, X:7, Tl/binary>>, N, Acc, NumBytes, TagLen, FieldNum) - when N < (32-7) -> - read_gr_b(Tl, N+7, X bsl N + Acc, NumBytes, TagLen+1, FieldNum); -read_gr_b(<<0:1, X:7, Tl/binary>>, N, Acc, NumBytes, TagLen, - FieldNum) -> - Key = X bsl N + Acc, - TagLen1 = TagLen + 1, - case {Key bsr 3, Key band 7} of - {FieldNum, 4} -> % 4 = group_end - {NumBytes, TagLen1}; - {_, 0} -> % 0 = varint - read_gr_vi(Tl, 0, NumBytes + TagLen1, FieldNum); - {_, 1} -> % 1 = bits64 - <<_:64, Tl2/binary>> = Tl, - read_gr_b(Tl2, 0, 0, NumBytes + TagLen1 + 8, 0, FieldNum); - {_, 2} -> % 2 = length_delimited - read_gr_ld(Tl, 0, 0, NumBytes + TagLen1, FieldNum); - {_, 3} -> % 3 = group_start - read_gr_b(Tl, 0, 0, NumBytes + TagLen1, 0, FieldNum); - {_, 4} -> % 4 = group_end - read_gr_b(Tl, 0, 0, NumBytes + TagLen1, 0, FieldNum); - {_, 5} -> % 5 = bits32 - <<_:32, Tl2/binary>> = Tl, - read_gr_b(Tl2, 0, 0, NumBytes + TagLen1 + 4, 0, FieldNum) - end. - -read_gr_vi(<<1:1, _:7, Tl/binary>>, N, NumBytes, FieldNum) - when N < (64-7) -> - read_gr_vi(Tl, N+7, NumBytes+1, FieldNum); -read_gr_vi(<<0:1, _:7, Tl/binary>>, _, NumBytes, FieldNum) -> - read_gr_b(Tl, 0, 0, NumBytes+1, 0, FieldNum). - -read_gr_ld(<<1:1, X:7, Tl/binary>>, N, Acc, NumBytes, FieldNum) - when N < (64-7) -> - read_gr_ld(Tl, N+7, X bsl N + Acc, NumBytes+1, FieldNum); -read_gr_ld(<<0:1, X:7, Tl/binary>>, N, Acc, NumBytes, FieldNum) -> - Len = X bsl N + Acc, - NumBytes1 = NumBytes + 1, - <<_:Len/binary, Tl2/binary>> = Tl, - read_gr_b(Tl2, 0, 0, NumBytes1 + Len, 0, FieldNum). - -merge_msgs(Prev, New, MsgName) when is_atom(MsgName) -> merge_msgs(Prev, New, MsgName, []). - -merge_msgs(Prev, New, MsgName, Opts) -> - TrUserData = proplists:get_value(user_data, Opts), - case MsgName of - dns_record_identifier -> merge_msg_dns_record_identifier(Prev, New, TrUserData); - dns_record -> merge_msg_dns_record(Prev, New, TrUserData); - list_dns_records_request -> merge_msg_list_dns_records_request(Prev, New, TrUserData); - list_dns_records_response -> merge_msg_list_dns_records_response(Prev, New, TrUserData); - put_dns_record_request -> merge_msg_put_dns_record_request(Prev, New, TrUserData); - empty -> merge_msg_empty(Prev, New, TrUserData) - end. - --compile({nowarn_unused_function,merge_msg_dns_record_identifier/3}). -merge_msg_dns_record_identifier(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{name := NFname}} -> S1#{name => NFname}; - {#{name := PFname}, _} -> S1#{name => PFname}; - _ -> S1 - end, - case {PMsg, NMsg} of - {_, #{type := NFtype}} -> S2#{type => NFtype}; - {#{type := PFtype}, _} -> S2#{type => PFtype}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_dns_record/3}). -merge_msg_dns_record(PMsg, NMsg, TrUserData) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{name := NFname}} -> S1#{name => NFname}; - {#{name := PFname}, _} -> S1#{name => PFname}; - _ -> S1 - end, - S3 = case {PMsg, NMsg} of - {_, #{type := NFtype}} -> S2#{type => NFtype}; - {#{type := PFtype}, _} -> S2#{type => PFtype}; - _ -> S2 - end, - S4 = case {PMsg, NMsg} of - {_, #{ttl := NFttl}} -> S3#{ttl => NFttl}; - {#{ttl := PFttl}, _} -> S3#{ttl => PFttl}; - _ -> S3 - end, - case {PMsg, NMsg} of - {#{records := PFrecords}, #{records := NFrecords}} -> S4#{records => 'erlang_++'(PFrecords, NFrecords, TrUserData)}; - {_, #{records := NFrecords}} -> S4#{records => NFrecords}; - {#{records := PFrecords}, _} -> S4#{records => PFrecords}; - {_, _} -> S4 - end. - --compile({nowarn_unused_function,merge_msg_list_dns_records_request/3}). -merge_msg_list_dns_records_request(_Prev, New, _TrUserData) -> New. - --compile({nowarn_unused_function,merge_msg_list_dns_records_response/3}). -merge_msg_list_dns_records_response(PMsg, NMsg, TrUserData) -> - S1 = #{}, - case {PMsg, NMsg} of - {#{dns_records := PFdns_records}, #{dns_records := NFdns_records}} -> S1#{dns_records => 'erlang_++'(PFdns_records, NFdns_records, TrUserData)}; - {_, #{dns_records := NFdns_records}} -> S1#{dns_records => NFdns_records}; - {#{dns_records := PFdns_records}, _} -> S1#{dns_records => PFdns_records}; - {_, _} -> S1 - end. - --compile({nowarn_unused_function,merge_msg_put_dns_record_request/3}). -merge_msg_put_dns_record_request(PMsg, NMsg, TrUserData) -> - S1 = #{}, - case {PMsg, NMsg} of - {#{dns_record := PFdns_record}, #{dns_record := NFdns_record}} -> S1#{dns_record => merge_msg_dns_record(PFdns_record, NFdns_record, TrUserData)}; - {_, #{dns_record := NFdns_record}} -> S1#{dns_record => NFdns_record}; - {#{dns_record := PFdns_record}, _} -> S1#{dns_record => PFdns_record}; - {_, _} -> S1 - end. - --compile({nowarn_unused_function,merge_msg_empty/3}). -merge_msg_empty(_Prev, New, _TrUserData) -> New. - - -verify_msg(Msg, MsgName) when is_atom(MsgName) -> verify_msg(Msg, MsgName, []). - -verify_msg(Msg, MsgName, Opts) -> - TrUserData = proplists:get_value(user_data, Opts), - case MsgName of - dns_record_identifier -> v_msg_dns_record_identifier(Msg, [MsgName], TrUserData); - dns_record -> v_msg_dns_record(Msg, [MsgName], TrUserData); - list_dns_records_request -> v_msg_list_dns_records_request(Msg, [MsgName], TrUserData); - list_dns_records_response -> v_msg_list_dns_records_response(Msg, [MsgName], TrUserData); - put_dns_record_request -> v_msg_put_dns_record_request(Msg, [MsgName], TrUserData); - empty -> v_msg_empty(Msg, [MsgName], TrUserData); - _ -> mk_type_error(not_a_known_message, Msg, []) - end. - - --compile({nowarn_unused_function,v_msg_dns_record_identifier/3}). --dialyzer({nowarn_function,v_msg_dns_record_identifier/3}). -v_msg_dns_record_identifier(#{} = M, Path, TrUserData) -> - case M of - #{name := F1} -> v_type_string(F1, [name | Path], TrUserData); - _ -> ok - end, - case M of - #{type := F2} -> v_type_string(F2, [type | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (name) -> ok; - (type) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_dns_record_identifier(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), dns_record_identifier}, M, Path); -v_msg_dns_record_identifier(X, Path, _TrUserData) -> mk_type_error({expected_msg, dns_record_identifier}, X, Path). - --compile({nowarn_unused_function,v_msg_dns_record/3}). --dialyzer({nowarn_function,v_msg_dns_record/3}). -v_msg_dns_record(#{} = M, Path, TrUserData) -> - case M of - #{name := F1} -> v_type_string(F1, [name | Path], TrUserData); - _ -> ok - end, - case M of - #{type := F2} -> v_type_string(F2, [type | Path], TrUserData); - _ -> ok - end, - case M of - #{ttl := F3} -> v_type_uint64(F3, [ttl | Path], TrUserData); - _ -> ok - end, - case M of - #{records := F4} -> - if is_list(F4) -> - _ = [v_type_string(Elem, [records | Path], TrUserData) || Elem <- F4], - ok; - true -> mk_type_error({invalid_list_of, string}, F4, [records | Path]) - end; - _ -> ok - end, - lists:foreach(fun (name) -> ok; - (type) -> ok; - (ttl) -> ok; - (records) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_dns_record(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), dns_record}, M, Path); -v_msg_dns_record(X, Path, _TrUserData) -> mk_type_error({expected_msg, dns_record}, X, Path). - --compile({nowarn_unused_function,v_msg_list_dns_records_request/3}). --dialyzer({nowarn_function,v_msg_list_dns_records_request/3}). -v_msg_list_dns_records_request(#{} = M, Path, _) -> - lists:foreach(fun (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) end, maps:keys(M)), - ok; -v_msg_list_dns_records_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_dns_records_request}, M, Path); -v_msg_list_dns_records_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_dns_records_request}, X, Path). - --compile({nowarn_unused_function,v_msg_list_dns_records_response/3}). --dialyzer({nowarn_function,v_msg_list_dns_records_response/3}). -v_msg_list_dns_records_response(#{} = M, Path, TrUserData) -> - case M of - #{dns_records := F1} -> - if is_list(F1) -> - _ = [v_msg_dns_record(Elem, [dns_records | Path], TrUserData) || Elem <- F1], - ok; - true -> mk_type_error({invalid_list_of, {msg, dns_record}}, F1, [dns_records | Path]) - end; - _ -> ok - end, - lists:foreach(fun (dns_records) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_dns_records_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_dns_records_response}, M, Path); -v_msg_list_dns_records_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_dns_records_response}, X, Path). - --compile({nowarn_unused_function,v_msg_put_dns_record_request/3}). --dialyzer({nowarn_function,v_msg_put_dns_record_request/3}). -v_msg_put_dns_record_request(#{} = M, Path, TrUserData) -> - case M of - #{dns_record := F1} -> v_msg_dns_record(F1, [dns_record | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (dns_record) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_put_dns_record_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), put_dns_record_request}, M, Path); -v_msg_put_dns_record_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, put_dns_record_request}, X, Path). - --compile({nowarn_unused_function,v_msg_empty/3}). --dialyzer({nowarn_function,v_msg_empty/3}). -v_msg_empty(#{} = M, Path, _) -> - lists:foreach(fun (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) end, maps:keys(M)), - ok; -v_msg_empty(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), empty}, M, Path); -v_msg_empty(X, Path, _TrUserData) -> mk_type_error({expected_msg, empty}, X, Path). - --compile({nowarn_unused_function,v_type_uint64/3}). --dialyzer({nowarn_function,v_type_uint64/3}). -v_type_uint64(N, _Path, _TrUserData) when 0 =< N, N =< 18446744073709551615 -> ok; -v_type_uint64(N, Path, _TrUserData) when is_integer(N) -> mk_type_error({value_out_of_range, uint64, unsigned, 64}, N, Path); -v_type_uint64(X, Path, _TrUserData) -> mk_type_error({bad_integer, uint64, unsigned, 64}, X, Path). - --compile({nowarn_unused_function,v_type_string/3}). --dialyzer({nowarn_function,v_type_string/3}). -v_type_string(S, Path, _TrUserData) when is_list(S); is_binary(S) -> - try unicode:characters_to_binary(S) of - B when is_binary(B) -> ok; - {error, _, _} -> mk_type_error(bad_unicode_string, S, Path) - catch - error:badarg -> mk_type_error(bad_unicode_string, S, Path) - end; -v_type_string(X, Path, _TrUserData) -> mk_type_error(bad_unicode_string, X, Path). - --compile({nowarn_unused_function,mk_type_error/3}). --spec mk_type_error(_, _, list()) -> no_return(). -mk_type_error(Error, ValueSeen, Path) -> - Path2 = prettify_path(Path), - erlang:error({gpb_type_error, {Error, [{value, ValueSeen}, {path, Path2}]}}). - - --compile({nowarn_unused_function,prettify_path/1}). --dialyzer({nowarn_function,prettify_path/1}). -prettify_path([]) -> top_level; -prettify_path(PathR) -> lists:append(lists:join(".", lists:map(fun atom_to_list/1, lists:reverse(PathR)))). - - --compile({nowarn_unused_function,id/2}). --compile({inline,id/2}). -id(X, _TrUserData) -> X. - --compile({nowarn_unused_function,v_ok/3}). --compile({inline,v_ok/3}). -v_ok(_Value, _Path, _TrUserData) -> ok. - --compile({nowarn_unused_function,m_overwrite/3}). --compile({inline,m_overwrite/3}). -m_overwrite(_Prev, New, _TrUserData) -> New. - --compile({nowarn_unused_function,cons/3}). --compile({inline,cons/3}). -cons(Elem, Acc, _TrUserData) -> [Elem | Acc]. - --compile({nowarn_unused_function,lists_reverse/2}). --compile({inline,lists_reverse/2}). -'lists_reverse'(L, _TrUserData) -> lists:reverse(L). --compile({nowarn_unused_function,'erlang_++'/3}). --compile({inline,'erlang_++'/3}). -'erlang_++'(A, B, _TrUserData) -> A ++ B. - - -get_msg_defs() -> - [{{msg, dns_record_identifier}, [#{name => name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => type, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, dns_record}, - [#{name => name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => type, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => ttl, fnum => 3, rnum => 4, type => uint64, occurrence => optional, opts => []}, - #{name => records, fnum => 4, rnum => 5, type => string, occurrence => repeated, opts => []}]}, - {{msg, list_dns_records_request}, []}, - {{msg, list_dns_records_response}, [#{name => dns_records, fnum => 1, rnum => 2, type => {msg, dns_record}, occurrence => repeated, opts => []}]}, - {{msg, put_dns_record_request}, [#{name => dns_record, fnum => 1, rnum => 2, type => {msg, dns_record}, occurrence => optional, opts => []}]}, - {{msg, empty}, []}]. - - -get_msg_names() -> [dns_record_identifier, dns_record, list_dns_records_request, list_dns_records_response, put_dns_record_request, empty]. - - -get_group_names() -> []. - - -get_msg_or_group_names() -> [dns_record_identifier, dns_record, list_dns_records_request, list_dns_records_response, put_dns_record_request, empty]. - - -get_enum_names() -> []. - - -fetch_msg_def(MsgName) -> - case find_msg_def(MsgName) of - Fs when is_list(Fs) -> Fs; - error -> erlang:error({no_such_msg, MsgName}) - end. - - --spec fetch_enum_def(_) -> no_return(). -fetch_enum_def(EnumName) -> erlang:error({no_such_enum, EnumName}). - - -find_msg_def(dns_record_identifier) -> [#{name => name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => type, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(dns_record) -> - [#{name => name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => type, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => ttl, fnum => 3, rnum => 4, type => uint64, occurrence => optional, opts => []}, - #{name => records, fnum => 4, rnum => 5, type => string, occurrence => repeated, opts => []}]; -find_msg_def(list_dns_records_request) -> []; -find_msg_def(list_dns_records_response) -> [#{name => dns_records, fnum => 1, rnum => 2, type => {msg, dns_record}, occurrence => repeated, opts => []}]; -find_msg_def(put_dns_record_request) -> [#{name => dns_record, fnum => 1, rnum => 2, type => {msg, dns_record}, occurrence => optional, opts => []}]; -find_msg_def(empty) -> []; -find_msg_def(_) -> error. - - -find_enum_def(_) -> error. - - --spec enum_symbol_by_value(_, _) -> no_return(). -enum_symbol_by_value(E, V) -> erlang:error({no_enum_defs, E, V}). - - --spec enum_value_by_symbol(_, _) -> no_return(). -enum_value_by_symbol(E, V) -> erlang:error({no_enum_defs, E, V}). - - - -get_service_names() -> ['DNS']. - - -get_service_def('DNS') -> - {{service, 'DNS'}, - [#{name => 'GetDNSRecord', input => dns_record_identifier, output => dns_record, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListDNSRecords', input => list_dns_records_request, output => list_dns_records_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'PutDNSRecord', input => put_dns_record_request, output => dns_record, input_stream => false, output_stream => false, opts => []}, - #{name => 'DeleteDNSRecord', input => dns_record_identifier, output => empty, input_stream => false, output_stream => false, opts => []}]}; -get_service_def(_) -> error. - - -get_rpc_names('DNS') -> ['GetDNSRecord', 'ListDNSRecords', 'PutDNSRecord', 'DeleteDNSRecord']; -get_rpc_names(_) -> error. - - -find_rpc_def('DNS', RpcName) -> find_rpc_def_DNS(RpcName); -find_rpc_def(_, _) -> error. - - -find_rpc_def_DNS('GetDNSRecord') -> #{name => 'GetDNSRecord', input => dns_record_identifier, output => dns_record, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DNS('ListDNSRecords') -> #{name => 'ListDNSRecords', input => list_dns_records_request, output => list_dns_records_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DNS('PutDNSRecord') -> #{name => 'PutDNSRecord', input => put_dns_record_request, output => dns_record, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DNS('DeleteDNSRecord') -> #{name => 'DeleteDNSRecord', input => dns_record_identifier, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DNS(_) -> error. - - -fetch_rpc_def(ServiceName, RpcName) -> - case find_rpc_def(ServiceName, RpcName) of - Def when is_map(Def) -> Def; - error -> erlang:error({no_such_rpc, ServiceName, RpcName}) - end. - - -%% Convert a a fully qualified (ie with package name) service name -%% as a binary to a service name as an atom. -fqbin_to_service_name(<<"DNS">>) -> 'DNS'; -fqbin_to_service_name(X) -> error({gpb_error, {badservice, X}}). - - -%% Convert a service name as an atom to a fully qualified -%% (ie with package name) name as a binary. -service_name_to_fqbin('DNS') -> <<"DNS">>; -service_name_to_fqbin(X) -> error({gpb_error, {badservice, X}}). - - -%% Convert a a fully qualified (ie with package name) service name -%% and an rpc name, both as binaries to a service name and an rpc -%% name, as atoms. -fqbins_to_service_and_rpc_name(<<"DNS">>, <<"GetDNSRecord">>) -> {'DNS', 'GetDNSRecord'}; -fqbins_to_service_and_rpc_name(<<"DNS">>, <<"ListDNSRecords">>) -> {'DNS', 'ListDNSRecords'}; -fqbins_to_service_and_rpc_name(<<"DNS">>, <<"PutDNSRecord">>) -> {'DNS', 'PutDNSRecord'}; -fqbins_to_service_and_rpc_name(<<"DNS">>, <<"DeleteDNSRecord">>) -> {'DNS', 'DeleteDNSRecord'}; -fqbins_to_service_and_rpc_name(S, R) -> error({gpb_error, {badservice_or_rpc, {S, R}}}). - - -%% Convert a service name and an rpc name, both as atoms, -%% to a fully qualified (ie with package name) service name and -%% an rpc name as binaries. -service_and_rpc_name_to_fqbins('DNS', 'GetDNSRecord') -> {<<"DNS">>, <<"GetDNSRecord">>}; -service_and_rpc_name_to_fqbins('DNS', 'ListDNSRecords') -> {<<"DNS">>, <<"ListDNSRecords">>}; -service_and_rpc_name_to_fqbins('DNS', 'PutDNSRecord') -> {<<"DNS">>, <<"PutDNSRecord">>}; -service_and_rpc_name_to_fqbins('DNS', 'DeleteDNSRecord') -> {<<"DNS">>, <<"DeleteDNSRecord">>}; -service_and_rpc_name_to_fqbins(S, R) -> error({gpb_error, {badservice_or_rpc, {S, R}}}). - - -fqbin_to_msg_name(<<"DNSRecordIdentifier">>) -> dns_record_identifier; -fqbin_to_msg_name(<<"DNSRecord">>) -> dns_record; -fqbin_to_msg_name(<<"ListDNSRecordsRequest">>) -> list_dns_records_request; -fqbin_to_msg_name(<<"ListDNSRecordsResponse">>) -> list_dns_records_response; -fqbin_to_msg_name(<<"PutDNSRecordRequest">>) -> put_dns_record_request; -fqbin_to_msg_name(<<"google.protobuf.Empty">>) -> empty; -fqbin_to_msg_name(E) -> error({gpb_error, {badmsg, E}}). - - -msg_name_to_fqbin(dns_record_identifier) -> <<"DNSRecordIdentifier">>; -msg_name_to_fqbin(dns_record) -> <<"DNSRecord">>; -msg_name_to_fqbin(list_dns_records_request) -> <<"ListDNSRecordsRequest">>; -msg_name_to_fqbin(list_dns_records_response) -> <<"ListDNSRecordsResponse">>; -msg_name_to_fqbin(put_dns_record_request) -> <<"PutDNSRecordRequest">>; -msg_name_to_fqbin(empty) -> <<"google.protobuf.Empty">>; -msg_name_to_fqbin(E) -> error({gpb_error, {badmsg, E}}). - - --spec fqbin_to_enum_name(_) -> no_return(). -fqbin_to_enum_name(E) -> error({gpb_error, {badenum, E}}). - - --spec enum_name_to_fqbin(_) -> no_return(). -enum_name_to_fqbin(E) -> error({gpb_error, {badenum, E}}). - - -get_package_name() -> 'google.protobuf'. - - -%% Whether or not the message names -%% are prepended with package name or not. -uses_packages() -> true. - - -source_basename() -> "dns.proto". - - -%% Retrieve all proto file names, also imported ones. -%% The order is top-down. The first element is always the main -%% source file. The files are returned with extension, -%% see get_all_proto_names/0 for a version that returns -%% the basenames sans extension -get_all_source_basenames() -> ["dns.proto", "empty.proto"]. - - -%% Retrieve all proto file names, also imported ones. -%% The order is top-down. The first element is always the main -%% source file. The files are returned sans .proto extension, -%% to make it easier to use them with the various get_xyz_containment -%% functions. -get_all_proto_names() -> ["dns", "empty"]. - - -get_msg_containment("dns") -> [dns_record, dns_record_identifier, list_dns_records_request, list_dns_records_response, put_dns_record_request]; -get_msg_containment("empty") -> [empty]; -get_msg_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_pkg_containment("dns") -> undefined; -get_pkg_containment("empty") -> 'google.protobuf'; -get_pkg_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_service_containment("dns") -> ['DNS']; -get_service_containment("empty") -> []; -get_service_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_rpc_containment("dns") -> [{'DNS', 'GetDNSRecord'}, {'DNS', 'ListDNSRecords'}, {'DNS', 'PutDNSRecord'}, {'DNS', 'DeleteDNSRecord'}]; -get_rpc_containment("empty") -> []; -get_rpc_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_enum_containment("dns") -> []; -get_enum_containment("empty") -> []; -get_enum_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_proto_by_msg_name_as_fqbin(<<"DNSRecordIdentifier">>) -> "dns"; -get_proto_by_msg_name_as_fqbin(<<"PutDNSRecordRequest">>) -> "dns"; -get_proto_by_msg_name_as_fqbin(<<"ListDNSRecordsRequest">>) -> "dns"; -get_proto_by_msg_name_as_fqbin(<<"DNSRecord">>) -> "dns"; -get_proto_by_msg_name_as_fqbin(<<"ListDNSRecordsResponse">>) -> "dns"; -get_proto_by_msg_name_as_fqbin(<<"google.protobuf.Empty">>) -> "empty"; -get_proto_by_msg_name_as_fqbin(E) -> error({gpb_error, {badmsg, E}}). - - -get_proto_by_service_name_as_fqbin(<<"DNS">>) -> "dns"; -get_proto_by_service_name_as_fqbin(E) -> error({gpb_error, {badservice, E}}). - - --spec get_proto_by_enum_name_as_fqbin(_) -> no_return(). -get_proto_by_enum_name_as_fqbin(E) -> error({gpb_error, {badenum, E}}). - - -get_protos_by_pkg_name_as_fqbin(<<"google.protobuf">>) -> ["empty"]; -get_protos_by_pkg_name_as_fqbin(E) -> error({gpb_error, {badpkg, E}}). - - - -gpb_version_as_string() -> - "4.19.8". - -gpb_version_as_list() -> - [4,19,8]. - -gpb_version_source() -> - "file". diff --git a/virtuerl/src/pb/domain_pb.erl b/virtuerl/src/pb/domain_pb.erl deleted file mode 100644 index 70aab16..0000000 --- a/virtuerl/src/pb/domain_pb.erl +++ /dev/null @@ -1,3401 +0,0 @@ -%% -*- coding: utf-8 -*- -%% @private -%% Automatically generated, do not edit -%% Generated by gpb_compile version 4.19.8 -%% Version source: file --module(domain_pb). - --export([encode_msg/2, encode_msg/3]). --export([decode_msg/2, decode_msg/3]). --export([merge_msgs/3, merge_msgs/4]). --export([verify_msg/2, verify_msg/3]). --export([get_msg_defs/0]). --export([get_msg_names/0]). --export([get_group_names/0]). --export([get_msg_or_group_names/0]). --export([get_enum_names/0]). --export([find_msg_def/1, fetch_msg_def/1]). --export([find_enum_def/1, fetch_enum_def/1]). --export([enum_symbol_by_value/2, enum_value_by_symbol/2]). --export([get_service_names/0]). --export([get_service_def/1]). --export([get_rpc_names/1]). --export([find_rpc_def/2, fetch_rpc_def/2]). --export([fqbin_to_service_name/1]). --export([service_name_to_fqbin/1]). --export([fqbins_to_service_and_rpc_name/2]). --export([service_and_rpc_name_to_fqbins/2]). --export([fqbin_to_msg_name/1]). --export([msg_name_to_fqbin/1]). --export([fqbin_to_enum_name/1]). --export([enum_name_to_fqbin/1]). --export([get_package_name/0]). --export([uses_packages/0]). --export([source_basename/0]). --export([get_all_source_basenames/0]). --export([get_all_proto_names/0]). --export([get_msg_containment/1]). --export([get_pkg_containment/1]). --export([get_service_containment/1]). --export([get_rpc_containment/1]). --export([get_enum_containment/1]). --export([get_proto_by_msg_name_as_fqbin/1]). --export([get_proto_by_service_name_as_fqbin/1]). --export([get_proto_by_enum_name_as_fqbin/1]). --export([get_protos_by_pkg_name_as_fqbin/1]). --export([gpb_version_as_string/0, gpb_version_as_list/0]). --export([gpb_version_source/0]). - - -%% enumerated types - --export_type([]). - -%% message types --type start_domain_request() :: - #{host => unicode:chardata(), % = 1, optional - uuid => unicode:chardata() % = 2, optional - }. - --type stop_domain_request() :: - #{host => unicode:chardata(), % = 1, optional - uuid => unicode:chardata(), % = 2, optional - force => boolean() | 0 | 1 % = 3, optional - }. - --type get_domain_request() :: - #{uuid => unicode:chardata(), % = 1, optional - host => unicode:chardata() % = 2, optional - }. - --type domain() :: - #{id => non_neg_integer(), % = 1, optional, 64 bits - uuid => unicode:chardata(), % = 2, optional - name => unicode:chardata(), % = 3, optional - vcpu => non_neg_integer(), % = 4, optional, 32 bits - memory => non_neg_integer(), % = 5, optional, 64 bits - network => unicode:chardata(), % = 6, optional - bridge => unicode:chardata(), % = 7, optional - state => unicode:chardata(), % = 8, optional - private_ip => unicode:chardata(), % = 9, optional - ipv6_address => unicode:chardata(), % = 15, optional - user_data => unicode:chardata(), % = 10, optional - nested_virtualization => boolean() | 0 | 1, % = 11, optional - base_image => unicode:chardata(), % = 12, optional - created_at => timestamp(), % = 13, optional - os_type => unicode:chardata() % = 14, optional - }. - --type list_domains_request() :: - #{host => unicode:chardata() % = 1, optional - }. - --type list_domains_response() :: - #{domains => [domain()] % = 1, repeated - }. - --type create_domain_request() :: - #{domain => domain(), % = 1, optional - host => unicode:chardata() % = 2, optional - }. - --type delete_domain_request() :: - #{uuid => unicode:chardata(), % = 1, optional - host => unicode:chardata() % = 2, optional - }. - --type download_image_request() :: - #{domain_id => unicode:chardata(), % = 1, optional - host => unicode:chardata() % = 2, optional - }. - --type image_chunk() :: - #{bytes => iodata() % = 1, optional - }. - --type get_network_request() :: - #{uuid => unicode:chardata(), % = 1, optional - host => unicode:chardata() % = 2, optional - }. - --type network() :: - #{uuid => unicode:chardata(), % = 1, optional - name => unicode:chardata(), % = 2, optional - cidr => unicode:chardata(), % = 3, optional - cidr6 => unicode:chardata() % = 4, optional - }. - --type list_networks_request() :: - #{host => unicode:chardata() % = 1, optional - }. - --type list_networks_response() :: - #{networks => [network()] % = 1, repeated - }. - --type create_network_request() :: - #{network => network(), % = 1, optional - host => unicode:chardata() % = 2, optional - }. - --type delete_network_request() :: - #{uuid => unicode:chardata(), % = 1, optional - host => unicode:chardata() % = 2, optional - }. - --type empty() :: - #{ - }. - --type timestamp() :: - #{seconds => integer(), % = 1, optional, 64 bits - nanos => integer() % = 2, optional, 32 bits - }. - --export_type(['start_domain_request'/0, 'stop_domain_request'/0, 'get_domain_request'/0, 'domain'/0, 'list_domains_request'/0, 'list_domains_response'/0, 'create_domain_request'/0, 'delete_domain_request'/0, 'download_image_request'/0, 'image_chunk'/0, 'get_network_request'/0, 'network'/0, 'list_networks_request'/0, 'list_networks_response'/0, 'create_network_request'/0, 'delete_network_request'/0, 'empty'/0, 'timestamp'/0]). --type '$msg_name'() :: start_domain_request | stop_domain_request | get_domain_request | domain | list_domains_request | list_domains_response | create_domain_request | delete_domain_request | download_image_request | image_chunk | get_network_request | network | list_networks_request | list_networks_response | create_network_request | delete_network_request | empty | timestamp. --type '$msg'() :: start_domain_request() | stop_domain_request() | get_domain_request() | domain() | list_domains_request() | list_domains_response() | create_domain_request() | delete_domain_request() | download_image_request() | image_chunk() | get_network_request() | network() | list_networks_request() | list_networks_response() | create_network_request() | delete_network_request() | empty() | timestamp(). --export_type(['$msg_name'/0, '$msg'/0]). - --if(?OTP_RELEASE >= 24). --dialyzer({no_underspecs, encode_msg/2}). --endif. --spec encode_msg('$msg'(), '$msg_name'()) -> binary(). -encode_msg(Msg, MsgName) when is_atom(MsgName) -> encode_msg(Msg, MsgName, []). - --if(?OTP_RELEASE >= 24). --dialyzer({no_underspecs, encode_msg/3}). --endif. --spec encode_msg('$msg'(), '$msg_name'(), list()) -> binary(). -encode_msg(Msg, MsgName, Opts) -> - case proplists:get_bool(verify, Opts) of - true -> verify_msg(Msg, MsgName, Opts); - false -> ok - end, - TrUserData = proplists:get_value(user_data, Opts), - case MsgName of - start_domain_request -> encode_msg_start_domain_request(id(Msg, TrUserData), TrUserData); - stop_domain_request -> encode_msg_stop_domain_request(id(Msg, TrUserData), TrUserData); - get_domain_request -> encode_msg_get_domain_request(id(Msg, TrUserData), TrUserData); - domain -> encode_msg_domain(id(Msg, TrUserData), TrUserData); - list_domains_request -> encode_msg_list_domains_request(id(Msg, TrUserData), TrUserData); - list_domains_response -> encode_msg_list_domains_response(id(Msg, TrUserData), TrUserData); - create_domain_request -> encode_msg_create_domain_request(id(Msg, TrUserData), TrUserData); - delete_domain_request -> encode_msg_delete_domain_request(id(Msg, TrUserData), TrUserData); - download_image_request -> encode_msg_download_image_request(id(Msg, TrUserData), TrUserData); - image_chunk -> encode_msg_image_chunk(id(Msg, TrUserData), TrUserData); - get_network_request -> encode_msg_get_network_request(id(Msg, TrUserData), TrUserData); - network -> encode_msg_network(id(Msg, TrUserData), TrUserData); - list_networks_request -> encode_msg_list_networks_request(id(Msg, TrUserData), TrUserData); - list_networks_response -> encode_msg_list_networks_response(id(Msg, TrUserData), TrUserData); - create_network_request -> encode_msg_create_network_request(id(Msg, TrUserData), TrUserData); - delete_network_request -> encode_msg_delete_network_request(id(Msg, TrUserData), TrUserData); - empty -> encode_msg_empty(id(Msg, TrUserData), TrUserData); - timestamp -> encode_msg_timestamp(id(Msg, TrUserData), TrUserData) - end. - - -encode_msg_start_domain_request(Msg, TrUserData) -> encode_msg_start_domain_request(Msg, <<>>, TrUserData). - - -encode_msg_start_domain_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{host := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{uuid := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_stop_domain_request(Msg, TrUserData) -> encode_msg_stop_domain_request(Msg, <<>>, TrUserData). - - -encode_msg_stop_domain_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{host := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - B2 = case M of - #{uuid := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end, - case M of - #{force := F3} -> - begin - TrF3 = id(F3, TrUserData), - if TrF3 =:= false -> B2; - true -> e_type_bool(TrF3, <>, TrUserData) - end - end; - _ -> B2 - end. - -encode_msg_get_domain_request(Msg, TrUserData) -> encode_msg_get_domain_request(Msg, <<>>, TrUserData). - - -encode_msg_get_domain_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{uuid := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{host := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_domain(Msg, TrUserData) -> encode_msg_domain(Msg, <<>>, TrUserData). - - -encode_msg_domain(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{id := F1} -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= 0 -> Bin; - true -> e_varint(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - B2 = case M of - #{uuid := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end, - B3 = case M of - #{name := F3} -> - begin - TrF3 = id(F3, TrUserData), - case is_empty_string(TrF3) of - true -> B2; - false -> e_type_string(TrF3, <>, TrUserData) - end - end; - _ -> B2 - end, - B4 = case M of - #{vcpu := F4} -> - begin - TrF4 = id(F4, TrUserData), - if TrF4 =:= 0 -> B3; - true -> e_varint(TrF4, <>, TrUserData) - end - end; - _ -> B3 - end, - B5 = case M of - #{memory := F5} -> - begin - TrF5 = id(F5, TrUserData), - if TrF5 =:= 0 -> B4; - true -> e_varint(TrF5, <>, TrUserData) - end - end; - _ -> B4 - end, - B6 = case M of - #{network := F6} -> - begin - TrF6 = id(F6, TrUserData), - case is_empty_string(TrF6) of - true -> B5; - false -> e_type_string(TrF6, <>, TrUserData) - end - end; - _ -> B5 - end, - B7 = case M of - #{bridge := F7} -> - begin - TrF7 = id(F7, TrUserData), - case is_empty_string(TrF7) of - true -> B6; - false -> e_type_string(TrF7, <>, TrUserData) - end - end; - _ -> B6 - end, - B8 = case M of - #{state := F8} -> - begin - TrF8 = id(F8, TrUserData), - case is_empty_string(TrF8) of - true -> B7; - false -> e_type_string(TrF8, <>, TrUserData) - end - end; - _ -> B7 - end, - B9 = case M of - #{private_ip := F9} -> - begin - TrF9 = id(F9, TrUserData), - case is_empty_string(TrF9) of - true -> B8; - false -> e_type_string(TrF9, <>, TrUserData) - end - end; - _ -> B8 - end, - B10 = case M of - #{ipv6_address := F10} -> - begin - TrF10 = id(F10, TrUserData), - case is_empty_string(TrF10) of - true -> B9; - false -> e_type_string(TrF10, <>, TrUserData) - end - end; - _ -> B9 - end, - B11 = case M of - #{user_data := F11} -> - begin - TrF11 = id(F11, TrUserData), - case is_empty_string(TrF11) of - true -> B10; - false -> e_type_string(TrF11, <>, TrUserData) - end - end; - _ -> B10 - end, - B12 = case M of - #{nested_virtualization := F12} -> - begin - TrF12 = id(F12, TrUserData), - if TrF12 =:= false -> B11; - true -> e_type_bool(TrF12, <>, TrUserData) - end - end; - _ -> B11 - end, - B13 = case M of - #{base_image := F13} -> - begin - TrF13 = id(F13, TrUserData), - case is_empty_string(TrF13) of - true -> B12; - false -> e_type_string(TrF13, <>, TrUserData) - end - end; - _ -> B12 - end, - B14 = case M of - #{created_at := F14} -> - begin - TrF14 = id(F14, TrUserData), - if TrF14 =:= undefined -> B13; - true -> e_mfield_domain_created_at(TrF14, <>, TrUserData) - end - end; - _ -> B13 - end, - case M of - #{os_type := F15} -> - begin - TrF15 = id(F15, TrUserData), - case is_empty_string(TrF15) of - true -> B14; - false -> e_type_string(TrF15, <>, TrUserData) - end - end; - _ -> B14 - end. - -encode_msg_list_domains_request(Msg, TrUserData) -> encode_msg_list_domains_request(Msg, <<>>, TrUserData). - - -encode_msg_list_domains_request(#{} = M, Bin, TrUserData) -> - case M of - #{host := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end. - -encode_msg_list_domains_response(Msg, TrUserData) -> encode_msg_list_domains_response(Msg, <<>>, TrUserData). - - -encode_msg_list_domains_response(#{} = M, Bin, TrUserData) -> - case M of - #{domains := F1} -> - TrF1 = id(F1, TrUserData), - if TrF1 == [] -> Bin; - true -> e_field_list_domains_response_domains(TrF1, Bin, TrUserData) - end; - _ -> Bin - end. - -encode_msg_create_domain_request(Msg, TrUserData) -> encode_msg_create_domain_request(Msg, <<>>, TrUserData). - - -encode_msg_create_domain_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{domain := F1} -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= undefined -> Bin; - true -> e_mfield_create_domain_request_domain(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{host := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_delete_domain_request(Msg, TrUserData) -> encode_msg_delete_domain_request(Msg, <<>>, TrUserData). - - -encode_msg_delete_domain_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{uuid := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{host := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_download_image_request(Msg, TrUserData) -> encode_msg_download_image_request(Msg, <<>>, TrUserData). - - -encode_msg_download_image_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{domain_id := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{host := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_image_chunk(Msg, TrUserData) -> encode_msg_image_chunk(Msg, <<>>, TrUserData). - - -encode_msg_image_chunk(#{} = M, Bin, TrUserData) -> - case M of - #{bytes := F1} -> - begin - TrF1 = id(F1, TrUserData), - case iolist_size(TrF1) of - 0 -> Bin; - _ -> e_type_bytes(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end. - -encode_msg_get_network_request(Msg, TrUserData) -> encode_msg_get_network_request(Msg, <<>>, TrUserData). - - -encode_msg_get_network_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{uuid := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{host := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_network(Msg, TrUserData) -> encode_msg_network(Msg, <<>>, TrUserData). - - -encode_msg_network(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{uuid := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - B2 = case M of - #{name := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end, - B3 = case M of - #{cidr := F3} -> - begin - TrF3 = id(F3, TrUserData), - case is_empty_string(TrF3) of - true -> B2; - false -> e_type_string(TrF3, <>, TrUserData) - end - end; - _ -> B2 - end, - case M of - #{cidr6 := F4} -> - begin - TrF4 = id(F4, TrUserData), - case is_empty_string(TrF4) of - true -> B3; - false -> e_type_string(TrF4, <>, TrUserData) - end - end; - _ -> B3 - end. - -encode_msg_list_networks_request(Msg, TrUserData) -> encode_msg_list_networks_request(Msg, <<>>, TrUserData). - - -encode_msg_list_networks_request(#{} = M, Bin, TrUserData) -> - case M of - #{host := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end. - -encode_msg_list_networks_response(Msg, TrUserData) -> encode_msg_list_networks_response(Msg, <<>>, TrUserData). - - -encode_msg_list_networks_response(#{} = M, Bin, TrUserData) -> - case M of - #{networks := F1} -> - TrF1 = id(F1, TrUserData), - if TrF1 == [] -> Bin; - true -> e_field_list_networks_response_networks(TrF1, Bin, TrUserData) - end; - _ -> Bin - end. - -encode_msg_create_network_request(Msg, TrUserData) -> encode_msg_create_network_request(Msg, <<>>, TrUserData). - - -encode_msg_create_network_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{network := F1} -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= undefined -> Bin; - true -> e_mfield_create_network_request_network(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{host := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_delete_network_request(Msg, TrUserData) -> encode_msg_delete_network_request(Msg, <<>>, TrUserData). - - -encode_msg_delete_network_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{uuid := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{host := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_empty(_Msg, _TrUserData) -> <<>>. - -encode_msg_timestamp(Msg, TrUserData) -> encode_msg_timestamp(Msg, <<>>, TrUserData). - - -encode_msg_timestamp(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{seconds := F1} -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= 0 -> Bin; - true -> e_type_int64(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{nanos := F2} -> - begin - TrF2 = id(F2, TrUserData), - if TrF2 =:= 0 -> B1; - true -> e_type_int32(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -e_mfield_domain_created_at(Msg, Bin, TrUserData) -> - SubBin = encode_msg_timestamp(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_mfield_list_domains_response_domains(Msg, Bin, TrUserData) -> - SubBin = encode_msg_domain(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_field_list_domains_response_domains([Elem | Rest], Bin, TrUserData) -> - Bin2 = <>, - Bin3 = e_mfield_list_domains_response_domains(id(Elem, TrUserData), Bin2, TrUserData), - e_field_list_domains_response_domains(Rest, Bin3, TrUserData); -e_field_list_domains_response_domains([], Bin, _TrUserData) -> Bin. - -e_mfield_create_domain_request_domain(Msg, Bin, TrUserData) -> - SubBin = encode_msg_domain(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_mfield_list_networks_response_networks(Msg, Bin, TrUserData) -> - SubBin = encode_msg_network(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_field_list_networks_response_networks([Elem | Rest], Bin, TrUserData) -> - Bin2 = <>, - Bin3 = e_mfield_list_networks_response_networks(id(Elem, TrUserData), Bin2, TrUserData), - e_field_list_networks_response_networks(Rest, Bin3, TrUserData); -e_field_list_networks_response_networks([], Bin, _TrUserData) -> Bin. - -e_mfield_create_network_request_network(Msg, Bin, TrUserData) -> - SubBin = encode_msg_network(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - --compile({nowarn_unused_function,e_type_sint/3}). -e_type_sint(Value, Bin, _TrUserData) when Value >= 0 -> e_varint(Value * 2, Bin); -e_type_sint(Value, Bin, _TrUserData) -> e_varint(Value * -2 - 1, Bin). - --compile({nowarn_unused_function,e_type_int32/3}). -e_type_int32(Value, Bin, _TrUserData) when 0 =< Value, Value =< 127 -> <>; -e_type_int32(Value, Bin, _TrUserData) -> - <> = <>, - e_varint(N, Bin). - --compile({nowarn_unused_function,e_type_int64/3}). -e_type_int64(Value, Bin, _TrUserData) when 0 =< Value, Value =< 127 -> <>; -e_type_int64(Value, Bin, _TrUserData) -> - <> = <>, - e_varint(N, Bin). - --compile({nowarn_unused_function,e_type_bool/3}). -e_type_bool(true, Bin, _TrUserData) -> <>; -e_type_bool(false, Bin, _TrUserData) -> <>; -e_type_bool(1, Bin, _TrUserData) -> <>; -e_type_bool(0, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_string/3}). -e_type_string(S, Bin, _TrUserData) -> - Utf8 = unicode:characters_to_binary(S), - Bin2 = e_varint(byte_size(Utf8), Bin), - <>. - --compile({nowarn_unused_function,e_type_bytes/3}). -e_type_bytes(Bytes, Bin, _TrUserData) when is_binary(Bytes) -> - Bin2 = e_varint(byte_size(Bytes), Bin), - <>; -e_type_bytes(Bytes, Bin, _TrUserData) when is_list(Bytes) -> - BytesBin = iolist_to_binary(Bytes), - Bin2 = e_varint(byte_size(BytesBin), Bin), - <>. - --compile({nowarn_unused_function,e_type_fixed32/3}). -e_type_fixed32(Value, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_sfixed32/3}). -e_type_sfixed32(Value, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_fixed64/3}). -e_type_fixed64(Value, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_sfixed64/3}). -e_type_sfixed64(Value, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_float/3}). -e_type_float(V, Bin, _) when is_number(V) -> <>; -e_type_float(infinity, Bin, _) -> <>; -e_type_float('-infinity', Bin, _) -> <>; -e_type_float(nan, Bin, _) -> <>. - --compile({nowarn_unused_function,e_type_double/3}). -e_type_double(V, Bin, _) when is_number(V) -> <>; -e_type_double(infinity, Bin, _) -> <>; -e_type_double('-infinity', Bin, _) -> <>; -e_type_double(nan, Bin, _) -> <>. - --compile({nowarn_unused_function,e_unknown_elems/2}). -e_unknown_elems([Elem | Rest], Bin) -> - BinR = case Elem of - {varint, FNum, N} -> - BinF = e_varint(FNum bsl 3, Bin), - e_varint(N, BinF); - {length_delimited, FNum, Data} -> - BinF = e_varint(FNum bsl 3 bor 2, Bin), - BinL = e_varint(byte_size(Data), BinF), - <>; - {group, FNum, GroupFields} -> - Bin1 = e_varint(FNum bsl 3 bor 3, Bin), - Bin2 = e_unknown_elems(GroupFields, Bin1), - e_varint(FNum bsl 3 bor 4, Bin2); - {fixed32, FNum, V} -> - BinF = e_varint(FNum bsl 3 bor 5, Bin), - <>; - {fixed64, FNum, V} -> - BinF = e_varint(FNum bsl 3 bor 1, Bin), - <> - end, - e_unknown_elems(Rest, BinR); -e_unknown_elems([], Bin) -> Bin. - --compile({nowarn_unused_function,e_varint/3}). -e_varint(N, Bin, _TrUserData) -> e_varint(N, Bin). - --compile({nowarn_unused_function,e_varint/2}). -e_varint(N, Bin) when N =< 127 -> <>; -e_varint(N, Bin) -> - Bin2 = <>, - e_varint(N bsr 7, Bin2). - -is_empty_string("") -> true; -is_empty_string(<<>>) -> true; -is_empty_string(L) when is_list(L) -> not string_has_chars(L); -is_empty_string(B) when is_binary(B) -> false. - -string_has_chars([C | _]) when is_integer(C) -> true; -string_has_chars([H | T]) -> - case string_has_chars(H) of - true -> true; - false -> string_has_chars(T) - end; -string_has_chars(B) when is_binary(B), byte_size(B) =/= 0 -> true; -string_has_chars(C) when is_integer(C) -> true; -string_has_chars(<<>>) -> false; -string_has_chars([]) -> false. - - -decode_msg(Bin, MsgName) when is_binary(Bin) -> decode_msg(Bin, MsgName, []). - -decode_msg(Bin, MsgName, Opts) when is_binary(Bin) -> - TrUserData = proplists:get_value(user_data, Opts), - decode_msg_1_catch(Bin, MsgName, TrUserData). - --ifdef('OTP_RELEASE'). -decode_msg_1_catch(Bin, MsgName, TrUserData) -> - try decode_msg_2_doit(MsgName, Bin, TrUserData) - catch - error:{gpb_error,_}=Reason:StackTrace -> - erlang:raise(error, Reason, StackTrace); - Class:Reason:StackTrace -> error({gpb_error,{decoding_failure, {Bin, MsgName, {Class, Reason, StackTrace}}}}) - end. --else. -decode_msg_1_catch(Bin, MsgName, TrUserData) -> - try decode_msg_2_doit(MsgName, Bin, TrUserData) - catch - error:{gpb_error,_}=Reason -> - erlang:raise(error, Reason, - erlang:get_stacktrace()); - Class:Reason -> - StackTrace = erlang:get_stacktrace(), - error({gpb_error,{decoding_failure, {Bin, MsgName, {Class, Reason, StackTrace}}}}) - end. --endif. - -decode_msg_2_doit(start_domain_request, Bin, TrUserData) -> id(decode_msg_start_domain_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(stop_domain_request, Bin, TrUserData) -> id(decode_msg_stop_domain_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(get_domain_request, Bin, TrUserData) -> id(decode_msg_get_domain_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(domain, Bin, TrUserData) -> id(decode_msg_domain(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_domains_request, Bin, TrUserData) -> id(decode_msg_list_domains_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_domains_response, Bin, TrUserData) -> id(decode_msg_list_domains_response(Bin, TrUserData), TrUserData); -decode_msg_2_doit(create_domain_request, Bin, TrUserData) -> id(decode_msg_create_domain_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(delete_domain_request, Bin, TrUserData) -> id(decode_msg_delete_domain_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(download_image_request, Bin, TrUserData) -> id(decode_msg_download_image_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(image_chunk, Bin, TrUserData) -> id(decode_msg_image_chunk(Bin, TrUserData), TrUserData); -decode_msg_2_doit(get_network_request, Bin, TrUserData) -> id(decode_msg_get_network_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(network, Bin, TrUserData) -> id(decode_msg_network(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_networks_request, Bin, TrUserData) -> id(decode_msg_list_networks_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_networks_response, Bin, TrUserData) -> id(decode_msg_list_networks_response(Bin, TrUserData), TrUserData); -decode_msg_2_doit(create_network_request, Bin, TrUserData) -> id(decode_msg_create_network_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(delete_network_request, Bin, TrUserData) -> id(decode_msg_delete_network_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(empty, Bin, TrUserData) -> id(decode_msg_empty(Bin, TrUserData), TrUserData); -decode_msg_2_doit(timestamp, Bin, TrUserData) -> id(decode_msg_timestamp(Bin, TrUserData), TrUserData). - - - -decode_msg_start_domain_request(Bin, TrUserData) -> dfp_read_field_def_start_domain_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_start_domain_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_start_domain_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_start_domain_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_start_domain_request_uuid(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_start_domain_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{host => F@_1, uuid => F@_2}; -dfp_read_field_def_start_domain_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_start_domain_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_start_domain_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_start_domain_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_start_domain_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_start_domain_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_start_domain_request_uuid(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_start_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_start_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_start_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_start_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_start_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_start_domain_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{host => F@_1, uuid => F@_2}. - -d_field_start_domain_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_start_domain_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_start_domain_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_start_domain_request(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_start_domain_request_uuid(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_start_domain_request_uuid(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_start_domain_request_uuid(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_start_domain_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_start_domain_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_start_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_start_domain_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_start_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_start_domain_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_start_domain_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_start_domain_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_start_domain_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_start_domain_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_start_domain_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_start_domain_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_start_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_start_domain_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_start_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_stop_domain_request(Bin, TrUserData) -> dfp_read_field_def_stop_domain_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), id(false, TrUserData), TrUserData). - -dfp_read_field_def_stop_domain_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_stop_domain_request_host(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_stop_domain_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_stop_domain_request_uuid(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_stop_domain_request(<<24, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_stop_domain_request_force(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_stop_domain_request(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{host => F@_1, uuid => F@_2, force => F@_3}; -dfp_read_field_def_stop_domain_request(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dg_read_field_def_stop_domain_request(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -dg_read_field_def_stop_domain_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 32 - 7 -> dg_read_field_def_stop_domain_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -dg_read_field_def_stop_domain_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_stop_domain_request_host(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 18 -> d_field_stop_domain_request_uuid(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 24 -> d_field_stop_domain_request_force(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_stop_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 1 -> skip_64_stop_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 2 -> skip_length_delimited_stop_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 3 -> skip_group_stop_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 5 -> skip_32_stop_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData) - end - end; -dg_read_field_def_stop_domain_request(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{host => F@_1, uuid => F@_2, force => F@_3}. - -d_field_stop_domain_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_stop_domain_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_stop_domain_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_stop_domain_request(RestF, 0, 0, F, NewFValue, F@_2, F@_3, TrUserData). - -d_field_stop_domain_request_uuid(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_stop_domain_request_uuid(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_stop_domain_request_uuid(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_stop_domain_request(RestF, 0, 0, F, F@_1, NewFValue, F@_3, TrUserData). - -d_field_stop_domain_request_force(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_stop_domain_request_force(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_stop_domain_request_force(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, TrUserData) -> - {NewFValue, RestF} = {id(X bsl N + Acc =/= 0, TrUserData), Rest}, - dfp_read_field_def_stop_domain_request(RestF, 0, 0, F, F@_1, F@_2, NewFValue, TrUserData). - -skip_varint_stop_domain_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> skip_varint_stop_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -skip_varint_stop_domain_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_stop_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_length_delimited_stop_domain_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> skip_length_delimited_stop_domain_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -skip_length_delimited_stop_domain_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_stop_domain_request(Rest2, 0, 0, F, F@_1, F@_2, F@_3, TrUserData). - -skip_group_stop_domain_request(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_stop_domain_request(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, TrUserData). - -skip_32_stop_domain_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_stop_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_64_stop_domain_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_stop_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -decode_msg_get_domain_request(Bin, TrUserData) -> dfp_read_field_def_get_domain_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_get_domain_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_get_domain_request_uuid(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_get_domain_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_get_domain_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_get_domain_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{uuid => F@_1, host => F@_2}; -dfp_read_field_def_get_domain_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_get_domain_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_get_domain_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_get_domain_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_get_domain_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_get_domain_request_uuid(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_get_domain_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_get_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_get_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_get_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_get_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_get_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_get_domain_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{uuid => F@_1, host => F@_2}. - -d_field_get_domain_request_uuid(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_get_domain_request_uuid(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_get_domain_request_uuid(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_get_domain_request(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_get_domain_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_get_domain_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_get_domain_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_get_domain_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_get_domain_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_get_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_get_domain_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_get_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_get_domain_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_get_domain_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_get_domain_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_get_domain_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_get_domain_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_get_domain_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_get_domain_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_get_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_get_domain_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_get_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_domain(Bin, TrUserData) -> - dfp_read_field_def_domain(Bin, - 0, - 0, - 0, - id(0, TrUserData), - id(<<>>, TrUserData), - id(<<>>, TrUserData), - id(0, TrUserData), - id(0, TrUserData), - id(<<>>, TrUserData), - id(<<>>, TrUserData), - id(<<>>, TrUserData), - id(<<>>, TrUserData), - id(<<>>, TrUserData), - id(<<>>, TrUserData), - id(false, TrUserData), - id(<<>>, TrUserData), - id('$undef', TrUserData), - id(<<>>, TrUserData), - TrUserData). - -dfp_read_field_def_domain(<<8, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_id(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_uuid(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<26, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_name(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_vcpu(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<40, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_memory(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<50, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_network(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<58, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_bridge(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<66, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_state(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<74, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_private_ip(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<122, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_ipv6_address(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<82, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_user_data(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<88, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_nested_virtualization(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<98, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_base_image(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<106, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_created_at(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<114, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - d_field_domain_os_type(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dfp_read_field_def_domain(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, _) -> - S1 = #{id => F@_1, uuid => F@_2, name => F@_3, vcpu => F@_4, memory => F@_5, network => F@_6, bridge => F@_7, state => F@_8, private_ip => F@_9, ipv6_address => F@_10, user_data => F@_11, nested_virtualization => F@_12, base_image => F@_13, - os_type => F@_15}, - if F@_14 == '$undef' -> S1; - true -> S1#{created_at => F@_14} - end; -dfp_read_field_def_domain(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - dg_read_field_def_domain(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -dg_read_field_def_domain(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 32 - 7 -> - dg_read_field_def_domain(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -dg_read_field_def_domain(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 8 -> d_field_domain_id(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 18 -> d_field_domain_uuid(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 26 -> d_field_domain_name(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 32 -> d_field_domain_vcpu(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 40 -> d_field_domain_memory(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 50 -> d_field_domain_network(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 58 -> d_field_domain_bridge(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 66 -> d_field_domain_state(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 74 -> d_field_domain_private_ip(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 122 -> d_field_domain_ipv6_address(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 82 -> d_field_domain_user_data(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 88 -> d_field_domain_nested_virtualization(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 98 -> d_field_domain_base_image(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 106 -> d_field_domain_created_at(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 114 -> d_field_domain_os_type(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_domain(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 1 -> skip_64_domain(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 2 -> skip_length_delimited_domain(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 3 -> skip_group_domain(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); - 5 -> skip_32_domain(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) - end - end; -dg_read_field_def_domain(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, _) -> - S1 = #{id => F@_1, uuid => F@_2, name => F@_3, vcpu => F@_4, memory => F@_5, network => F@_6, bridge => F@_7, state => F@_8, private_ip => F@_9, ipv6_address => F@_10, user_data => F@_11, nested_virtualization => F@_12, base_image => F@_13, - os_type => F@_15}, - if F@_14 == '$undef' -> S1; - true -> S1#{created_at => F@_14} - end. - -d_field_domain_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - {NewFValue, RestF} = {id((X bsl N + Acc) band 18446744073709551615, TrUserData), Rest}, - dfp_read_field_def_domain(RestF, 0, 0, F, NewFValue, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -d_field_domain_uuid(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_uuid(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_uuid(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_domain(RestF, 0, 0, F, F@_1, NewFValue, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -d_field_domain_name(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_name(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_name(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_domain(RestF, 0, 0, F, F@_1, F@_2, NewFValue, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -d_field_domain_vcpu(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_vcpu(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_vcpu(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, _, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - {NewFValue, RestF} = {id((X bsl N + Acc) band 4294967295, TrUserData), Rest}, - dfp_read_field_def_domain(RestF, 0, 0, F, F@_1, F@_2, F@_3, NewFValue, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -d_field_domain_memory(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_memory(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_memory(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, _, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - {NewFValue, RestF} = {id((X bsl N + Acc) band 18446744073709551615, TrUserData), Rest}, - dfp_read_field_def_domain(RestF, 0, 0, F, F@_1, F@_2, F@_3, F@_4, NewFValue, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -d_field_domain_network(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_network(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_network(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, _, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_domain(RestF, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, NewFValue, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -d_field_domain_bridge(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_bridge(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_bridge(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, _, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_domain(RestF, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, NewFValue, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -d_field_domain_state(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_state(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_state(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, _, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_domain(RestF, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, NewFValue, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -d_field_domain_private_ip(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_private_ip(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_private_ip(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, _, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_domain(RestF, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, NewFValue, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -d_field_domain_ipv6_address(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_ipv6_address(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_ipv6_address(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, _, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_domain(RestF, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, NewFValue, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -d_field_domain_user_data(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_user_data(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_user_data(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, _, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_domain(RestF, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, NewFValue, F@_12, F@_13, F@_14, F@_15, TrUserData). - -d_field_domain_nested_virtualization(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_nested_virtualization(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_nested_virtualization(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, _, F@_13, F@_14, F@_15, TrUserData) -> - {NewFValue, RestF} = {id(X bsl N + Acc =/= 0, TrUserData), Rest}, - dfp_read_field_def_domain(RestF, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, NewFValue, F@_13, F@_14, F@_15, TrUserData). - -d_field_domain_base_image(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_base_image(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_base_image(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, _, F@_14, F@_15, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_domain(RestF, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, NewFValue, F@_14, F@_15, TrUserData). - -d_field_domain_created_at(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_created_at(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_created_at(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, Prev, F@_15, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_timestamp(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_domain(RestF, - 0, - 0, - F, - F@_1, - F@_2, - F@_3, - F@_4, - F@_5, - F@_6, - F@_7, - F@_8, - F@_9, - F@_10, - F@_11, - F@_12, - F@_13, - if Prev == '$undef' -> NewFValue; - true -> merge_msg_timestamp(Prev, NewFValue, TrUserData) - end, - F@_15, - TrUserData). - -d_field_domain_os_type(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - d_field_domain_os_type(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -d_field_domain_os_type(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_domain(RestF, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, NewFValue, TrUserData). - -skip_varint_domain(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - skip_varint_domain(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -skip_varint_domain(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - dfp_read_field_def_domain(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -skip_length_delimited_domain(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) when N < 57 -> - skip_length_delimited_domain(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData); -skip_length_delimited_domain(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_domain(Rest2, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -skip_group_domain(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_domain(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -skip_32_domain(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - dfp_read_field_def_domain(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -skip_64_domain(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData) -> - dfp_read_field_def_domain(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, F@_14, F@_15, TrUserData). - -decode_msg_list_domains_request(Bin, TrUserData) -> dfp_read_field_def_list_domains_request(Bin, 0, 0, 0, id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_list_domains_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_domains_request_host(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_list_domains_request(<<>>, 0, 0, _, F@_1, _) -> #{host => F@_1}; -dfp_read_field_def_list_domains_request(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_domains_request(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_list_domains_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_domains_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_list_domains_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_domains_request_host(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_domains_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_list_domains_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_list_domains_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_list_domains_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_list_domains_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_list_domains_request(<<>>, 0, 0, _, F@_1, _) -> #{host => F@_1}. - -d_field_list_domains_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_domains_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_list_domains_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_list_domains_request(RestF, 0, 0, F, NewFValue, TrUserData). - -skip_varint_list_domains_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_domains_request(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_list_domains_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_domains_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_list_domains_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_domains_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_list_domains_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_domains_request(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_list_domains_request(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_domains_request(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_list_domains_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_domains_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_list_domains_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_domains_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_list_domains_response(Bin, TrUserData) -> dfp_read_field_def_list_domains_response(Bin, 0, 0, 0, id([], TrUserData), TrUserData). - -dfp_read_field_def_list_domains_response(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_domains_response_domains(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_list_domains_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{domains => lists_reverse(R1, TrUserData)} - end; -dfp_read_field_def_list_domains_response(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_domains_response(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_list_domains_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_domains_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_list_domains_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_domains_response_domains(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_domains_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_list_domains_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_list_domains_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_list_domains_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_list_domains_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_list_domains_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{domains => lists_reverse(R1, TrUserData)} - end. - -d_field_list_domains_response_domains(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_domains_response_domains(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_list_domains_response_domains(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_domain(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_list_domains_response(RestF, 0, 0, F, cons(NewFValue, Prev, TrUserData), TrUserData). - -skip_varint_list_domains_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_domains_response(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_list_domains_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_domains_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_list_domains_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_domains_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_list_domains_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_domains_response(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_list_domains_response(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_domains_response(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_list_domains_response(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_domains_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_list_domains_response(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_domains_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_create_domain_request(Bin, TrUserData) -> dfp_read_field_def_create_domain_request(Bin, 0, 0, 0, id('$undef', TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_create_domain_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_create_domain_request_domain(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_create_domain_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_create_domain_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_create_domain_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> - S1 = #{host => F@_2}, - if F@_1 == '$undef' -> S1; - true -> S1#{domain => F@_1} - end; -dfp_read_field_def_create_domain_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_create_domain_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_create_domain_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_create_domain_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_create_domain_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_create_domain_request_domain(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_create_domain_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_create_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_create_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_create_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_create_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_create_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_create_domain_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> - S1 = #{host => F@_2}, - if F@_1 == '$undef' -> S1; - true -> S1#{domain => F@_1} - end. - -d_field_create_domain_request_domain(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_create_domain_request_domain(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_create_domain_request_domain(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_domain(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_create_domain_request(RestF, - 0, - 0, - F, - if Prev == '$undef' -> NewFValue; - true -> merge_msg_domain(Prev, NewFValue, TrUserData) - end, - F@_2, - TrUserData). - -d_field_create_domain_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_create_domain_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_create_domain_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_create_domain_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_create_domain_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_create_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_create_domain_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_create_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_create_domain_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_create_domain_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_create_domain_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_create_domain_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_create_domain_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_create_domain_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_create_domain_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_create_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_create_domain_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_create_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_delete_domain_request(Bin, TrUserData) -> dfp_read_field_def_delete_domain_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_delete_domain_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_delete_domain_request_uuid(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_delete_domain_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_delete_domain_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_delete_domain_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{uuid => F@_1, host => F@_2}; -dfp_read_field_def_delete_domain_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_delete_domain_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_delete_domain_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_delete_domain_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_delete_domain_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_delete_domain_request_uuid(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_delete_domain_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_delete_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_delete_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_delete_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_delete_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_delete_domain_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_delete_domain_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{uuid => F@_1, host => F@_2}. - -d_field_delete_domain_request_uuid(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_delete_domain_request_uuid(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_delete_domain_request_uuid(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_delete_domain_request(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_delete_domain_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_delete_domain_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_delete_domain_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_delete_domain_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_delete_domain_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_delete_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_delete_domain_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_delete_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_delete_domain_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_delete_domain_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_delete_domain_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_delete_domain_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_delete_domain_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_delete_domain_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_delete_domain_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_delete_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_delete_domain_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_delete_domain_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_download_image_request(Bin, TrUserData) -> dfp_read_field_def_download_image_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_download_image_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_download_image_request_domain_id(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_download_image_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_download_image_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_download_image_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{domain_id => F@_1, host => F@_2}; -dfp_read_field_def_download_image_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_download_image_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_download_image_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_download_image_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_download_image_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_download_image_request_domain_id(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_download_image_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_download_image_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_download_image_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_download_image_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_download_image_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_download_image_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_download_image_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{domain_id => F@_1, host => F@_2}. - -d_field_download_image_request_domain_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_download_image_request_domain_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_download_image_request_domain_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_download_image_request(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_download_image_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_download_image_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_download_image_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_download_image_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_download_image_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_download_image_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_download_image_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_download_image_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_download_image_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_download_image_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_download_image_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_download_image_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_download_image_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_download_image_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_download_image_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_download_image_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_download_image_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_download_image_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_image_chunk(Bin, TrUserData) -> dfp_read_field_def_image_chunk(Bin, 0, 0, 0, id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_image_chunk(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_image_chunk_bytes(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_image_chunk(<<>>, 0, 0, _, F@_1, _) -> #{bytes => F@_1}; -dfp_read_field_def_image_chunk(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_image_chunk(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_image_chunk(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_image_chunk(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_image_chunk(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_image_chunk_bytes(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_image_chunk(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_image_chunk(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_image_chunk(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_image_chunk(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_image_chunk(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_image_chunk(<<>>, 0, 0, _, F@_1, _) -> #{bytes => F@_1}. - -d_field_image_chunk_bytes(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_image_chunk_bytes(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_image_chunk_bytes(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_image_chunk(RestF, 0, 0, F, NewFValue, TrUserData). - -skip_varint_image_chunk(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_image_chunk(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_image_chunk(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_image_chunk(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_image_chunk(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_image_chunk(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_image_chunk(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_image_chunk(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_image_chunk(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_image_chunk(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_image_chunk(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_image_chunk(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_image_chunk(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_image_chunk(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_get_network_request(Bin, TrUserData) -> dfp_read_field_def_get_network_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_get_network_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_get_network_request_uuid(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_get_network_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_get_network_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_get_network_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{uuid => F@_1, host => F@_2}; -dfp_read_field_def_get_network_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_get_network_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_get_network_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_get_network_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_get_network_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_get_network_request_uuid(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_get_network_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_get_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_get_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_get_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_get_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_get_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_get_network_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{uuid => F@_1, host => F@_2}. - -d_field_get_network_request_uuid(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_get_network_request_uuid(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_get_network_request_uuid(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_get_network_request(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_get_network_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_get_network_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_get_network_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_get_network_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_get_network_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_get_network_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_get_network_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_get_network_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_get_network_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_get_network_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_get_network_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_get_network_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_get_network_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_get_network_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_get_network_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_get_network_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_get_network_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_get_network_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_network(Bin, TrUserData) -> dfp_read_field_def_network(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_network(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_network_uuid(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dfp_read_field_def_network(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_network_name(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dfp_read_field_def_network(<<26, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_network_cidr(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dfp_read_field_def_network(<<34, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_network_cidr6(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dfp_read_field_def_network(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, _) -> #{uuid => F@_1, name => F@_2, cidr => F@_3, cidr6 => F@_4}; -dfp_read_field_def_network(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dg_read_field_def_network(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -dg_read_field_def_network(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 32 - 7 -> dg_read_field_def_network(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dg_read_field_def_network(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, F@_4, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_network_uuid(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); - 18 -> d_field_network_name(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); - 26 -> d_field_network_cidr(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); - 34 -> d_field_network_cidr6(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_network(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); - 1 -> skip_64_network(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); - 2 -> skip_length_delimited_network(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); - 3 -> skip_group_network(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); - 5 -> skip_32_network(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData) - end - end; -dg_read_field_def_network(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, _) -> #{uuid => F@_1, name => F@_2, cidr => F@_3, cidr6 => F@_4}. - -d_field_network_uuid(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_network_uuid(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -d_field_network_uuid(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, F@_4, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_network(RestF, 0, 0, F, NewFValue, F@_2, F@_3, F@_4, TrUserData). - -d_field_network_name(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_network_name(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -d_field_network_name(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, F@_4, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_network(RestF, 0, 0, F, F@_1, NewFValue, F@_3, F@_4, TrUserData). - -d_field_network_cidr(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_network_cidr(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -d_field_network_cidr(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, F@_4, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_network(RestF, 0, 0, F, F@_1, F@_2, NewFValue, F@_4, TrUserData). - -d_field_network_cidr6(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_network_cidr6(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -d_field_network_cidr6(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_network(RestF, 0, 0, F, F@_1, F@_2, F@_3, NewFValue, TrUserData). - -skip_varint_network(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> skip_varint_network(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -skip_varint_network(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dfp_read_field_def_network(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -skip_length_delimited_network(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> skip_length_delimited_network(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -skip_length_delimited_network(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_network(Rest2, 0, 0, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -skip_group_network(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, F@_4, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_network(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, F@_4, TrUserData). - -skip_32_network(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dfp_read_field_def_network(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -skip_64_network(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dfp_read_field_def_network(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -decode_msg_list_networks_request(Bin, TrUserData) -> dfp_read_field_def_list_networks_request(Bin, 0, 0, 0, id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_list_networks_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_networks_request_host(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_list_networks_request(<<>>, 0, 0, _, F@_1, _) -> #{host => F@_1}; -dfp_read_field_def_list_networks_request(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_networks_request(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_list_networks_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_networks_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_list_networks_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_networks_request_host(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_networks_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_list_networks_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_list_networks_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_list_networks_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_list_networks_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_list_networks_request(<<>>, 0, 0, _, F@_1, _) -> #{host => F@_1}. - -d_field_list_networks_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_networks_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_list_networks_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_list_networks_request(RestF, 0, 0, F, NewFValue, TrUserData). - -skip_varint_list_networks_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_networks_request(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_list_networks_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_networks_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_list_networks_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_networks_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_list_networks_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_networks_request(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_list_networks_request(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_networks_request(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_list_networks_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_networks_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_list_networks_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_networks_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_list_networks_response(Bin, TrUserData) -> dfp_read_field_def_list_networks_response(Bin, 0, 0, 0, id([], TrUserData), TrUserData). - -dfp_read_field_def_list_networks_response(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_networks_response_networks(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_list_networks_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{networks => lists_reverse(R1, TrUserData)} - end; -dfp_read_field_def_list_networks_response(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_networks_response(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_list_networks_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_networks_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_list_networks_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_networks_response_networks(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_networks_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_list_networks_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_list_networks_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_list_networks_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_list_networks_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_list_networks_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{networks => lists_reverse(R1, TrUserData)} - end. - -d_field_list_networks_response_networks(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_networks_response_networks(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_list_networks_response_networks(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_network(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_list_networks_response(RestF, 0, 0, F, cons(NewFValue, Prev, TrUserData), TrUserData). - -skip_varint_list_networks_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_networks_response(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_list_networks_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_networks_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_list_networks_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_networks_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_list_networks_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_networks_response(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_list_networks_response(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_networks_response(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_list_networks_response(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_networks_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_list_networks_response(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_networks_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_create_network_request(Bin, TrUserData) -> dfp_read_field_def_create_network_request(Bin, 0, 0, 0, id('$undef', TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_create_network_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_create_network_request_network(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_create_network_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_create_network_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_create_network_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> - S1 = #{host => F@_2}, - if F@_1 == '$undef' -> S1; - true -> S1#{network => F@_1} - end; -dfp_read_field_def_create_network_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_create_network_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_create_network_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_create_network_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_create_network_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_create_network_request_network(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_create_network_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_create_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_create_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_create_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_create_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_create_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_create_network_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> - S1 = #{host => F@_2}, - if F@_1 == '$undef' -> S1; - true -> S1#{network => F@_1} - end. - -d_field_create_network_request_network(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_create_network_request_network(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_create_network_request_network(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_network(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_create_network_request(RestF, - 0, - 0, - F, - if Prev == '$undef' -> NewFValue; - true -> merge_msg_network(Prev, NewFValue, TrUserData) - end, - F@_2, - TrUserData). - -d_field_create_network_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_create_network_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_create_network_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_create_network_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_create_network_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_create_network_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_create_network_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_create_network_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_create_network_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_create_network_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_create_network_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_create_network_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_create_network_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_create_network_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_create_network_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_create_network_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_create_network_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_create_network_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_delete_network_request(Bin, TrUserData) -> dfp_read_field_def_delete_network_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_delete_network_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_delete_network_request_uuid(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_delete_network_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_delete_network_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_delete_network_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{uuid => F@_1, host => F@_2}; -dfp_read_field_def_delete_network_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_delete_network_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_delete_network_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_delete_network_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_delete_network_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_delete_network_request_uuid(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_delete_network_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_delete_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_delete_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_delete_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_delete_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_delete_network_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_delete_network_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{uuid => F@_1, host => F@_2}. - -d_field_delete_network_request_uuid(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_delete_network_request_uuid(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_delete_network_request_uuid(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_delete_network_request(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_delete_network_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_delete_network_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_delete_network_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_delete_network_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_delete_network_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_delete_network_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_delete_network_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_delete_network_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_delete_network_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_delete_network_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_delete_network_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_delete_network_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_delete_network_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_delete_network_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_delete_network_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_delete_network_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_delete_network_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_delete_network_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_empty(Bin, TrUserData) -> dfp_read_field_def_empty(Bin, 0, 0, 0, TrUserData). - -dfp_read_field_def_empty(<<>>, 0, 0, _, _) -> #{}; -dfp_read_field_def_empty(Other, Z1, Z2, F, TrUserData) -> dg_read_field_def_empty(Other, Z1, Z2, F, TrUserData). - -dg_read_field_def_empty(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 32 - 7 -> dg_read_field_def_empty(Rest, N + 7, X bsl N + Acc, F, TrUserData); -dg_read_field_def_empty(<<0:1, X:7, Rest/binary>>, N, Acc, _, TrUserData) -> - Key = X bsl N + Acc, - case Key band 7 of - 0 -> skip_varint_empty(Rest, 0, 0, Key bsr 3, TrUserData); - 1 -> skip_64_empty(Rest, 0, 0, Key bsr 3, TrUserData); - 2 -> skip_length_delimited_empty(Rest, 0, 0, Key bsr 3, TrUserData); - 3 -> skip_group_empty(Rest, 0, 0, Key bsr 3, TrUserData); - 5 -> skip_32_empty(Rest, 0, 0, Key bsr 3, TrUserData) - end; -dg_read_field_def_empty(<<>>, 0, 0, _, _) -> #{}. - -skip_varint_empty(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> skip_varint_empty(Rest, Z1, Z2, F, TrUserData); -skip_varint_empty(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_empty(Rest, Z1, Z2, F, TrUserData). - -skip_length_delimited_empty(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 57 -> skip_length_delimited_empty(Rest, N + 7, X bsl N + Acc, F, TrUserData); -skip_length_delimited_empty(<<0:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_empty(Rest2, 0, 0, F, TrUserData). - -skip_group_empty(Bin, _, Z2, FNum, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_empty(Rest, 0, Z2, FNum, TrUserData). - -skip_32_empty(<<_:32, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_empty(Rest, Z1, Z2, F, TrUserData). - -skip_64_empty(<<_:64, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_empty(Rest, Z1, Z2, F, TrUserData). - -decode_msg_timestamp(Bin, TrUserData) -> dfp_read_field_def_timestamp(Bin, 0, 0, 0, id(0, TrUserData), id(0, TrUserData), TrUserData). - -dfp_read_field_def_timestamp(<<8, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_timestamp_seconds(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_timestamp(<<16, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_timestamp_nanos(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_timestamp(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{seconds => F@_1, nanos => F@_2}; -dfp_read_field_def_timestamp(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_timestamp(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_timestamp(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_timestamp(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_timestamp(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 8 -> d_field_timestamp_seconds(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 16 -> d_field_timestamp_nanos(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_timestamp(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_timestamp(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_timestamp(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_timestamp(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_timestamp(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_timestamp(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{seconds => F@_1, nanos => F@_2}. - -d_field_timestamp_seconds(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_timestamp_seconds(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_timestamp_seconds(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = {begin <> = <<(X bsl N + Acc):64/unsigned-native>>, id(Res, TrUserData) end, Rest}, - dfp_read_field_def_timestamp(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_timestamp_nanos(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_timestamp_nanos(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_timestamp_nanos(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = {begin <> = <<(X bsl N + Acc):32/unsigned-native>>, id(Res, TrUserData) end, Rest}, - dfp_read_field_def_timestamp(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_timestamp(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_timestamp(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_timestamp(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_timestamp(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_timestamp(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_timestamp(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_timestamp(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_timestamp(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_timestamp(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_timestamp(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_timestamp(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_timestamp(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_timestamp(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_timestamp(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -read_group(Bin, FieldNum) -> - {NumBytes, EndTagLen} = read_gr_b(Bin, 0, 0, 0, 0, FieldNum), - <> = Bin, - {Group, Rest}. - -%% Like skipping over fields, but record the total length, -%% Each field is <(FieldNum bsl 3) bor FieldType> ++ -%% Record the length because varints may be non-optimally encoded. -%% -%% Groups can be nested, but assume the same FieldNum cannot be nested -%% because group field numbers are shared with the rest of the fields -%% numbers. Thus we can search just for an group-end with the same -%% field number. -%% -%% (The only time the same group field number could occur would -%% be in a nested sub message, but then it would be inside a -%% length-delimited entry, which we skip-read by length.) -read_gr_b(<<1:1, X:7, Tl/binary>>, N, Acc, NumBytes, TagLen, FieldNum) - when N < (32-7) -> - read_gr_b(Tl, N+7, X bsl N + Acc, NumBytes, TagLen+1, FieldNum); -read_gr_b(<<0:1, X:7, Tl/binary>>, N, Acc, NumBytes, TagLen, - FieldNum) -> - Key = X bsl N + Acc, - TagLen1 = TagLen + 1, - case {Key bsr 3, Key band 7} of - {FieldNum, 4} -> % 4 = group_end - {NumBytes, TagLen1}; - {_, 0} -> % 0 = varint - read_gr_vi(Tl, 0, NumBytes + TagLen1, FieldNum); - {_, 1} -> % 1 = bits64 - <<_:64, Tl2/binary>> = Tl, - read_gr_b(Tl2, 0, 0, NumBytes + TagLen1 + 8, 0, FieldNum); - {_, 2} -> % 2 = length_delimited - read_gr_ld(Tl, 0, 0, NumBytes + TagLen1, FieldNum); - {_, 3} -> % 3 = group_start - read_gr_b(Tl, 0, 0, NumBytes + TagLen1, 0, FieldNum); - {_, 4} -> % 4 = group_end - read_gr_b(Tl, 0, 0, NumBytes + TagLen1, 0, FieldNum); - {_, 5} -> % 5 = bits32 - <<_:32, Tl2/binary>> = Tl, - read_gr_b(Tl2, 0, 0, NumBytes + TagLen1 + 4, 0, FieldNum) - end. - -read_gr_vi(<<1:1, _:7, Tl/binary>>, N, NumBytes, FieldNum) - when N < (64-7) -> - read_gr_vi(Tl, N+7, NumBytes+1, FieldNum); -read_gr_vi(<<0:1, _:7, Tl/binary>>, _, NumBytes, FieldNum) -> - read_gr_b(Tl, 0, 0, NumBytes+1, 0, FieldNum). - -read_gr_ld(<<1:1, X:7, Tl/binary>>, N, Acc, NumBytes, FieldNum) - when N < (64-7) -> - read_gr_ld(Tl, N+7, X bsl N + Acc, NumBytes+1, FieldNum); -read_gr_ld(<<0:1, X:7, Tl/binary>>, N, Acc, NumBytes, FieldNum) -> - Len = X bsl N + Acc, - NumBytes1 = NumBytes + 1, - <<_:Len/binary, Tl2/binary>> = Tl, - read_gr_b(Tl2, 0, 0, NumBytes1 + Len, 0, FieldNum). - -merge_msgs(Prev, New, MsgName) when is_atom(MsgName) -> merge_msgs(Prev, New, MsgName, []). - -merge_msgs(Prev, New, MsgName, Opts) -> - TrUserData = proplists:get_value(user_data, Opts), - case MsgName of - start_domain_request -> merge_msg_start_domain_request(Prev, New, TrUserData); - stop_domain_request -> merge_msg_stop_domain_request(Prev, New, TrUserData); - get_domain_request -> merge_msg_get_domain_request(Prev, New, TrUserData); - domain -> merge_msg_domain(Prev, New, TrUserData); - list_domains_request -> merge_msg_list_domains_request(Prev, New, TrUserData); - list_domains_response -> merge_msg_list_domains_response(Prev, New, TrUserData); - create_domain_request -> merge_msg_create_domain_request(Prev, New, TrUserData); - delete_domain_request -> merge_msg_delete_domain_request(Prev, New, TrUserData); - download_image_request -> merge_msg_download_image_request(Prev, New, TrUserData); - image_chunk -> merge_msg_image_chunk(Prev, New, TrUserData); - get_network_request -> merge_msg_get_network_request(Prev, New, TrUserData); - network -> merge_msg_network(Prev, New, TrUserData); - list_networks_request -> merge_msg_list_networks_request(Prev, New, TrUserData); - list_networks_response -> merge_msg_list_networks_response(Prev, New, TrUserData); - create_network_request -> merge_msg_create_network_request(Prev, New, TrUserData); - delete_network_request -> merge_msg_delete_network_request(Prev, New, TrUserData); - empty -> merge_msg_empty(Prev, New, TrUserData); - timestamp -> merge_msg_timestamp(Prev, New, TrUserData) - end. - --compile({nowarn_unused_function,merge_msg_start_domain_request/3}). -merge_msg_start_domain_request(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S1#{host => NFhost}; - {#{host := PFhost}, _} -> S1#{host => PFhost}; - _ -> S1 - end, - case {PMsg, NMsg} of - {_, #{uuid := NFuuid}} -> S2#{uuid => NFuuid}; - {#{uuid := PFuuid}, _} -> S2#{uuid => PFuuid}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_stop_domain_request/3}). -merge_msg_stop_domain_request(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S1#{host => NFhost}; - {#{host := PFhost}, _} -> S1#{host => PFhost}; - _ -> S1 - end, - S3 = case {PMsg, NMsg} of - {_, #{uuid := NFuuid}} -> S2#{uuid => NFuuid}; - {#{uuid := PFuuid}, _} -> S2#{uuid => PFuuid}; - _ -> S2 - end, - case {PMsg, NMsg} of - {_, #{force := NFforce}} -> S3#{force => NFforce}; - {#{force := PFforce}, _} -> S3#{force => PFforce}; - _ -> S3 - end. - --compile({nowarn_unused_function,merge_msg_get_domain_request/3}). -merge_msg_get_domain_request(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{uuid := NFuuid}} -> S1#{uuid => NFuuid}; - {#{uuid := PFuuid}, _} -> S1#{uuid => PFuuid}; - _ -> S1 - end, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S2#{host => NFhost}; - {#{host := PFhost}, _} -> S2#{host => PFhost}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_domain/3}). -merge_msg_domain(PMsg, NMsg, TrUserData) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{id := NFid}} -> S1#{id => NFid}; - {#{id := PFid}, _} -> S1#{id => PFid}; - _ -> S1 - end, - S3 = case {PMsg, NMsg} of - {_, #{uuid := NFuuid}} -> S2#{uuid => NFuuid}; - {#{uuid := PFuuid}, _} -> S2#{uuid => PFuuid}; - _ -> S2 - end, - S4 = case {PMsg, NMsg} of - {_, #{name := NFname}} -> S3#{name => NFname}; - {#{name := PFname}, _} -> S3#{name => PFname}; - _ -> S3 - end, - S5 = case {PMsg, NMsg} of - {_, #{vcpu := NFvcpu}} -> S4#{vcpu => NFvcpu}; - {#{vcpu := PFvcpu}, _} -> S4#{vcpu => PFvcpu}; - _ -> S4 - end, - S6 = case {PMsg, NMsg} of - {_, #{memory := NFmemory}} -> S5#{memory => NFmemory}; - {#{memory := PFmemory}, _} -> S5#{memory => PFmemory}; - _ -> S5 - end, - S7 = case {PMsg, NMsg} of - {_, #{network := NFnetwork}} -> S6#{network => NFnetwork}; - {#{network := PFnetwork}, _} -> S6#{network => PFnetwork}; - _ -> S6 - end, - S8 = case {PMsg, NMsg} of - {_, #{bridge := NFbridge}} -> S7#{bridge => NFbridge}; - {#{bridge := PFbridge}, _} -> S7#{bridge => PFbridge}; - _ -> S7 - end, - S9 = case {PMsg, NMsg} of - {_, #{state := NFstate}} -> S8#{state => NFstate}; - {#{state := PFstate}, _} -> S8#{state => PFstate}; - _ -> S8 - end, - S10 = case {PMsg, NMsg} of - {_, #{private_ip := NFprivate_ip}} -> S9#{private_ip => NFprivate_ip}; - {#{private_ip := PFprivate_ip}, _} -> S9#{private_ip => PFprivate_ip}; - _ -> S9 - end, - S11 = case {PMsg, NMsg} of - {_, #{ipv6_address := NFipv6_address}} -> S10#{ipv6_address => NFipv6_address}; - {#{ipv6_address := PFipv6_address}, _} -> S10#{ipv6_address => PFipv6_address}; - _ -> S10 - end, - S12 = case {PMsg, NMsg} of - {_, #{user_data := NFuser_data}} -> S11#{user_data => NFuser_data}; - {#{user_data := PFuser_data}, _} -> S11#{user_data => PFuser_data}; - _ -> S11 - end, - S13 = case {PMsg, NMsg} of - {_, #{nested_virtualization := NFnested_virtualization}} -> S12#{nested_virtualization => NFnested_virtualization}; - {#{nested_virtualization := PFnested_virtualization}, _} -> S12#{nested_virtualization => PFnested_virtualization}; - _ -> S12 - end, - S14 = case {PMsg, NMsg} of - {_, #{base_image := NFbase_image}} -> S13#{base_image => NFbase_image}; - {#{base_image := PFbase_image}, _} -> S13#{base_image => PFbase_image}; - _ -> S13 - end, - S15 = case {PMsg, NMsg} of - {#{created_at := PFcreated_at}, #{created_at := NFcreated_at}} -> S14#{created_at => merge_msg_timestamp(PFcreated_at, NFcreated_at, TrUserData)}; - {_, #{created_at := NFcreated_at}} -> S14#{created_at => NFcreated_at}; - {#{created_at := PFcreated_at}, _} -> S14#{created_at => PFcreated_at}; - {_, _} -> S14 - end, - case {PMsg, NMsg} of - {_, #{os_type := NFos_type}} -> S15#{os_type => NFos_type}; - {#{os_type := PFos_type}, _} -> S15#{os_type => PFos_type}; - _ -> S15 - end. - --compile({nowarn_unused_function,merge_msg_list_domains_request/3}). -merge_msg_list_domains_request(PMsg, NMsg, _) -> - S1 = #{}, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S1#{host => NFhost}; - {#{host := PFhost}, _} -> S1#{host => PFhost}; - _ -> S1 - end. - --compile({nowarn_unused_function,merge_msg_list_domains_response/3}). -merge_msg_list_domains_response(PMsg, NMsg, TrUserData) -> - S1 = #{}, - case {PMsg, NMsg} of - {#{domains := PFdomains}, #{domains := NFdomains}} -> S1#{domains => 'erlang_++'(PFdomains, NFdomains, TrUserData)}; - {_, #{domains := NFdomains}} -> S1#{domains => NFdomains}; - {#{domains := PFdomains}, _} -> S1#{domains => PFdomains}; - {_, _} -> S1 - end. - --compile({nowarn_unused_function,merge_msg_create_domain_request/3}). -merge_msg_create_domain_request(PMsg, NMsg, TrUserData) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {#{domain := PFdomain}, #{domain := NFdomain}} -> S1#{domain => merge_msg_domain(PFdomain, NFdomain, TrUserData)}; - {_, #{domain := NFdomain}} -> S1#{domain => NFdomain}; - {#{domain := PFdomain}, _} -> S1#{domain => PFdomain}; - {_, _} -> S1 - end, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S2#{host => NFhost}; - {#{host := PFhost}, _} -> S2#{host => PFhost}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_delete_domain_request/3}). -merge_msg_delete_domain_request(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{uuid := NFuuid}} -> S1#{uuid => NFuuid}; - {#{uuid := PFuuid}, _} -> S1#{uuid => PFuuid}; - _ -> S1 - end, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S2#{host => NFhost}; - {#{host := PFhost}, _} -> S2#{host => PFhost}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_download_image_request/3}). -merge_msg_download_image_request(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{domain_id := NFdomain_id}} -> S1#{domain_id => NFdomain_id}; - {#{domain_id := PFdomain_id}, _} -> S1#{domain_id => PFdomain_id}; - _ -> S1 - end, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S2#{host => NFhost}; - {#{host := PFhost}, _} -> S2#{host => PFhost}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_image_chunk/3}). -merge_msg_image_chunk(PMsg, NMsg, _) -> - S1 = #{}, - case {PMsg, NMsg} of - {_, #{bytes := NFbytes}} -> S1#{bytes => NFbytes}; - {#{bytes := PFbytes}, _} -> S1#{bytes => PFbytes}; - _ -> S1 - end. - --compile({nowarn_unused_function,merge_msg_get_network_request/3}). -merge_msg_get_network_request(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{uuid := NFuuid}} -> S1#{uuid => NFuuid}; - {#{uuid := PFuuid}, _} -> S1#{uuid => PFuuid}; - _ -> S1 - end, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S2#{host => NFhost}; - {#{host := PFhost}, _} -> S2#{host => PFhost}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_network/3}). -merge_msg_network(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{uuid := NFuuid}} -> S1#{uuid => NFuuid}; - {#{uuid := PFuuid}, _} -> S1#{uuid => PFuuid}; - _ -> S1 - end, - S3 = case {PMsg, NMsg} of - {_, #{name := NFname}} -> S2#{name => NFname}; - {#{name := PFname}, _} -> S2#{name => PFname}; - _ -> S2 - end, - S4 = case {PMsg, NMsg} of - {_, #{cidr := NFcidr}} -> S3#{cidr => NFcidr}; - {#{cidr := PFcidr}, _} -> S3#{cidr => PFcidr}; - _ -> S3 - end, - case {PMsg, NMsg} of - {_, #{cidr6 := NFcidr6}} -> S4#{cidr6 => NFcidr6}; - {#{cidr6 := PFcidr6}, _} -> S4#{cidr6 => PFcidr6}; - _ -> S4 - end. - --compile({nowarn_unused_function,merge_msg_list_networks_request/3}). -merge_msg_list_networks_request(PMsg, NMsg, _) -> - S1 = #{}, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S1#{host => NFhost}; - {#{host := PFhost}, _} -> S1#{host => PFhost}; - _ -> S1 - end. - --compile({nowarn_unused_function,merge_msg_list_networks_response/3}). -merge_msg_list_networks_response(PMsg, NMsg, TrUserData) -> - S1 = #{}, - case {PMsg, NMsg} of - {#{networks := PFnetworks}, #{networks := NFnetworks}} -> S1#{networks => 'erlang_++'(PFnetworks, NFnetworks, TrUserData)}; - {_, #{networks := NFnetworks}} -> S1#{networks => NFnetworks}; - {#{networks := PFnetworks}, _} -> S1#{networks => PFnetworks}; - {_, _} -> S1 - end. - --compile({nowarn_unused_function,merge_msg_create_network_request/3}). -merge_msg_create_network_request(PMsg, NMsg, TrUserData) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {#{network := PFnetwork}, #{network := NFnetwork}} -> S1#{network => merge_msg_network(PFnetwork, NFnetwork, TrUserData)}; - {_, #{network := NFnetwork}} -> S1#{network => NFnetwork}; - {#{network := PFnetwork}, _} -> S1#{network => PFnetwork}; - {_, _} -> S1 - end, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S2#{host => NFhost}; - {#{host := PFhost}, _} -> S2#{host => PFhost}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_delete_network_request/3}). -merge_msg_delete_network_request(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{uuid := NFuuid}} -> S1#{uuid => NFuuid}; - {#{uuid := PFuuid}, _} -> S1#{uuid => PFuuid}; - _ -> S1 - end, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S2#{host => NFhost}; - {#{host := PFhost}, _} -> S2#{host => PFhost}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_empty/3}). -merge_msg_empty(_Prev, New, _TrUserData) -> New. - --compile({nowarn_unused_function,merge_msg_timestamp/3}). -merge_msg_timestamp(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{seconds := NFseconds}} -> S1#{seconds => NFseconds}; - {#{seconds := PFseconds}, _} -> S1#{seconds => PFseconds}; - _ -> S1 - end, - case {PMsg, NMsg} of - {_, #{nanos := NFnanos}} -> S2#{nanos => NFnanos}; - {#{nanos := PFnanos}, _} -> S2#{nanos => PFnanos}; - _ -> S2 - end. - - -verify_msg(Msg, MsgName) when is_atom(MsgName) -> verify_msg(Msg, MsgName, []). - -verify_msg(Msg, MsgName, Opts) -> - TrUserData = proplists:get_value(user_data, Opts), - case MsgName of - start_domain_request -> v_msg_start_domain_request(Msg, [MsgName], TrUserData); - stop_domain_request -> v_msg_stop_domain_request(Msg, [MsgName], TrUserData); - get_domain_request -> v_msg_get_domain_request(Msg, [MsgName], TrUserData); - domain -> v_msg_domain(Msg, [MsgName], TrUserData); - list_domains_request -> v_msg_list_domains_request(Msg, [MsgName], TrUserData); - list_domains_response -> v_msg_list_domains_response(Msg, [MsgName], TrUserData); - create_domain_request -> v_msg_create_domain_request(Msg, [MsgName], TrUserData); - delete_domain_request -> v_msg_delete_domain_request(Msg, [MsgName], TrUserData); - download_image_request -> v_msg_download_image_request(Msg, [MsgName], TrUserData); - image_chunk -> v_msg_image_chunk(Msg, [MsgName], TrUserData); - get_network_request -> v_msg_get_network_request(Msg, [MsgName], TrUserData); - network -> v_msg_network(Msg, [MsgName], TrUserData); - list_networks_request -> v_msg_list_networks_request(Msg, [MsgName], TrUserData); - list_networks_response -> v_msg_list_networks_response(Msg, [MsgName], TrUserData); - create_network_request -> v_msg_create_network_request(Msg, [MsgName], TrUserData); - delete_network_request -> v_msg_delete_network_request(Msg, [MsgName], TrUserData); - empty -> v_msg_empty(Msg, [MsgName], TrUserData); - timestamp -> v_msg_timestamp(Msg, [MsgName], TrUserData); - _ -> mk_type_error(not_a_known_message, Msg, []) - end. - - --compile({nowarn_unused_function,v_msg_start_domain_request/3}). --dialyzer({nowarn_function,v_msg_start_domain_request/3}). -v_msg_start_domain_request(#{} = M, Path, TrUserData) -> - case M of - #{host := F1} -> v_type_string(F1, [host | Path], TrUserData); - _ -> ok - end, - case M of - #{uuid := F2} -> v_type_string(F2, [uuid | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (host) -> ok; - (uuid) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_start_domain_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), start_domain_request}, M, Path); -v_msg_start_domain_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, start_domain_request}, X, Path). - --compile({nowarn_unused_function,v_msg_stop_domain_request/3}). --dialyzer({nowarn_function,v_msg_stop_domain_request/3}). -v_msg_stop_domain_request(#{} = M, Path, TrUserData) -> - case M of - #{host := F1} -> v_type_string(F1, [host | Path], TrUserData); - _ -> ok - end, - case M of - #{uuid := F2} -> v_type_string(F2, [uuid | Path], TrUserData); - _ -> ok - end, - case M of - #{force := F3} -> v_type_bool(F3, [force | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (host) -> ok; - (uuid) -> ok; - (force) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_stop_domain_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), stop_domain_request}, M, Path); -v_msg_stop_domain_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, stop_domain_request}, X, Path). - --compile({nowarn_unused_function,v_msg_get_domain_request/3}). --dialyzer({nowarn_function,v_msg_get_domain_request/3}). -v_msg_get_domain_request(#{} = M, Path, TrUserData) -> - case M of - #{uuid := F1} -> v_type_string(F1, [uuid | Path], TrUserData); - _ -> ok - end, - case M of - #{host := F2} -> v_type_string(F2, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (uuid) -> ok; - (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_get_domain_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), get_domain_request}, M, Path); -v_msg_get_domain_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, get_domain_request}, X, Path). - --compile({nowarn_unused_function,v_msg_domain/3}). --dialyzer({nowarn_function,v_msg_domain/3}). -v_msg_domain(#{} = M, Path, TrUserData) -> - case M of - #{id := F1} -> v_type_uint64(F1, [id | Path], TrUserData); - _ -> ok - end, - case M of - #{uuid := F2} -> v_type_string(F2, [uuid | Path], TrUserData); - _ -> ok - end, - case M of - #{name := F3} -> v_type_string(F3, [name | Path], TrUserData); - _ -> ok - end, - case M of - #{vcpu := F4} -> v_type_uint32(F4, [vcpu | Path], TrUserData); - _ -> ok - end, - case M of - #{memory := F5} -> v_type_uint64(F5, [memory | Path], TrUserData); - _ -> ok - end, - case M of - #{network := F6} -> v_type_string(F6, [network | Path], TrUserData); - _ -> ok - end, - case M of - #{bridge := F7} -> v_type_string(F7, [bridge | Path], TrUserData); - _ -> ok - end, - case M of - #{state := F8} -> v_type_string(F8, [state | Path], TrUserData); - _ -> ok - end, - case M of - #{private_ip := F9} -> v_type_string(F9, [private_ip | Path], TrUserData); - _ -> ok - end, - case M of - #{ipv6_address := F10} -> v_type_string(F10, [ipv6_address | Path], TrUserData); - _ -> ok - end, - case M of - #{user_data := F11} -> v_type_string(F11, [user_data | Path], TrUserData); - _ -> ok - end, - case M of - #{nested_virtualization := F12} -> v_type_bool(F12, [nested_virtualization | Path], TrUserData); - _ -> ok - end, - case M of - #{base_image := F13} -> v_type_string(F13, [base_image | Path], TrUserData); - _ -> ok - end, - case M of - #{created_at := F14} -> v_msg_timestamp(F14, [created_at | Path], TrUserData); - _ -> ok - end, - case M of - #{os_type := F15} -> v_type_string(F15, [os_type | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (id) -> ok; - (uuid) -> ok; - (name) -> ok; - (vcpu) -> ok; - (memory) -> ok; - (network) -> ok; - (bridge) -> ok; - (state) -> ok; - (private_ip) -> ok; - (ipv6_address) -> ok; - (user_data) -> ok; - (nested_virtualization) -> ok; - (base_image) -> ok; - (created_at) -> ok; - (os_type) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_domain(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), domain}, M, Path); -v_msg_domain(X, Path, _TrUserData) -> mk_type_error({expected_msg, domain}, X, Path). - --compile({nowarn_unused_function,v_msg_list_domains_request/3}). --dialyzer({nowarn_function,v_msg_list_domains_request/3}). -v_msg_list_domains_request(#{} = M, Path, TrUserData) -> - case M of - #{host := F1} -> v_type_string(F1, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_domains_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_domains_request}, M, Path); -v_msg_list_domains_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_domains_request}, X, Path). - --compile({nowarn_unused_function,v_msg_list_domains_response/3}). --dialyzer({nowarn_function,v_msg_list_domains_response/3}). -v_msg_list_domains_response(#{} = M, Path, TrUserData) -> - case M of - #{domains := F1} -> - if is_list(F1) -> - _ = [v_msg_domain(Elem, [domains | Path], TrUserData) || Elem <- F1], - ok; - true -> mk_type_error({invalid_list_of, {msg, domain}}, F1, [domains | Path]) - end; - _ -> ok - end, - lists:foreach(fun (domains) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_domains_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_domains_response}, M, Path); -v_msg_list_domains_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_domains_response}, X, Path). - --compile({nowarn_unused_function,v_msg_create_domain_request/3}). --dialyzer({nowarn_function,v_msg_create_domain_request/3}). -v_msg_create_domain_request(#{} = M, Path, TrUserData) -> - case M of - #{domain := F1} -> v_msg_domain(F1, [domain | Path], TrUserData); - _ -> ok - end, - case M of - #{host := F2} -> v_type_string(F2, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (domain) -> ok; - (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_create_domain_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), create_domain_request}, M, Path); -v_msg_create_domain_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, create_domain_request}, X, Path). - --compile({nowarn_unused_function,v_msg_delete_domain_request/3}). --dialyzer({nowarn_function,v_msg_delete_domain_request/3}). -v_msg_delete_domain_request(#{} = M, Path, TrUserData) -> - case M of - #{uuid := F1} -> v_type_string(F1, [uuid | Path], TrUserData); - _ -> ok - end, - case M of - #{host := F2} -> v_type_string(F2, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (uuid) -> ok; - (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_delete_domain_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), delete_domain_request}, M, Path); -v_msg_delete_domain_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, delete_domain_request}, X, Path). - --compile({nowarn_unused_function,v_msg_download_image_request/3}). --dialyzer({nowarn_function,v_msg_download_image_request/3}). -v_msg_download_image_request(#{} = M, Path, TrUserData) -> - case M of - #{domain_id := F1} -> v_type_string(F1, [domain_id | Path], TrUserData); - _ -> ok - end, - case M of - #{host := F2} -> v_type_string(F2, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (domain_id) -> ok; - (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_download_image_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), download_image_request}, M, Path); -v_msg_download_image_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, download_image_request}, X, Path). - --compile({nowarn_unused_function,v_msg_image_chunk/3}). --dialyzer({nowarn_function,v_msg_image_chunk/3}). -v_msg_image_chunk(#{} = M, Path, TrUserData) -> - case M of - #{bytes := F1} -> v_type_bytes(F1, [bytes | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (bytes) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_image_chunk(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), image_chunk}, M, Path); -v_msg_image_chunk(X, Path, _TrUserData) -> mk_type_error({expected_msg, image_chunk}, X, Path). - --compile({nowarn_unused_function,v_msg_get_network_request/3}). --dialyzer({nowarn_function,v_msg_get_network_request/3}). -v_msg_get_network_request(#{} = M, Path, TrUserData) -> - case M of - #{uuid := F1} -> v_type_string(F1, [uuid | Path], TrUserData); - _ -> ok - end, - case M of - #{host := F2} -> v_type_string(F2, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (uuid) -> ok; - (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_get_network_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), get_network_request}, M, Path); -v_msg_get_network_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, get_network_request}, X, Path). - --compile({nowarn_unused_function,v_msg_network/3}). --dialyzer({nowarn_function,v_msg_network/3}). -v_msg_network(#{} = M, Path, TrUserData) -> - case M of - #{uuid := F1} -> v_type_string(F1, [uuid | Path], TrUserData); - _ -> ok - end, - case M of - #{name := F2} -> v_type_string(F2, [name | Path], TrUserData); - _ -> ok - end, - case M of - #{cidr := F3} -> v_type_string(F3, [cidr | Path], TrUserData); - _ -> ok - end, - case M of - #{cidr6 := F4} -> v_type_string(F4, [cidr6 | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (uuid) -> ok; - (name) -> ok; - (cidr) -> ok; - (cidr6) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_network(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), network}, M, Path); -v_msg_network(X, Path, _TrUserData) -> mk_type_error({expected_msg, network}, X, Path). - --compile({nowarn_unused_function,v_msg_list_networks_request/3}). --dialyzer({nowarn_function,v_msg_list_networks_request/3}). -v_msg_list_networks_request(#{} = M, Path, TrUserData) -> - case M of - #{host := F1} -> v_type_string(F1, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_networks_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_networks_request}, M, Path); -v_msg_list_networks_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_networks_request}, X, Path). - --compile({nowarn_unused_function,v_msg_list_networks_response/3}). --dialyzer({nowarn_function,v_msg_list_networks_response/3}). -v_msg_list_networks_response(#{} = M, Path, TrUserData) -> - case M of - #{networks := F1} -> - if is_list(F1) -> - _ = [v_msg_network(Elem, [networks | Path], TrUserData) || Elem <- F1], - ok; - true -> mk_type_error({invalid_list_of, {msg, network}}, F1, [networks | Path]) - end; - _ -> ok - end, - lists:foreach(fun (networks) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_networks_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_networks_response}, M, Path); -v_msg_list_networks_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_networks_response}, X, Path). - --compile({nowarn_unused_function,v_msg_create_network_request/3}). --dialyzer({nowarn_function,v_msg_create_network_request/3}). -v_msg_create_network_request(#{} = M, Path, TrUserData) -> - case M of - #{network := F1} -> v_msg_network(F1, [network | Path], TrUserData); - _ -> ok - end, - case M of - #{host := F2} -> v_type_string(F2, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (network) -> ok; - (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_create_network_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), create_network_request}, M, Path); -v_msg_create_network_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, create_network_request}, X, Path). - --compile({nowarn_unused_function,v_msg_delete_network_request/3}). --dialyzer({nowarn_function,v_msg_delete_network_request/3}). -v_msg_delete_network_request(#{} = M, Path, TrUserData) -> - case M of - #{uuid := F1} -> v_type_string(F1, [uuid | Path], TrUserData); - _ -> ok - end, - case M of - #{host := F2} -> v_type_string(F2, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (uuid) -> ok; - (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_delete_network_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), delete_network_request}, M, Path); -v_msg_delete_network_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, delete_network_request}, X, Path). - --compile({nowarn_unused_function,v_msg_empty/3}). --dialyzer({nowarn_function,v_msg_empty/3}). -v_msg_empty(#{} = M, Path, _) -> - lists:foreach(fun (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) end, maps:keys(M)), - ok; -v_msg_empty(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), empty}, M, Path); -v_msg_empty(X, Path, _TrUserData) -> mk_type_error({expected_msg, empty}, X, Path). - --compile({nowarn_unused_function,v_msg_timestamp/3}). --dialyzer({nowarn_function,v_msg_timestamp/3}). -v_msg_timestamp(#{} = M, Path, TrUserData) -> - case M of - #{seconds := F1} -> v_type_int64(F1, [seconds | Path], TrUserData); - _ -> ok - end, - case M of - #{nanos := F2} -> v_type_int32(F2, [nanos | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (seconds) -> ok; - (nanos) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_timestamp(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), timestamp}, M, Path); -v_msg_timestamp(X, Path, _TrUserData) -> mk_type_error({expected_msg, timestamp}, X, Path). - --compile({nowarn_unused_function,v_type_int32/3}). --dialyzer({nowarn_function,v_type_int32/3}). -v_type_int32(N, _Path, _TrUserData) when -2147483648 =< N, N =< 2147483647 -> ok; -v_type_int32(N, Path, _TrUserData) when is_integer(N) -> mk_type_error({value_out_of_range, int32, signed, 32}, N, Path); -v_type_int32(X, Path, _TrUserData) -> mk_type_error({bad_integer, int32, signed, 32}, X, Path). - --compile({nowarn_unused_function,v_type_int64/3}). --dialyzer({nowarn_function,v_type_int64/3}). -v_type_int64(N, _Path, _TrUserData) when -9223372036854775808 =< N, N =< 9223372036854775807 -> ok; -v_type_int64(N, Path, _TrUserData) when is_integer(N) -> mk_type_error({value_out_of_range, int64, signed, 64}, N, Path); -v_type_int64(X, Path, _TrUserData) -> mk_type_error({bad_integer, int64, signed, 64}, X, Path). - --compile({nowarn_unused_function,v_type_uint32/3}). --dialyzer({nowarn_function,v_type_uint32/3}). -v_type_uint32(N, _Path, _TrUserData) when 0 =< N, N =< 4294967295 -> ok; -v_type_uint32(N, Path, _TrUserData) when is_integer(N) -> mk_type_error({value_out_of_range, uint32, unsigned, 32}, N, Path); -v_type_uint32(X, Path, _TrUserData) -> mk_type_error({bad_integer, uint32, unsigned, 32}, X, Path). - --compile({nowarn_unused_function,v_type_uint64/3}). --dialyzer({nowarn_function,v_type_uint64/3}). -v_type_uint64(N, _Path, _TrUserData) when 0 =< N, N =< 18446744073709551615 -> ok; -v_type_uint64(N, Path, _TrUserData) when is_integer(N) -> mk_type_error({value_out_of_range, uint64, unsigned, 64}, N, Path); -v_type_uint64(X, Path, _TrUserData) -> mk_type_error({bad_integer, uint64, unsigned, 64}, X, Path). - --compile({nowarn_unused_function,v_type_bool/3}). --dialyzer({nowarn_function,v_type_bool/3}). -v_type_bool(false, _Path, _TrUserData) -> ok; -v_type_bool(true, _Path, _TrUserData) -> ok; -v_type_bool(0, _Path, _TrUserData) -> ok; -v_type_bool(1, _Path, _TrUserData) -> ok; -v_type_bool(X, Path, _TrUserData) -> mk_type_error(bad_boolean_value, X, Path). - --compile({nowarn_unused_function,v_type_string/3}). --dialyzer({nowarn_function,v_type_string/3}). -v_type_string(S, Path, _TrUserData) when is_list(S); is_binary(S) -> - try unicode:characters_to_binary(S) of - B when is_binary(B) -> ok; - {error, _, _} -> mk_type_error(bad_unicode_string, S, Path) - catch - error:badarg -> mk_type_error(bad_unicode_string, S, Path) - end; -v_type_string(X, Path, _TrUserData) -> mk_type_error(bad_unicode_string, X, Path). - --compile({nowarn_unused_function,v_type_bytes/3}). --dialyzer({nowarn_function,v_type_bytes/3}). -v_type_bytes(B, _Path, _TrUserData) when is_binary(B) -> ok; -v_type_bytes(B, _Path, _TrUserData) when is_list(B) -> ok; -v_type_bytes(X, Path, _TrUserData) -> mk_type_error(bad_binary_value, X, Path). - --compile({nowarn_unused_function,mk_type_error/3}). --spec mk_type_error(_, _, list()) -> no_return(). -mk_type_error(Error, ValueSeen, Path) -> - Path2 = prettify_path(Path), - erlang:error({gpb_type_error, {Error, [{value, ValueSeen}, {path, Path2}]}}). - - --compile({nowarn_unused_function,prettify_path/1}). --dialyzer({nowarn_function,prettify_path/1}). -prettify_path([]) -> top_level; -prettify_path(PathR) -> lists:append(lists:join(".", lists:map(fun atom_to_list/1, lists:reverse(PathR)))). - - --compile({nowarn_unused_function,id/2}). --compile({inline,id/2}). -id(X, _TrUserData) -> X. - --compile({nowarn_unused_function,v_ok/3}). --compile({inline,v_ok/3}). -v_ok(_Value, _Path, _TrUserData) -> ok. - --compile({nowarn_unused_function,m_overwrite/3}). --compile({inline,m_overwrite/3}). -m_overwrite(_Prev, New, _TrUserData) -> New. - --compile({nowarn_unused_function,cons/3}). --compile({inline,cons/3}). -cons(Elem, Acc, _TrUserData) -> [Elem | Acc]. - --compile({nowarn_unused_function,lists_reverse/2}). --compile({inline,lists_reverse/2}). -'lists_reverse'(L, _TrUserData) -> lists:reverse(L). --compile({nowarn_unused_function,'erlang_++'/3}). --compile({inline,'erlang_++'/3}). -'erlang_++'(A, B, _TrUserData) -> A ++ B. - - -get_msg_defs() -> - [{{msg, start_domain_request}, [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => uuid, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, stop_domain_request}, - [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => uuid, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => force, fnum => 3, rnum => 4, type => bool, occurrence => optional, opts => []}]}, - {{msg, get_domain_request}, [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, domain}, - [#{name => id, fnum => 1, rnum => 2, type => uint64, occurrence => optional, opts => []}, - #{name => uuid, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => name, fnum => 3, rnum => 4, type => string, occurrence => optional, opts => []}, - #{name => vcpu, fnum => 4, rnum => 5, type => uint32, occurrence => optional, opts => []}, - #{name => memory, fnum => 5, rnum => 6, type => uint64, occurrence => optional, opts => []}, - #{name => network, fnum => 6, rnum => 7, type => string, occurrence => optional, opts => []}, - #{name => bridge, fnum => 7, rnum => 8, type => string, occurrence => optional, opts => []}, - #{name => state, fnum => 8, rnum => 9, type => string, occurrence => optional, opts => []}, - #{name => private_ip, fnum => 9, rnum => 10, type => string, occurrence => optional, opts => []}, - #{name => ipv6_address, fnum => 15, rnum => 11, type => string, occurrence => optional, opts => []}, - #{name => user_data, fnum => 10, rnum => 12, type => string, occurrence => optional, opts => []}, - #{name => nested_virtualization, fnum => 11, rnum => 13, type => bool, occurrence => optional, opts => []}, - #{name => base_image, fnum => 12, rnum => 14, type => string, occurrence => optional, opts => []}, - #{name => created_at, fnum => 13, rnum => 15, type => {msg, timestamp}, occurrence => optional, opts => []}, - #{name => os_type, fnum => 14, rnum => 16, type => string, occurrence => optional, opts => []}]}, - {{msg, list_domains_request}, [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]}, - {{msg, list_domains_response}, [#{name => domains, fnum => 1, rnum => 2, type => {msg, domain}, occurrence => repeated, opts => []}]}, - {{msg, create_domain_request}, [#{name => domain, fnum => 1, rnum => 2, type => {msg, domain}, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, delete_domain_request}, [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, download_image_request}, [#{name => domain_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, image_chunk}, [#{name => bytes, fnum => 1, rnum => 2, type => bytes, occurrence => optional, opts => []}]}, - {{msg, get_network_request}, [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, network}, - [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => name, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => cidr, fnum => 3, rnum => 4, type => string, occurrence => optional, opts => []}, - #{name => cidr6, fnum => 4, rnum => 5, type => string, occurrence => optional, opts => []}]}, - {{msg, list_networks_request}, [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]}, - {{msg, list_networks_response}, [#{name => networks, fnum => 1, rnum => 2, type => {msg, network}, occurrence => repeated, opts => []}]}, - {{msg, create_network_request}, [#{name => network, fnum => 1, rnum => 2, type => {msg, network}, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, delete_network_request}, [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, empty}, []}, - {{msg, timestamp}, [#{name => seconds, fnum => 1, rnum => 2, type => int64, occurrence => optional, opts => []}, #{name => nanos, fnum => 2, rnum => 3, type => int32, occurrence => optional, opts => []}]}]. - - -get_msg_names() -> - [start_domain_request, - stop_domain_request, - get_domain_request, - domain, - list_domains_request, - list_domains_response, - create_domain_request, - delete_domain_request, - download_image_request, - image_chunk, - get_network_request, - network, - list_networks_request, - list_networks_response, - create_network_request, - delete_network_request, - empty, - timestamp]. - - -get_group_names() -> []. - - -get_msg_or_group_names() -> - [start_domain_request, - stop_domain_request, - get_domain_request, - domain, - list_domains_request, - list_domains_response, - create_domain_request, - delete_domain_request, - download_image_request, - image_chunk, - get_network_request, - network, - list_networks_request, - list_networks_response, - create_network_request, - delete_network_request, - empty, - timestamp]. - - -get_enum_names() -> []. - - -fetch_msg_def(MsgName) -> - case find_msg_def(MsgName) of - Fs when is_list(Fs) -> Fs; - error -> erlang:error({no_such_msg, MsgName}) - end. - - --spec fetch_enum_def(_) -> no_return(). -fetch_enum_def(EnumName) -> erlang:error({no_such_enum, EnumName}). - - -find_msg_def(start_domain_request) -> [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => uuid, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(stop_domain_request) -> - [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => uuid, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => force, fnum => 3, rnum => 4, type => bool, occurrence => optional, opts => []}]; -find_msg_def(get_domain_request) -> [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(domain) -> - [#{name => id, fnum => 1, rnum => 2, type => uint64, occurrence => optional, opts => []}, - #{name => uuid, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => name, fnum => 3, rnum => 4, type => string, occurrence => optional, opts => []}, - #{name => vcpu, fnum => 4, rnum => 5, type => uint32, occurrence => optional, opts => []}, - #{name => memory, fnum => 5, rnum => 6, type => uint64, occurrence => optional, opts => []}, - #{name => network, fnum => 6, rnum => 7, type => string, occurrence => optional, opts => []}, - #{name => bridge, fnum => 7, rnum => 8, type => string, occurrence => optional, opts => []}, - #{name => state, fnum => 8, rnum => 9, type => string, occurrence => optional, opts => []}, - #{name => private_ip, fnum => 9, rnum => 10, type => string, occurrence => optional, opts => []}, - #{name => ipv6_address, fnum => 15, rnum => 11, type => string, occurrence => optional, opts => []}, - #{name => user_data, fnum => 10, rnum => 12, type => string, occurrence => optional, opts => []}, - #{name => nested_virtualization, fnum => 11, rnum => 13, type => bool, occurrence => optional, opts => []}, - #{name => base_image, fnum => 12, rnum => 14, type => string, occurrence => optional, opts => []}, - #{name => created_at, fnum => 13, rnum => 15, type => {msg, timestamp}, occurrence => optional, opts => []}, - #{name => os_type, fnum => 14, rnum => 16, type => string, occurrence => optional, opts => []}]; -find_msg_def(list_domains_request) -> [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]; -find_msg_def(list_domains_response) -> [#{name => domains, fnum => 1, rnum => 2, type => {msg, domain}, occurrence => repeated, opts => []}]; -find_msg_def(create_domain_request) -> [#{name => domain, fnum => 1, rnum => 2, type => {msg, domain}, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(delete_domain_request) -> [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(download_image_request) -> [#{name => domain_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(image_chunk) -> [#{name => bytes, fnum => 1, rnum => 2, type => bytes, occurrence => optional, opts => []}]; -find_msg_def(get_network_request) -> [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(network) -> - [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => name, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => cidr, fnum => 3, rnum => 4, type => string, occurrence => optional, opts => []}, - #{name => cidr6, fnum => 4, rnum => 5, type => string, occurrence => optional, opts => []}]; -find_msg_def(list_networks_request) -> [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]; -find_msg_def(list_networks_response) -> [#{name => networks, fnum => 1, rnum => 2, type => {msg, network}, occurrence => repeated, opts => []}]; -find_msg_def(create_network_request) -> [#{name => network, fnum => 1, rnum => 2, type => {msg, network}, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(delete_network_request) -> [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(empty) -> []; -find_msg_def(timestamp) -> [#{name => seconds, fnum => 1, rnum => 2, type => int64, occurrence => optional, opts => []}, #{name => nanos, fnum => 2, rnum => 3, type => int32, occurrence => optional, opts => []}]; -find_msg_def(_) -> error. - - -find_enum_def(_) -> error. - - --spec enum_symbol_by_value(_, _) -> no_return(). -enum_symbol_by_value(E, V) -> erlang:error({no_enum_defs, E, V}). - - --spec enum_value_by_symbol(_, _) -> no_return(). -enum_value_by_symbol(E, V) -> erlang:error({no_enum_defs, E, V}). - - - -get_service_names() -> ['DomainService']. - - -get_service_def('DomainService') -> - {{service, 'DomainService'}, - [#{name => 'GetDomain', input => get_domain_request, output => domain, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListDomains', input => list_domains_request, output => list_domains_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'CreateDomain', input => create_domain_request, output => domain, input_stream => false, output_stream => false, opts => []}, - #{name => 'DeleteDomain', input => delete_domain_request, output => empty, input_stream => false, output_stream => false, opts => []}, - #{name => 'DownloadImage', input => download_image_request, output => image_chunk, input_stream => false, output_stream => true, opts => []}, - #{name => 'GetNetwork', input => get_network_request, output => network, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListNetworks', input => list_networks_request, output => list_networks_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'CreateNetwork', input => create_network_request, output => network, input_stream => false, output_stream => false, opts => []}, - #{name => 'DeleteNetwork', input => delete_network_request, output => empty, input_stream => false, output_stream => false, opts => []}]}; -get_service_def(_) -> error. - - -get_rpc_names('DomainService') -> ['GetDomain', 'ListDomains', 'CreateDomain', 'DeleteDomain', 'DownloadImage', 'GetNetwork', 'ListNetworks', 'CreateNetwork', 'DeleteNetwork']; -get_rpc_names(_) -> error. - - -find_rpc_def('DomainService', RpcName) -> find_rpc_def_DomainService(RpcName); -find_rpc_def(_, _) -> error. - - -find_rpc_def_DomainService('GetDomain') -> #{name => 'GetDomain', input => get_domain_request, output => domain, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DomainService('ListDomains') -> #{name => 'ListDomains', input => list_domains_request, output => list_domains_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DomainService('CreateDomain') -> #{name => 'CreateDomain', input => create_domain_request, output => domain, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DomainService('DeleteDomain') -> #{name => 'DeleteDomain', input => delete_domain_request, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DomainService('DownloadImage') -> #{name => 'DownloadImage', input => download_image_request, output => image_chunk, input_stream => false, output_stream => true, opts => []}; -find_rpc_def_DomainService('GetNetwork') -> #{name => 'GetNetwork', input => get_network_request, output => network, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DomainService('ListNetworks') -> #{name => 'ListNetworks', input => list_networks_request, output => list_networks_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DomainService('CreateNetwork') -> #{name => 'CreateNetwork', input => create_network_request, output => network, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DomainService('DeleteNetwork') -> #{name => 'DeleteNetwork', input => delete_network_request, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_DomainService(_) -> error. - - -fetch_rpc_def(ServiceName, RpcName) -> - case find_rpc_def(ServiceName, RpcName) of - Def when is_map(Def) -> Def; - error -> erlang:error({no_such_rpc, ServiceName, RpcName}) - end. - - -%% Convert a a fully qualified (ie with package name) service name -%% as a binary to a service name as an atom. -fqbin_to_service_name(<<"DomainService">>) -> 'DomainService'; -fqbin_to_service_name(X) -> error({gpb_error, {badservice, X}}). - - -%% Convert a service name as an atom to a fully qualified -%% (ie with package name) name as a binary. -service_name_to_fqbin('DomainService') -> <<"DomainService">>; -service_name_to_fqbin(X) -> error({gpb_error, {badservice, X}}). - - -%% Convert a a fully qualified (ie with package name) service name -%% and an rpc name, both as binaries to a service name and an rpc -%% name, as atoms. -fqbins_to_service_and_rpc_name(<<"DomainService">>, <<"GetDomain">>) -> {'DomainService', 'GetDomain'}; -fqbins_to_service_and_rpc_name(<<"DomainService">>, <<"ListDomains">>) -> {'DomainService', 'ListDomains'}; -fqbins_to_service_and_rpc_name(<<"DomainService">>, <<"CreateDomain">>) -> {'DomainService', 'CreateDomain'}; -fqbins_to_service_and_rpc_name(<<"DomainService">>, <<"DeleteDomain">>) -> {'DomainService', 'DeleteDomain'}; -fqbins_to_service_and_rpc_name(<<"DomainService">>, <<"DownloadImage">>) -> {'DomainService', 'DownloadImage'}; -fqbins_to_service_and_rpc_name(<<"DomainService">>, <<"GetNetwork">>) -> {'DomainService', 'GetNetwork'}; -fqbins_to_service_and_rpc_name(<<"DomainService">>, <<"ListNetworks">>) -> {'DomainService', 'ListNetworks'}; -fqbins_to_service_and_rpc_name(<<"DomainService">>, <<"CreateNetwork">>) -> {'DomainService', 'CreateNetwork'}; -fqbins_to_service_and_rpc_name(<<"DomainService">>, <<"DeleteNetwork">>) -> {'DomainService', 'DeleteNetwork'}; -fqbins_to_service_and_rpc_name(S, R) -> error({gpb_error, {badservice_or_rpc, {S, R}}}). - - -%% Convert a service name and an rpc name, both as atoms, -%% to a fully qualified (ie with package name) service name and -%% an rpc name as binaries. -service_and_rpc_name_to_fqbins('DomainService', 'GetDomain') -> {<<"DomainService">>, <<"GetDomain">>}; -service_and_rpc_name_to_fqbins('DomainService', 'ListDomains') -> {<<"DomainService">>, <<"ListDomains">>}; -service_and_rpc_name_to_fqbins('DomainService', 'CreateDomain') -> {<<"DomainService">>, <<"CreateDomain">>}; -service_and_rpc_name_to_fqbins('DomainService', 'DeleteDomain') -> {<<"DomainService">>, <<"DeleteDomain">>}; -service_and_rpc_name_to_fqbins('DomainService', 'DownloadImage') -> {<<"DomainService">>, <<"DownloadImage">>}; -service_and_rpc_name_to_fqbins('DomainService', 'GetNetwork') -> {<<"DomainService">>, <<"GetNetwork">>}; -service_and_rpc_name_to_fqbins('DomainService', 'ListNetworks') -> {<<"DomainService">>, <<"ListNetworks">>}; -service_and_rpc_name_to_fqbins('DomainService', 'CreateNetwork') -> {<<"DomainService">>, <<"CreateNetwork">>}; -service_and_rpc_name_to_fqbins('DomainService', 'DeleteNetwork') -> {<<"DomainService">>, <<"DeleteNetwork">>}; -service_and_rpc_name_to_fqbins(S, R) -> error({gpb_error, {badservice_or_rpc, {S, R}}}). - - -fqbin_to_msg_name(<<"StartDomainRequest">>) -> start_domain_request; -fqbin_to_msg_name(<<"StopDomainRequest">>) -> stop_domain_request; -fqbin_to_msg_name(<<"GetDomainRequest">>) -> get_domain_request; -fqbin_to_msg_name(<<"Domain">>) -> domain; -fqbin_to_msg_name(<<"ListDomainsRequest">>) -> list_domains_request; -fqbin_to_msg_name(<<"ListDomainsResponse">>) -> list_domains_response; -fqbin_to_msg_name(<<"CreateDomainRequest">>) -> create_domain_request; -fqbin_to_msg_name(<<"DeleteDomainRequest">>) -> delete_domain_request; -fqbin_to_msg_name(<<"DownloadImageRequest">>) -> download_image_request; -fqbin_to_msg_name(<<"ImageChunk">>) -> image_chunk; -fqbin_to_msg_name(<<"GetNetworkRequest">>) -> get_network_request; -fqbin_to_msg_name(<<"Network">>) -> network; -fqbin_to_msg_name(<<"ListNetworksRequest">>) -> list_networks_request; -fqbin_to_msg_name(<<"ListNetworksResponse">>) -> list_networks_response; -fqbin_to_msg_name(<<"CreateNetworkRequest">>) -> create_network_request; -fqbin_to_msg_name(<<"DeleteNetworkRequest">>) -> delete_network_request; -fqbin_to_msg_name(<<"google.protobuf.Empty">>) -> empty; -fqbin_to_msg_name(<<"google.protobuf.Timestamp">>) -> timestamp; -fqbin_to_msg_name(E) -> error({gpb_error, {badmsg, E}}). - - -msg_name_to_fqbin(start_domain_request) -> <<"StartDomainRequest">>; -msg_name_to_fqbin(stop_domain_request) -> <<"StopDomainRequest">>; -msg_name_to_fqbin(get_domain_request) -> <<"GetDomainRequest">>; -msg_name_to_fqbin(domain) -> <<"Domain">>; -msg_name_to_fqbin(list_domains_request) -> <<"ListDomainsRequest">>; -msg_name_to_fqbin(list_domains_response) -> <<"ListDomainsResponse">>; -msg_name_to_fqbin(create_domain_request) -> <<"CreateDomainRequest">>; -msg_name_to_fqbin(delete_domain_request) -> <<"DeleteDomainRequest">>; -msg_name_to_fqbin(download_image_request) -> <<"DownloadImageRequest">>; -msg_name_to_fqbin(image_chunk) -> <<"ImageChunk">>; -msg_name_to_fqbin(get_network_request) -> <<"GetNetworkRequest">>; -msg_name_to_fqbin(network) -> <<"Network">>; -msg_name_to_fqbin(list_networks_request) -> <<"ListNetworksRequest">>; -msg_name_to_fqbin(list_networks_response) -> <<"ListNetworksResponse">>; -msg_name_to_fqbin(create_network_request) -> <<"CreateNetworkRequest">>; -msg_name_to_fqbin(delete_network_request) -> <<"DeleteNetworkRequest">>; -msg_name_to_fqbin(empty) -> <<"google.protobuf.Empty">>; -msg_name_to_fqbin(timestamp) -> <<"google.protobuf.Timestamp">>; -msg_name_to_fqbin(E) -> error({gpb_error, {badmsg, E}}). - - --spec fqbin_to_enum_name(_) -> no_return(). -fqbin_to_enum_name(E) -> error({gpb_error, {badenum, E}}). - - --spec enum_name_to_fqbin(_) -> no_return(). -enum_name_to_fqbin(E) -> error({gpb_error, {badenum, E}}). - - -get_package_name() -> 'google.protobuf'. - - -%% Whether or not the message names -%% are prepended with package name or not. -uses_packages() -> true. - - -source_basename() -> "domain.proto". - - -%% Retrieve all proto file names, also imported ones. -%% The order is top-down. The first element is always the main -%% source file. The files are returned with extension, -%% see get_all_proto_names/0 for a version that returns -%% the basenames sans extension -get_all_source_basenames() -> ["domain.proto", "empty.proto", "timestamp.proto"]. - - -%% Retrieve all proto file names, also imported ones. -%% The order is top-down. The first element is always the main -%% source file. The files are returned sans .proto extension, -%% to make it easier to use them with the various get_xyz_containment -%% functions. -get_all_proto_names() -> ["domain", "empty", "timestamp"]. - - -get_msg_containment("domain") -> - [create_domain_request, - create_network_request, - delete_domain_request, - delete_network_request, - domain, - download_image_request, - get_domain_request, - get_network_request, - image_chunk, - list_domains_request, - list_domains_response, - list_networks_request, - list_networks_response, - network, - start_domain_request, - stop_domain_request]; -get_msg_containment("empty") -> [empty]; -get_msg_containment("timestamp") -> [timestamp]; -get_msg_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_pkg_containment("domain") -> undefined; -get_pkg_containment("empty") -> 'google.protobuf'; -get_pkg_containment("timestamp") -> 'google.protobuf'; -get_pkg_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_service_containment("domain") -> ['DomainService']; -get_service_containment("empty") -> []; -get_service_containment("timestamp") -> []; -get_service_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_rpc_containment("domain") -> - [{'DomainService', 'GetDomain'}, - {'DomainService', 'ListDomains'}, - {'DomainService', 'CreateDomain'}, - {'DomainService', 'DeleteDomain'}, - {'DomainService', 'DownloadImage'}, - {'DomainService', 'GetNetwork'}, - {'DomainService', 'ListNetworks'}, - {'DomainService', 'CreateNetwork'}, - {'DomainService', 'DeleteNetwork'}]; -get_rpc_containment("empty") -> []; -get_rpc_containment("timestamp") -> []; -get_rpc_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_enum_containment("domain") -> []; -get_enum_containment("empty") -> []; -get_enum_containment("timestamp") -> []; -get_enum_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_proto_by_msg_name_as_fqbin(<<"google.protobuf.Timestamp">>) -> "timestamp"; -get_proto_by_msg_name_as_fqbin(<<"StopDomainRequest">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"StartDomainRequest">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"ListNetworksRequest">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"ListDomainsRequest">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"GetNetworkRequest">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"GetDomainRequest">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"DownloadImageRequest">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"DeleteNetworkRequest">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"DeleteDomainRequest">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"CreateNetworkRequest">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"CreateDomainRequest">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"ListNetworksResponse">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"ListDomainsResponse">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"google.protobuf.Empty">>) -> "empty"; -get_proto_by_msg_name_as_fqbin(<<"Network">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"ImageChunk">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(<<"Domain">>) -> "domain"; -get_proto_by_msg_name_as_fqbin(E) -> error({gpb_error, {badmsg, E}}). - - -get_proto_by_service_name_as_fqbin(<<"DomainService">>) -> "domain"; -get_proto_by_service_name_as_fqbin(E) -> error({gpb_error, {badservice, E}}). - - --spec get_proto_by_enum_name_as_fqbin(_) -> no_return(). -get_proto_by_enum_name_as_fqbin(E) -> error({gpb_error, {badenum, E}}). - - -get_protos_by_pkg_name_as_fqbin(<<"google.protobuf">>) -> ["empty", "timestamp"]; -get_protos_by_pkg_name_as_fqbin(E) -> error({gpb_error, {badpkg, E}}). - - - -gpb_version_as_string() -> - "4.19.8". - -gpb_version_as_list() -> - [4,19,8]. - -gpb_version_source() -> - "file". diff --git a/virtuerl/src/pb/domain_service_bhvr.erl b/virtuerl/src/pb/domain_service_bhvr.erl deleted file mode 100644 index f01775b..0000000 --- a/virtuerl/src/pb/domain_service_bhvr.erl +++ /dev/null @@ -1,45 +0,0 @@ -%%%------------------------------------------------------------------- -%% @doc Behaviour to implement for grpc service DomainService. -%% @end -%%%------------------------------------------------------------------- - -%% this module was generated and should not be modified manually - --module(domain_service_bhvr). - -%% Unary RPC --callback get_domain(ctx:t(), domain_pb:get_domain_request()) -> - {ok, domain_pb:domain(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback list_domains(ctx:t(), domain_pb:list_domains_request()) -> - {ok, domain_pb:list_domains_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback create_domain(ctx:t(), domain_pb:create_domain_request()) -> - {ok, domain_pb:domain(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback delete_domain(ctx:t(), domain_pb:delete_domain_request()) -> - {ok, domain_pb:empty(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% --callback download_image(domain_pb:download_image_request(), grpcbox_stream:t()) -> - ok | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback get_network(ctx:t(), domain_pb:get_network_request()) -> - {ok, domain_pb:network(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback list_networks(ctx:t(), domain_pb:list_networks_request()) -> - {ok, domain_pb:list_networks_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback create_network(ctx:t(), domain_pb:create_network_request()) -> - {ok, domain_pb:network(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback delete_network(ctx:t(), domain_pb:delete_network_request()) -> - {ok, domain_pb:empty(), ctx:t()} | grpcbox_stream:grpc_error_response(). - diff --git a/virtuerl/src/pb/domain_service_client.erl b/virtuerl/src/pb/domain_service_client.erl deleted file mode 100644 index 9162a74..0000000 --- a/virtuerl/src/pb/domain_service_client.erl +++ /dev/null @@ -1,187 +0,0 @@ -%%%------------------------------------------------------------------- -%% @doc Client module for grpc service DomainService. -%% @end -%%%------------------------------------------------------------------- - -%% this module was generated and should not be modified manually - --module(domain_service_client). - --compile(export_all). --compile(nowarn_export_all). - --include_lib("grpcbox/include/grpcbox.hrl"). - --define(is_ctx(Ctx), is_tuple(Ctx) andalso element(1, Ctx) =:= ctx). - --define(SERVICE, 'DomainService'). --define(PROTO_MODULE, 'domain_pb'). --define(MARSHAL_FUN(T), fun(I) -> ?PROTO_MODULE:encode_msg(I, T) end). --define(UNMARSHAL_FUN(T), fun(I) -> ?PROTO_MODULE:decode_msg(I, T) end). --define(DEF(Input, Output, MessageType), #grpcbox_def{service=?SERVICE, - message_type=MessageType, - marshal_fun=?MARSHAL_FUN(Input), - unmarshal_fun=?UNMARSHAL_FUN(Output)}). - -%% @doc Unary RPC --spec get_domain(domain_pb:get_domain_request()) -> - {ok, domain_pb:domain(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_domain(Input) -> - get_domain(ctx:new(), Input, #{}). - --spec get_domain(ctx:t() | domain_pb:get_domain_request(), domain_pb:get_domain_request() | grpcbox_client:options()) -> - {ok, domain_pb:domain(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_domain(Ctx, Input) when ?is_ctx(Ctx) -> - get_domain(Ctx, Input, #{}); -get_domain(Input, Options) -> - get_domain(ctx:new(), Input, Options). - --spec get_domain(ctx:t(), domain_pb:get_domain_request(), grpcbox_client:options()) -> - {ok, domain_pb:domain(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_domain(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/DomainService/GetDomain">>, Input, ?DEF(get_domain_request, domain, <<"GetDomainRequest">>), Options). - -%% @doc Unary RPC --spec list_domains(domain_pb:list_domains_request()) -> - {ok, domain_pb:list_domains_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_domains(Input) -> - list_domains(ctx:new(), Input, #{}). - --spec list_domains(ctx:t() | domain_pb:list_domains_request(), domain_pb:list_domains_request() | grpcbox_client:options()) -> - {ok, domain_pb:list_domains_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_domains(Ctx, Input) when ?is_ctx(Ctx) -> - list_domains(Ctx, Input, #{}); -list_domains(Input, Options) -> - list_domains(ctx:new(), Input, Options). - --spec list_domains(ctx:t(), domain_pb:list_domains_request(), grpcbox_client:options()) -> - {ok, domain_pb:list_domains_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_domains(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/DomainService/ListDomains">>, Input, ?DEF(list_domains_request, list_domains_response, <<"ListDomainsRequest">>), Options). - -%% @doc Unary RPC --spec create_domain(domain_pb:create_domain_request()) -> - {ok, domain_pb:domain(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -create_domain(Input) -> - create_domain(ctx:new(), Input, #{}). - --spec create_domain(ctx:t() | domain_pb:create_domain_request(), domain_pb:create_domain_request() | grpcbox_client:options()) -> - {ok, domain_pb:domain(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -create_domain(Ctx, Input) when ?is_ctx(Ctx) -> - create_domain(Ctx, Input, #{}); -create_domain(Input, Options) -> - create_domain(ctx:new(), Input, Options). - --spec create_domain(ctx:t(), domain_pb:create_domain_request(), grpcbox_client:options()) -> - {ok, domain_pb:domain(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -create_domain(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/DomainService/CreateDomain">>, Input, ?DEF(create_domain_request, domain, <<"CreateDomainRequest">>), Options). - -%% @doc Unary RPC --spec delete_domain(domain_pb:delete_domain_request()) -> - {ok, domain_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_domain(Input) -> - delete_domain(ctx:new(), Input, #{}). - --spec delete_domain(ctx:t() | domain_pb:delete_domain_request(), domain_pb:delete_domain_request() | grpcbox_client:options()) -> - {ok, domain_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_domain(Ctx, Input) when ?is_ctx(Ctx) -> - delete_domain(Ctx, Input, #{}); -delete_domain(Input, Options) -> - delete_domain(ctx:new(), Input, Options). - --spec delete_domain(ctx:t(), domain_pb:delete_domain_request(), grpcbox_client:options()) -> - {ok, domain_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_domain(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/DomainService/DeleteDomain">>, Input, ?DEF(delete_domain_request, empty, <<"DeleteDomainRequest">>), Options). - -%% @doc --spec download_image(domain_pb:download_image_request()) -> - {ok, grpcbox_client:stream()} | grpcbox_stream:grpc_error_response() | {error, any()}. -download_image(Input) -> - download_image(ctx:new(), Input, #{}). - --spec download_image(ctx:t() | domain_pb:download_image_request(), domain_pb:download_image_request() | grpcbox_client:options()) -> - {ok, grpcbox_client:stream()} | grpcbox_stream:grpc_error_response() | {error, any()}. -download_image(Ctx, Input) when ?is_ctx(Ctx) -> - download_image(Ctx, Input, #{}); -download_image(Input, Options) -> - download_image(ctx:new(), Input, Options). - --spec download_image(ctx:t(), domain_pb:download_image_request(), grpcbox_client:options()) -> - {ok, grpcbox_client:stream()} | grpcbox_stream:grpc_error_response() | {error, any()}. -download_image(Ctx, Input, Options) -> - grpcbox_client:stream(Ctx, <<"/DomainService/DownloadImage">>, Input, ?DEF(download_image_request, image_chunk, <<"DownloadImageRequest">>), Options). - -%% @doc Unary RPC --spec get_network(domain_pb:get_network_request()) -> - {ok, domain_pb:network(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_network(Input) -> - get_network(ctx:new(), Input, #{}). - --spec get_network(ctx:t() | domain_pb:get_network_request(), domain_pb:get_network_request() | grpcbox_client:options()) -> - {ok, domain_pb:network(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_network(Ctx, Input) when ?is_ctx(Ctx) -> - get_network(Ctx, Input, #{}); -get_network(Input, Options) -> - get_network(ctx:new(), Input, Options). - --spec get_network(ctx:t(), domain_pb:get_network_request(), grpcbox_client:options()) -> - {ok, domain_pb:network(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_network(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/DomainService/GetNetwork">>, Input, ?DEF(get_network_request, network, <<"GetNetworkRequest">>), Options). - -%% @doc Unary RPC --spec list_networks(domain_pb:list_networks_request()) -> - {ok, domain_pb:list_networks_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_networks(Input) -> - list_networks(ctx:new(), Input, #{}). - --spec list_networks(ctx:t() | domain_pb:list_networks_request(), domain_pb:list_networks_request() | grpcbox_client:options()) -> - {ok, domain_pb:list_networks_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_networks(Ctx, Input) when ?is_ctx(Ctx) -> - list_networks(Ctx, Input, #{}); -list_networks(Input, Options) -> - list_networks(ctx:new(), Input, Options). - --spec list_networks(ctx:t(), domain_pb:list_networks_request(), grpcbox_client:options()) -> - {ok, domain_pb:list_networks_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_networks(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/DomainService/ListNetworks">>, Input, ?DEF(list_networks_request, list_networks_response, <<"ListNetworksRequest">>), Options). - -%% @doc Unary RPC --spec create_network(domain_pb:create_network_request()) -> - {ok, domain_pb:network(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -create_network(Input) -> - create_network(ctx:new(), Input, #{}). - --spec create_network(ctx:t() | domain_pb:create_network_request(), domain_pb:create_network_request() | grpcbox_client:options()) -> - {ok, domain_pb:network(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -create_network(Ctx, Input) when ?is_ctx(Ctx) -> - create_network(Ctx, Input, #{}); -create_network(Input, Options) -> - create_network(ctx:new(), Input, Options). - --spec create_network(ctx:t(), domain_pb:create_network_request(), grpcbox_client:options()) -> - {ok, domain_pb:network(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -create_network(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/DomainService/CreateNetwork">>, Input, ?DEF(create_network_request, network, <<"CreateNetworkRequest">>), Options). - -%% @doc Unary RPC --spec delete_network(domain_pb:delete_network_request()) -> - {ok, domain_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_network(Input) -> - delete_network(ctx:new(), Input, #{}). - --spec delete_network(ctx:t() | domain_pb:delete_network_request(), domain_pb:delete_network_request() | grpcbox_client:options()) -> - {ok, domain_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_network(Ctx, Input) when ?is_ctx(Ctx) -> - delete_network(Ctx, Input, #{}); -delete_network(Input, Options) -> - delete_network(ctx:new(), Input, Options). - --spec delete_network(ctx:t(), domain_pb:delete_network_request(), grpcbox_client:options()) -> - {ok, domain_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_network(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/DomainService/DeleteNetwork">>, Input, ?DEF(delete_network_request, empty, <<"DeleteNetworkRequest">>), Options). - diff --git a/virtuerl/src/pb/host_pb.erl b/virtuerl/src/pb/host_pb.erl deleted file mode 100644 index 994eb97..0000000 --- a/virtuerl/src/pb/host_pb.erl +++ /dev/null @@ -1,1431 +0,0 @@ -%% -*- coding: utf-8 -*- -%% @private -%% Automatically generated, do not edit -%% Generated by gpb_compile version 4.19.8 -%% Version source: file --module(host_pb). - --export([encode_msg/2, encode_msg/3]). --export([decode_msg/2, decode_msg/3]). --export([merge_msgs/3, merge_msgs/4]). --export([verify_msg/2, verify_msg/3]). --export([get_msg_defs/0]). --export([get_msg_names/0]). --export([get_group_names/0]). --export([get_msg_or_group_names/0]). --export([get_enum_names/0]). --export([find_msg_def/1, fetch_msg_def/1]). --export([find_enum_def/1, fetch_enum_def/1]). --export([enum_symbol_by_value/2, enum_value_by_symbol/2]). --export([get_service_names/0]). --export([get_service_def/1]). --export([get_rpc_names/1]). --export([find_rpc_def/2, fetch_rpc_def/2]). --export([fqbin_to_service_name/1]). --export([service_name_to_fqbin/1]). --export([fqbins_to_service_and_rpc_name/2]). --export([service_and_rpc_name_to_fqbins/2]). --export([fqbin_to_msg_name/1]). --export([msg_name_to_fqbin/1]). --export([fqbin_to_enum_name/1]). --export([enum_name_to_fqbin/1]). --export([get_package_name/0]). --export([uses_packages/0]). --export([source_basename/0]). --export([get_all_source_basenames/0]). --export([get_all_proto_names/0]). --export([get_msg_containment/1]). --export([get_pkg_containment/1]). --export([get_service_containment/1]). --export([get_rpc_containment/1]). --export([get_enum_containment/1]). --export([get_proto_by_msg_name_as_fqbin/1]). --export([get_proto_by_service_name_as_fqbin/1]). --export([get_proto_by_enum_name_as_fqbin/1]). --export([get_protos_by_pkg_name_as_fqbin/1]). --export([gpb_version_as_string/0, gpb_version_as_list/0]). --export([gpb_version_source/0]). - - -%% enumerated types - --export_type([]). - -%% message types --type create_bootstrap_token_request() :: - #{expires_at => unicode:chardata() % = 1, optional - }. - --type create_bootstrap_token_response() :: - #{token => unicode:chardata() % = 1, optional - }. - --type host() :: - #{name => unicode:chardata(), % = 1, optional - address => unicode:chardata() % = 2, optional - }. - --type list_hosts_request() :: - #{ - }. - --type list_hosts_response() :: - #{hosts => [host()] % = 1, repeated - }. - --type register_host_request() :: - #{host => host(), % = 1, optional - token => unicode:chardata() % = 2, optional - }. - --type heartbeat_request() :: - #{host => host() % = 1, optional - }. - --type heartbeat_response() :: - #{ - }. - --type empty() :: - #{ - }. - --export_type(['create_bootstrap_token_request'/0, 'create_bootstrap_token_response'/0, 'host'/0, 'list_hosts_request'/0, 'list_hosts_response'/0, 'register_host_request'/0, 'heartbeat_request'/0, 'heartbeat_response'/0, 'empty'/0]). --type '$msg_name'() :: create_bootstrap_token_request | create_bootstrap_token_response | host | list_hosts_request | list_hosts_response | register_host_request | heartbeat_request | heartbeat_response | empty. --type '$msg'() :: create_bootstrap_token_request() | create_bootstrap_token_response() | host() | list_hosts_request() | list_hosts_response() | register_host_request() | heartbeat_request() | heartbeat_response() | empty(). --export_type(['$msg_name'/0, '$msg'/0]). - --if(?OTP_RELEASE >= 24). --dialyzer({no_underspecs, encode_msg/2}). --endif. --spec encode_msg('$msg'(), '$msg_name'()) -> binary(). -encode_msg(Msg, MsgName) when is_atom(MsgName) -> encode_msg(Msg, MsgName, []). - --if(?OTP_RELEASE >= 24). --dialyzer({no_underspecs, encode_msg/3}). --endif. --spec encode_msg('$msg'(), '$msg_name'(), list()) -> binary(). -encode_msg(Msg, MsgName, Opts) -> - case proplists:get_bool(verify, Opts) of - true -> verify_msg(Msg, MsgName, Opts); - false -> ok - end, - TrUserData = proplists:get_value(user_data, Opts), - case MsgName of - create_bootstrap_token_request -> encode_msg_create_bootstrap_token_request(id(Msg, TrUserData), TrUserData); - create_bootstrap_token_response -> encode_msg_create_bootstrap_token_response(id(Msg, TrUserData), TrUserData); - host -> encode_msg_host(id(Msg, TrUserData), TrUserData); - list_hosts_request -> encode_msg_list_hosts_request(id(Msg, TrUserData), TrUserData); - list_hosts_response -> encode_msg_list_hosts_response(id(Msg, TrUserData), TrUserData); - register_host_request -> encode_msg_register_host_request(id(Msg, TrUserData), TrUserData); - heartbeat_request -> encode_msg_heartbeat_request(id(Msg, TrUserData), TrUserData); - heartbeat_response -> encode_msg_heartbeat_response(id(Msg, TrUserData), TrUserData); - empty -> encode_msg_empty(id(Msg, TrUserData), TrUserData) - end. - - -encode_msg_create_bootstrap_token_request(Msg, TrUserData) -> encode_msg_create_bootstrap_token_request(Msg, <<>>, TrUserData). - - -encode_msg_create_bootstrap_token_request(#{} = M, Bin, TrUserData) -> - case M of - #{expires_at := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end. - -encode_msg_create_bootstrap_token_response(Msg, TrUserData) -> encode_msg_create_bootstrap_token_response(Msg, <<>>, TrUserData). - - -encode_msg_create_bootstrap_token_response(#{} = M, Bin, TrUserData) -> - case M of - #{token := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end. - -encode_msg_host(Msg, TrUserData) -> encode_msg_host(Msg, <<>>, TrUserData). - - -encode_msg_host(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{name := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{address := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_list_hosts_request(_Msg, _TrUserData) -> <<>>. - -encode_msg_list_hosts_response(Msg, TrUserData) -> encode_msg_list_hosts_response(Msg, <<>>, TrUserData). - - -encode_msg_list_hosts_response(#{} = M, Bin, TrUserData) -> - case M of - #{hosts := F1} -> - TrF1 = id(F1, TrUserData), - if TrF1 == [] -> Bin; - true -> e_field_list_hosts_response_hosts(TrF1, Bin, TrUserData) - end; - _ -> Bin - end. - -encode_msg_register_host_request(Msg, TrUserData) -> encode_msg_register_host_request(Msg, <<>>, TrUserData). - - -encode_msg_register_host_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{host := F1} -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= undefined -> Bin; - true -> e_mfield_register_host_request_host(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{token := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_heartbeat_request(Msg, TrUserData) -> encode_msg_heartbeat_request(Msg, <<>>, TrUserData). - - -encode_msg_heartbeat_request(#{} = M, Bin, TrUserData) -> - case M of - #{host := F1} -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= undefined -> Bin; - true -> e_mfield_heartbeat_request_host(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end. - -encode_msg_heartbeat_response(_Msg, _TrUserData) -> <<>>. - -encode_msg_empty(_Msg, _TrUserData) -> <<>>. - -e_mfield_list_hosts_response_hosts(Msg, Bin, TrUserData) -> - SubBin = encode_msg_host(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_field_list_hosts_response_hosts([Elem | Rest], Bin, TrUserData) -> - Bin2 = <>, - Bin3 = e_mfield_list_hosts_response_hosts(id(Elem, TrUserData), Bin2, TrUserData), - e_field_list_hosts_response_hosts(Rest, Bin3, TrUserData); -e_field_list_hosts_response_hosts([], Bin, _TrUserData) -> Bin. - -e_mfield_register_host_request_host(Msg, Bin, TrUserData) -> - SubBin = encode_msg_host(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_mfield_heartbeat_request_host(Msg, Bin, TrUserData) -> - SubBin = encode_msg_host(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - --compile({nowarn_unused_function,e_type_sint/3}). -e_type_sint(Value, Bin, _TrUserData) when Value >= 0 -> e_varint(Value * 2, Bin); -e_type_sint(Value, Bin, _TrUserData) -> e_varint(Value * -2 - 1, Bin). - --compile({nowarn_unused_function,e_type_int32/3}). -e_type_int32(Value, Bin, _TrUserData) when 0 =< Value, Value =< 127 -> <>; -e_type_int32(Value, Bin, _TrUserData) -> - <> = <>, - e_varint(N, Bin). - --compile({nowarn_unused_function,e_type_int64/3}). -e_type_int64(Value, Bin, _TrUserData) when 0 =< Value, Value =< 127 -> <>; -e_type_int64(Value, Bin, _TrUserData) -> - <> = <>, - e_varint(N, Bin). - --compile({nowarn_unused_function,e_type_bool/3}). -e_type_bool(true, Bin, _TrUserData) -> <>; -e_type_bool(false, Bin, _TrUserData) -> <>; -e_type_bool(1, Bin, _TrUserData) -> <>; -e_type_bool(0, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_string/3}). -e_type_string(S, Bin, _TrUserData) -> - Utf8 = unicode:characters_to_binary(S), - Bin2 = e_varint(byte_size(Utf8), Bin), - <>. - --compile({nowarn_unused_function,e_type_bytes/3}). -e_type_bytes(Bytes, Bin, _TrUserData) when is_binary(Bytes) -> - Bin2 = e_varint(byte_size(Bytes), Bin), - <>; -e_type_bytes(Bytes, Bin, _TrUserData) when is_list(Bytes) -> - BytesBin = iolist_to_binary(Bytes), - Bin2 = e_varint(byte_size(BytesBin), Bin), - <>. - --compile({nowarn_unused_function,e_type_fixed32/3}). -e_type_fixed32(Value, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_sfixed32/3}). -e_type_sfixed32(Value, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_fixed64/3}). -e_type_fixed64(Value, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_sfixed64/3}). -e_type_sfixed64(Value, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_float/3}). -e_type_float(V, Bin, _) when is_number(V) -> <>; -e_type_float(infinity, Bin, _) -> <>; -e_type_float('-infinity', Bin, _) -> <>; -e_type_float(nan, Bin, _) -> <>. - --compile({nowarn_unused_function,e_type_double/3}). -e_type_double(V, Bin, _) when is_number(V) -> <>; -e_type_double(infinity, Bin, _) -> <>; -e_type_double('-infinity', Bin, _) -> <>; -e_type_double(nan, Bin, _) -> <>. - --compile({nowarn_unused_function,e_unknown_elems/2}). -e_unknown_elems([Elem | Rest], Bin) -> - BinR = case Elem of - {varint, FNum, N} -> - BinF = e_varint(FNum bsl 3, Bin), - e_varint(N, BinF); - {length_delimited, FNum, Data} -> - BinF = e_varint(FNum bsl 3 bor 2, Bin), - BinL = e_varint(byte_size(Data), BinF), - <>; - {group, FNum, GroupFields} -> - Bin1 = e_varint(FNum bsl 3 bor 3, Bin), - Bin2 = e_unknown_elems(GroupFields, Bin1), - e_varint(FNum bsl 3 bor 4, Bin2); - {fixed32, FNum, V} -> - BinF = e_varint(FNum bsl 3 bor 5, Bin), - <>; - {fixed64, FNum, V} -> - BinF = e_varint(FNum bsl 3 bor 1, Bin), - <> - end, - e_unknown_elems(Rest, BinR); -e_unknown_elems([], Bin) -> Bin. - --compile({nowarn_unused_function,e_varint/3}). -e_varint(N, Bin, _TrUserData) -> e_varint(N, Bin). - --compile({nowarn_unused_function,e_varint/2}). -e_varint(N, Bin) when N =< 127 -> <>; -e_varint(N, Bin) -> - Bin2 = <>, - e_varint(N bsr 7, Bin2). - -is_empty_string("") -> true; -is_empty_string(<<>>) -> true; -is_empty_string(L) when is_list(L) -> not string_has_chars(L); -is_empty_string(B) when is_binary(B) -> false. - -string_has_chars([C | _]) when is_integer(C) -> true; -string_has_chars([H | T]) -> - case string_has_chars(H) of - true -> true; - false -> string_has_chars(T) - end; -string_has_chars(B) when is_binary(B), byte_size(B) =/= 0 -> true; -string_has_chars(C) when is_integer(C) -> true; -string_has_chars(<<>>) -> false; -string_has_chars([]) -> false. - - -decode_msg(Bin, MsgName) when is_binary(Bin) -> decode_msg(Bin, MsgName, []). - -decode_msg(Bin, MsgName, Opts) when is_binary(Bin) -> - TrUserData = proplists:get_value(user_data, Opts), - decode_msg_1_catch(Bin, MsgName, TrUserData). - --ifdef('OTP_RELEASE'). -decode_msg_1_catch(Bin, MsgName, TrUserData) -> - try decode_msg_2_doit(MsgName, Bin, TrUserData) - catch - error:{gpb_error,_}=Reason:StackTrace -> - erlang:raise(error, Reason, StackTrace); - Class:Reason:StackTrace -> error({gpb_error,{decoding_failure, {Bin, MsgName, {Class, Reason, StackTrace}}}}) - end. --else. -decode_msg_1_catch(Bin, MsgName, TrUserData) -> - try decode_msg_2_doit(MsgName, Bin, TrUserData) - catch - error:{gpb_error,_}=Reason -> - erlang:raise(error, Reason, - erlang:get_stacktrace()); - Class:Reason -> - StackTrace = erlang:get_stacktrace(), - error({gpb_error,{decoding_failure, {Bin, MsgName, {Class, Reason, StackTrace}}}}) - end. --endif. - -decode_msg_2_doit(create_bootstrap_token_request, Bin, TrUserData) -> id(decode_msg_create_bootstrap_token_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(create_bootstrap_token_response, Bin, TrUserData) -> id(decode_msg_create_bootstrap_token_response(Bin, TrUserData), TrUserData); -decode_msg_2_doit(host, Bin, TrUserData) -> id(decode_msg_host(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_hosts_request, Bin, TrUserData) -> id(decode_msg_list_hosts_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_hosts_response, Bin, TrUserData) -> id(decode_msg_list_hosts_response(Bin, TrUserData), TrUserData); -decode_msg_2_doit(register_host_request, Bin, TrUserData) -> id(decode_msg_register_host_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(heartbeat_request, Bin, TrUserData) -> id(decode_msg_heartbeat_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(heartbeat_response, Bin, TrUserData) -> id(decode_msg_heartbeat_response(Bin, TrUserData), TrUserData); -decode_msg_2_doit(empty, Bin, TrUserData) -> id(decode_msg_empty(Bin, TrUserData), TrUserData). - - - -decode_msg_create_bootstrap_token_request(Bin, TrUserData) -> dfp_read_field_def_create_bootstrap_token_request(Bin, 0, 0, 0, id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_create_bootstrap_token_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_create_bootstrap_token_request_expires_at(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_create_bootstrap_token_request(<<>>, 0, 0, _, F@_1, _) -> #{expires_at => F@_1}; -dfp_read_field_def_create_bootstrap_token_request(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_create_bootstrap_token_request(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_create_bootstrap_token_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_create_bootstrap_token_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_create_bootstrap_token_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_create_bootstrap_token_request_expires_at(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_create_bootstrap_token_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_create_bootstrap_token_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_create_bootstrap_token_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_create_bootstrap_token_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_create_bootstrap_token_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_create_bootstrap_token_request(<<>>, 0, 0, _, F@_1, _) -> #{expires_at => F@_1}. - -d_field_create_bootstrap_token_request_expires_at(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_create_bootstrap_token_request_expires_at(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_create_bootstrap_token_request_expires_at(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_create_bootstrap_token_request(RestF, 0, 0, F, NewFValue, TrUserData). - -skip_varint_create_bootstrap_token_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_create_bootstrap_token_request(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_create_bootstrap_token_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_create_bootstrap_token_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_create_bootstrap_token_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_create_bootstrap_token_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_create_bootstrap_token_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_create_bootstrap_token_request(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_create_bootstrap_token_request(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_create_bootstrap_token_request(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_create_bootstrap_token_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_create_bootstrap_token_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_create_bootstrap_token_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_create_bootstrap_token_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_create_bootstrap_token_response(Bin, TrUserData) -> dfp_read_field_def_create_bootstrap_token_response(Bin, 0, 0, 0, id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_create_bootstrap_token_response(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_create_bootstrap_token_response_token(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_create_bootstrap_token_response(<<>>, 0, 0, _, F@_1, _) -> #{token => F@_1}; -dfp_read_field_def_create_bootstrap_token_response(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_create_bootstrap_token_response(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_create_bootstrap_token_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_create_bootstrap_token_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_create_bootstrap_token_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_create_bootstrap_token_response_token(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_create_bootstrap_token_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_create_bootstrap_token_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_create_bootstrap_token_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_create_bootstrap_token_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_create_bootstrap_token_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_create_bootstrap_token_response(<<>>, 0, 0, _, F@_1, _) -> #{token => F@_1}. - -d_field_create_bootstrap_token_response_token(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_create_bootstrap_token_response_token(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_create_bootstrap_token_response_token(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_create_bootstrap_token_response(RestF, 0, 0, F, NewFValue, TrUserData). - -skip_varint_create_bootstrap_token_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_create_bootstrap_token_response(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_create_bootstrap_token_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_create_bootstrap_token_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_create_bootstrap_token_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_create_bootstrap_token_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_create_bootstrap_token_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_create_bootstrap_token_response(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_create_bootstrap_token_response(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_create_bootstrap_token_response(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_create_bootstrap_token_response(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_create_bootstrap_token_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_create_bootstrap_token_response(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_create_bootstrap_token_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_host(Bin, TrUserData) -> dfp_read_field_def_host(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_host(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_host_name(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_host(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_host_address(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_host(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{name => F@_1, address => F@_2}; -dfp_read_field_def_host(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_host(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_host(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_host_name(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_host_address(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_host(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_host(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_host(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_host(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_host(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_host(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{name => F@_1, address => F@_2}. - -d_field_host_name(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_host_name(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_host_name(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_host(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_host_address(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_host_address(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_host_address(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_host(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_host(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_host(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_host(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_host(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_host(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_host(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_host(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_list_hosts_request(Bin, TrUserData) -> dfp_read_field_def_list_hosts_request(Bin, 0, 0, 0, TrUserData). - -dfp_read_field_def_list_hosts_request(<<>>, 0, 0, _, _) -> #{}; -dfp_read_field_def_list_hosts_request(Other, Z1, Z2, F, TrUserData) -> dg_read_field_def_list_hosts_request(Other, Z1, Z2, F, TrUserData). - -dg_read_field_def_list_hosts_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_hosts_request(Rest, N + 7, X bsl N + Acc, F, TrUserData); -dg_read_field_def_list_hosts_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, TrUserData) -> - Key = X bsl N + Acc, - case Key band 7 of - 0 -> skip_varint_list_hosts_request(Rest, 0, 0, Key bsr 3, TrUserData); - 1 -> skip_64_list_hosts_request(Rest, 0, 0, Key bsr 3, TrUserData); - 2 -> skip_length_delimited_list_hosts_request(Rest, 0, 0, Key bsr 3, TrUserData); - 3 -> skip_group_list_hosts_request(Rest, 0, 0, Key bsr 3, TrUserData); - 5 -> skip_32_list_hosts_request(Rest, 0, 0, Key bsr 3, TrUserData) - end; -dg_read_field_def_list_hosts_request(<<>>, 0, 0, _, _) -> #{}. - -skip_varint_list_hosts_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> skip_varint_list_hosts_request(Rest, Z1, Z2, F, TrUserData); -skip_varint_list_hosts_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_list_hosts_request(Rest, Z1, Z2, F, TrUserData). - -skip_length_delimited_list_hosts_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 57 -> skip_length_delimited_list_hosts_request(Rest, N + 7, X bsl N + Acc, F, TrUserData); -skip_length_delimited_list_hosts_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_hosts_request(Rest2, 0, 0, F, TrUserData). - -skip_group_list_hosts_request(Bin, _, Z2, FNum, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_hosts_request(Rest, 0, Z2, FNum, TrUserData). - -skip_32_list_hosts_request(<<_:32, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_list_hosts_request(Rest, Z1, Z2, F, TrUserData). - -skip_64_list_hosts_request(<<_:64, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_list_hosts_request(Rest, Z1, Z2, F, TrUserData). - -decode_msg_list_hosts_response(Bin, TrUserData) -> dfp_read_field_def_list_hosts_response(Bin, 0, 0, 0, id([], TrUserData), TrUserData). - -dfp_read_field_def_list_hosts_response(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_hosts_response_hosts(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_list_hosts_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{hosts => lists_reverse(R1, TrUserData)} - end; -dfp_read_field_def_list_hosts_response(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_hosts_response(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_list_hosts_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_hosts_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_list_hosts_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_hosts_response_hosts(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_hosts_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_list_hosts_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_list_hosts_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_list_hosts_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_list_hosts_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_list_hosts_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{hosts => lists_reverse(R1, TrUserData)} - end. - -d_field_list_hosts_response_hosts(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_hosts_response_hosts(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_list_hosts_response_hosts(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_host(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_list_hosts_response(RestF, 0, 0, F, cons(NewFValue, Prev, TrUserData), TrUserData). - -skip_varint_list_hosts_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_hosts_response(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_list_hosts_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_hosts_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_list_hosts_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_hosts_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_list_hosts_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_hosts_response(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_list_hosts_response(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_hosts_response(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_list_hosts_response(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_hosts_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_list_hosts_response(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_hosts_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_register_host_request(Bin, TrUserData) -> dfp_read_field_def_register_host_request(Bin, 0, 0, 0, id('$undef', TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_register_host_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_register_host_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_register_host_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_register_host_request_token(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_register_host_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> - S1 = #{token => F@_2}, - if F@_1 == '$undef' -> S1; - true -> S1#{host => F@_1} - end; -dfp_read_field_def_register_host_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_register_host_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_register_host_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_register_host_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_register_host_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_register_host_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_register_host_request_token(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_register_host_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_register_host_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_register_host_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_register_host_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_register_host_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_register_host_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> - S1 = #{token => F@_2}, - if F@_1 == '$undef' -> S1; - true -> S1#{host => F@_1} - end. - -d_field_register_host_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_register_host_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_register_host_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_host(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_register_host_request(RestF, - 0, - 0, - F, - if Prev == '$undef' -> NewFValue; - true -> merge_msg_host(Prev, NewFValue, TrUserData) - end, - F@_2, - TrUserData). - -d_field_register_host_request_token(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_register_host_request_token(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_register_host_request_token(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_register_host_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_register_host_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_register_host_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_register_host_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_register_host_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_register_host_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_register_host_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_register_host_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_register_host_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_register_host_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_register_host_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_register_host_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_register_host_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_register_host_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_register_host_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_heartbeat_request(Bin, TrUserData) -> dfp_read_field_def_heartbeat_request(Bin, 0, 0, 0, id('$undef', TrUserData), TrUserData). - -dfp_read_field_def_heartbeat_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_heartbeat_request_host(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_heartbeat_request(<<>>, 0, 0, _, F@_1, _) -> - S1 = #{}, - if F@_1 == '$undef' -> S1; - true -> S1#{host => F@_1} - end; -dfp_read_field_def_heartbeat_request(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_heartbeat_request(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_heartbeat_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_heartbeat_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_heartbeat_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_heartbeat_request_host(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_heartbeat_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_heartbeat_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_heartbeat_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_heartbeat_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_heartbeat_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_heartbeat_request(<<>>, 0, 0, _, F@_1, _) -> - S1 = #{}, - if F@_1 == '$undef' -> S1; - true -> S1#{host => F@_1} - end. - -d_field_heartbeat_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_heartbeat_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_heartbeat_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_host(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_heartbeat_request(RestF, - 0, - 0, - F, - if Prev == '$undef' -> NewFValue; - true -> merge_msg_host(Prev, NewFValue, TrUserData) - end, - TrUserData). - -skip_varint_heartbeat_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_heartbeat_request(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_heartbeat_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_heartbeat_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_heartbeat_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_heartbeat_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_heartbeat_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_heartbeat_request(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_heartbeat_request(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_heartbeat_request(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_heartbeat_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_heartbeat_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_heartbeat_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_heartbeat_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_heartbeat_response(Bin, TrUserData) -> dfp_read_field_def_heartbeat_response(Bin, 0, 0, 0, TrUserData). - -dfp_read_field_def_heartbeat_response(<<>>, 0, 0, _, _) -> #{}; -dfp_read_field_def_heartbeat_response(Other, Z1, Z2, F, TrUserData) -> dg_read_field_def_heartbeat_response(Other, Z1, Z2, F, TrUserData). - -dg_read_field_def_heartbeat_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 32 - 7 -> dg_read_field_def_heartbeat_response(Rest, N + 7, X bsl N + Acc, F, TrUserData); -dg_read_field_def_heartbeat_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, TrUserData) -> - Key = X bsl N + Acc, - case Key band 7 of - 0 -> skip_varint_heartbeat_response(Rest, 0, 0, Key bsr 3, TrUserData); - 1 -> skip_64_heartbeat_response(Rest, 0, 0, Key bsr 3, TrUserData); - 2 -> skip_length_delimited_heartbeat_response(Rest, 0, 0, Key bsr 3, TrUserData); - 3 -> skip_group_heartbeat_response(Rest, 0, 0, Key bsr 3, TrUserData); - 5 -> skip_32_heartbeat_response(Rest, 0, 0, Key bsr 3, TrUserData) - end; -dg_read_field_def_heartbeat_response(<<>>, 0, 0, _, _) -> #{}. - -skip_varint_heartbeat_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> skip_varint_heartbeat_response(Rest, Z1, Z2, F, TrUserData); -skip_varint_heartbeat_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_heartbeat_response(Rest, Z1, Z2, F, TrUserData). - -skip_length_delimited_heartbeat_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 57 -> skip_length_delimited_heartbeat_response(Rest, N + 7, X bsl N + Acc, F, TrUserData); -skip_length_delimited_heartbeat_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_heartbeat_response(Rest2, 0, 0, F, TrUserData). - -skip_group_heartbeat_response(Bin, _, Z2, FNum, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_heartbeat_response(Rest, 0, Z2, FNum, TrUserData). - -skip_32_heartbeat_response(<<_:32, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_heartbeat_response(Rest, Z1, Z2, F, TrUserData). - -skip_64_heartbeat_response(<<_:64, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_heartbeat_response(Rest, Z1, Z2, F, TrUserData). - -decode_msg_empty(Bin, TrUserData) -> dfp_read_field_def_empty(Bin, 0, 0, 0, TrUserData). - -dfp_read_field_def_empty(<<>>, 0, 0, _, _) -> #{}; -dfp_read_field_def_empty(Other, Z1, Z2, F, TrUserData) -> dg_read_field_def_empty(Other, Z1, Z2, F, TrUserData). - -dg_read_field_def_empty(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 32 - 7 -> dg_read_field_def_empty(Rest, N + 7, X bsl N + Acc, F, TrUserData); -dg_read_field_def_empty(<<0:1, X:7, Rest/binary>>, N, Acc, _, TrUserData) -> - Key = X bsl N + Acc, - case Key band 7 of - 0 -> skip_varint_empty(Rest, 0, 0, Key bsr 3, TrUserData); - 1 -> skip_64_empty(Rest, 0, 0, Key bsr 3, TrUserData); - 2 -> skip_length_delimited_empty(Rest, 0, 0, Key bsr 3, TrUserData); - 3 -> skip_group_empty(Rest, 0, 0, Key bsr 3, TrUserData); - 5 -> skip_32_empty(Rest, 0, 0, Key bsr 3, TrUserData) - end; -dg_read_field_def_empty(<<>>, 0, 0, _, _) -> #{}. - -skip_varint_empty(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> skip_varint_empty(Rest, Z1, Z2, F, TrUserData); -skip_varint_empty(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_empty(Rest, Z1, Z2, F, TrUserData). - -skip_length_delimited_empty(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 57 -> skip_length_delimited_empty(Rest, N + 7, X bsl N + Acc, F, TrUserData); -skip_length_delimited_empty(<<0:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_empty(Rest2, 0, 0, F, TrUserData). - -skip_group_empty(Bin, _, Z2, FNum, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_empty(Rest, 0, Z2, FNum, TrUserData). - -skip_32_empty(<<_:32, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_empty(Rest, Z1, Z2, F, TrUserData). - -skip_64_empty(<<_:64, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_empty(Rest, Z1, Z2, F, TrUserData). - -read_group(Bin, FieldNum) -> - {NumBytes, EndTagLen} = read_gr_b(Bin, 0, 0, 0, 0, FieldNum), - <> = Bin, - {Group, Rest}. - -%% Like skipping over fields, but record the total length, -%% Each field is <(FieldNum bsl 3) bor FieldType> ++ -%% Record the length because varints may be non-optimally encoded. -%% -%% Groups can be nested, but assume the same FieldNum cannot be nested -%% because group field numbers are shared with the rest of the fields -%% numbers. Thus we can search just for an group-end with the same -%% field number. -%% -%% (The only time the same group field number could occur would -%% be in a nested sub message, but then it would be inside a -%% length-delimited entry, which we skip-read by length.) -read_gr_b(<<1:1, X:7, Tl/binary>>, N, Acc, NumBytes, TagLen, FieldNum) - when N < (32-7) -> - read_gr_b(Tl, N+7, X bsl N + Acc, NumBytes, TagLen+1, FieldNum); -read_gr_b(<<0:1, X:7, Tl/binary>>, N, Acc, NumBytes, TagLen, - FieldNum) -> - Key = X bsl N + Acc, - TagLen1 = TagLen + 1, - case {Key bsr 3, Key band 7} of - {FieldNum, 4} -> % 4 = group_end - {NumBytes, TagLen1}; - {_, 0} -> % 0 = varint - read_gr_vi(Tl, 0, NumBytes + TagLen1, FieldNum); - {_, 1} -> % 1 = bits64 - <<_:64, Tl2/binary>> = Tl, - read_gr_b(Tl2, 0, 0, NumBytes + TagLen1 + 8, 0, FieldNum); - {_, 2} -> % 2 = length_delimited - read_gr_ld(Tl, 0, 0, NumBytes + TagLen1, FieldNum); - {_, 3} -> % 3 = group_start - read_gr_b(Tl, 0, 0, NumBytes + TagLen1, 0, FieldNum); - {_, 4} -> % 4 = group_end - read_gr_b(Tl, 0, 0, NumBytes + TagLen1, 0, FieldNum); - {_, 5} -> % 5 = bits32 - <<_:32, Tl2/binary>> = Tl, - read_gr_b(Tl2, 0, 0, NumBytes + TagLen1 + 4, 0, FieldNum) - end. - -read_gr_vi(<<1:1, _:7, Tl/binary>>, N, NumBytes, FieldNum) - when N < (64-7) -> - read_gr_vi(Tl, N+7, NumBytes+1, FieldNum); -read_gr_vi(<<0:1, _:7, Tl/binary>>, _, NumBytes, FieldNum) -> - read_gr_b(Tl, 0, 0, NumBytes+1, 0, FieldNum). - -read_gr_ld(<<1:1, X:7, Tl/binary>>, N, Acc, NumBytes, FieldNum) - when N < (64-7) -> - read_gr_ld(Tl, N+7, X bsl N + Acc, NumBytes+1, FieldNum); -read_gr_ld(<<0:1, X:7, Tl/binary>>, N, Acc, NumBytes, FieldNum) -> - Len = X bsl N + Acc, - NumBytes1 = NumBytes + 1, - <<_:Len/binary, Tl2/binary>> = Tl, - read_gr_b(Tl2, 0, 0, NumBytes1 + Len, 0, FieldNum). - -merge_msgs(Prev, New, MsgName) when is_atom(MsgName) -> merge_msgs(Prev, New, MsgName, []). - -merge_msgs(Prev, New, MsgName, Opts) -> - TrUserData = proplists:get_value(user_data, Opts), - case MsgName of - create_bootstrap_token_request -> merge_msg_create_bootstrap_token_request(Prev, New, TrUserData); - create_bootstrap_token_response -> merge_msg_create_bootstrap_token_response(Prev, New, TrUserData); - host -> merge_msg_host(Prev, New, TrUserData); - list_hosts_request -> merge_msg_list_hosts_request(Prev, New, TrUserData); - list_hosts_response -> merge_msg_list_hosts_response(Prev, New, TrUserData); - register_host_request -> merge_msg_register_host_request(Prev, New, TrUserData); - heartbeat_request -> merge_msg_heartbeat_request(Prev, New, TrUserData); - heartbeat_response -> merge_msg_heartbeat_response(Prev, New, TrUserData); - empty -> merge_msg_empty(Prev, New, TrUserData) - end. - --compile({nowarn_unused_function,merge_msg_create_bootstrap_token_request/3}). -merge_msg_create_bootstrap_token_request(PMsg, NMsg, _) -> - S1 = #{}, - case {PMsg, NMsg} of - {_, #{expires_at := NFexpires_at}} -> S1#{expires_at => NFexpires_at}; - {#{expires_at := PFexpires_at}, _} -> S1#{expires_at => PFexpires_at}; - _ -> S1 - end. - --compile({nowarn_unused_function,merge_msg_create_bootstrap_token_response/3}). -merge_msg_create_bootstrap_token_response(PMsg, NMsg, _) -> - S1 = #{}, - case {PMsg, NMsg} of - {_, #{token := NFtoken}} -> S1#{token => NFtoken}; - {#{token := PFtoken}, _} -> S1#{token => PFtoken}; - _ -> S1 - end. - --compile({nowarn_unused_function,merge_msg_host/3}). -merge_msg_host(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{name := NFname}} -> S1#{name => NFname}; - {#{name := PFname}, _} -> S1#{name => PFname}; - _ -> S1 - end, - case {PMsg, NMsg} of - {_, #{address := NFaddress}} -> S2#{address => NFaddress}; - {#{address := PFaddress}, _} -> S2#{address => PFaddress}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_list_hosts_request/3}). -merge_msg_list_hosts_request(_Prev, New, _TrUserData) -> New. - --compile({nowarn_unused_function,merge_msg_list_hosts_response/3}). -merge_msg_list_hosts_response(PMsg, NMsg, TrUserData) -> - S1 = #{}, - case {PMsg, NMsg} of - {#{hosts := PFhosts}, #{hosts := NFhosts}} -> S1#{hosts => 'erlang_++'(PFhosts, NFhosts, TrUserData)}; - {_, #{hosts := NFhosts}} -> S1#{hosts => NFhosts}; - {#{hosts := PFhosts}, _} -> S1#{hosts => PFhosts}; - {_, _} -> S1 - end. - --compile({nowarn_unused_function,merge_msg_register_host_request/3}). -merge_msg_register_host_request(PMsg, NMsg, TrUserData) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {#{host := PFhost}, #{host := NFhost}} -> S1#{host => merge_msg_host(PFhost, NFhost, TrUserData)}; - {_, #{host := NFhost}} -> S1#{host => NFhost}; - {#{host := PFhost}, _} -> S1#{host => PFhost}; - {_, _} -> S1 - end, - case {PMsg, NMsg} of - {_, #{token := NFtoken}} -> S2#{token => NFtoken}; - {#{token := PFtoken}, _} -> S2#{token => PFtoken}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_heartbeat_request/3}). -merge_msg_heartbeat_request(PMsg, NMsg, TrUserData) -> - S1 = #{}, - case {PMsg, NMsg} of - {#{host := PFhost}, #{host := NFhost}} -> S1#{host => merge_msg_host(PFhost, NFhost, TrUserData)}; - {_, #{host := NFhost}} -> S1#{host => NFhost}; - {#{host := PFhost}, _} -> S1#{host => PFhost}; - {_, _} -> S1 - end. - --compile({nowarn_unused_function,merge_msg_heartbeat_response/3}). -merge_msg_heartbeat_response(_Prev, New, _TrUserData) -> New. - --compile({nowarn_unused_function,merge_msg_empty/3}). -merge_msg_empty(_Prev, New, _TrUserData) -> New. - - -verify_msg(Msg, MsgName) when is_atom(MsgName) -> verify_msg(Msg, MsgName, []). - -verify_msg(Msg, MsgName, Opts) -> - TrUserData = proplists:get_value(user_data, Opts), - case MsgName of - create_bootstrap_token_request -> v_msg_create_bootstrap_token_request(Msg, [MsgName], TrUserData); - create_bootstrap_token_response -> v_msg_create_bootstrap_token_response(Msg, [MsgName], TrUserData); - host -> v_msg_host(Msg, [MsgName], TrUserData); - list_hosts_request -> v_msg_list_hosts_request(Msg, [MsgName], TrUserData); - list_hosts_response -> v_msg_list_hosts_response(Msg, [MsgName], TrUserData); - register_host_request -> v_msg_register_host_request(Msg, [MsgName], TrUserData); - heartbeat_request -> v_msg_heartbeat_request(Msg, [MsgName], TrUserData); - heartbeat_response -> v_msg_heartbeat_response(Msg, [MsgName], TrUserData); - empty -> v_msg_empty(Msg, [MsgName], TrUserData); - _ -> mk_type_error(not_a_known_message, Msg, []) - end. - - --compile({nowarn_unused_function,v_msg_create_bootstrap_token_request/3}). --dialyzer({nowarn_function,v_msg_create_bootstrap_token_request/3}). -v_msg_create_bootstrap_token_request(#{} = M, Path, TrUserData) -> - case M of - #{expires_at := F1} -> v_type_string(F1, [expires_at | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (expires_at) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_create_bootstrap_token_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), create_bootstrap_token_request}, M, Path); -v_msg_create_bootstrap_token_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, create_bootstrap_token_request}, X, Path). - --compile({nowarn_unused_function,v_msg_create_bootstrap_token_response/3}). --dialyzer({nowarn_function,v_msg_create_bootstrap_token_response/3}). -v_msg_create_bootstrap_token_response(#{} = M, Path, TrUserData) -> - case M of - #{token := F1} -> v_type_string(F1, [token | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (token) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_create_bootstrap_token_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), create_bootstrap_token_response}, M, Path); -v_msg_create_bootstrap_token_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, create_bootstrap_token_response}, X, Path). - --compile({nowarn_unused_function,v_msg_host/3}). --dialyzer({nowarn_function,v_msg_host/3}). -v_msg_host(#{} = M, Path, TrUserData) -> - case M of - #{name := F1} -> v_type_string(F1, [name | Path], TrUserData); - _ -> ok - end, - case M of - #{address := F2} -> v_type_string(F2, [address | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (name) -> ok; - (address) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_host(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), host}, M, Path); -v_msg_host(X, Path, _TrUserData) -> mk_type_error({expected_msg, host}, X, Path). - --compile({nowarn_unused_function,v_msg_list_hosts_request/3}). --dialyzer({nowarn_function,v_msg_list_hosts_request/3}). -v_msg_list_hosts_request(#{} = M, Path, _) -> - lists:foreach(fun (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) end, maps:keys(M)), - ok; -v_msg_list_hosts_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_hosts_request}, M, Path); -v_msg_list_hosts_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_hosts_request}, X, Path). - --compile({nowarn_unused_function,v_msg_list_hosts_response/3}). --dialyzer({nowarn_function,v_msg_list_hosts_response/3}). -v_msg_list_hosts_response(#{} = M, Path, TrUserData) -> - case M of - #{hosts := F1} -> - if is_list(F1) -> - _ = [v_msg_host(Elem, [hosts | Path], TrUserData) || Elem <- F1], - ok; - true -> mk_type_error({invalid_list_of, {msg, host}}, F1, [hosts | Path]) - end; - _ -> ok - end, - lists:foreach(fun (hosts) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_hosts_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_hosts_response}, M, Path); -v_msg_list_hosts_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_hosts_response}, X, Path). - --compile({nowarn_unused_function,v_msg_register_host_request/3}). --dialyzer({nowarn_function,v_msg_register_host_request/3}). -v_msg_register_host_request(#{} = M, Path, TrUserData) -> - case M of - #{host := F1} -> v_msg_host(F1, [host | Path], TrUserData); - _ -> ok - end, - case M of - #{token := F2} -> v_type_string(F2, [token | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (host) -> ok; - (token) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_register_host_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), register_host_request}, M, Path); -v_msg_register_host_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, register_host_request}, X, Path). - --compile({nowarn_unused_function,v_msg_heartbeat_request/3}). --dialyzer({nowarn_function,v_msg_heartbeat_request/3}). -v_msg_heartbeat_request(#{} = M, Path, TrUserData) -> - case M of - #{host := F1} -> v_msg_host(F1, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_heartbeat_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), heartbeat_request}, M, Path); -v_msg_heartbeat_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, heartbeat_request}, X, Path). - --compile({nowarn_unused_function,v_msg_heartbeat_response/3}). --dialyzer({nowarn_function,v_msg_heartbeat_response/3}). -v_msg_heartbeat_response(#{} = M, Path, _) -> - lists:foreach(fun (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) end, maps:keys(M)), - ok; -v_msg_heartbeat_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), heartbeat_response}, M, Path); -v_msg_heartbeat_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, heartbeat_response}, X, Path). - --compile({nowarn_unused_function,v_msg_empty/3}). --dialyzer({nowarn_function,v_msg_empty/3}). -v_msg_empty(#{} = M, Path, _) -> - lists:foreach(fun (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) end, maps:keys(M)), - ok; -v_msg_empty(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), empty}, M, Path); -v_msg_empty(X, Path, _TrUserData) -> mk_type_error({expected_msg, empty}, X, Path). - --compile({nowarn_unused_function,v_type_string/3}). --dialyzer({nowarn_function,v_type_string/3}). -v_type_string(S, Path, _TrUserData) when is_list(S); is_binary(S) -> - try unicode:characters_to_binary(S) of - B when is_binary(B) -> ok; - {error, _, _} -> mk_type_error(bad_unicode_string, S, Path) - catch - error:badarg -> mk_type_error(bad_unicode_string, S, Path) - end; -v_type_string(X, Path, _TrUserData) -> mk_type_error(bad_unicode_string, X, Path). - --compile({nowarn_unused_function,mk_type_error/3}). --spec mk_type_error(_, _, list()) -> no_return(). -mk_type_error(Error, ValueSeen, Path) -> - Path2 = prettify_path(Path), - erlang:error({gpb_type_error, {Error, [{value, ValueSeen}, {path, Path2}]}}). - - --compile({nowarn_unused_function,prettify_path/1}). --dialyzer({nowarn_function,prettify_path/1}). -prettify_path([]) -> top_level; -prettify_path(PathR) -> lists:append(lists:join(".", lists:map(fun atom_to_list/1, lists:reverse(PathR)))). - - --compile({nowarn_unused_function,id/2}). --compile({inline,id/2}). -id(X, _TrUserData) -> X. - --compile({nowarn_unused_function,v_ok/3}). --compile({inline,v_ok/3}). -v_ok(_Value, _Path, _TrUserData) -> ok. - --compile({nowarn_unused_function,m_overwrite/3}). --compile({inline,m_overwrite/3}). -m_overwrite(_Prev, New, _TrUserData) -> New. - --compile({nowarn_unused_function,cons/3}). --compile({inline,cons/3}). -cons(Elem, Acc, _TrUserData) -> [Elem | Acc]. - --compile({nowarn_unused_function,lists_reverse/2}). --compile({inline,lists_reverse/2}). -'lists_reverse'(L, _TrUserData) -> lists:reverse(L). --compile({nowarn_unused_function,'erlang_++'/3}). --compile({inline,'erlang_++'/3}). -'erlang_++'(A, B, _TrUserData) -> A ++ B. - - -get_msg_defs() -> - [{{msg, create_bootstrap_token_request}, [#{name => expires_at, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]}, - {{msg, create_bootstrap_token_response}, [#{name => token, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]}, - {{msg, host}, [#{name => name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => address, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, list_hosts_request}, []}, - {{msg, list_hosts_response}, [#{name => hosts, fnum => 1, rnum => 2, type => {msg, host}, occurrence => repeated, opts => []}]}, - {{msg, register_host_request}, [#{name => host, fnum => 1, rnum => 2, type => {msg, host}, occurrence => optional, opts => []}, #{name => token, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, heartbeat_request}, [#{name => host, fnum => 1, rnum => 2, type => {msg, host}, occurrence => optional, opts => []}]}, - {{msg, heartbeat_response}, []}, - {{msg, empty}, []}]. - - -get_msg_names() -> [create_bootstrap_token_request, create_bootstrap_token_response, host, list_hosts_request, list_hosts_response, register_host_request, heartbeat_request, heartbeat_response, empty]. - - -get_group_names() -> []. - - -get_msg_or_group_names() -> [create_bootstrap_token_request, create_bootstrap_token_response, host, list_hosts_request, list_hosts_response, register_host_request, heartbeat_request, heartbeat_response, empty]. - - -get_enum_names() -> []. - - -fetch_msg_def(MsgName) -> - case find_msg_def(MsgName) of - Fs when is_list(Fs) -> Fs; - error -> erlang:error({no_such_msg, MsgName}) - end. - - --spec fetch_enum_def(_) -> no_return(). -fetch_enum_def(EnumName) -> erlang:error({no_such_enum, EnumName}). - - -find_msg_def(create_bootstrap_token_request) -> [#{name => expires_at, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]; -find_msg_def(create_bootstrap_token_response) -> [#{name => token, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]; -find_msg_def(host) -> [#{name => name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => address, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(list_hosts_request) -> []; -find_msg_def(list_hosts_response) -> [#{name => hosts, fnum => 1, rnum => 2, type => {msg, host}, occurrence => repeated, opts => []}]; -find_msg_def(register_host_request) -> [#{name => host, fnum => 1, rnum => 2, type => {msg, host}, occurrence => optional, opts => []}, #{name => token, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(heartbeat_request) -> [#{name => host, fnum => 1, rnum => 2, type => {msg, host}, occurrence => optional, opts => []}]; -find_msg_def(heartbeat_response) -> []; -find_msg_def(empty) -> []; -find_msg_def(_) -> error. - - -find_enum_def(_) -> error. - - --spec enum_symbol_by_value(_, _) -> no_return(). -enum_symbol_by_value(E, V) -> erlang:error({no_enum_defs, E, V}). - - --spec enum_value_by_symbol(_, _) -> no_return(). -enum_value_by_symbol(E, V) -> erlang:error({no_enum_defs, E, V}). - - - -get_service_names() -> ['HostService']. - - -get_service_def('HostService') -> - {{service, 'HostService'}, - [#{name => 'CreateBootstrapToken', input => create_bootstrap_token_request, output => create_bootstrap_token_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'GetHost', input => host, output => host, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListHosts', input => list_hosts_request, output => list_hosts_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'Register', input => register_host_request, output => host, input_stream => false, output_stream => false, opts => []}, - #{name => 'Deregister', input => host, output => empty, input_stream => false, output_stream => false, opts => []}, - #{name => 'Heartbeat', input => heartbeat_request, output => heartbeat_response, input_stream => false, output_stream => false, opts => []}]}; -get_service_def(_) -> error. - - -get_rpc_names('HostService') -> ['CreateBootstrapToken', 'GetHost', 'ListHosts', 'Register', 'Deregister', 'Heartbeat']; -get_rpc_names(_) -> error. - - -find_rpc_def('HostService', RpcName) -> find_rpc_def_HostService(RpcName); -find_rpc_def(_, _) -> error. - - -find_rpc_def_HostService('CreateBootstrapToken') -> #{name => 'CreateBootstrapToken', input => create_bootstrap_token_request, output => create_bootstrap_token_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_HostService('GetHost') -> #{name => 'GetHost', input => host, output => host, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_HostService('ListHosts') -> #{name => 'ListHosts', input => list_hosts_request, output => list_hosts_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_HostService('Register') -> #{name => 'Register', input => register_host_request, output => host, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_HostService('Deregister') -> #{name => 'Deregister', input => host, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_HostService('Heartbeat') -> #{name => 'Heartbeat', input => heartbeat_request, output => heartbeat_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_HostService(_) -> error. - - -fetch_rpc_def(ServiceName, RpcName) -> - case find_rpc_def(ServiceName, RpcName) of - Def when is_map(Def) -> Def; - error -> erlang:error({no_such_rpc, ServiceName, RpcName}) - end. - - -%% Convert a a fully qualified (ie with package name) service name -%% as a binary to a service name as an atom. -fqbin_to_service_name(<<"HostService">>) -> 'HostService'; -fqbin_to_service_name(X) -> error({gpb_error, {badservice, X}}). - - -%% Convert a service name as an atom to a fully qualified -%% (ie with package name) name as a binary. -service_name_to_fqbin('HostService') -> <<"HostService">>; -service_name_to_fqbin(X) -> error({gpb_error, {badservice, X}}). - - -%% Convert a a fully qualified (ie with package name) service name -%% and an rpc name, both as binaries to a service name and an rpc -%% name, as atoms. -fqbins_to_service_and_rpc_name(<<"HostService">>, <<"CreateBootstrapToken">>) -> {'HostService', 'CreateBootstrapToken'}; -fqbins_to_service_and_rpc_name(<<"HostService">>, <<"GetHost">>) -> {'HostService', 'GetHost'}; -fqbins_to_service_and_rpc_name(<<"HostService">>, <<"ListHosts">>) -> {'HostService', 'ListHosts'}; -fqbins_to_service_and_rpc_name(<<"HostService">>, <<"Register">>) -> {'HostService', 'Register'}; -fqbins_to_service_and_rpc_name(<<"HostService">>, <<"Deregister">>) -> {'HostService', 'Deregister'}; -fqbins_to_service_and_rpc_name(<<"HostService">>, <<"Heartbeat">>) -> {'HostService', 'Heartbeat'}; -fqbins_to_service_and_rpc_name(S, R) -> error({gpb_error, {badservice_or_rpc, {S, R}}}). - - -%% Convert a service name and an rpc name, both as atoms, -%% to a fully qualified (ie with package name) service name and -%% an rpc name as binaries. -service_and_rpc_name_to_fqbins('HostService', 'CreateBootstrapToken') -> {<<"HostService">>, <<"CreateBootstrapToken">>}; -service_and_rpc_name_to_fqbins('HostService', 'GetHost') -> {<<"HostService">>, <<"GetHost">>}; -service_and_rpc_name_to_fqbins('HostService', 'ListHosts') -> {<<"HostService">>, <<"ListHosts">>}; -service_and_rpc_name_to_fqbins('HostService', 'Register') -> {<<"HostService">>, <<"Register">>}; -service_and_rpc_name_to_fqbins('HostService', 'Deregister') -> {<<"HostService">>, <<"Deregister">>}; -service_and_rpc_name_to_fqbins('HostService', 'Heartbeat') -> {<<"HostService">>, <<"Heartbeat">>}; -service_and_rpc_name_to_fqbins(S, R) -> error({gpb_error, {badservice_or_rpc, {S, R}}}). - - -fqbin_to_msg_name(<<"CreateBootstrapTokenRequest">>) -> create_bootstrap_token_request; -fqbin_to_msg_name(<<"CreateBootstrapTokenResponse">>) -> create_bootstrap_token_response; -fqbin_to_msg_name(<<"Host">>) -> host; -fqbin_to_msg_name(<<"ListHostsRequest">>) -> list_hosts_request; -fqbin_to_msg_name(<<"ListHostsResponse">>) -> list_hosts_response; -fqbin_to_msg_name(<<"RegisterHostRequest">>) -> register_host_request; -fqbin_to_msg_name(<<"HeartbeatRequest">>) -> heartbeat_request; -fqbin_to_msg_name(<<"HeartbeatResponse">>) -> heartbeat_response; -fqbin_to_msg_name(<<"google.protobuf.Empty">>) -> empty; -fqbin_to_msg_name(E) -> error({gpb_error, {badmsg, E}}). - - -msg_name_to_fqbin(create_bootstrap_token_request) -> <<"CreateBootstrapTokenRequest">>; -msg_name_to_fqbin(create_bootstrap_token_response) -> <<"CreateBootstrapTokenResponse">>; -msg_name_to_fqbin(host) -> <<"Host">>; -msg_name_to_fqbin(list_hosts_request) -> <<"ListHostsRequest">>; -msg_name_to_fqbin(list_hosts_response) -> <<"ListHostsResponse">>; -msg_name_to_fqbin(register_host_request) -> <<"RegisterHostRequest">>; -msg_name_to_fqbin(heartbeat_request) -> <<"HeartbeatRequest">>; -msg_name_to_fqbin(heartbeat_response) -> <<"HeartbeatResponse">>; -msg_name_to_fqbin(empty) -> <<"google.protobuf.Empty">>; -msg_name_to_fqbin(E) -> error({gpb_error, {badmsg, E}}). - - --spec fqbin_to_enum_name(_) -> no_return(). -fqbin_to_enum_name(E) -> error({gpb_error, {badenum, E}}). - - --spec enum_name_to_fqbin(_) -> no_return(). -enum_name_to_fqbin(E) -> error({gpb_error, {badenum, E}}). - - -get_package_name() -> 'google.protobuf'. - - -%% Whether or not the message names -%% are prepended with package name or not. -uses_packages() -> true. - - -source_basename() -> "host.proto". - - -%% Retrieve all proto file names, also imported ones. -%% The order is top-down. The first element is always the main -%% source file. The files are returned with extension, -%% see get_all_proto_names/0 for a version that returns -%% the basenames sans extension -get_all_source_basenames() -> ["host.proto", "empty.proto"]. - - -%% Retrieve all proto file names, also imported ones. -%% The order is top-down. The first element is always the main -%% source file. The files are returned sans .proto extension, -%% to make it easier to use them with the various get_xyz_containment -%% functions. -get_all_proto_names() -> ["host", "empty"]. - - -get_msg_containment("host") -> [create_bootstrap_token_request, create_bootstrap_token_response, heartbeat_request, heartbeat_response, host, list_hosts_request, list_hosts_response, register_host_request]; -get_msg_containment("empty") -> [empty]; -get_msg_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_pkg_containment("host") -> undefined; -get_pkg_containment("empty") -> 'google.protobuf'; -get_pkg_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_service_containment("host") -> ['HostService']; -get_service_containment("empty") -> []; -get_service_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_rpc_containment("host") -> [{'HostService', 'CreateBootstrapToken'}, {'HostService', 'GetHost'}, {'HostService', 'ListHosts'}, {'HostService', 'Register'}, {'HostService', 'Deregister'}, {'HostService', 'Heartbeat'}]; -get_rpc_containment("empty") -> []; -get_rpc_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_enum_containment("host") -> []; -get_enum_containment("empty") -> []; -get_enum_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_proto_by_msg_name_as_fqbin(<<"RegisterHostRequest">>) -> "host"; -get_proto_by_msg_name_as_fqbin(<<"ListHostsRequest">>) -> "host"; -get_proto_by_msg_name_as_fqbin(<<"Host">>) -> "host"; -get_proto_by_msg_name_as_fqbin(<<"HeartbeatRequest">>) -> "host"; -get_proto_by_msg_name_as_fqbin(<<"CreateBootstrapTokenRequest">>) -> "host"; -get_proto_by_msg_name_as_fqbin(<<"ListHostsResponse">>) -> "host"; -get_proto_by_msg_name_as_fqbin(<<"HeartbeatResponse">>) -> "host"; -get_proto_by_msg_name_as_fqbin(<<"CreateBootstrapTokenResponse">>) -> "host"; -get_proto_by_msg_name_as_fqbin(<<"google.protobuf.Empty">>) -> "empty"; -get_proto_by_msg_name_as_fqbin(E) -> error({gpb_error, {badmsg, E}}). - - -get_proto_by_service_name_as_fqbin(<<"HostService">>) -> "host"; -get_proto_by_service_name_as_fqbin(E) -> error({gpb_error, {badservice, E}}). - - --spec get_proto_by_enum_name_as_fqbin(_) -> no_return(). -get_proto_by_enum_name_as_fqbin(E) -> error({gpb_error, {badenum, E}}). - - -get_protos_by_pkg_name_as_fqbin(<<"google.protobuf">>) -> ["empty"]; -get_protos_by_pkg_name_as_fqbin(E) -> error({gpb_error, {badpkg, E}}). - - - -gpb_version_as_string() -> - "4.19.8". - -gpb_version_as_list() -> - [4,19,8]. - -gpb_version_source() -> - "file". diff --git a/virtuerl/src/pb/host_service_bhvr.erl b/virtuerl/src/pb/host_service_bhvr.erl deleted file mode 100644 index afefefd..0000000 --- a/virtuerl/src/pb/host_service_bhvr.erl +++ /dev/null @@ -1,33 +0,0 @@ -%%%------------------------------------------------------------------- -%% @doc Behaviour to implement for grpc service HostService. -%% @end -%%%------------------------------------------------------------------- - -%% this module was generated and should not be modified manually - --module(host_service_bhvr). - -%% Unary RPC --callback create_bootstrap_token(ctx:t(), host_pb:create_bootstrap_token_request()) -> - {ok, host_pb:create_bootstrap_token_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback get_host(ctx:t(), host_pb:host()) -> - {ok, host_pb:host(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback list_hosts(ctx:t(), host_pb:list_hosts_request()) -> - {ok, host_pb:list_hosts_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback register(ctx:t(), host_pb:register_host_request()) -> - {ok, host_pb:host(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback deregister(ctx:t(), host_pb:host()) -> - {ok, host_pb:empty(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback heartbeat(ctx:t(), host_pb:heartbeat_request()) -> - {ok, host_pb:heartbeat_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). - diff --git a/virtuerl/src/pb/host_service_client.erl b/virtuerl/src/pb/host_service_client.erl deleted file mode 100644 index 3ac13f9..0000000 --- a/virtuerl/src/pb/host_service_client.erl +++ /dev/null @@ -1,133 +0,0 @@ -%%%------------------------------------------------------------------- -%% @doc Client module for grpc service HostService. -%% @end -%%%------------------------------------------------------------------- - -%% this module was generated and should not be modified manually - --module(host_service_client). - --compile(export_all). --compile(nowarn_export_all). - --include_lib("grpcbox/include/grpcbox.hrl"). - --define(is_ctx(Ctx), is_tuple(Ctx) andalso element(1, Ctx) =:= ctx). - --define(SERVICE, 'HostService'). --define(PROTO_MODULE, 'host_pb'). --define(MARSHAL_FUN(T), fun(I) -> ?PROTO_MODULE:encode_msg(I, T) end). --define(UNMARSHAL_FUN(T), fun(I) -> ?PROTO_MODULE:decode_msg(I, T) end). --define(DEF(Input, Output, MessageType), #grpcbox_def{service=?SERVICE, - message_type=MessageType, - marshal_fun=?MARSHAL_FUN(Input), - unmarshal_fun=?UNMARSHAL_FUN(Output)}). - -%% @doc Unary RPC --spec create_bootstrap_token(host_pb:create_bootstrap_token_request()) -> - {ok, host_pb:create_bootstrap_token_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -create_bootstrap_token(Input) -> - create_bootstrap_token(ctx:new(), Input, #{}). - --spec create_bootstrap_token(ctx:t() | host_pb:create_bootstrap_token_request(), host_pb:create_bootstrap_token_request() | grpcbox_client:options()) -> - {ok, host_pb:create_bootstrap_token_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -create_bootstrap_token(Ctx, Input) when ?is_ctx(Ctx) -> - create_bootstrap_token(Ctx, Input, #{}); -create_bootstrap_token(Input, Options) -> - create_bootstrap_token(ctx:new(), Input, Options). - --spec create_bootstrap_token(ctx:t(), host_pb:create_bootstrap_token_request(), grpcbox_client:options()) -> - {ok, host_pb:create_bootstrap_token_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -create_bootstrap_token(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/HostService/CreateBootstrapToken">>, Input, ?DEF(create_bootstrap_token_request, create_bootstrap_token_response, <<"CreateBootstrapTokenRequest">>), Options). - -%% @doc Unary RPC --spec get_host(host_pb:host()) -> - {ok, host_pb:host(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_host(Input) -> - get_host(ctx:new(), Input, #{}). - --spec get_host(ctx:t() | host_pb:host(), host_pb:host() | grpcbox_client:options()) -> - {ok, host_pb:host(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_host(Ctx, Input) when ?is_ctx(Ctx) -> - get_host(Ctx, Input, #{}); -get_host(Input, Options) -> - get_host(ctx:new(), Input, Options). - --spec get_host(ctx:t(), host_pb:host(), grpcbox_client:options()) -> - {ok, host_pb:host(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_host(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/HostService/GetHost">>, Input, ?DEF(host, host, <<"Host">>), Options). - -%% @doc Unary RPC --spec list_hosts(host_pb:list_hosts_request()) -> - {ok, host_pb:list_hosts_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_hosts(Input) -> - list_hosts(ctx:new(), Input, #{}). - --spec list_hosts(ctx:t() | host_pb:list_hosts_request(), host_pb:list_hosts_request() | grpcbox_client:options()) -> - {ok, host_pb:list_hosts_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_hosts(Ctx, Input) when ?is_ctx(Ctx) -> - list_hosts(Ctx, Input, #{}); -list_hosts(Input, Options) -> - list_hosts(ctx:new(), Input, Options). - --spec list_hosts(ctx:t(), host_pb:list_hosts_request(), grpcbox_client:options()) -> - {ok, host_pb:list_hosts_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_hosts(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/HostService/ListHosts">>, Input, ?DEF(list_hosts_request, list_hosts_response, <<"ListHostsRequest">>), Options). - -%% @doc Unary RPC --spec register(host_pb:register_host_request()) -> - {ok, host_pb:host(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -register(Input) -> - register(ctx:new(), Input, #{}). - --spec register(ctx:t() | host_pb:register_host_request(), host_pb:register_host_request() | grpcbox_client:options()) -> - {ok, host_pb:host(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -register(Ctx, Input) when ?is_ctx(Ctx) -> - register(Ctx, Input, #{}); -register(Input, Options) -> - register(ctx:new(), Input, Options). - --spec register(ctx:t(), host_pb:register_host_request(), grpcbox_client:options()) -> - {ok, host_pb:host(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -register(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/HostService/Register">>, Input, ?DEF(register_host_request, host, <<"RegisterHostRequest">>), Options). - -%% @doc Unary RPC --spec deregister(host_pb:host()) -> - {ok, host_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -deregister(Input) -> - deregister(ctx:new(), Input, #{}). - --spec deregister(ctx:t() | host_pb:host(), host_pb:host() | grpcbox_client:options()) -> - {ok, host_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -deregister(Ctx, Input) when ?is_ctx(Ctx) -> - deregister(Ctx, Input, #{}); -deregister(Input, Options) -> - deregister(ctx:new(), Input, Options). - --spec deregister(ctx:t(), host_pb:host(), grpcbox_client:options()) -> - {ok, host_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -deregister(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/HostService/Deregister">>, Input, ?DEF(host, empty, <<"Host">>), Options). - -%% @doc Unary RPC --spec heartbeat(host_pb:heartbeat_request()) -> - {ok, host_pb:heartbeat_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -heartbeat(Input) -> - heartbeat(ctx:new(), Input, #{}). - --spec heartbeat(ctx:t() | host_pb:heartbeat_request(), host_pb:heartbeat_request() | grpcbox_client:options()) -> - {ok, host_pb:heartbeat_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -heartbeat(Ctx, Input) when ?is_ctx(Ctx) -> - heartbeat(Ctx, Input, #{}); -heartbeat(Input, Options) -> - heartbeat(ctx:new(), Input, Options). - --spec heartbeat(ctx:t(), host_pb:heartbeat_request(), grpcbox_client:options()) -> - {ok, host_pb:heartbeat_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -heartbeat(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/HostService/Heartbeat">>, Input, ?DEF(heartbeat_request, heartbeat_response, <<"HeartbeatRequest">>), Options). - diff --git a/virtuerl/src/pb/port_forwarding_pb.erl b/virtuerl/src/pb/port_forwarding_pb.erl deleted file mode 100644 index f36a103..0000000 --- a/virtuerl/src/pb/port_forwarding_pb.erl +++ /dev/null @@ -1,1320 +0,0 @@ -%% -*- coding: utf-8 -*- -%% @private -%% Automatically generated, do not edit -%% Generated by gpb_compile version 4.19.8 -%% Version source: file --module(port_forwarding_pb). - --export([encode_msg/2, encode_msg/3]). --export([decode_msg/2, decode_msg/3]). --export([merge_msgs/3, merge_msgs/4]). --export([verify_msg/2, verify_msg/3]). --export([get_msg_defs/0]). --export([get_msg_names/0]). --export([get_group_names/0]). --export([get_msg_or_group_names/0]). --export([get_enum_names/0]). --export([find_msg_def/1, fetch_msg_def/1]). --export([find_enum_def/1, fetch_enum_def/1]). --export([enum_symbol_by_value/2, enum_value_by_symbol/2]). --export([get_service_names/0]). --export([get_service_def/1]). --export([get_rpc_names/1]). --export([find_rpc_def/2, fetch_rpc_def/2]). --export([fqbin_to_service_name/1]). --export([service_name_to_fqbin/1]). --export([fqbins_to_service_and_rpc_name/2]). --export([service_and_rpc_name_to_fqbins/2]). --export([fqbin_to_msg_name/1]). --export([msg_name_to_fqbin/1]). --export([fqbin_to_enum_name/1]). --export([enum_name_to_fqbin/1]). --export([get_package_name/0]). --export([uses_packages/0]). --export([source_basename/0]). --export([get_all_source_basenames/0]). --export([get_all_proto_names/0]). --export([get_msg_containment/1]). --export([get_pkg_containment/1]). --export([get_service_containment/1]). --export([get_rpc_containment/1]). --export([get_enum_containment/1]). --export([get_proto_by_msg_name_as_fqbin/1]). --export([get_proto_by_service_name_as_fqbin/1]). --export([get_proto_by_enum_name_as_fqbin/1]). --export([get_protos_by_pkg_name_as_fqbin/1]). --export([gpb_version_as_string/0, gpb_version_as_list/0]). --export([gpb_version_source/0]). - - -%% enumerated types - --export_type([]). - -%% message types --type port_forwarding_identifier() :: - #{host => unicode:chardata(), % = 1, optional - protocol => unicode:chardata(), % = 2, optional - source_port => non_neg_integer() % = 3, optional, 32 bits - }. - --type port_forwarding() :: - #{protocol => unicode:chardata(), % = 2, optional - source_port => non_neg_integer(), % = 3, optional, 32 bits - target_ip => unicode:chardata(), % = 4, optional - target_port => non_neg_integer() % = 5, optional, 32 bits - }. - --type list_port_forwardings_request() :: - #{host => unicode:chardata() % = 1, optional - }. - --type list_port_forwardings_response() :: - #{port_forwardings => [port_forwarding()] % = 1, repeated - }. - --type put_port_forwarding_request() :: - #{port_forwarding => port_forwarding(), % = 1, optional - host => unicode:chardata() % = 2, optional - }. - --type empty() :: - #{ - }. - --export_type(['port_forwarding_identifier'/0, 'port_forwarding'/0, 'list_port_forwardings_request'/0, 'list_port_forwardings_response'/0, 'put_port_forwarding_request'/0, 'empty'/0]). --type '$msg_name'() :: port_forwarding_identifier | port_forwarding | list_port_forwardings_request | list_port_forwardings_response | put_port_forwarding_request | empty. --type '$msg'() :: port_forwarding_identifier() | port_forwarding() | list_port_forwardings_request() | list_port_forwardings_response() | put_port_forwarding_request() | empty(). --export_type(['$msg_name'/0, '$msg'/0]). - --if(?OTP_RELEASE >= 24). --dialyzer({no_underspecs, encode_msg/2}). --endif. --spec encode_msg('$msg'(), '$msg_name'()) -> binary(). -encode_msg(Msg, MsgName) when is_atom(MsgName) -> encode_msg(Msg, MsgName, []). - --if(?OTP_RELEASE >= 24). --dialyzer({no_underspecs, encode_msg/3}). --endif. --spec encode_msg('$msg'(), '$msg_name'(), list()) -> binary(). -encode_msg(Msg, MsgName, Opts) -> - case proplists:get_bool(verify, Opts) of - true -> verify_msg(Msg, MsgName, Opts); - false -> ok - end, - TrUserData = proplists:get_value(user_data, Opts), - case MsgName of - port_forwarding_identifier -> encode_msg_port_forwarding_identifier(id(Msg, TrUserData), TrUserData); - port_forwarding -> encode_msg_port_forwarding(id(Msg, TrUserData), TrUserData); - list_port_forwardings_request -> encode_msg_list_port_forwardings_request(id(Msg, TrUserData), TrUserData); - list_port_forwardings_response -> encode_msg_list_port_forwardings_response(id(Msg, TrUserData), TrUserData); - put_port_forwarding_request -> encode_msg_put_port_forwarding_request(id(Msg, TrUserData), TrUserData); - empty -> encode_msg_empty(id(Msg, TrUserData), TrUserData) - end. - - -encode_msg_port_forwarding_identifier(Msg, TrUserData) -> encode_msg_port_forwarding_identifier(Msg, <<>>, TrUserData). - - -encode_msg_port_forwarding_identifier(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{host := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - B2 = case M of - #{protocol := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end, - case M of - #{source_port := F3} -> - begin - TrF3 = id(F3, TrUserData), - if TrF3 =:= 0 -> B2; - true -> e_varint(TrF3, <>, TrUserData) - end - end; - _ -> B2 - end. - -encode_msg_port_forwarding(Msg, TrUserData) -> encode_msg_port_forwarding(Msg, <<>>, TrUserData). - - -encode_msg_port_forwarding(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{protocol := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - B2 = case M of - #{source_port := F2} -> - begin - TrF2 = id(F2, TrUserData), - if TrF2 =:= 0 -> B1; - true -> e_varint(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end, - B3 = case M of - #{target_ip := F3} -> - begin - TrF3 = id(F3, TrUserData), - case is_empty_string(TrF3) of - true -> B2; - false -> e_type_string(TrF3, <>, TrUserData) - end - end; - _ -> B2 - end, - case M of - #{target_port := F4} -> - begin - TrF4 = id(F4, TrUserData), - if TrF4 =:= 0 -> B3; - true -> e_varint(TrF4, <>, TrUserData) - end - end; - _ -> B3 - end. - -encode_msg_list_port_forwardings_request(Msg, TrUserData) -> encode_msg_list_port_forwardings_request(Msg, <<>>, TrUserData). - - -encode_msg_list_port_forwardings_request(#{} = M, Bin, TrUserData) -> - case M of - #{host := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end. - -encode_msg_list_port_forwardings_response(Msg, TrUserData) -> encode_msg_list_port_forwardings_response(Msg, <<>>, TrUserData). - - -encode_msg_list_port_forwardings_response(#{} = M, Bin, TrUserData) -> - case M of - #{port_forwardings := F1} -> - TrF1 = id(F1, TrUserData), - if TrF1 == [] -> Bin; - true -> e_field_list_port_forwardings_response_port_forwardings(TrF1, Bin, TrUserData) - end; - _ -> Bin - end. - -encode_msg_put_port_forwarding_request(Msg, TrUserData) -> encode_msg_put_port_forwarding_request(Msg, <<>>, TrUserData). - - -encode_msg_put_port_forwarding_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{port_forwarding := F1} -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= undefined -> Bin; - true -> e_mfield_put_port_forwarding_request_port_forwarding(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{host := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_empty(_Msg, _TrUserData) -> <<>>. - -e_mfield_list_port_forwardings_response_port_forwardings(Msg, Bin, TrUserData) -> - SubBin = encode_msg_port_forwarding(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_field_list_port_forwardings_response_port_forwardings([Elem | Rest], Bin, TrUserData) -> - Bin2 = <>, - Bin3 = e_mfield_list_port_forwardings_response_port_forwardings(id(Elem, TrUserData), Bin2, TrUserData), - e_field_list_port_forwardings_response_port_forwardings(Rest, Bin3, TrUserData); -e_field_list_port_forwardings_response_port_forwardings([], Bin, _TrUserData) -> Bin. - -e_mfield_put_port_forwarding_request_port_forwarding(Msg, Bin, TrUserData) -> - SubBin = encode_msg_port_forwarding(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - --compile({nowarn_unused_function,e_type_sint/3}). -e_type_sint(Value, Bin, _TrUserData) when Value >= 0 -> e_varint(Value * 2, Bin); -e_type_sint(Value, Bin, _TrUserData) -> e_varint(Value * -2 - 1, Bin). - --compile({nowarn_unused_function,e_type_int32/3}). -e_type_int32(Value, Bin, _TrUserData) when 0 =< Value, Value =< 127 -> <>; -e_type_int32(Value, Bin, _TrUserData) -> - <> = <>, - e_varint(N, Bin). - --compile({nowarn_unused_function,e_type_int64/3}). -e_type_int64(Value, Bin, _TrUserData) when 0 =< Value, Value =< 127 -> <>; -e_type_int64(Value, Bin, _TrUserData) -> - <> = <>, - e_varint(N, Bin). - --compile({nowarn_unused_function,e_type_bool/3}). -e_type_bool(true, Bin, _TrUserData) -> <>; -e_type_bool(false, Bin, _TrUserData) -> <>; -e_type_bool(1, Bin, _TrUserData) -> <>; -e_type_bool(0, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_string/3}). -e_type_string(S, Bin, _TrUserData) -> - Utf8 = unicode:characters_to_binary(S), - Bin2 = e_varint(byte_size(Utf8), Bin), - <>. - --compile({nowarn_unused_function,e_type_bytes/3}). -e_type_bytes(Bytes, Bin, _TrUserData) when is_binary(Bytes) -> - Bin2 = e_varint(byte_size(Bytes), Bin), - <>; -e_type_bytes(Bytes, Bin, _TrUserData) when is_list(Bytes) -> - BytesBin = iolist_to_binary(Bytes), - Bin2 = e_varint(byte_size(BytesBin), Bin), - <>. - --compile({nowarn_unused_function,e_type_fixed32/3}). -e_type_fixed32(Value, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_sfixed32/3}). -e_type_sfixed32(Value, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_fixed64/3}). -e_type_fixed64(Value, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_sfixed64/3}). -e_type_sfixed64(Value, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_float/3}). -e_type_float(V, Bin, _) when is_number(V) -> <>; -e_type_float(infinity, Bin, _) -> <>; -e_type_float('-infinity', Bin, _) -> <>; -e_type_float(nan, Bin, _) -> <>. - --compile({nowarn_unused_function,e_type_double/3}). -e_type_double(V, Bin, _) when is_number(V) -> <>; -e_type_double(infinity, Bin, _) -> <>; -e_type_double('-infinity', Bin, _) -> <>; -e_type_double(nan, Bin, _) -> <>. - --compile({nowarn_unused_function,e_unknown_elems/2}). -e_unknown_elems([Elem | Rest], Bin) -> - BinR = case Elem of - {varint, FNum, N} -> - BinF = e_varint(FNum bsl 3, Bin), - e_varint(N, BinF); - {length_delimited, FNum, Data} -> - BinF = e_varint(FNum bsl 3 bor 2, Bin), - BinL = e_varint(byte_size(Data), BinF), - <>; - {group, FNum, GroupFields} -> - Bin1 = e_varint(FNum bsl 3 bor 3, Bin), - Bin2 = e_unknown_elems(GroupFields, Bin1), - e_varint(FNum bsl 3 bor 4, Bin2); - {fixed32, FNum, V} -> - BinF = e_varint(FNum bsl 3 bor 5, Bin), - <>; - {fixed64, FNum, V} -> - BinF = e_varint(FNum bsl 3 bor 1, Bin), - <> - end, - e_unknown_elems(Rest, BinR); -e_unknown_elems([], Bin) -> Bin. - --compile({nowarn_unused_function,e_varint/3}). -e_varint(N, Bin, _TrUserData) -> e_varint(N, Bin). - --compile({nowarn_unused_function,e_varint/2}). -e_varint(N, Bin) when N =< 127 -> <>; -e_varint(N, Bin) -> - Bin2 = <>, - e_varint(N bsr 7, Bin2). - -is_empty_string("") -> true; -is_empty_string(<<>>) -> true; -is_empty_string(L) when is_list(L) -> not string_has_chars(L); -is_empty_string(B) when is_binary(B) -> false. - -string_has_chars([C | _]) when is_integer(C) -> true; -string_has_chars([H | T]) -> - case string_has_chars(H) of - true -> true; - false -> string_has_chars(T) - end; -string_has_chars(B) when is_binary(B), byte_size(B) =/= 0 -> true; -string_has_chars(C) when is_integer(C) -> true; -string_has_chars(<<>>) -> false; -string_has_chars([]) -> false. - - -decode_msg(Bin, MsgName) when is_binary(Bin) -> decode_msg(Bin, MsgName, []). - -decode_msg(Bin, MsgName, Opts) when is_binary(Bin) -> - TrUserData = proplists:get_value(user_data, Opts), - decode_msg_1_catch(Bin, MsgName, TrUserData). - --ifdef('OTP_RELEASE'). -decode_msg_1_catch(Bin, MsgName, TrUserData) -> - try decode_msg_2_doit(MsgName, Bin, TrUserData) - catch - error:{gpb_error,_}=Reason:StackTrace -> - erlang:raise(error, Reason, StackTrace); - Class:Reason:StackTrace -> error({gpb_error,{decoding_failure, {Bin, MsgName, {Class, Reason, StackTrace}}}}) - end. --else. -decode_msg_1_catch(Bin, MsgName, TrUserData) -> - try decode_msg_2_doit(MsgName, Bin, TrUserData) - catch - error:{gpb_error,_}=Reason -> - erlang:raise(error, Reason, - erlang:get_stacktrace()); - Class:Reason -> - StackTrace = erlang:get_stacktrace(), - error({gpb_error,{decoding_failure, {Bin, MsgName, {Class, Reason, StackTrace}}}}) - end. --endif. - -decode_msg_2_doit(port_forwarding_identifier, Bin, TrUserData) -> id(decode_msg_port_forwarding_identifier(Bin, TrUserData), TrUserData); -decode_msg_2_doit(port_forwarding, Bin, TrUserData) -> id(decode_msg_port_forwarding(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_port_forwardings_request, Bin, TrUserData) -> id(decode_msg_list_port_forwardings_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_port_forwardings_response, Bin, TrUserData) -> id(decode_msg_list_port_forwardings_response(Bin, TrUserData), TrUserData); -decode_msg_2_doit(put_port_forwarding_request, Bin, TrUserData) -> id(decode_msg_put_port_forwarding_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(empty, Bin, TrUserData) -> id(decode_msg_empty(Bin, TrUserData), TrUserData). - - - -decode_msg_port_forwarding_identifier(Bin, TrUserData) -> dfp_read_field_def_port_forwarding_identifier(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), id(0, TrUserData), TrUserData). - -dfp_read_field_def_port_forwarding_identifier(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_port_forwarding_identifier_host(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_port_forwarding_identifier(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_port_forwarding_identifier_protocol(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_port_forwarding_identifier(<<24, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_port_forwarding_identifier_source_port(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_port_forwarding_identifier(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{host => F@_1, protocol => F@_2, source_port => F@_3}; -dfp_read_field_def_port_forwarding_identifier(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dg_read_field_def_port_forwarding_identifier(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -dg_read_field_def_port_forwarding_identifier(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 32 - 7 -> dg_read_field_def_port_forwarding_identifier(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -dg_read_field_def_port_forwarding_identifier(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_port_forwarding_identifier_host(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 18 -> d_field_port_forwarding_identifier_protocol(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 24 -> d_field_port_forwarding_identifier_source_port(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_port_forwarding_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 1 -> skip_64_port_forwarding_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 2 -> skip_length_delimited_port_forwarding_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 3 -> skip_group_port_forwarding_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 5 -> skip_32_port_forwarding_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData) - end - end; -dg_read_field_def_port_forwarding_identifier(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{host => F@_1, protocol => F@_2, source_port => F@_3}. - -d_field_port_forwarding_identifier_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_port_forwarding_identifier_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_port_forwarding_identifier_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_port_forwarding_identifier(RestF, 0, 0, F, NewFValue, F@_2, F@_3, TrUserData). - -d_field_port_forwarding_identifier_protocol(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_port_forwarding_identifier_protocol(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_port_forwarding_identifier_protocol(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_port_forwarding_identifier(RestF, 0, 0, F, F@_1, NewFValue, F@_3, TrUserData). - -d_field_port_forwarding_identifier_source_port(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_port_forwarding_identifier_source_port(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_port_forwarding_identifier_source_port(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, TrUserData) -> - {NewFValue, RestF} = {id((X bsl N + Acc) band 4294967295, TrUserData), Rest}, - dfp_read_field_def_port_forwarding_identifier(RestF, 0, 0, F, F@_1, F@_2, NewFValue, TrUserData). - -skip_varint_port_forwarding_identifier(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> skip_varint_port_forwarding_identifier(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -skip_varint_port_forwarding_identifier(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_port_forwarding_identifier(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_length_delimited_port_forwarding_identifier(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> skip_length_delimited_port_forwarding_identifier(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -skip_length_delimited_port_forwarding_identifier(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_port_forwarding_identifier(Rest2, 0, 0, F, F@_1, F@_2, F@_3, TrUserData). - -skip_group_port_forwarding_identifier(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_port_forwarding_identifier(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, TrUserData). - -skip_32_port_forwarding_identifier(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_port_forwarding_identifier(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_64_port_forwarding_identifier(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_port_forwarding_identifier(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -decode_msg_port_forwarding(Bin, TrUserData) -> dfp_read_field_def_port_forwarding(Bin, 0, 0, 0, id(<<>>, TrUserData), id(0, TrUserData), id(<<>>, TrUserData), id(0, TrUserData), TrUserData). - -dfp_read_field_def_port_forwarding(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_port_forwarding_protocol(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dfp_read_field_def_port_forwarding(<<24, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_port_forwarding_source_port(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dfp_read_field_def_port_forwarding(<<34, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_port_forwarding_target_ip(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dfp_read_field_def_port_forwarding(<<40, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_port_forwarding_target_port(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dfp_read_field_def_port_forwarding(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, _) -> #{protocol => F@_1, source_port => F@_2, target_ip => F@_3, target_port => F@_4}; -dfp_read_field_def_port_forwarding(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dg_read_field_def_port_forwarding(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -dg_read_field_def_port_forwarding(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 32 - 7 -> dg_read_field_def_port_forwarding(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dg_read_field_def_port_forwarding(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, F@_4, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 18 -> d_field_port_forwarding_protocol(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); - 24 -> d_field_port_forwarding_source_port(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); - 34 -> d_field_port_forwarding_target_ip(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); - 40 -> d_field_port_forwarding_target_port(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_port_forwarding(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); - 1 -> skip_64_port_forwarding(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); - 2 -> skip_length_delimited_port_forwarding(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); - 3 -> skip_group_port_forwarding(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); - 5 -> skip_32_port_forwarding(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData) - end - end; -dg_read_field_def_port_forwarding(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, _) -> #{protocol => F@_1, source_port => F@_2, target_ip => F@_3, target_port => F@_4}. - -d_field_port_forwarding_protocol(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_port_forwarding_protocol(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -d_field_port_forwarding_protocol(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, F@_4, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_port_forwarding(RestF, 0, 0, F, NewFValue, F@_2, F@_3, F@_4, TrUserData). - -d_field_port_forwarding_source_port(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_port_forwarding_source_port(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -d_field_port_forwarding_source_port(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, F@_4, TrUserData) -> - {NewFValue, RestF} = {id((X bsl N + Acc) band 4294967295, TrUserData), Rest}, - dfp_read_field_def_port_forwarding(RestF, 0, 0, F, F@_1, NewFValue, F@_3, F@_4, TrUserData). - -d_field_port_forwarding_target_ip(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_port_forwarding_target_ip(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -d_field_port_forwarding_target_ip(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, F@_4, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_port_forwarding(RestF, 0, 0, F, F@_1, F@_2, NewFValue, F@_4, TrUserData). - -d_field_port_forwarding_target_port(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_port_forwarding_target_port(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -d_field_port_forwarding_target_port(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, _, TrUserData) -> - {NewFValue, RestF} = {id((X bsl N + Acc) band 4294967295, TrUserData), Rest}, - dfp_read_field_def_port_forwarding(RestF, 0, 0, F, F@_1, F@_2, F@_3, NewFValue, TrUserData). - -skip_varint_port_forwarding(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> skip_varint_port_forwarding(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -skip_varint_port_forwarding(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dfp_read_field_def_port_forwarding(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -skip_length_delimited_port_forwarding(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> skip_length_delimited_port_forwarding(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -skip_length_delimited_port_forwarding(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_port_forwarding(Rest2, 0, 0, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -skip_group_port_forwarding(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, F@_4, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_port_forwarding(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, F@_4, TrUserData). - -skip_32_port_forwarding(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dfp_read_field_def_port_forwarding(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -skip_64_port_forwarding(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dfp_read_field_def_port_forwarding(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -decode_msg_list_port_forwardings_request(Bin, TrUserData) -> dfp_read_field_def_list_port_forwardings_request(Bin, 0, 0, 0, id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_list_port_forwardings_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_port_forwardings_request_host(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_list_port_forwardings_request(<<>>, 0, 0, _, F@_1, _) -> #{host => F@_1}; -dfp_read_field_def_list_port_forwardings_request(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_port_forwardings_request(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_list_port_forwardings_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_port_forwardings_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_list_port_forwardings_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_port_forwardings_request_host(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_port_forwardings_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_list_port_forwardings_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_list_port_forwardings_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_list_port_forwardings_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_list_port_forwardings_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_list_port_forwardings_request(<<>>, 0, 0, _, F@_1, _) -> #{host => F@_1}. - -d_field_list_port_forwardings_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_port_forwardings_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_list_port_forwardings_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_list_port_forwardings_request(RestF, 0, 0, F, NewFValue, TrUserData). - -skip_varint_list_port_forwardings_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_port_forwardings_request(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_list_port_forwardings_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_port_forwardings_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_list_port_forwardings_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_port_forwardings_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_list_port_forwardings_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_port_forwardings_request(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_list_port_forwardings_request(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_port_forwardings_request(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_list_port_forwardings_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_port_forwardings_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_list_port_forwardings_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_port_forwardings_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_list_port_forwardings_response(Bin, TrUserData) -> dfp_read_field_def_list_port_forwardings_response(Bin, 0, 0, 0, id([], TrUserData), TrUserData). - -dfp_read_field_def_list_port_forwardings_response(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_port_forwardings_response_port_forwardings(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_list_port_forwardings_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{port_forwardings => lists_reverse(R1, TrUserData)} - end; -dfp_read_field_def_list_port_forwardings_response(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_port_forwardings_response(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_list_port_forwardings_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_port_forwardings_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_list_port_forwardings_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_port_forwardings_response_port_forwardings(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_port_forwardings_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_list_port_forwardings_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_list_port_forwardings_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_list_port_forwardings_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_list_port_forwardings_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_list_port_forwardings_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{port_forwardings => lists_reverse(R1, TrUserData)} - end. - -d_field_list_port_forwardings_response_port_forwardings(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_port_forwardings_response_port_forwardings(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_list_port_forwardings_response_port_forwardings(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_port_forwarding(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_list_port_forwardings_response(RestF, 0, 0, F, cons(NewFValue, Prev, TrUserData), TrUserData). - -skip_varint_list_port_forwardings_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_port_forwardings_response(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_list_port_forwardings_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_port_forwardings_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_list_port_forwardings_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_port_forwardings_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_list_port_forwardings_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_port_forwardings_response(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_list_port_forwardings_response(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_port_forwardings_response(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_list_port_forwardings_response(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_port_forwardings_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_list_port_forwardings_response(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_port_forwardings_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_put_port_forwarding_request(Bin, TrUserData) -> dfp_read_field_def_put_port_forwarding_request(Bin, 0, 0, 0, id('$undef', TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_put_port_forwarding_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_put_port_forwarding_request_port_forwarding(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_put_port_forwarding_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_put_port_forwarding_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_put_port_forwarding_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> - S1 = #{host => F@_2}, - if F@_1 == '$undef' -> S1; - true -> S1#{port_forwarding => F@_1} - end; -dfp_read_field_def_put_port_forwarding_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_put_port_forwarding_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_put_port_forwarding_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_put_port_forwarding_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_put_port_forwarding_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_put_port_forwarding_request_port_forwarding(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_put_port_forwarding_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_put_port_forwarding_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_put_port_forwarding_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_put_port_forwarding_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_put_port_forwarding_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_put_port_forwarding_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_put_port_forwarding_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> - S1 = #{host => F@_2}, - if F@_1 == '$undef' -> S1; - true -> S1#{port_forwarding => F@_1} - end. - -d_field_put_port_forwarding_request_port_forwarding(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_put_port_forwarding_request_port_forwarding(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_put_port_forwarding_request_port_forwarding(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_port_forwarding(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_put_port_forwarding_request(RestF, - 0, - 0, - F, - if Prev == '$undef' -> NewFValue; - true -> merge_msg_port_forwarding(Prev, NewFValue, TrUserData) - end, - F@_2, - TrUserData). - -d_field_put_port_forwarding_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_put_port_forwarding_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_put_port_forwarding_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_put_port_forwarding_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_put_port_forwarding_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_put_port_forwarding_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_put_port_forwarding_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_put_port_forwarding_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_put_port_forwarding_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_put_port_forwarding_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_put_port_forwarding_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_put_port_forwarding_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_put_port_forwarding_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_put_port_forwarding_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_put_port_forwarding_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_put_port_forwarding_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_put_port_forwarding_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_put_port_forwarding_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_empty(Bin, TrUserData) -> dfp_read_field_def_empty(Bin, 0, 0, 0, TrUserData). - -dfp_read_field_def_empty(<<>>, 0, 0, _, _) -> #{}; -dfp_read_field_def_empty(Other, Z1, Z2, F, TrUserData) -> dg_read_field_def_empty(Other, Z1, Z2, F, TrUserData). - -dg_read_field_def_empty(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 32 - 7 -> dg_read_field_def_empty(Rest, N + 7, X bsl N + Acc, F, TrUserData); -dg_read_field_def_empty(<<0:1, X:7, Rest/binary>>, N, Acc, _, TrUserData) -> - Key = X bsl N + Acc, - case Key band 7 of - 0 -> skip_varint_empty(Rest, 0, 0, Key bsr 3, TrUserData); - 1 -> skip_64_empty(Rest, 0, 0, Key bsr 3, TrUserData); - 2 -> skip_length_delimited_empty(Rest, 0, 0, Key bsr 3, TrUserData); - 3 -> skip_group_empty(Rest, 0, 0, Key bsr 3, TrUserData); - 5 -> skip_32_empty(Rest, 0, 0, Key bsr 3, TrUserData) - end; -dg_read_field_def_empty(<<>>, 0, 0, _, _) -> #{}. - -skip_varint_empty(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> skip_varint_empty(Rest, Z1, Z2, F, TrUserData); -skip_varint_empty(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_empty(Rest, Z1, Z2, F, TrUserData). - -skip_length_delimited_empty(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 57 -> skip_length_delimited_empty(Rest, N + 7, X bsl N + Acc, F, TrUserData); -skip_length_delimited_empty(<<0:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_empty(Rest2, 0, 0, F, TrUserData). - -skip_group_empty(Bin, _, Z2, FNum, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_empty(Rest, 0, Z2, FNum, TrUserData). - -skip_32_empty(<<_:32, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_empty(Rest, Z1, Z2, F, TrUserData). - -skip_64_empty(<<_:64, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_empty(Rest, Z1, Z2, F, TrUserData). - -read_group(Bin, FieldNum) -> - {NumBytes, EndTagLen} = read_gr_b(Bin, 0, 0, 0, 0, FieldNum), - <> = Bin, - {Group, Rest}. - -%% Like skipping over fields, but record the total length, -%% Each field is <(FieldNum bsl 3) bor FieldType> ++ -%% Record the length because varints may be non-optimally encoded. -%% -%% Groups can be nested, but assume the same FieldNum cannot be nested -%% because group field numbers are shared with the rest of the fields -%% numbers. Thus we can search just for an group-end with the same -%% field number. -%% -%% (The only time the same group field number could occur would -%% be in a nested sub message, but then it would be inside a -%% length-delimited entry, which we skip-read by length.) -read_gr_b(<<1:1, X:7, Tl/binary>>, N, Acc, NumBytes, TagLen, FieldNum) - when N < (32-7) -> - read_gr_b(Tl, N+7, X bsl N + Acc, NumBytes, TagLen+1, FieldNum); -read_gr_b(<<0:1, X:7, Tl/binary>>, N, Acc, NumBytes, TagLen, - FieldNum) -> - Key = X bsl N + Acc, - TagLen1 = TagLen + 1, - case {Key bsr 3, Key band 7} of - {FieldNum, 4} -> % 4 = group_end - {NumBytes, TagLen1}; - {_, 0} -> % 0 = varint - read_gr_vi(Tl, 0, NumBytes + TagLen1, FieldNum); - {_, 1} -> % 1 = bits64 - <<_:64, Tl2/binary>> = Tl, - read_gr_b(Tl2, 0, 0, NumBytes + TagLen1 + 8, 0, FieldNum); - {_, 2} -> % 2 = length_delimited - read_gr_ld(Tl, 0, 0, NumBytes + TagLen1, FieldNum); - {_, 3} -> % 3 = group_start - read_gr_b(Tl, 0, 0, NumBytes + TagLen1, 0, FieldNum); - {_, 4} -> % 4 = group_end - read_gr_b(Tl, 0, 0, NumBytes + TagLen1, 0, FieldNum); - {_, 5} -> % 5 = bits32 - <<_:32, Tl2/binary>> = Tl, - read_gr_b(Tl2, 0, 0, NumBytes + TagLen1 + 4, 0, FieldNum) - end. - -read_gr_vi(<<1:1, _:7, Tl/binary>>, N, NumBytes, FieldNum) - when N < (64-7) -> - read_gr_vi(Tl, N+7, NumBytes+1, FieldNum); -read_gr_vi(<<0:1, _:7, Tl/binary>>, _, NumBytes, FieldNum) -> - read_gr_b(Tl, 0, 0, NumBytes+1, 0, FieldNum). - -read_gr_ld(<<1:1, X:7, Tl/binary>>, N, Acc, NumBytes, FieldNum) - when N < (64-7) -> - read_gr_ld(Tl, N+7, X bsl N + Acc, NumBytes+1, FieldNum); -read_gr_ld(<<0:1, X:7, Tl/binary>>, N, Acc, NumBytes, FieldNum) -> - Len = X bsl N + Acc, - NumBytes1 = NumBytes + 1, - <<_:Len/binary, Tl2/binary>> = Tl, - read_gr_b(Tl2, 0, 0, NumBytes1 + Len, 0, FieldNum). - -merge_msgs(Prev, New, MsgName) when is_atom(MsgName) -> merge_msgs(Prev, New, MsgName, []). - -merge_msgs(Prev, New, MsgName, Opts) -> - TrUserData = proplists:get_value(user_data, Opts), - case MsgName of - port_forwarding_identifier -> merge_msg_port_forwarding_identifier(Prev, New, TrUserData); - port_forwarding -> merge_msg_port_forwarding(Prev, New, TrUserData); - list_port_forwardings_request -> merge_msg_list_port_forwardings_request(Prev, New, TrUserData); - list_port_forwardings_response -> merge_msg_list_port_forwardings_response(Prev, New, TrUserData); - put_port_forwarding_request -> merge_msg_put_port_forwarding_request(Prev, New, TrUserData); - empty -> merge_msg_empty(Prev, New, TrUserData) - end. - --compile({nowarn_unused_function,merge_msg_port_forwarding_identifier/3}). -merge_msg_port_forwarding_identifier(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S1#{host => NFhost}; - {#{host := PFhost}, _} -> S1#{host => PFhost}; - _ -> S1 - end, - S3 = case {PMsg, NMsg} of - {_, #{protocol := NFprotocol}} -> S2#{protocol => NFprotocol}; - {#{protocol := PFprotocol}, _} -> S2#{protocol => PFprotocol}; - _ -> S2 - end, - case {PMsg, NMsg} of - {_, #{source_port := NFsource_port}} -> S3#{source_port => NFsource_port}; - {#{source_port := PFsource_port}, _} -> S3#{source_port => PFsource_port}; - _ -> S3 - end. - --compile({nowarn_unused_function,merge_msg_port_forwarding/3}). -merge_msg_port_forwarding(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{protocol := NFprotocol}} -> S1#{protocol => NFprotocol}; - {#{protocol := PFprotocol}, _} -> S1#{protocol => PFprotocol}; - _ -> S1 - end, - S3 = case {PMsg, NMsg} of - {_, #{source_port := NFsource_port}} -> S2#{source_port => NFsource_port}; - {#{source_port := PFsource_port}, _} -> S2#{source_port => PFsource_port}; - _ -> S2 - end, - S4 = case {PMsg, NMsg} of - {_, #{target_ip := NFtarget_ip}} -> S3#{target_ip => NFtarget_ip}; - {#{target_ip := PFtarget_ip}, _} -> S3#{target_ip => PFtarget_ip}; - _ -> S3 - end, - case {PMsg, NMsg} of - {_, #{target_port := NFtarget_port}} -> S4#{target_port => NFtarget_port}; - {#{target_port := PFtarget_port}, _} -> S4#{target_port => PFtarget_port}; - _ -> S4 - end. - --compile({nowarn_unused_function,merge_msg_list_port_forwardings_request/3}). -merge_msg_list_port_forwardings_request(PMsg, NMsg, _) -> - S1 = #{}, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S1#{host => NFhost}; - {#{host := PFhost}, _} -> S1#{host => PFhost}; - _ -> S1 - end. - --compile({nowarn_unused_function,merge_msg_list_port_forwardings_response/3}). -merge_msg_list_port_forwardings_response(PMsg, NMsg, TrUserData) -> - S1 = #{}, - case {PMsg, NMsg} of - {#{port_forwardings := PFport_forwardings}, #{port_forwardings := NFport_forwardings}} -> S1#{port_forwardings => 'erlang_++'(PFport_forwardings, NFport_forwardings, TrUserData)}; - {_, #{port_forwardings := NFport_forwardings}} -> S1#{port_forwardings => NFport_forwardings}; - {#{port_forwardings := PFport_forwardings}, _} -> S1#{port_forwardings => PFport_forwardings}; - {_, _} -> S1 - end. - --compile({nowarn_unused_function,merge_msg_put_port_forwarding_request/3}). -merge_msg_put_port_forwarding_request(PMsg, NMsg, TrUserData) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {#{port_forwarding := PFport_forwarding}, #{port_forwarding := NFport_forwarding}} -> S1#{port_forwarding => merge_msg_port_forwarding(PFport_forwarding, NFport_forwarding, TrUserData)}; - {_, #{port_forwarding := NFport_forwarding}} -> S1#{port_forwarding => NFport_forwarding}; - {#{port_forwarding := PFport_forwarding}, _} -> S1#{port_forwarding => PFport_forwarding}; - {_, _} -> S1 - end, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S2#{host => NFhost}; - {#{host := PFhost}, _} -> S2#{host => PFhost}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_empty/3}). -merge_msg_empty(_Prev, New, _TrUserData) -> New. - - -verify_msg(Msg, MsgName) when is_atom(MsgName) -> verify_msg(Msg, MsgName, []). - -verify_msg(Msg, MsgName, Opts) -> - TrUserData = proplists:get_value(user_data, Opts), - case MsgName of - port_forwarding_identifier -> v_msg_port_forwarding_identifier(Msg, [MsgName], TrUserData); - port_forwarding -> v_msg_port_forwarding(Msg, [MsgName], TrUserData); - list_port_forwardings_request -> v_msg_list_port_forwardings_request(Msg, [MsgName], TrUserData); - list_port_forwardings_response -> v_msg_list_port_forwardings_response(Msg, [MsgName], TrUserData); - put_port_forwarding_request -> v_msg_put_port_forwarding_request(Msg, [MsgName], TrUserData); - empty -> v_msg_empty(Msg, [MsgName], TrUserData); - _ -> mk_type_error(not_a_known_message, Msg, []) - end. - - --compile({nowarn_unused_function,v_msg_port_forwarding_identifier/3}). --dialyzer({nowarn_function,v_msg_port_forwarding_identifier/3}). -v_msg_port_forwarding_identifier(#{} = M, Path, TrUserData) -> - case M of - #{host := F1} -> v_type_string(F1, [host | Path], TrUserData); - _ -> ok - end, - case M of - #{protocol := F2} -> v_type_string(F2, [protocol | Path], TrUserData); - _ -> ok - end, - case M of - #{source_port := F3} -> v_type_uint32(F3, [source_port | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (host) -> ok; - (protocol) -> ok; - (source_port) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_port_forwarding_identifier(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), port_forwarding_identifier}, M, Path); -v_msg_port_forwarding_identifier(X, Path, _TrUserData) -> mk_type_error({expected_msg, port_forwarding_identifier}, X, Path). - --compile({nowarn_unused_function,v_msg_port_forwarding/3}). --dialyzer({nowarn_function,v_msg_port_forwarding/3}). -v_msg_port_forwarding(#{} = M, Path, TrUserData) -> - case M of - #{protocol := F1} -> v_type_string(F1, [protocol | Path], TrUserData); - _ -> ok - end, - case M of - #{source_port := F2} -> v_type_uint32(F2, [source_port | Path], TrUserData); - _ -> ok - end, - case M of - #{target_ip := F3} -> v_type_string(F3, [target_ip | Path], TrUserData); - _ -> ok - end, - case M of - #{target_port := F4} -> v_type_uint32(F4, [target_port | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (protocol) -> ok; - (source_port) -> ok; - (target_ip) -> ok; - (target_port) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_port_forwarding(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), port_forwarding}, M, Path); -v_msg_port_forwarding(X, Path, _TrUserData) -> mk_type_error({expected_msg, port_forwarding}, X, Path). - --compile({nowarn_unused_function,v_msg_list_port_forwardings_request/3}). --dialyzer({nowarn_function,v_msg_list_port_forwardings_request/3}). -v_msg_list_port_forwardings_request(#{} = M, Path, TrUserData) -> - case M of - #{host := F1} -> v_type_string(F1, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_port_forwardings_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_port_forwardings_request}, M, Path); -v_msg_list_port_forwardings_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_port_forwardings_request}, X, Path). - --compile({nowarn_unused_function,v_msg_list_port_forwardings_response/3}). --dialyzer({nowarn_function,v_msg_list_port_forwardings_response/3}). -v_msg_list_port_forwardings_response(#{} = M, Path, TrUserData) -> - case M of - #{port_forwardings := F1} -> - if is_list(F1) -> - _ = [v_msg_port_forwarding(Elem, [port_forwardings | Path], TrUserData) || Elem <- F1], - ok; - true -> mk_type_error({invalid_list_of, {msg, port_forwarding}}, F1, [port_forwardings | Path]) - end; - _ -> ok - end, - lists:foreach(fun (port_forwardings) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_port_forwardings_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_port_forwardings_response}, M, Path); -v_msg_list_port_forwardings_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_port_forwardings_response}, X, Path). - --compile({nowarn_unused_function,v_msg_put_port_forwarding_request/3}). --dialyzer({nowarn_function,v_msg_put_port_forwarding_request/3}). -v_msg_put_port_forwarding_request(#{} = M, Path, TrUserData) -> - case M of - #{port_forwarding := F1} -> v_msg_port_forwarding(F1, [port_forwarding | Path], TrUserData); - _ -> ok - end, - case M of - #{host := F2} -> v_type_string(F2, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (port_forwarding) -> ok; - (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_put_port_forwarding_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), put_port_forwarding_request}, M, Path); -v_msg_put_port_forwarding_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, put_port_forwarding_request}, X, Path). - --compile({nowarn_unused_function,v_msg_empty/3}). --dialyzer({nowarn_function,v_msg_empty/3}). -v_msg_empty(#{} = M, Path, _) -> - lists:foreach(fun (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) end, maps:keys(M)), - ok; -v_msg_empty(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), empty}, M, Path); -v_msg_empty(X, Path, _TrUserData) -> mk_type_error({expected_msg, empty}, X, Path). - --compile({nowarn_unused_function,v_type_uint32/3}). --dialyzer({nowarn_function,v_type_uint32/3}). -v_type_uint32(N, _Path, _TrUserData) when 0 =< N, N =< 4294967295 -> ok; -v_type_uint32(N, Path, _TrUserData) when is_integer(N) -> mk_type_error({value_out_of_range, uint32, unsigned, 32}, N, Path); -v_type_uint32(X, Path, _TrUserData) -> mk_type_error({bad_integer, uint32, unsigned, 32}, X, Path). - --compile({nowarn_unused_function,v_type_string/3}). --dialyzer({nowarn_function,v_type_string/3}). -v_type_string(S, Path, _TrUserData) when is_list(S); is_binary(S) -> - try unicode:characters_to_binary(S) of - B when is_binary(B) -> ok; - {error, _, _} -> mk_type_error(bad_unicode_string, S, Path) - catch - error:badarg -> mk_type_error(bad_unicode_string, S, Path) - end; -v_type_string(X, Path, _TrUserData) -> mk_type_error(bad_unicode_string, X, Path). - --compile({nowarn_unused_function,mk_type_error/3}). --spec mk_type_error(_, _, list()) -> no_return(). -mk_type_error(Error, ValueSeen, Path) -> - Path2 = prettify_path(Path), - erlang:error({gpb_type_error, {Error, [{value, ValueSeen}, {path, Path2}]}}). - - --compile({nowarn_unused_function,prettify_path/1}). --dialyzer({nowarn_function,prettify_path/1}). -prettify_path([]) -> top_level; -prettify_path(PathR) -> lists:append(lists:join(".", lists:map(fun atom_to_list/1, lists:reverse(PathR)))). - - --compile({nowarn_unused_function,id/2}). --compile({inline,id/2}). -id(X, _TrUserData) -> X. - --compile({nowarn_unused_function,v_ok/3}). --compile({inline,v_ok/3}). -v_ok(_Value, _Path, _TrUserData) -> ok. - --compile({nowarn_unused_function,m_overwrite/3}). --compile({inline,m_overwrite/3}). -m_overwrite(_Prev, New, _TrUserData) -> New. - --compile({nowarn_unused_function,cons/3}). --compile({inline,cons/3}). -cons(Elem, Acc, _TrUserData) -> [Elem | Acc]. - --compile({nowarn_unused_function,lists_reverse/2}). --compile({inline,lists_reverse/2}). -'lists_reverse'(L, _TrUserData) -> lists:reverse(L). --compile({nowarn_unused_function,'erlang_++'/3}). --compile({inline,'erlang_++'/3}). -'erlang_++'(A, B, _TrUserData) -> A ++ B. - - -get_msg_defs() -> - [{{msg, port_forwarding_identifier}, - [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => protocol, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => source_port, fnum => 3, rnum => 4, type => uint32, occurrence => optional, opts => []}]}, - {{msg, port_forwarding}, - [#{name => protocol, fnum => 2, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => source_port, fnum => 3, rnum => 3, type => uint32, occurrence => optional, opts => []}, - #{name => target_ip, fnum => 4, rnum => 4, type => string, occurrence => optional, opts => []}, - #{name => target_port, fnum => 5, rnum => 5, type => uint32, occurrence => optional, opts => []}]}, - {{msg, list_port_forwardings_request}, [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]}, - {{msg, list_port_forwardings_response}, [#{name => port_forwardings, fnum => 1, rnum => 2, type => {msg, port_forwarding}, occurrence => repeated, opts => []}]}, - {{msg, put_port_forwarding_request}, [#{name => port_forwarding, fnum => 1, rnum => 2, type => {msg, port_forwarding}, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, empty}, []}]. - - -get_msg_names() -> [port_forwarding_identifier, port_forwarding, list_port_forwardings_request, list_port_forwardings_response, put_port_forwarding_request, empty]. - - -get_group_names() -> []. - - -get_msg_or_group_names() -> [port_forwarding_identifier, port_forwarding, list_port_forwardings_request, list_port_forwardings_response, put_port_forwarding_request, empty]. - - -get_enum_names() -> []. - - -fetch_msg_def(MsgName) -> - case find_msg_def(MsgName) of - Fs when is_list(Fs) -> Fs; - error -> erlang:error({no_such_msg, MsgName}) - end. - - --spec fetch_enum_def(_) -> no_return(). -fetch_enum_def(EnumName) -> erlang:error({no_such_enum, EnumName}). - - -find_msg_def(port_forwarding_identifier) -> - [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => protocol, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => source_port, fnum => 3, rnum => 4, type => uint32, occurrence => optional, opts => []}]; -find_msg_def(port_forwarding) -> - [#{name => protocol, fnum => 2, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => source_port, fnum => 3, rnum => 3, type => uint32, occurrence => optional, opts => []}, - #{name => target_ip, fnum => 4, rnum => 4, type => string, occurrence => optional, opts => []}, - #{name => target_port, fnum => 5, rnum => 5, type => uint32, occurrence => optional, opts => []}]; -find_msg_def(list_port_forwardings_request) -> [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]; -find_msg_def(list_port_forwardings_response) -> [#{name => port_forwardings, fnum => 1, rnum => 2, type => {msg, port_forwarding}, occurrence => repeated, opts => []}]; -find_msg_def(put_port_forwarding_request) -> - [#{name => port_forwarding, fnum => 1, rnum => 2, type => {msg, port_forwarding}, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(empty) -> []; -find_msg_def(_) -> error. - - -find_enum_def(_) -> error. - - --spec enum_symbol_by_value(_, _) -> no_return(). -enum_symbol_by_value(E, V) -> erlang:error({no_enum_defs, E, V}). - - --spec enum_value_by_symbol(_, _) -> no_return(). -enum_value_by_symbol(E, V) -> erlang:error({no_enum_defs, E, V}). - - - -get_service_names() -> ['PortForwardingService']. - - -get_service_def('PortForwardingService') -> - {{service, 'PortForwardingService'}, - [#{name => 'GetPortForwarding', input => port_forwarding_identifier, output => port_forwarding, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListPortForwardings', input => list_port_forwardings_request, output => list_port_forwardings_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'PutPortForwarding', input => put_port_forwarding_request, output => port_forwarding, input_stream => false, output_stream => false, opts => []}, - #{name => 'DeletePortForwarding', input => port_forwarding_identifier, output => empty, input_stream => false, output_stream => false, opts => []}]}; -get_service_def(_) -> error. - - -get_rpc_names('PortForwardingService') -> ['GetPortForwarding', 'ListPortForwardings', 'PutPortForwarding', 'DeletePortForwarding']; -get_rpc_names(_) -> error. - - -find_rpc_def('PortForwardingService', RpcName) -> find_rpc_def_PortForwardingService(RpcName); -find_rpc_def(_, _) -> error. - - -find_rpc_def_PortForwardingService('GetPortForwarding') -> #{name => 'GetPortForwarding', input => port_forwarding_identifier, output => port_forwarding, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_PortForwardingService('ListPortForwardings') -> #{name => 'ListPortForwardings', input => list_port_forwardings_request, output => list_port_forwardings_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_PortForwardingService('PutPortForwarding') -> #{name => 'PutPortForwarding', input => put_port_forwarding_request, output => port_forwarding, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_PortForwardingService('DeletePortForwarding') -> #{name => 'DeletePortForwarding', input => port_forwarding_identifier, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_PortForwardingService(_) -> error. - - -fetch_rpc_def(ServiceName, RpcName) -> - case find_rpc_def(ServiceName, RpcName) of - Def when is_map(Def) -> Def; - error -> erlang:error({no_such_rpc, ServiceName, RpcName}) - end. - - -%% Convert a a fully qualified (ie with package name) service name -%% as a binary to a service name as an atom. -fqbin_to_service_name(<<"PortForwardingService">>) -> 'PortForwardingService'; -fqbin_to_service_name(X) -> error({gpb_error, {badservice, X}}). - - -%% Convert a service name as an atom to a fully qualified -%% (ie with package name) name as a binary. -service_name_to_fqbin('PortForwardingService') -> <<"PortForwardingService">>; -service_name_to_fqbin(X) -> error({gpb_error, {badservice, X}}). - - -%% Convert a a fully qualified (ie with package name) service name -%% and an rpc name, both as binaries to a service name and an rpc -%% name, as atoms. -fqbins_to_service_and_rpc_name(<<"PortForwardingService">>, <<"GetPortForwarding">>) -> {'PortForwardingService', 'GetPortForwarding'}; -fqbins_to_service_and_rpc_name(<<"PortForwardingService">>, <<"ListPortForwardings">>) -> {'PortForwardingService', 'ListPortForwardings'}; -fqbins_to_service_and_rpc_name(<<"PortForwardingService">>, <<"PutPortForwarding">>) -> {'PortForwardingService', 'PutPortForwarding'}; -fqbins_to_service_and_rpc_name(<<"PortForwardingService">>, <<"DeletePortForwarding">>) -> {'PortForwardingService', 'DeletePortForwarding'}; -fqbins_to_service_and_rpc_name(S, R) -> error({gpb_error, {badservice_or_rpc, {S, R}}}). - - -%% Convert a service name and an rpc name, both as atoms, -%% to a fully qualified (ie with package name) service name and -%% an rpc name as binaries. -service_and_rpc_name_to_fqbins('PortForwardingService', 'GetPortForwarding') -> {<<"PortForwardingService">>, <<"GetPortForwarding">>}; -service_and_rpc_name_to_fqbins('PortForwardingService', 'ListPortForwardings') -> {<<"PortForwardingService">>, <<"ListPortForwardings">>}; -service_and_rpc_name_to_fqbins('PortForwardingService', 'PutPortForwarding') -> {<<"PortForwardingService">>, <<"PutPortForwarding">>}; -service_and_rpc_name_to_fqbins('PortForwardingService', 'DeletePortForwarding') -> {<<"PortForwardingService">>, <<"DeletePortForwarding">>}; -service_and_rpc_name_to_fqbins(S, R) -> error({gpb_error, {badservice_or_rpc, {S, R}}}). - - -fqbin_to_msg_name(<<"PortForwardingIdentifier">>) -> port_forwarding_identifier; -fqbin_to_msg_name(<<"PortForwarding">>) -> port_forwarding; -fqbin_to_msg_name(<<"ListPortForwardingsRequest">>) -> list_port_forwardings_request; -fqbin_to_msg_name(<<"ListPortForwardingsResponse">>) -> list_port_forwardings_response; -fqbin_to_msg_name(<<"PutPortForwardingRequest">>) -> put_port_forwarding_request; -fqbin_to_msg_name(<<"google.protobuf.Empty">>) -> empty; -fqbin_to_msg_name(E) -> error({gpb_error, {badmsg, E}}). - - -msg_name_to_fqbin(port_forwarding_identifier) -> <<"PortForwardingIdentifier">>; -msg_name_to_fqbin(port_forwarding) -> <<"PortForwarding">>; -msg_name_to_fqbin(list_port_forwardings_request) -> <<"ListPortForwardingsRequest">>; -msg_name_to_fqbin(list_port_forwardings_response) -> <<"ListPortForwardingsResponse">>; -msg_name_to_fqbin(put_port_forwarding_request) -> <<"PutPortForwardingRequest">>; -msg_name_to_fqbin(empty) -> <<"google.protobuf.Empty">>; -msg_name_to_fqbin(E) -> error({gpb_error, {badmsg, E}}). - - --spec fqbin_to_enum_name(_) -> no_return(). -fqbin_to_enum_name(E) -> error({gpb_error, {badenum, E}}). - - --spec enum_name_to_fqbin(_) -> no_return(). -enum_name_to_fqbin(E) -> error({gpb_error, {badenum, E}}). - - -get_package_name() -> 'google.protobuf'. - - -%% Whether or not the message names -%% are prepended with package name or not. -uses_packages() -> true. - - -source_basename() -> "port_forwarding.proto". - - -%% Retrieve all proto file names, also imported ones. -%% The order is top-down. The first element is always the main -%% source file. The files are returned with extension, -%% see get_all_proto_names/0 for a version that returns -%% the basenames sans extension -get_all_source_basenames() -> ["port_forwarding.proto", "empty.proto"]. - - -%% Retrieve all proto file names, also imported ones. -%% The order is top-down. The first element is always the main -%% source file. The files are returned sans .proto extension, -%% to make it easier to use them with the various get_xyz_containment -%% functions. -get_all_proto_names() -> ["port_forwarding", "empty"]. - - -get_msg_containment("port_forwarding") -> [list_port_forwardings_request, list_port_forwardings_response, port_forwarding, port_forwarding_identifier, put_port_forwarding_request]; -get_msg_containment("empty") -> [empty]; -get_msg_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_pkg_containment("port_forwarding") -> undefined; -get_pkg_containment("empty") -> 'google.protobuf'; -get_pkg_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_service_containment("port_forwarding") -> ['PortForwardingService']; -get_service_containment("empty") -> []; -get_service_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_rpc_containment("port_forwarding") -> [{'PortForwardingService', 'GetPortForwarding'}, {'PortForwardingService', 'ListPortForwardings'}, {'PortForwardingService', 'PutPortForwarding'}, {'PortForwardingService', 'DeletePortForwarding'}]; -get_rpc_containment("empty") -> []; -get_rpc_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_enum_containment("port_forwarding") -> []; -get_enum_containment("empty") -> []; -get_enum_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_proto_by_msg_name_as_fqbin(<<"PortForwardingIdentifier">>) -> "port_forwarding"; -get_proto_by_msg_name_as_fqbin(<<"PutPortForwardingRequest">>) -> "port_forwarding"; -get_proto_by_msg_name_as_fqbin(<<"ListPortForwardingsRequest">>) -> "port_forwarding"; -get_proto_by_msg_name_as_fqbin(<<"ListPortForwardingsResponse">>) -> "port_forwarding"; -get_proto_by_msg_name_as_fqbin(<<"PortForwarding">>) -> "port_forwarding"; -get_proto_by_msg_name_as_fqbin(<<"google.protobuf.Empty">>) -> "empty"; -get_proto_by_msg_name_as_fqbin(E) -> error({gpb_error, {badmsg, E}}). - - -get_proto_by_service_name_as_fqbin(<<"PortForwardingService">>) -> "port_forwarding"; -get_proto_by_service_name_as_fqbin(E) -> error({gpb_error, {badservice, E}}). - - --spec get_proto_by_enum_name_as_fqbin(_) -> no_return(). -get_proto_by_enum_name_as_fqbin(E) -> error({gpb_error, {badenum, E}}). - - -get_protos_by_pkg_name_as_fqbin(<<"google.protobuf">>) -> ["empty"]; -get_protos_by_pkg_name_as_fqbin(E) -> error({gpb_error, {badpkg, E}}). - - - -gpb_version_as_string() -> - "4.19.8". - -gpb_version_as_list() -> - [4,19,8]. - -gpb_version_source() -> - "file". diff --git a/virtuerl/src/pb/port_forwarding_service_bhvr.erl b/virtuerl/src/pb/port_forwarding_service_bhvr.erl deleted file mode 100644 index 21208cf..0000000 --- a/virtuerl/src/pb/port_forwarding_service_bhvr.erl +++ /dev/null @@ -1,25 +0,0 @@ -%%%------------------------------------------------------------------- -%% @doc Behaviour to implement for grpc service PortForwardingService. -%% @end -%%%------------------------------------------------------------------- - -%% this module was generated and should not be modified manually - --module(port_forwarding_service_bhvr). - -%% Unary RPC --callback get_port_forwarding(ctx:t(), port_forwarding_pb:port_forwarding_identifier()) -> - {ok, port_forwarding_pb:port_forwarding(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback list_port_forwardings(ctx:t(), port_forwarding_pb:list_port_forwardings_request()) -> - {ok, port_forwarding_pb:list_port_forwardings_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback put_port_forwarding(ctx:t(), port_forwarding_pb:put_port_forwarding_request()) -> - {ok, port_forwarding_pb:port_forwarding(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback delete_port_forwarding(ctx:t(), port_forwarding_pb:port_forwarding_identifier()) -> - {ok, port_forwarding_pb:empty(), ctx:t()} | grpcbox_stream:grpc_error_response(). - diff --git a/virtuerl/src/pb/port_forwarding_service_client.erl b/virtuerl/src/pb/port_forwarding_service_client.erl deleted file mode 100644 index 6043ffa..0000000 --- a/virtuerl/src/pb/port_forwarding_service_client.erl +++ /dev/null @@ -1,97 +0,0 @@ -%%%------------------------------------------------------------------- -%% @doc Client module for grpc service PortForwardingService. -%% @end -%%%------------------------------------------------------------------- - -%% this module was generated and should not be modified manually - --module(port_forwarding_service_client). - --compile(export_all). --compile(nowarn_export_all). - --include_lib("grpcbox/include/grpcbox.hrl"). - --define(is_ctx(Ctx), is_tuple(Ctx) andalso element(1, Ctx) =:= ctx). - --define(SERVICE, 'PortForwardingService'). --define(PROTO_MODULE, 'port_forwarding_pb'). --define(MARSHAL_FUN(T), fun(I) -> ?PROTO_MODULE:encode_msg(I, T) end). --define(UNMARSHAL_FUN(T), fun(I) -> ?PROTO_MODULE:decode_msg(I, T) end). --define(DEF(Input, Output, MessageType), #grpcbox_def{service=?SERVICE, - message_type=MessageType, - marshal_fun=?MARSHAL_FUN(Input), - unmarshal_fun=?UNMARSHAL_FUN(Output)}). - -%% @doc Unary RPC --spec get_port_forwarding(port_forwarding_pb:port_forwarding_identifier()) -> - {ok, port_forwarding_pb:port_forwarding(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_port_forwarding(Input) -> - get_port_forwarding(ctx:new(), Input, #{}). - --spec get_port_forwarding(ctx:t() | port_forwarding_pb:port_forwarding_identifier(), port_forwarding_pb:port_forwarding_identifier() | grpcbox_client:options()) -> - {ok, port_forwarding_pb:port_forwarding(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_port_forwarding(Ctx, Input) when ?is_ctx(Ctx) -> - get_port_forwarding(Ctx, Input, #{}); -get_port_forwarding(Input, Options) -> - get_port_forwarding(ctx:new(), Input, Options). - --spec get_port_forwarding(ctx:t(), port_forwarding_pb:port_forwarding_identifier(), grpcbox_client:options()) -> - {ok, port_forwarding_pb:port_forwarding(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_port_forwarding(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/PortForwardingService/GetPortForwarding">>, Input, ?DEF(port_forwarding_identifier, port_forwarding, <<"PortForwardingIdentifier">>), Options). - -%% @doc Unary RPC --spec list_port_forwardings(port_forwarding_pb:list_port_forwardings_request()) -> - {ok, port_forwarding_pb:list_port_forwardings_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_port_forwardings(Input) -> - list_port_forwardings(ctx:new(), Input, #{}). - --spec list_port_forwardings(ctx:t() | port_forwarding_pb:list_port_forwardings_request(), port_forwarding_pb:list_port_forwardings_request() | grpcbox_client:options()) -> - {ok, port_forwarding_pb:list_port_forwardings_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_port_forwardings(Ctx, Input) when ?is_ctx(Ctx) -> - list_port_forwardings(Ctx, Input, #{}); -list_port_forwardings(Input, Options) -> - list_port_forwardings(ctx:new(), Input, Options). - --spec list_port_forwardings(ctx:t(), port_forwarding_pb:list_port_forwardings_request(), grpcbox_client:options()) -> - {ok, port_forwarding_pb:list_port_forwardings_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_port_forwardings(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/PortForwardingService/ListPortForwardings">>, Input, ?DEF(list_port_forwardings_request, list_port_forwardings_response, <<"ListPortForwardingsRequest">>), Options). - -%% @doc Unary RPC --spec put_port_forwarding(port_forwarding_pb:put_port_forwarding_request()) -> - {ok, port_forwarding_pb:port_forwarding(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -put_port_forwarding(Input) -> - put_port_forwarding(ctx:new(), Input, #{}). - --spec put_port_forwarding(ctx:t() | port_forwarding_pb:put_port_forwarding_request(), port_forwarding_pb:put_port_forwarding_request() | grpcbox_client:options()) -> - {ok, port_forwarding_pb:port_forwarding(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -put_port_forwarding(Ctx, Input) when ?is_ctx(Ctx) -> - put_port_forwarding(Ctx, Input, #{}); -put_port_forwarding(Input, Options) -> - put_port_forwarding(ctx:new(), Input, Options). - --spec put_port_forwarding(ctx:t(), port_forwarding_pb:put_port_forwarding_request(), grpcbox_client:options()) -> - {ok, port_forwarding_pb:port_forwarding(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -put_port_forwarding(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/PortForwardingService/PutPortForwarding">>, Input, ?DEF(put_port_forwarding_request, port_forwarding, <<"PutPortForwardingRequest">>), Options). - -%% @doc Unary RPC --spec delete_port_forwarding(port_forwarding_pb:port_forwarding_identifier()) -> - {ok, port_forwarding_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_port_forwarding(Input) -> - delete_port_forwarding(ctx:new(), Input, #{}). - --spec delete_port_forwarding(ctx:t() | port_forwarding_pb:port_forwarding_identifier(), port_forwarding_pb:port_forwarding_identifier() | grpcbox_client:options()) -> - {ok, port_forwarding_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_port_forwarding(Ctx, Input) when ?is_ctx(Ctx) -> - delete_port_forwarding(Ctx, Input, #{}); -delete_port_forwarding(Input, Options) -> - delete_port_forwarding(ctx:new(), Input, Options). - --spec delete_port_forwarding(ctx:t(), port_forwarding_pb:port_forwarding_identifier(), grpcbox_client:options()) -> - {ok, port_forwarding_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_port_forwarding(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/PortForwardingService/DeletePortForwarding">>, Input, ?DEF(port_forwarding_identifier, empty, <<"PortForwardingIdentifier">>), Options). - diff --git a/virtuerl/src/pb/route_pb.erl b/virtuerl/src/pb/route_pb.erl deleted file mode 100644 index c2c47f4..0000000 --- a/virtuerl/src/pb/route_pb.erl +++ /dev/null @@ -1,1912 +0,0 @@ -%% -*- coding: utf-8 -*- -%% @private -%% Automatically generated, do not edit -%% Generated by gpb_compile version 4.19.8 -%% Version source: file --module(route_pb). - --export([encode_msg/2, encode_msg/3]). --export([decode_msg/2, decode_msg/3]). --export([merge_msgs/3, merge_msgs/4]). --export([verify_msg/2, verify_msg/3]). --export([get_msg_defs/0]). --export([get_msg_names/0]). --export([get_group_names/0]). --export([get_msg_or_group_names/0]). --export([get_enum_names/0]). --export([find_msg_def/1, fetch_msg_def/1]). --export([find_enum_def/1, fetch_enum_def/1]). --export([enum_symbol_by_value/2, enum_value_by_symbol/2]). --export([get_service_names/0]). --export([get_service_def/1]). --export([get_rpc_names/1]). --export([find_rpc_def/2, fetch_rpc_def/2]). --export([fqbin_to_service_name/1]). --export([service_name_to_fqbin/1]). --export([fqbins_to_service_and_rpc_name/2]). --export([service_and_rpc_name_to_fqbins/2]). --export([fqbin_to_msg_name/1]). --export([msg_name_to_fqbin/1]). --export([fqbin_to_enum_name/1]). --export([enum_name_to_fqbin/1]). --export([get_package_name/0]). --export([uses_packages/0]). --export([source_basename/0]). --export([get_all_source_basenames/0]). --export([get_all_proto_names/0]). --export([get_msg_containment/1]). --export([get_pkg_containment/1]). --export([get_service_containment/1]). --export([get_rpc_containment/1]). --export([get_enum_containment/1]). --export([get_proto_by_msg_name_as_fqbin/1]). --export([get_proto_by_service_name_as_fqbin/1]). --export([get_proto_by_enum_name_as_fqbin/1]). --export([get_protos_by_pkg_name_as_fqbin/1]). --export([gpb_version_as_string/0, gpb_version_as_list/0]). --export([gpb_version_source/0]). - - -%% enumerated types - --export_type([]). - -%% message types --type route_table() :: - #{network_name => unicode:chardata(), % = 1, optional - id => non_neg_integer(), % = 2, optional, 32 bits - name => unicode:chardata() % = 3, optional - }. - --type route_table_identifier() :: - #{id => non_neg_integer() % = 1, optional, 32 bits - }. - --type list_route_tables_request() :: - #{network_name => unicode:chardata() % = 1, optional - }. - --type list_route_tables_response() :: - #{route_tables => [route_table()] % = 1, repeated - }. - --type create_route_table_request() :: - #{route_table => route_table() % = 1, optional - }. - --type route_identifier() :: - #{route_table_id => non_neg_integer(), % = 1, optional, 32 bits - destination => unicode:chardata() % = 2, optional - }. - --type route() :: - #{route_table_id => non_neg_integer(), % = 1, optional, 32 bits - destination => unicode:chardata(), % = 2, optional - gateways => [unicode:chardata()] % = 3, repeated - }. - --type list_routes_request() :: - #{route_table_id => non_neg_integer() % = 1, optional, 32 bits - }. - --type list_routes_response() :: - #{routes => [route()] % = 1, repeated - }. - --type put_route_request() :: - #{route => route() % = 1, optional - }. - --type sync_request() :: - #{ - }. - --type empty() :: - #{ - }. - --export_type(['route_table'/0, 'route_table_identifier'/0, 'list_route_tables_request'/0, 'list_route_tables_response'/0, 'create_route_table_request'/0, 'route_identifier'/0, 'route'/0, 'list_routes_request'/0, 'list_routes_response'/0, 'put_route_request'/0, 'sync_request'/0, 'empty'/0]). --type '$msg_name'() :: route_table | route_table_identifier | list_route_tables_request | list_route_tables_response | create_route_table_request | route_identifier | route | list_routes_request | list_routes_response | put_route_request | sync_request | empty. --type '$msg'() :: route_table() | route_table_identifier() | list_route_tables_request() | list_route_tables_response() | create_route_table_request() | route_identifier() | route() | list_routes_request() | list_routes_response() | put_route_request() | sync_request() | empty(). --export_type(['$msg_name'/0, '$msg'/0]). - --if(?OTP_RELEASE >= 24). --dialyzer({no_underspecs, encode_msg/2}). --endif. --spec encode_msg('$msg'(), '$msg_name'()) -> binary(). -encode_msg(Msg, MsgName) when is_atom(MsgName) -> encode_msg(Msg, MsgName, []). - --if(?OTP_RELEASE >= 24). --dialyzer({no_underspecs, encode_msg/3}). --endif. --spec encode_msg('$msg'(), '$msg_name'(), list()) -> binary(). -encode_msg(Msg, MsgName, Opts) -> - case proplists:get_bool(verify, Opts) of - true -> verify_msg(Msg, MsgName, Opts); - false -> ok - end, - TrUserData = proplists:get_value(user_data, Opts), - case MsgName of - route_table -> encode_msg_route_table(id(Msg, TrUserData), TrUserData); - route_table_identifier -> encode_msg_route_table_identifier(id(Msg, TrUserData), TrUserData); - list_route_tables_request -> encode_msg_list_route_tables_request(id(Msg, TrUserData), TrUserData); - list_route_tables_response -> encode_msg_list_route_tables_response(id(Msg, TrUserData), TrUserData); - create_route_table_request -> encode_msg_create_route_table_request(id(Msg, TrUserData), TrUserData); - route_identifier -> encode_msg_route_identifier(id(Msg, TrUserData), TrUserData); - route -> encode_msg_route(id(Msg, TrUserData), TrUserData); - list_routes_request -> encode_msg_list_routes_request(id(Msg, TrUserData), TrUserData); - list_routes_response -> encode_msg_list_routes_response(id(Msg, TrUserData), TrUserData); - put_route_request -> encode_msg_put_route_request(id(Msg, TrUserData), TrUserData); - sync_request -> encode_msg_sync_request(id(Msg, TrUserData), TrUserData); - empty -> encode_msg_empty(id(Msg, TrUserData), TrUserData) - end. - - -encode_msg_route_table(Msg, TrUserData) -> encode_msg_route_table(Msg, <<>>, TrUserData). - - -encode_msg_route_table(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{network_name := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - B2 = case M of - #{id := F2} -> - begin - TrF2 = id(F2, TrUserData), - if TrF2 =:= 0 -> B1; - true -> e_varint(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end, - case M of - #{name := F3} -> - begin - TrF3 = id(F3, TrUserData), - case is_empty_string(TrF3) of - true -> B2; - false -> e_type_string(TrF3, <>, TrUserData) - end - end; - _ -> B2 - end. - -encode_msg_route_table_identifier(Msg, TrUserData) -> encode_msg_route_table_identifier(Msg, <<>>, TrUserData). - - -encode_msg_route_table_identifier(#{} = M, Bin, TrUserData) -> - case M of - #{id := F1} -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= 0 -> Bin; - true -> e_varint(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end. - -encode_msg_list_route_tables_request(Msg, TrUserData) -> encode_msg_list_route_tables_request(Msg, <<>>, TrUserData). - - -encode_msg_list_route_tables_request(#{} = M, Bin, TrUserData) -> - case M of - #{network_name := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end. - -encode_msg_list_route_tables_response(Msg, TrUserData) -> encode_msg_list_route_tables_response(Msg, <<>>, TrUserData). - - -encode_msg_list_route_tables_response(#{} = M, Bin, TrUserData) -> - case M of - #{route_tables := F1} -> - TrF1 = id(F1, TrUserData), - if TrF1 == [] -> Bin; - true -> e_field_list_route_tables_response_route_tables(TrF1, Bin, TrUserData) - end; - _ -> Bin - end. - -encode_msg_create_route_table_request(Msg, TrUserData) -> encode_msg_create_route_table_request(Msg, <<>>, TrUserData). - - -encode_msg_create_route_table_request(#{} = M, Bin, TrUserData) -> - case M of - #{route_table := F1} -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= undefined -> Bin; - true -> e_mfield_create_route_table_request_route_table(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end. - -encode_msg_route_identifier(Msg, TrUserData) -> encode_msg_route_identifier(Msg, <<>>, TrUserData). - - -encode_msg_route_identifier(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{route_table_id := F1} -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= 0 -> Bin; - true -> e_varint(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{destination := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_route(Msg, TrUserData) -> encode_msg_route(Msg, <<>>, TrUserData). - - -encode_msg_route(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{route_table_id := F1} -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= 0 -> Bin; - true -> e_varint(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - B2 = case M of - #{destination := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end, - case M of - #{gateways := F3} -> - TrF3 = id(F3, TrUserData), - if TrF3 == [] -> B2; - true -> e_field_route_gateways(TrF3, B2, TrUserData) - end; - _ -> B2 - end. - -encode_msg_list_routes_request(Msg, TrUserData) -> encode_msg_list_routes_request(Msg, <<>>, TrUserData). - - -encode_msg_list_routes_request(#{} = M, Bin, TrUserData) -> - case M of - #{route_table_id := F1} -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= 0 -> Bin; - true -> e_varint(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end. - -encode_msg_list_routes_response(Msg, TrUserData) -> encode_msg_list_routes_response(Msg, <<>>, TrUserData). - - -encode_msg_list_routes_response(#{} = M, Bin, TrUserData) -> - case M of - #{routes := F1} -> - TrF1 = id(F1, TrUserData), - if TrF1 == [] -> Bin; - true -> e_field_list_routes_response_routes(TrF1, Bin, TrUserData) - end; - _ -> Bin - end. - -encode_msg_put_route_request(Msg, TrUserData) -> encode_msg_put_route_request(Msg, <<>>, TrUserData). - - -encode_msg_put_route_request(#{} = M, Bin, TrUserData) -> - case M of - #{route := F1} -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= undefined -> Bin; - true -> e_mfield_put_route_request_route(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end. - -encode_msg_sync_request(_Msg, _TrUserData) -> <<>>. - -encode_msg_empty(_Msg, _TrUserData) -> <<>>. - -e_mfield_list_route_tables_response_route_tables(Msg, Bin, TrUserData) -> - SubBin = encode_msg_route_table(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_field_list_route_tables_response_route_tables([Elem | Rest], Bin, TrUserData) -> - Bin2 = <>, - Bin3 = e_mfield_list_route_tables_response_route_tables(id(Elem, TrUserData), Bin2, TrUserData), - e_field_list_route_tables_response_route_tables(Rest, Bin3, TrUserData); -e_field_list_route_tables_response_route_tables([], Bin, _TrUserData) -> Bin. - -e_mfield_create_route_table_request_route_table(Msg, Bin, TrUserData) -> - SubBin = encode_msg_route_table(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_field_route_gateways([Elem | Rest], Bin, TrUserData) -> - Bin2 = <>, - Bin3 = e_type_string(id(Elem, TrUserData), Bin2, TrUserData), - e_field_route_gateways(Rest, Bin3, TrUserData); -e_field_route_gateways([], Bin, _TrUserData) -> Bin. - -e_mfield_list_routes_response_routes(Msg, Bin, TrUserData) -> - SubBin = encode_msg_route(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_field_list_routes_response_routes([Elem | Rest], Bin, TrUserData) -> - Bin2 = <>, - Bin3 = e_mfield_list_routes_response_routes(id(Elem, TrUserData), Bin2, TrUserData), - e_field_list_routes_response_routes(Rest, Bin3, TrUserData); -e_field_list_routes_response_routes([], Bin, _TrUserData) -> Bin. - -e_mfield_put_route_request_route(Msg, Bin, TrUserData) -> - SubBin = encode_msg_route(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - --compile({nowarn_unused_function,e_type_sint/3}). -e_type_sint(Value, Bin, _TrUserData) when Value >= 0 -> e_varint(Value * 2, Bin); -e_type_sint(Value, Bin, _TrUserData) -> e_varint(Value * -2 - 1, Bin). - --compile({nowarn_unused_function,e_type_int32/3}). -e_type_int32(Value, Bin, _TrUserData) when 0 =< Value, Value =< 127 -> <>; -e_type_int32(Value, Bin, _TrUserData) -> - <> = <>, - e_varint(N, Bin). - --compile({nowarn_unused_function,e_type_int64/3}). -e_type_int64(Value, Bin, _TrUserData) when 0 =< Value, Value =< 127 -> <>; -e_type_int64(Value, Bin, _TrUserData) -> - <> = <>, - e_varint(N, Bin). - --compile({nowarn_unused_function,e_type_bool/3}). -e_type_bool(true, Bin, _TrUserData) -> <>; -e_type_bool(false, Bin, _TrUserData) -> <>; -e_type_bool(1, Bin, _TrUserData) -> <>; -e_type_bool(0, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_string/3}). -e_type_string(S, Bin, _TrUserData) -> - Utf8 = unicode:characters_to_binary(S), - Bin2 = e_varint(byte_size(Utf8), Bin), - <>. - --compile({nowarn_unused_function,e_type_bytes/3}). -e_type_bytes(Bytes, Bin, _TrUserData) when is_binary(Bytes) -> - Bin2 = e_varint(byte_size(Bytes), Bin), - <>; -e_type_bytes(Bytes, Bin, _TrUserData) when is_list(Bytes) -> - BytesBin = iolist_to_binary(Bytes), - Bin2 = e_varint(byte_size(BytesBin), Bin), - <>. - --compile({nowarn_unused_function,e_type_fixed32/3}). -e_type_fixed32(Value, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_sfixed32/3}). -e_type_sfixed32(Value, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_fixed64/3}). -e_type_fixed64(Value, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_sfixed64/3}). -e_type_sfixed64(Value, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_float/3}). -e_type_float(V, Bin, _) when is_number(V) -> <>; -e_type_float(infinity, Bin, _) -> <>; -e_type_float('-infinity', Bin, _) -> <>; -e_type_float(nan, Bin, _) -> <>. - --compile({nowarn_unused_function,e_type_double/3}). -e_type_double(V, Bin, _) when is_number(V) -> <>; -e_type_double(infinity, Bin, _) -> <>; -e_type_double('-infinity', Bin, _) -> <>; -e_type_double(nan, Bin, _) -> <>. - --compile({nowarn_unused_function,e_unknown_elems/2}). -e_unknown_elems([Elem | Rest], Bin) -> - BinR = case Elem of - {varint, FNum, N} -> - BinF = e_varint(FNum bsl 3, Bin), - e_varint(N, BinF); - {length_delimited, FNum, Data} -> - BinF = e_varint(FNum bsl 3 bor 2, Bin), - BinL = e_varint(byte_size(Data), BinF), - <>; - {group, FNum, GroupFields} -> - Bin1 = e_varint(FNum bsl 3 bor 3, Bin), - Bin2 = e_unknown_elems(GroupFields, Bin1), - e_varint(FNum bsl 3 bor 4, Bin2); - {fixed32, FNum, V} -> - BinF = e_varint(FNum bsl 3 bor 5, Bin), - <>; - {fixed64, FNum, V} -> - BinF = e_varint(FNum bsl 3 bor 1, Bin), - <> - end, - e_unknown_elems(Rest, BinR); -e_unknown_elems([], Bin) -> Bin. - --compile({nowarn_unused_function,e_varint/3}). -e_varint(N, Bin, _TrUserData) -> e_varint(N, Bin). - --compile({nowarn_unused_function,e_varint/2}). -e_varint(N, Bin) when N =< 127 -> <>; -e_varint(N, Bin) -> - Bin2 = <>, - e_varint(N bsr 7, Bin2). - -is_empty_string("") -> true; -is_empty_string(<<>>) -> true; -is_empty_string(L) when is_list(L) -> not string_has_chars(L); -is_empty_string(B) when is_binary(B) -> false. - -string_has_chars([C | _]) when is_integer(C) -> true; -string_has_chars([H | T]) -> - case string_has_chars(H) of - true -> true; - false -> string_has_chars(T) - end; -string_has_chars(B) when is_binary(B), byte_size(B) =/= 0 -> true; -string_has_chars(C) when is_integer(C) -> true; -string_has_chars(<<>>) -> false; -string_has_chars([]) -> false. - - -decode_msg(Bin, MsgName) when is_binary(Bin) -> decode_msg(Bin, MsgName, []). - -decode_msg(Bin, MsgName, Opts) when is_binary(Bin) -> - TrUserData = proplists:get_value(user_data, Opts), - decode_msg_1_catch(Bin, MsgName, TrUserData). - --ifdef('OTP_RELEASE'). -decode_msg_1_catch(Bin, MsgName, TrUserData) -> - try decode_msg_2_doit(MsgName, Bin, TrUserData) - catch - error:{gpb_error,_}=Reason:StackTrace -> - erlang:raise(error, Reason, StackTrace); - Class:Reason:StackTrace -> error({gpb_error,{decoding_failure, {Bin, MsgName, {Class, Reason, StackTrace}}}}) - end. --else. -decode_msg_1_catch(Bin, MsgName, TrUserData) -> - try decode_msg_2_doit(MsgName, Bin, TrUserData) - catch - error:{gpb_error,_}=Reason -> - erlang:raise(error, Reason, - erlang:get_stacktrace()); - Class:Reason -> - StackTrace = erlang:get_stacktrace(), - error({gpb_error,{decoding_failure, {Bin, MsgName, {Class, Reason, StackTrace}}}}) - end. --endif. - -decode_msg_2_doit(route_table, Bin, TrUserData) -> id(decode_msg_route_table(Bin, TrUserData), TrUserData); -decode_msg_2_doit(route_table_identifier, Bin, TrUserData) -> id(decode_msg_route_table_identifier(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_route_tables_request, Bin, TrUserData) -> id(decode_msg_list_route_tables_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_route_tables_response, Bin, TrUserData) -> id(decode_msg_list_route_tables_response(Bin, TrUserData), TrUserData); -decode_msg_2_doit(create_route_table_request, Bin, TrUserData) -> id(decode_msg_create_route_table_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(route_identifier, Bin, TrUserData) -> id(decode_msg_route_identifier(Bin, TrUserData), TrUserData); -decode_msg_2_doit(route, Bin, TrUserData) -> id(decode_msg_route(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_routes_request, Bin, TrUserData) -> id(decode_msg_list_routes_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_routes_response, Bin, TrUserData) -> id(decode_msg_list_routes_response(Bin, TrUserData), TrUserData); -decode_msg_2_doit(put_route_request, Bin, TrUserData) -> id(decode_msg_put_route_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(sync_request, Bin, TrUserData) -> id(decode_msg_sync_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(empty, Bin, TrUserData) -> id(decode_msg_empty(Bin, TrUserData), TrUserData). - - - -decode_msg_route_table(Bin, TrUserData) -> dfp_read_field_def_route_table(Bin, 0, 0, 0, id(<<>>, TrUserData), id(0, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_route_table(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_route_table_network_name(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_route_table(<<16, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_route_table_id(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_route_table(<<26, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_route_table_name(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_route_table(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{network_name => F@_1, id => F@_2, name => F@_3}; -dfp_read_field_def_route_table(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dg_read_field_def_route_table(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -dg_read_field_def_route_table(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 32 - 7 -> dg_read_field_def_route_table(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -dg_read_field_def_route_table(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_route_table_network_name(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 16 -> d_field_route_table_id(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 26 -> d_field_route_table_name(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_route_table(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 1 -> skip_64_route_table(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 2 -> skip_length_delimited_route_table(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 3 -> skip_group_route_table(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 5 -> skip_32_route_table(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData) - end - end; -dg_read_field_def_route_table(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{network_name => F@_1, id => F@_2, name => F@_3}. - -d_field_route_table_network_name(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_route_table_network_name(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_route_table_network_name(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_route_table(RestF, 0, 0, F, NewFValue, F@_2, F@_3, TrUserData). - -d_field_route_table_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_route_table_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_route_table_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, TrUserData) -> - {NewFValue, RestF} = {id((X bsl N + Acc) band 4294967295, TrUserData), Rest}, - dfp_read_field_def_route_table(RestF, 0, 0, F, F@_1, NewFValue, F@_3, TrUserData). - -d_field_route_table_name(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_route_table_name(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_route_table_name(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_route_table(RestF, 0, 0, F, F@_1, F@_2, NewFValue, TrUserData). - -skip_varint_route_table(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> skip_varint_route_table(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -skip_varint_route_table(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_route_table(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_length_delimited_route_table(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> skip_length_delimited_route_table(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -skip_length_delimited_route_table(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_route_table(Rest2, 0, 0, F, F@_1, F@_2, F@_3, TrUserData). - -skip_group_route_table(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_route_table(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, TrUserData). - -skip_32_route_table(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_route_table(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_64_route_table(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_route_table(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -decode_msg_route_table_identifier(Bin, TrUserData) -> dfp_read_field_def_route_table_identifier(Bin, 0, 0, 0, id(0, TrUserData), TrUserData). - -dfp_read_field_def_route_table_identifier(<<8, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_route_table_identifier_id(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_route_table_identifier(<<>>, 0, 0, _, F@_1, _) -> #{id => F@_1}; -dfp_read_field_def_route_table_identifier(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_route_table_identifier(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_route_table_identifier(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_route_table_identifier(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_route_table_identifier(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 8 -> d_field_route_table_identifier_id(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_route_table_identifier(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_route_table_identifier(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_route_table_identifier(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_route_table_identifier(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_route_table_identifier(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_route_table_identifier(<<>>, 0, 0, _, F@_1, _) -> #{id => F@_1}. - -d_field_route_table_identifier_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_route_table_identifier_id(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_route_table_identifier_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, TrUserData) -> - {NewFValue, RestF} = {id((X bsl N + Acc) band 4294967295, TrUserData), Rest}, - dfp_read_field_def_route_table_identifier(RestF, 0, 0, F, NewFValue, TrUserData). - -skip_varint_route_table_identifier(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_route_table_identifier(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_route_table_identifier(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_route_table_identifier(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_route_table_identifier(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_route_table_identifier(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_route_table_identifier(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_route_table_identifier(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_route_table_identifier(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_route_table_identifier(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_route_table_identifier(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_route_table_identifier(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_route_table_identifier(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_route_table_identifier(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_list_route_tables_request(Bin, TrUserData) -> dfp_read_field_def_list_route_tables_request(Bin, 0, 0, 0, id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_list_route_tables_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_route_tables_request_network_name(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_list_route_tables_request(<<>>, 0, 0, _, F@_1, _) -> #{network_name => F@_1}; -dfp_read_field_def_list_route_tables_request(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_route_tables_request(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_list_route_tables_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_route_tables_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_list_route_tables_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_route_tables_request_network_name(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_route_tables_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_list_route_tables_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_list_route_tables_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_list_route_tables_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_list_route_tables_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_list_route_tables_request(<<>>, 0, 0, _, F@_1, _) -> #{network_name => F@_1}. - -d_field_list_route_tables_request_network_name(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_route_tables_request_network_name(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_list_route_tables_request_network_name(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_list_route_tables_request(RestF, 0, 0, F, NewFValue, TrUserData). - -skip_varint_list_route_tables_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_route_tables_request(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_list_route_tables_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_route_tables_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_list_route_tables_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_route_tables_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_list_route_tables_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_route_tables_request(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_list_route_tables_request(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_route_tables_request(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_list_route_tables_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_route_tables_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_list_route_tables_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_route_tables_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_list_route_tables_response(Bin, TrUserData) -> dfp_read_field_def_list_route_tables_response(Bin, 0, 0, 0, id([], TrUserData), TrUserData). - -dfp_read_field_def_list_route_tables_response(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_route_tables_response_route_tables(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_list_route_tables_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{route_tables => lists_reverse(R1, TrUserData)} - end; -dfp_read_field_def_list_route_tables_response(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_route_tables_response(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_list_route_tables_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_route_tables_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_list_route_tables_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_route_tables_response_route_tables(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_route_tables_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_list_route_tables_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_list_route_tables_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_list_route_tables_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_list_route_tables_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_list_route_tables_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{route_tables => lists_reverse(R1, TrUserData)} - end. - -d_field_list_route_tables_response_route_tables(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_route_tables_response_route_tables(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_list_route_tables_response_route_tables(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_route_table(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_list_route_tables_response(RestF, 0, 0, F, cons(NewFValue, Prev, TrUserData), TrUserData). - -skip_varint_list_route_tables_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_route_tables_response(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_list_route_tables_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_route_tables_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_list_route_tables_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_route_tables_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_list_route_tables_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_route_tables_response(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_list_route_tables_response(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_route_tables_response(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_list_route_tables_response(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_route_tables_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_list_route_tables_response(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_route_tables_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_create_route_table_request(Bin, TrUserData) -> dfp_read_field_def_create_route_table_request(Bin, 0, 0, 0, id('$undef', TrUserData), TrUserData). - -dfp_read_field_def_create_route_table_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_create_route_table_request_route_table(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_create_route_table_request(<<>>, 0, 0, _, F@_1, _) -> - S1 = #{}, - if F@_1 == '$undef' -> S1; - true -> S1#{route_table => F@_1} - end; -dfp_read_field_def_create_route_table_request(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_create_route_table_request(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_create_route_table_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_create_route_table_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_create_route_table_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_create_route_table_request_route_table(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_create_route_table_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_create_route_table_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_create_route_table_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_create_route_table_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_create_route_table_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_create_route_table_request(<<>>, 0, 0, _, F@_1, _) -> - S1 = #{}, - if F@_1 == '$undef' -> S1; - true -> S1#{route_table => F@_1} - end. - -d_field_create_route_table_request_route_table(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_create_route_table_request_route_table(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_create_route_table_request_route_table(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_route_table(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_create_route_table_request(RestF, - 0, - 0, - F, - if Prev == '$undef' -> NewFValue; - true -> merge_msg_route_table(Prev, NewFValue, TrUserData) - end, - TrUserData). - -skip_varint_create_route_table_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_create_route_table_request(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_create_route_table_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_create_route_table_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_create_route_table_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_create_route_table_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_create_route_table_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_create_route_table_request(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_create_route_table_request(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_create_route_table_request(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_create_route_table_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_create_route_table_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_create_route_table_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_create_route_table_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_route_identifier(Bin, TrUserData) -> dfp_read_field_def_route_identifier(Bin, 0, 0, 0, id(0, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_route_identifier(<<8, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_route_identifier_route_table_id(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_route_identifier(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_route_identifier_destination(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_route_identifier(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{route_table_id => F@_1, destination => F@_2}; -dfp_read_field_def_route_identifier(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_route_identifier(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_route_identifier(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_route_identifier(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_route_identifier(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 8 -> d_field_route_identifier_route_table_id(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_route_identifier_destination(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_route_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_route_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_route_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_route_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_route_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_route_identifier(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{route_table_id => F@_1, destination => F@_2}. - -d_field_route_identifier_route_table_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_route_identifier_route_table_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_route_identifier_route_table_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = {id((X bsl N + Acc) band 4294967295, TrUserData), Rest}, - dfp_read_field_def_route_identifier(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_route_identifier_destination(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_route_identifier_destination(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_route_identifier_destination(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_route_identifier(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_route_identifier(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_route_identifier(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_route_identifier(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_route_identifier(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_route_identifier(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_route_identifier(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_route_identifier(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_route_identifier(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_route_identifier(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_route_identifier(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_route_identifier(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_route_identifier(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_route_identifier(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_route_identifier(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_route(Bin, TrUserData) -> dfp_read_field_def_route(Bin, 0, 0, 0, id(0, TrUserData), id(<<>>, TrUserData), id([], TrUserData), TrUserData). - -dfp_read_field_def_route(<<8, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_route_route_table_id(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_route(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_route_destination(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_route(<<26, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_route_gateways(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_route(<<>>, 0, 0, _, F@_1, F@_2, R1, TrUserData) -> #{route_table_id => F@_1, destination => F@_2, gateways => lists_reverse(R1, TrUserData)}; -dfp_read_field_def_route(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dg_read_field_def_route(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -dg_read_field_def_route(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 32 - 7 -> dg_read_field_def_route(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -dg_read_field_def_route(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 8 -> d_field_route_route_table_id(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 18 -> d_field_route_destination(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 26 -> d_field_route_gateways(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_route(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 1 -> skip_64_route(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 2 -> skip_length_delimited_route(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 3 -> skip_group_route(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 5 -> skip_32_route(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData) - end - end; -dg_read_field_def_route(<<>>, 0, 0, _, F@_1, F@_2, R1, TrUserData) -> #{route_table_id => F@_1, destination => F@_2, gateways => lists_reverse(R1, TrUserData)}. - -d_field_route_route_table_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_route_route_table_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_route_route_table_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, TrUserData) -> - {NewFValue, RestF} = {id((X bsl N + Acc) band 4294967295, TrUserData), Rest}, - dfp_read_field_def_route(RestF, 0, 0, F, NewFValue, F@_2, F@_3, TrUserData). - -d_field_route_destination(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_route_destination(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_route_destination(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_route(RestF, 0, 0, F, F@_1, NewFValue, F@_3, TrUserData). - -d_field_route_gateways(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_route_gateways(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_route_gateways(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_route(RestF, 0, 0, F, F@_1, F@_2, cons(NewFValue, Prev, TrUserData), TrUserData). - -skip_varint_route(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> skip_varint_route(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -skip_varint_route(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_route(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_length_delimited_route(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> skip_length_delimited_route(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -skip_length_delimited_route(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_route(Rest2, 0, 0, F, F@_1, F@_2, F@_3, TrUserData). - -skip_group_route(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_route(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, TrUserData). - -skip_32_route(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_route(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_64_route(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_route(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -decode_msg_list_routes_request(Bin, TrUserData) -> dfp_read_field_def_list_routes_request(Bin, 0, 0, 0, id(0, TrUserData), TrUserData). - -dfp_read_field_def_list_routes_request(<<8, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_routes_request_route_table_id(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_list_routes_request(<<>>, 0, 0, _, F@_1, _) -> #{route_table_id => F@_1}; -dfp_read_field_def_list_routes_request(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_routes_request(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_list_routes_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_routes_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_list_routes_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 8 -> d_field_list_routes_request_route_table_id(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_routes_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_list_routes_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_list_routes_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_list_routes_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_list_routes_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_list_routes_request(<<>>, 0, 0, _, F@_1, _) -> #{route_table_id => F@_1}. - -d_field_list_routes_request_route_table_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_routes_request_route_table_id(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_list_routes_request_route_table_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, TrUserData) -> - {NewFValue, RestF} = {id((X bsl N + Acc) band 4294967295, TrUserData), Rest}, - dfp_read_field_def_list_routes_request(RestF, 0, 0, F, NewFValue, TrUserData). - -skip_varint_list_routes_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_routes_request(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_list_routes_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_routes_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_list_routes_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_routes_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_list_routes_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_routes_request(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_list_routes_request(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_routes_request(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_list_routes_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_routes_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_list_routes_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_routes_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_list_routes_response(Bin, TrUserData) -> dfp_read_field_def_list_routes_response(Bin, 0, 0, 0, id([], TrUserData), TrUserData). - -dfp_read_field_def_list_routes_response(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_routes_response_routes(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_list_routes_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{routes => lists_reverse(R1, TrUserData)} - end; -dfp_read_field_def_list_routes_response(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_routes_response(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_list_routes_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_routes_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_list_routes_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_routes_response_routes(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_routes_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_list_routes_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_list_routes_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_list_routes_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_list_routes_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_list_routes_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{routes => lists_reverse(R1, TrUserData)} - end. - -d_field_list_routes_response_routes(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_routes_response_routes(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_list_routes_response_routes(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_route(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_list_routes_response(RestF, 0, 0, F, cons(NewFValue, Prev, TrUserData), TrUserData). - -skip_varint_list_routes_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_routes_response(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_list_routes_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_routes_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_list_routes_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_routes_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_list_routes_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_routes_response(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_list_routes_response(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_routes_response(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_list_routes_response(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_routes_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_list_routes_response(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_routes_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_put_route_request(Bin, TrUserData) -> dfp_read_field_def_put_route_request(Bin, 0, 0, 0, id('$undef', TrUserData), TrUserData). - -dfp_read_field_def_put_route_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_put_route_request_route(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_put_route_request(<<>>, 0, 0, _, F@_1, _) -> - S1 = #{}, - if F@_1 == '$undef' -> S1; - true -> S1#{route => F@_1} - end; -dfp_read_field_def_put_route_request(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_put_route_request(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_put_route_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_put_route_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_put_route_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_put_route_request_route(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_put_route_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_put_route_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_put_route_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_put_route_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_put_route_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_put_route_request(<<>>, 0, 0, _, F@_1, _) -> - S1 = #{}, - if F@_1 == '$undef' -> S1; - true -> S1#{route => F@_1} - end. - -d_field_put_route_request_route(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_put_route_request_route(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_put_route_request_route(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_route(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_put_route_request(RestF, - 0, - 0, - F, - if Prev == '$undef' -> NewFValue; - true -> merge_msg_route(Prev, NewFValue, TrUserData) - end, - TrUserData). - -skip_varint_put_route_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_put_route_request(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_put_route_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_put_route_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_put_route_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_put_route_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_put_route_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_put_route_request(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_put_route_request(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_put_route_request(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_put_route_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_put_route_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_put_route_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_put_route_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_sync_request(Bin, TrUserData) -> dfp_read_field_def_sync_request(Bin, 0, 0, 0, TrUserData). - -dfp_read_field_def_sync_request(<<>>, 0, 0, _, _) -> #{}; -dfp_read_field_def_sync_request(Other, Z1, Z2, F, TrUserData) -> dg_read_field_def_sync_request(Other, Z1, Z2, F, TrUserData). - -dg_read_field_def_sync_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 32 - 7 -> dg_read_field_def_sync_request(Rest, N + 7, X bsl N + Acc, F, TrUserData); -dg_read_field_def_sync_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, TrUserData) -> - Key = X bsl N + Acc, - case Key band 7 of - 0 -> skip_varint_sync_request(Rest, 0, 0, Key bsr 3, TrUserData); - 1 -> skip_64_sync_request(Rest, 0, 0, Key bsr 3, TrUserData); - 2 -> skip_length_delimited_sync_request(Rest, 0, 0, Key bsr 3, TrUserData); - 3 -> skip_group_sync_request(Rest, 0, 0, Key bsr 3, TrUserData); - 5 -> skip_32_sync_request(Rest, 0, 0, Key bsr 3, TrUserData) - end; -dg_read_field_def_sync_request(<<>>, 0, 0, _, _) -> #{}. - -skip_varint_sync_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> skip_varint_sync_request(Rest, Z1, Z2, F, TrUserData); -skip_varint_sync_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_sync_request(Rest, Z1, Z2, F, TrUserData). - -skip_length_delimited_sync_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 57 -> skip_length_delimited_sync_request(Rest, N + 7, X bsl N + Acc, F, TrUserData); -skip_length_delimited_sync_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_sync_request(Rest2, 0, 0, F, TrUserData). - -skip_group_sync_request(Bin, _, Z2, FNum, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_sync_request(Rest, 0, Z2, FNum, TrUserData). - -skip_32_sync_request(<<_:32, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_sync_request(Rest, Z1, Z2, F, TrUserData). - -skip_64_sync_request(<<_:64, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_sync_request(Rest, Z1, Z2, F, TrUserData). - -decode_msg_empty(Bin, TrUserData) -> dfp_read_field_def_empty(Bin, 0, 0, 0, TrUserData). - -dfp_read_field_def_empty(<<>>, 0, 0, _, _) -> #{}; -dfp_read_field_def_empty(Other, Z1, Z2, F, TrUserData) -> dg_read_field_def_empty(Other, Z1, Z2, F, TrUserData). - -dg_read_field_def_empty(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 32 - 7 -> dg_read_field_def_empty(Rest, N + 7, X bsl N + Acc, F, TrUserData); -dg_read_field_def_empty(<<0:1, X:7, Rest/binary>>, N, Acc, _, TrUserData) -> - Key = X bsl N + Acc, - case Key band 7 of - 0 -> skip_varint_empty(Rest, 0, 0, Key bsr 3, TrUserData); - 1 -> skip_64_empty(Rest, 0, 0, Key bsr 3, TrUserData); - 2 -> skip_length_delimited_empty(Rest, 0, 0, Key bsr 3, TrUserData); - 3 -> skip_group_empty(Rest, 0, 0, Key bsr 3, TrUserData); - 5 -> skip_32_empty(Rest, 0, 0, Key bsr 3, TrUserData) - end; -dg_read_field_def_empty(<<>>, 0, 0, _, _) -> #{}. - -skip_varint_empty(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> skip_varint_empty(Rest, Z1, Z2, F, TrUserData); -skip_varint_empty(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_empty(Rest, Z1, Z2, F, TrUserData). - -skip_length_delimited_empty(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 57 -> skip_length_delimited_empty(Rest, N + 7, X bsl N + Acc, F, TrUserData); -skip_length_delimited_empty(<<0:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_empty(Rest2, 0, 0, F, TrUserData). - -skip_group_empty(Bin, _, Z2, FNum, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_empty(Rest, 0, Z2, FNum, TrUserData). - -skip_32_empty(<<_:32, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_empty(Rest, Z1, Z2, F, TrUserData). - -skip_64_empty(<<_:64, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_empty(Rest, Z1, Z2, F, TrUserData). - -read_group(Bin, FieldNum) -> - {NumBytes, EndTagLen} = read_gr_b(Bin, 0, 0, 0, 0, FieldNum), - <> = Bin, - {Group, Rest}. - -%% Like skipping over fields, but record the total length, -%% Each field is <(FieldNum bsl 3) bor FieldType> ++ -%% Record the length because varints may be non-optimally encoded. -%% -%% Groups can be nested, but assume the same FieldNum cannot be nested -%% because group field numbers are shared with the rest of the fields -%% numbers. Thus we can search just for an group-end with the same -%% field number. -%% -%% (The only time the same group field number could occur would -%% be in a nested sub message, but then it would be inside a -%% length-delimited entry, which we skip-read by length.) -read_gr_b(<<1:1, X:7, Tl/binary>>, N, Acc, NumBytes, TagLen, FieldNum) - when N < (32-7) -> - read_gr_b(Tl, N+7, X bsl N + Acc, NumBytes, TagLen+1, FieldNum); -read_gr_b(<<0:1, X:7, Tl/binary>>, N, Acc, NumBytes, TagLen, - FieldNum) -> - Key = X bsl N + Acc, - TagLen1 = TagLen + 1, - case {Key bsr 3, Key band 7} of - {FieldNum, 4} -> % 4 = group_end - {NumBytes, TagLen1}; - {_, 0} -> % 0 = varint - read_gr_vi(Tl, 0, NumBytes + TagLen1, FieldNum); - {_, 1} -> % 1 = bits64 - <<_:64, Tl2/binary>> = Tl, - read_gr_b(Tl2, 0, 0, NumBytes + TagLen1 + 8, 0, FieldNum); - {_, 2} -> % 2 = length_delimited - read_gr_ld(Tl, 0, 0, NumBytes + TagLen1, FieldNum); - {_, 3} -> % 3 = group_start - read_gr_b(Tl, 0, 0, NumBytes + TagLen1, 0, FieldNum); - {_, 4} -> % 4 = group_end - read_gr_b(Tl, 0, 0, NumBytes + TagLen1, 0, FieldNum); - {_, 5} -> % 5 = bits32 - <<_:32, Tl2/binary>> = Tl, - read_gr_b(Tl2, 0, 0, NumBytes + TagLen1 + 4, 0, FieldNum) - end. - -read_gr_vi(<<1:1, _:7, Tl/binary>>, N, NumBytes, FieldNum) - when N < (64-7) -> - read_gr_vi(Tl, N+7, NumBytes+1, FieldNum); -read_gr_vi(<<0:1, _:7, Tl/binary>>, _, NumBytes, FieldNum) -> - read_gr_b(Tl, 0, 0, NumBytes+1, 0, FieldNum). - -read_gr_ld(<<1:1, X:7, Tl/binary>>, N, Acc, NumBytes, FieldNum) - when N < (64-7) -> - read_gr_ld(Tl, N+7, X bsl N + Acc, NumBytes+1, FieldNum); -read_gr_ld(<<0:1, X:7, Tl/binary>>, N, Acc, NumBytes, FieldNum) -> - Len = X bsl N + Acc, - NumBytes1 = NumBytes + 1, - <<_:Len/binary, Tl2/binary>> = Tl, - read_gr_b(Tl2, 0, 0, NumBytes1 + Len, 0, FieldNum). - -merge_msgs(Prev, New, MsgName) when is_atom(MsgName) -> merge_msgs(Prev, New, MsgName, []). - -merge_msgs(Prev, New, MsgName, Opts) -> - TrUserData = proplists:get_value(user_data, Opts), - case MsgName of - route_table -> merge_msg_route_table(Prev, New, TrUserData); - route_table_identifier -> merge_msg_route_table_identifier(Prev, New, TrUserData); - list_route_tables_request -> merge_msg_list_route_tables_request(Prev, New, TrUserData); - list_route_tables_response -> merge_msg_list_route_tables_response(Prev, New, TrUserData); - create_route_table_request -> merge_msg_create_route_table_request(Prev, New, TrUserData); - route_identifier -> merge_msg_route_identifier(Prev, New, TrUserData); - route -> merge_msg_route(Prev, New, TrUserData); - list_routes_request -> merge_msg_list_routes_request(Prev, New, TrUserData); - list_routes_response -> merge_msg_list_routes_response(Prev, New, TrUserData); - put_route_request -> merge_msg_put_route_request(Prev, New, TrUserData); - sync_request -> merge_msg_sync_request(Prev, New, TrUserData); - empty -> merge_msg_empty(Prev, New, TrUserData) - end. - --compile({nowarn_unused_function,merge_msg_route_table/3}). -merge_msg_route_table(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{network_name := NFnetwork_name}} -> S1#{network_name => NFnetwork_name}; - {#{network_name := PFnetwork_name}, _} -> S1#{network_name => PFnetwork_name}; - _ -> S1 - end, - S3 = case {PMsg, NMsg} of - {_, #{id := NFid}} -> S2#{id => NFid}; - {#{id := PFid}, _} -> S2#{id => PFid}; - _ -> S2 - end, - case {PMsg, NMsg} of - {_, #{name := NFname}} -> S3#{name => NFname}; - {#{name := PFname}, _} -> S3#{name => PFname}; - _ -> S3 - end. - --compile({nowarn_unused_function,merge_msg_route_table_identifier/3}). -merge_msg_route_table_identifier(PMsg, NMsg, _) -> - S1 = #{}, - case {PMsg, NMsg} of - {_, #{id := NFid}} -> S1#{id => NFid}; - {#{id := PFid}, _} -> S1#{id => PFid}; - _ -> S1 - end. - --compile({nowarn_unused_function,merge_msg_list_route_tables_request/3}). -merge_msg_list_route_tables_request(PMsg, NMsg, _) -> - S1 = #{}, - case {PMsg, NMsg} of - {_, #{network_name := NFnetwork_name}} -> S1#{network_name => NFnetwork_name}; - {#{network_name := PFnetwork_name}, _} -> S1#{network_name => PFnetwork_name}; - _ -> S1 - end. - --compile({nowarn_unused_function,merge_msg_list_route_tables_response/3}). -merge_msg_list_route_tables_response(PMsg, NMsg, TrUserData) -> - S1 = #{}, - case {PMsg, NMsg} of - {#{route_tables := PFroute_tables}, #{route_tables := NFroute_tables}} -> S1#{route_tables => 'erlang_++'(PFroute_tables, NFroute_tables, TrUserData)}; - {_, #{route_tables := NFroute_tables}} -> S1#{route_tables => NFroute_tables}; - {#{route_tables := PFroute_tables}, _} -> S1#{route_tables => PFroute_tables}; - {_, _} -> S1 - end. - --compile({nowarn_unused_function,merge_msg_create_route_table_request/3}). -merge_msg_create_route_table_request(PMsg, NMsg, TrUserData) -> - S1 = #{}, - case {PMsg, NMsg} of - {#{route_table := PFroute_table}, #{route_table := NFroute_table}} -> S1#{route_table => merge_msg_route_table(PFroute_table, NFroute_table, TrUserData)}; - {_, #{route_table := NFroute_table}} -> S1#{route_table => NFroute_table}; - {#{route_table := PFroute_table}, _} -> S1#{route_table => PFroute_table}; - {_, _} -> S1 - end. - --compile({nowarn_unused_function,merge_msg_route_identifier/3}). -merge_msg_route_identifier(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{route_table_id := NFroute_table_id}} -> S1#{route_table_id => NFroute_table_id}; - {#{route_table_id := PFroute_table_id}, _} -> S1#{route_table_id => PFroute_table_id}; - _ -> S1 - end, - case {PMsg, NMsg} of - {_, #{destination := NFdestination}} -> S2#{destination => NFdestination}; - {#{destination := PFdestination}, _} -> S2#{destination => PFdestination}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_route/3}). -merge_msg_route(PMsg, NMsg, TrUserData) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{route_table_id := NFroute_table_id}} -> S1#{route_table_id => NFroute_table_id}; - {#{route_table_id := PFroute_table_id}, _} -> S1#{route_table_id => PFroute_table_id}; - _ -> S1 - end, - S3 = case {PMsg, NMsg} of - {_, #{destination := NFdestination}} -> S2#{destination => NFdestination}; - {#{destination := PFdestination}, _} -> S2#{destination => PFdestination}; - _ -> S2 - end, - case {PMsg, NMsg} of - {#{gateways := PFgateways}, #{gateways := NFgateways}} -> S3#{gateways => 'erlang_++'(PFgateways, NFgateways, TrUserData)}; - {_, #{gateways := NFgateways}} -> S3#{gateways => NFgateways}; - {#{gateways := PFgateways}, _} -> S3#{gateways => PFgateways}; - {_, _} -> S3 - end. - --compile({nowarn_unused_function,merge_msg_list_routes_request/3}). -merge_msg_list_routes_request(PMsg, NMsg, _) -> - S1 = #{}, - case {PMsg, NMsg} of - {_, #{route_table_id := NFroute_table_id}} -> S1#{route_table_id => NFroute_table_id}; - {#{route_table_id := PFroute_table_id}, _} -> S1#{route_table_id => PFroute_table_id}; - _ -> S1 - end. - --compile({nowarn_unused_function,merge_msg_list_routes_response/3}). -merge_msg_list_routes_response(PMsg, NMsg, TrUserData) -> - S1 = #{}, - case {PMsg, NMsg} of - {#{routes := PFroutes}, #{routes := NFroutes}} -> S1#{routes => 'erlang_++'(PFroutes, NFroutes, TrUserData)}; - {_, #{routes := NFroutes}} -> S1#{routes => NFroutes}; - {#{routes := PFroutes}, _} -> S1#{routes => PFroutes}; - {_, _} -> S1 - end. - --compile({nowarn_unused_function,merge_msg_put_route_request/3}). -merge_msg_put_route_request(PMsg, NMsg, TrUserData) -> - S1 = #{}, - case {PMsg, NMsg} of - {#{route := PFroute}, #{route := NFroute}} -> S1#{route => merge_msg_route(PFroute, NFroute, TrUserData)}; - {_, #{route := NFroute}} -> S1#{route => NFroute}; - {#{route := PFroute}, _} -> S1#{route => PFroute}; - {_, _} -> S1 - end. - --compile({nowarn_unused_function,merge_msg_sync_request/3}). -merge_msg_sync_request(_Prev, New, _TrUserData) -> New. - --compile({nowarn_unused_function,merge_msg_empty/3}). -merge_msg_empty(_Prev, New, _TrUserData) -> New. - - -verify_msg(Msg, MsgName) when is_atom(MsgName) -> verify_msg(Msg, MsgName, []). - -verify_msg(Msg, MsgName, Opts) -> - TrUserData = proplists:get_value(user_data, Opts), - case MsgName of - route_table -> v_msg_route_table(Msg, [MsgName], TrUserData); - route_table_identifier -> v_msg_route_table_identifier(Msg, [MsgName], TrUserData); - list_route_tables_request -> v_msg_list_route_tables_request(Msg, [MsgName], TrUserData); - list_route_tables_response -> v_msg_list_route_tables_response(Msg, [MsgName], TrUserData); - create_route_table_request -> v_msg_create_route_table_request(Msg, [MsgName], TrUserData); - route_identifier -> v_msg_route_identifier(Msg, [MsgName], TrUserData); - route -> v_msg_route(Msg, [MsgName], TrUserData); - list_routes_request -> v_msg_list_routes_request(Msg, [MsgName], TrUserData); - list_routes_response -> v_msg_list_routes_response(Msg, [MsgName], TrUserData); - put_route_request -> v_msg_put_route_request(Msg, [MsgName], TrUserData); - sync_request -> v_msg_sync_request(Msg, [MsgName], TrUserData); - empty -> v_msg_empty(Msg, [MsgName], TrUserData); - _ -> mk_type_error(not_a_known_message, Msg, []) - end. - - --compile({nowarn_unused_function,v_msg_route_table/3}). --dialyzer({nowarn_function,v_msg_route_table/3}). -v_msg_route_table(#{} = M, Path, TrUserData) -> - case M of - #{network_name := F1} -> v_type_string(F1, [network_name | Path], TrUserData); - _ -> ok - end, - case M of - #{id := F2} -> v_type_uint32(F2, [id | Path], TrUserData); - _ -> ok - end, - case M of - #{name := F3} -> v_type_string(F3, [name | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (network_name) -> ok; - (id) -> ok; - (name) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_route_table(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), route_table}, M, Path); -v_msg_route_table(X, Path, _TrUserData) -> mk_type_error({expected_msg, route_table}, X, Path). - --compile({nowarn_unused_function,v_msg_route_table_identifier/3}). --dialyzer({nowarn_function,v_msg_route_table_identifier/3}). -v_msg_route_table_identifier(#{} = M, Path, TrUserData) -> - case M of - #{id := F1} -> v_type_uint32(F1, [id | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (id) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_route_table_identifier(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), route_table_identifier}, M, Path); -v_msg_route_table_identifier(X, Path, _TrUserData) -> mk_type_error({expected_msg, route_table_identifier}, X, Path). - --compile({nowarn_unused_function,v_msg_list_route_tables_request/3}). --dialyzer({nowarn_function,v_msg_list_route_tables_request/3}). -v_msg_list_route_tables_request(#{} = M, Path, TrUserData) -> - case M of - #{network_name := F1} -> v_type_string(F1, [network_name | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (network_name) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_route_tables_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_route_tables_request}, M, Path); -v_msg_list_route_tables_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_route_tables_request}, X, Path). - --compile({nowarn_unused_function,v_msg_list_route_tables_response/3}). --dialyzer({nowarn_function,v_msg_list_route_tables_response/3}). -v_msg_list_route_tables_response(#{} = M, Path, TrUserData) -> - case M of - #{route_tables := F1} -> - if is_list(F1) -> - _ = [v_msg_route_table(Elem, [route_tables | Path], TrUserData) || Elem <- F1], - ok; - true -> mk_type_error({invalid_list_of, {msg, route_table}}, F1, [route_tables | Path]) - end; - _ -> ok - end, - lists:foreach(fun (route_tables) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_route_tables_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_route_tables_response}, M, Path); -v_msg_list_route_tables_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_route_tables_response}, X, Path). - --compile({nowarn_unused_function,v_msg_create_route_table_request/3}). --dialyzer({nowarn_function,v_msg_create_route_table_request/3}). -v_msg_create_route_table_request(#{} = M, Path, TrUserData) -> - case M of - #{route_table := F1} -> v_msg_route_table(F1, [route_table | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (route_table) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_create_route_table_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), create_route_table_request}, M, Path); -v_msg_create_route_table_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, create_route_table_request}, X, Path). - --compile({nowarn_unused_function,v_msg_route_identifier/3}). --dialyzer({nowarn_function,v_msg_route_identifier/3}). -v_msg_route_identifier(#{} = M, Path, TrUserData) -> - case M of - #{route_table_id := F1} -> v_type_uint32(F1, [route_table_id | Path], TrUserData); - _ -> ok - end, - case M of - #{destination := F2} -> v_type_string(F2, [destination | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (route_table_id) -> ok; - (destination) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_route_identifier(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), route_identifier}, M, Path); -v_msg_route_identifier(X, Path, _TrUserData) -> mk_type_error({expected_msg, route_identifier}, X, Path). - --compile({nowarn_unused_function,v_msg_route/3}). --dialyzer({nowarn_function,v_msg_route/3}). -v_msg_route(#{} = M, Path, TrUserData) -> - case M of - #{route_table_id := F1} -> v_type_uint32(F1, [route_table_id | Path], TrUserData); - _ -> ok - end, - case M of - #{destination := F2} -> v_type_string(F2, [destination | Path], TrUserData); - _ -> ok - end, - case M of - #{gateways := F3} -> - if is_list(F3) -> - _ = [v_type_string(Elem, [gateways | Path], TrUserData) || Elem <- F3], - ok; - true -> mk_type_error({invalid_list_of, string}, F3, [gateways | Path]) - end; - _ -> ok - end, - lists:foreach(fun (route_table_id) -> ok; - (destination) -> ok; - (gateways) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_route(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), route}, M, Path); -v_msg_route(X, Path, _TrUserData) -> mk_type_error({expected_msg, route}, X, Path). - --compile({nowarn_unused_function,v_msg_list_routes_request/3}). --dialyzer({nowarn_function,v_msg_list_routes_request/3}). -v_msg_list_routes_request(#{} = M, Path, TrUserData) -> - case M of - #{route_table_id := F1} -> v_type_uint32(F1, [route_table_id | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (route_table_id) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_routes_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_routes_request}, M, Path); -v_msg_list_routes_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_routes_request}, X, Path). - --compile({nowarn_unused_function,v_msg_list_routes_response/3}). --dialyzer({nowarn_function,v_msg_list_routes_response/3}). -v_msg_list_routes_response(#{} = M, Path, TrUserData) -> - case M of - #{routes := F1} -> - if is_list(F1) -> - _ = [v_msg_route(Elem, [routes | Path], TrUserData) || Elem <- F1], - ok; - true -> mk_type_error({invalid_list_of, {msg, route}}, F1, [routes | Path]) - end; - _ -> ok - end, - lists:foreach(fun (routes) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_routes_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_routes_response}, M, Path); -v_msg_list_routes_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_routes_response}, X, Path). - --compile({nowarn_unused_function,v_msg_put_route_request/3}). --dialyzer({nowarn_function,v_msg_put_route_request/3}). -v_msg_put_route_request(#{} = M, Path, TrUserData) -> - case M of - #{route := F1} -> v_msg_route(F1, [route | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (route) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_put_route_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), put_route_request}, M, Path); -v_msg_put_route_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, put_route_request}, X, Path). - --compile({nowarn_unused_function,v_msg_sync_request/3}). --dialyzer({nowarn_function,v_msg_sync_request/3}). -v_msg_sync_request(#{} = M, Path, _) -> - lists:foreach(fun (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) end, maps:keys(M)), - ok; -v_msg_sync_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), sync_request}, M, Path); -v_msg_sync_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, sync_request}, X, Path). - --compile({nowarn_unused_function,v_msg_empty/3}). --dialyzer({nowarn_function,v_msg_empty/3}). -v_msg_empty(#{} = M, Path, _) -> - lists:foreach(fun (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) end, maps:keys(M)), - ok; -v_msg_empty(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), empty}, M, Path); -v_msg_empty(X, Path, _TrUserData) -> mk_type_error({expected_msg, empty}, X, Path). - --compile({nowarn_unused_function,v_type_uint32/3}). --dialyzer({nowarn_function,v_type_uint32/3}). -v_type_uint32(N, _Path, _TrUserData) when 0 =< N, N =< 4294967295 -> ok; -v_type_uint32(N, Path, _TrUserData) when is_integer(N) -> mk_type_error({value_out_of_range, uint32, unsigned, 32}, N, Path); -v_type_uint32(X, Path, _TrUserData) -> mk_type_error({bad_integer, uint32, unsigned, 32}, X, Path). - --compile({nowarn_unused_function,v_type_string/3}). --dialyzer({nowarn_function,v_type_string/3}). -v_type_string(S, Path, _TrUserData) when is_list(S); is_binary(S) -> - try unicode:characters_to_binary(S) of - B when is_binary(B) -> ok; - {error, _, _} -> mk_type_error(bad_unicode_string, S, Path) - catch - error:badarg -> mk_type_error(bad_unicode_string, S, Path) - end; -v_type_string(X, Path, _TrUserData) -> mk_type_error(bad_unicode_string, X, Path). - --compile({nowarn_unused_function,mk_type_error/3}). --spec mk_type_error(_, _, list()) -> no_return(). -mk_type_error(Error, ValueSeen, Path) -> - Path2 = prettify_path(Path), - erlang:error({gpb_type_error, {Error, [{value, ValueSeen}, {path, Path2}]}}). - - --compile({nowarn_unused_function,prettify_path/1}). --dialyzer({nowarn_function,prettify_path/1}). -prettify_path([]) -> top_level; -prettify_path(PathR) -> lists:append(lists:join(".", lists:map(fun atom_to_list/1, lists:reverse(PathR)))). - - --compile({nowarn_unused_function,id/2}). --compile({inline,id/2}). -id(X, _TrUserData) -> X. - --compile({nowarn_unused_function,v_ok/3}). --compile({inline,v_ok/3}). -v_ok(_Value, _Path, _TrUserData) -> ok. - --compile({nowarn_unused_function,m_overwrite/3}). --compile({inline,m_overwrite/3}). -m_overwrite(_Prev, New, _TrUserData) -> New. - --compile({nowarn_unused_function,cons/3}). --compile({inline,cons/3}). -cons(Elem, Acc, _TrUserData) -> [Elem | Acc]. - --compile({nowarn_unused_function,lists_reverse/2}). --compile({inline,lists_reverse/2}). -'lists_reverse'(L, _TrUserData) -> lists:reverse(L). --compile({nowarn_unused_function,'erlang_++'/3}). --compile({inline,'erlang_++'/3}). -'erlang_++'(A, B, _TrUserData) -> A ++ B. - - -get_msg_defs() -> - [{{msg, route_table}, - [#{name => network_name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => id, fnum => 2, rnum => 3, type => uint32, occurrence => optional, opts => []}, - #{name => name, fnum => 3, rnum => 4, type => string, occurrence => optional, opts => []}]}, - {{msg, route_table_identifier}, [#{name => id, fnum => 1, rnum => 2, type => uint32, occurrence => optional, opts => []}]}, - {{msg, list_route_tables_request}, [#{name => network_name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]}, - {{msg, list_route_tables_response}, [#{name => route_tables, fnum => 1, rnum => 2, type => {msg, route_table}, occurrence => repeated, opts => []}]}, - {{msg, create_route_table_request}, [#{name => route_table, fnum => 1, rnum => 2, type => {msg, route_table}, occurrence => optional, opts => []}]}, - {{msg, route_identifier}, [#{name => route_table_id, fnum => 1, rnum => 2, type => uint32, occurrence => optional, opts => []}, #{name => destination, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, route}, - [#{name => route_table_id, fnum => 1, rnum => 2, type => uint32, occurrence => optional, opts => []}, - #{name => destination, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => gateways, fnum => 3, rnum => 4, type => string, occurrence => repeated, opts => []}]}, - {{msg, list_routes_request}, [#{name => route_table_id, fnum => 1, rnum => 2, type => uint32, occurrence => optional, opts => []}]}, - {{msg, list_routes_response}, [#{name => routes, fnum => 1, rnum => 2, type => {msg, route}, occurrence => repeated, opts => []}]}, - {{msg, put_route_request}, [#{name => route, fnum => 1, rnum => 2, type => {msg, route}, occurrence => optional, opts => []}]}, - {{msg, sync_request}, []}, - {{msg, empty}, []}]. - - -get_msg_names() -> [route_table, route_table_identifier, list_route_tables_request, list_route_tables_response, create_route_table_request, route_identifier, route, list_routes_request, list_routes_response, put_route_request, sync_request, empty]. - - -get_group_names() -> []. - - -get_msg_or_group_names() -> - [route_table, route_table_identifier, list_route_tables_request, list_route_tables_response, create_route_table_request, route_identifier, route, list_routes_request, list_routes_response, put_route_request, sync_request, empty]. - - -get_enum_names() -> []. - - -fetch_msg_def(MsgName) -> - case find_msg_def(MsgName) of - Fs when is_list(Fs) -> Fs; - error -> erlang:error({no_such_msg, MsgName}) - end. - - --spec fetch_enum_def(_) -> no_return(). -fetch_enum_def(EnumName) -> erlang:error({no_such_enum, EnumName}). - - -find_msg_def(route_table) -> - [#{name => network_name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => id, fnum => 2, rnum => 3, type => uint32, occurrence => optional, opts => []}, - #{name => name, fnum => 3, rnum => 4, type => string, occurrence => optional, opts => []}]; -find_msg_def(route_table_identifier) -> [#{name => id, fnum => 1, rnum => 2, type => uint32, occurrence => optional, opts => []}]; -find_msg_def(list_route_tables_request) -> [#{name => network_name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]; -find_msg_def(list_route_tables_response) -> [#{name => route_tables, fnum => 1, rnum => 2, type => {msg, route_table}, occurrence => repeated, opts => []}]; -find_msg_def(create_route_table_request) -> [#{name => route_table, fnum => 1, rnum => 2, type => {msg, route_table}, occurrence => optional, opts => []}]; -find_msg_def(route_identifier) -> [#{name => route_table_id, fnum => 1, rnum => 2, type => uint32, occurrence => optional, opts => []}, #{name => destination, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(route) -> - [#{name => route_table_id, fnum => 1, rnum => 2, type => uint32, occurrence => optional, opts => []}, - #{name => destination, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => gateways, fnum => 3, rnum => 4, type => string, occurrence => repeated, opts => []}]; -find_msg_def(list_routes_request) -> [#{name => route_table_id, fnum => 1, rnum => 2, type => uint32, occurrence => optional, opts => []}]; -find_msg_def(list_routes_response) -> [#{name => routes, fnum => 1, rnum => 2, type => {msg, route}, occurrence => repeated, opts => []}]; -find_msg_def(put_route_request) -> [#{name => route, fnum => 1, rnum => 2, type => {msg, route}, occurrence => optional, opts => []}]; -find_msg_def(sync_request) -> []; -find_msg_def(empty) -> []; -find_msg_def(_) -> error. - - -find_enum_def(_) -> error. - - --spec enum_symbol_by_value(_, _) -> no_return(). -enum_symbol_by_value(E, V) -> erlang:error({no_enum_defs, E, V}). - - --spec enum_value_by_symbol(_, _) -> no_return(). -enum_value_by_symbol(E, V) -> erlang:error({no_enum_defs, E, V}). - - - -get_service_names() -> ['RouteService']. - - -get_service_def('RouteService') -> - {{service, 'RouteService'}, - [#{name => 'GetRouteTable', input => route_table_identifier, output => route_table, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListRouteTables', input => list_route_tables_request, output => list_route_tables_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'CreateRouteTable', input => create_route_table_request, output => route_table, input_stream => false, output_stream => false, opts => []}, - #{name => 'DeleteRouteTable', input => route_table_identifier, output => empty, input_stream => false, output_stream => false, opts => []}, - #{name => 'GetRoute', input => route_identifier, output => route, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListRoutes', input => list_routes_request, output => list_routes_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'PutRoute', input => put_route_request, output => route, input_stream => false, output_stream => false, opts => []}, - #{name => 'DeleteRoute', input => route_identifier, output => empty, input_stream => false, output_stream => false, opts => []}, - #{name => 'Sync', input => sync_request, output => empty, input_stream => false, output_stream => false, opts => []}]}; -get_service_def(_) -> error. - - -get_rpc_names('RouteService') -> ['GetRouteTable', 'ListRouteTables', 'CreateRouteTable', 'DeleteRouteTable', 'GetRoute', 'ListRoutes', 'PutRoute', 'DeleteRoute', 'Sync']; -get_rpc_names(_) -> error. - - -find_rpc_def('RouteService', RpcName) -> find_rpc_def_RouteService(RpcName); -find_rpc_def(_, _) -> error. - - -find_rpc_def_RouteService('GetRouteTable') -> #{name => 'GetRouteTable', input => route_table_identifier, output => route_table, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_RouteService('ListRouteTables') -> #{name => 'ListRouteTables', input => list_route_tables_request, output => list_route_tables_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_RouteService('CreateRouteTable') -> #{name => 'CreateRouteTable', input => create_route_table_request, output => route_table, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_RouteService('DeleteRouteTable') -> #{name => 'DeleteRouteTable', input => route_table_identifier, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_RouteService('GetRoute') -> #{name => 'GetRoute', input => route_identifier, output => route, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_RouteService('ListRoutes') -> #{name => 'ListRoutes', input => list_routes_request, output => list_routes_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_RouteService('PutRoute') -> #{name => 'PutRoute', input => put_route_request, output => route, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_RouteService('DeleteRoute') -> #{name => 'DeleteRoute', input => route_identifier, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_RouteService('Sync') -> #{name => 'Sync', input => sync_request, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_RouteService(_) -> error. - - -fetch_rpc_def(ServiceName, RpcName) -> - case find_rpc_def(ServiceName, RpcName) of - Def when is_map(Def) -> Def; - error -> erlang:error({no_such_rpc, ServiceName, RpcName}) - end. - - -%% Convert a a fully qualified (ie with package name) service name -%% as a binary to a service name as an atom. -fqbin_to_service_name(<<"RouteService">>) -> 'RouteService'; -fqbin_to_service_name(X) -> error({gpb_error, {badservice, X}}). - - -%% Convert a service name as an atom to a fully qualified -%% (ie with package name) name as a binary. -service_name_to_fqbin('RouteService') -> <<"RouteService">>; -service_name_to_fqbin(X) -> error({gpb_error, {badservice, X}}). - - -%% Convert a a fully qualified (ie with package name) service name -%% and an rpc name, both as binaries to a service name and an rpc -%% name, as atoms. -fqbins_to_service_and_rpc_name(<<"RouteService">>, <<"GetRouteTable">>) -> {'RouteService', 'GetRouteTable'}; -fqbins_to_service_and_rpc_name(<<"RouteService">>, <<"ListRouteTables">>) -> {'RouteService', 'ListRouteTables'}; -fqbins_to_service_and_rpc_name(<<"RouteService">>, <<"CreateRouteTable">>) -> {'RouteService', 'CreateRouteTable'}; -fqbins_to_service_and_rpc_name(<<"RouteService">>, <<"DeleteRouteTable">>) -> {'RouteService', 'DeleteRouteTable'}; -fqbins_to_service_and_rpc_name(<<"RouteService">>, <<"GetRoute">>) -> {'RouteService', 'GetRoute'}; -fqbins_to_service_and_rpc_name(<<"RouteService">>, <<"ListRoutes">>) -> {'RouteService', 'ListRoutes'}; -fqbins_to_service_and_rpc_name(<<"RouteService">>, <<"PutRoute">>) -> {'RouteService', 'PutRoute'}; -fqbins_to_service_and_rpc_name(<<"RouteService">>, <<"DeleteRoute">>) -> {'RouteService', 'DeleteRoute'}; -fqbins_to_service_and_rpc_name(<<"RouteService">>, <<"Sync">>) -> {'RouteService', 'Sync'}; -fqbins_to_service_and_rpc_name(S, R) -> error({gpb_error, {badservice_or_rpc, {S, R}}}). - - -%% Convert a service name and an rpc name, both as atoms, -%% to a fully qualified (ie with package name) service name and -%% an rpc name as binaries. -service_and_rpc_name_to_fqbins('RouteService', 'GetRouteTable') -> {<<"RouteService">>, <<"GetRouteTable">>}; -service_and_rpc_name_to_fqbins('RouteService', 'ListRouteTables') -> {<<"RouteService">>, <<"ListRouteTables">>}; -service_and_rpc_name_to_fqbins('RouteService', 'CreateRouteTable') -> {<<"RouteService">>, <<"CreateRouteTable">>}; -service_and_rpc_name_to_fqbins('RouteService', 'DeleteRouteTable') -> {<<"RouteService">>, <<"DeleteRouteTable">>}; -service_and_rpc_name_to_fqbins('RouteService', 'GetRoute') -> {<<"RouteService">>, <<"GetRoute">>}; -service_and_rpc_name_to_fqbins('RouteService', 'ListRoutes') -> {<<"RouteService">>, <<"ListRoutes">>}; -service_and_rpc_name_to_fqbins('RouteService', 'PutRoute') -> {<<"RouteService">>, <<"PutRoute">>}; -service_and_rpc_name_to_fqbins('RouteService', 'DeleteRoute') -> {<<"RouteService">>, <<"DeleteRoute">>}; -service_and_rpc_name_to_fqbins('RouteService', 'Sync') -> {<<"RouteService">>, <<"Sync">>}; -service_and_rpc_name_to_fqbins(S, R) -> error({gpb_error, {badservice_or_rpc, {S, R}}}). - - -fqbin_to_msg_name(<<"RouteTable">>) -> route_table; -fqbin_to_msg_name(<<"RouteTableIdentifier">>) -> route_table_identifier; -fqbin_to_msg_name(<<"ListRouteTablesRequest">>) -> list_route_tables_request; -fqbin_to_msg_name(<<"ListRouteTablesResponse">>) -> list_route_tables_response; -fqbin_to_msg_name(<<"CreateRouteTableRequest">>) -> create_route_table_request; -fqbin_to_msg_name(<<"RouteIdentifier">>) -> route_identifier; -fqbin_to_msg_name(<<"Route">>) -> route; -fqbin_to_msg_name(<<"ListRoutesRequest">>) -> list_routes_request; -fqbin_to_msg_name(<<"ListRoutesResponse">>) -> list_routes_response; -fqbin_to_msg_name(<<"PutRouteRequest">>) -> put_route_request; -fqbin_to_msg_name(<<"SyncRequest">>) -> sync_request; -fqbin_to_msg_name(<<"google.protobuf.Empty">>) -> empty; -fqbin_to_msg_name(E) -> error({gpb_error, {badmsg, E}}). - - -msg_name_to_fqbin(route_table) -> <<"RouteTable">>; -msg_name_to_fqbin(route_table_identifier) -> <<"RouteTableIdentifier">>; -msg_name_to_fqbin(list_route_tables_request) -> <<"ListRouteTablesRequest">>; -msg_name_to_fqbin(list_route_tables_response) -> <<"ListRouteTablesResponse">>; -msg_name_to_fqbin(create_route_table_request) -> <<"CreateRouteTableRequest">>; -msg_name_to_fqbin(route_identifier) -> <<"RouteIdentifier">>; -msg_name_to_fqbin(route) -> <<"Route">>; -msg_name_to_fqbin(list_routes_request) -> <<"ListRoutesRequest">>; -msg_name_to_fqbin(list_routes_response) -> <<"ListRoutesResponse">>; -msg_name_to_fqbin(put_route_request) -> <<"PutRouteRequest">>; -msg_name_to_fqbin(sync_request) -> <<"SyncRequest">>; -msg_name_to_fqbin(empty) -> <<"google.protobuf.Empty">>; -msg_name_to_fqbin(E) -> error({gpb_error, {badmsg, E}}). - - --spec fqbin_to_enum_name(_) -> no_return(). -fqbin_to_enum_name(E) -> error({gpb_error, {badenum, E}}). - - --spec enum_name_to_fqbin(_) -> no_return(). -enum_name_to_fqbin(E) -> error({gpb_error, {badenum, E}}). - - -get_package_name() -> 'google.protobuf'. - - -%% Whether or not the message names -%% are prepended with package name or not. -uses_packages() -> true. - - -source_basename() -> "route.proto". - - -%% Retrieve all proto file names, also imported ones. -%% The order is top-down. The first element is always the main -%% source file. The files are returned with extension, -%% see get_all_proto_names/0 for a version that returns -%% the basenames sans extension -get_all_source_basenames() -> ["route.proto", "empty.proto"]. - - -%% Retrieve all proto file names, also imported ones. -%% The order is top-down. The first element is always the main -%% source file. The files are returned sans .proto extension, -%% to make it easier to use them with the various get_xyz_containment -%% functions. -get_all_proto_names() -> ["route", "empty"]. - - -get_msg_containment("route") -> - [create_route_table_request, list_route_tables_request, list_route_tables_response, list_routes_request, list_routes_response, put_route_request, route, route_identifier, route_table, route_table_identifier, sync_request]; -get_msg_containment("empty") -> [empty]; -get_msg_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_pkg_containment("route") -> undefined; -get_pkg_containment("empty") -> 'google.protobuf'; -get_pkg_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_service_containment("route") -> ['RouteService']; -get_service_containment("empty") -> []; -get_service_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_rpc_containment("route") -> - [{'RouteService', 'GetRouteTable'}, - {'RouteService', 'ListRouteTables'}, - {'RouteService', 'CreateRouteTable'}, - {'RouteService', 'DeleteRouteTable'}, - {'RouteService', 'GetRoute'}, - {'RouteService', 'ListRoutes'}, - {'RouteService', 'PutRoute'}, - {'RouteService', 'DeleteRoute'}, - {'RouteService', 'Sync'}]; -get_rpc_containment("empty") -> []; -get_rpc_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_enum_containment("route") -> []; -get_enum_containment("empty") -> []; -get_enum_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_proto_by_msg_name_as_fqbin(<<"RouteTableIdentifier">>) -> "route"; -get_proto_by_msg_name_as_fqbin(<<"RouteIdentifier">>) -> "route"; -get_proto_by_msg_name_as_fqbin(<<"SyncRequest">>) -> "route"; -get_proto_by_msg_name_as_fqbin(<<"PutRouteRequest">>) -> "route"; -get_proto_by_msg_name_as_fqbin(<<"ListRoutesRequest">>) -> "route"; -get_proto_by_msg_name_as_fqbin(<<"ListRouteTablesRequest">>) -> "route"; -get_proto_by_msg_name_as_fqbin(<<"CreateRouteTableRequest">>) -> "route"; -get_proto_by_msg_name_as_fqbin(<<"RouteTable">>) -> "route"; -get_proto_by_msg_name_as_fqbin(<<"Route">>) -> "route"; -get_proto_by_msg_name_as_fqbin(<<"ListRoutesResponse">>) -> "route"; -get_proto_by_msg_name_as_fqbin(<<"ListRouteTablesResponse">>) -> "route"; -get_proto_by_msg_name_as_fqbin(<<"google.protobuf.Empty">>) -> "empty"; -get_proto_by_msg_name_as_fqbin(E) -> error({gpb_error, {badmsg, E}}). - - -get_proto_by_service_name_as_fqbin(<<"RouteService">>) -> "route"; -get_proto_by_service_name_as_fqbin(E) -> error({gpb_error, {badservice, E}}). - - --spec get_proto_by_enum_name_as_fqbin(_) -> no_return(). -get_proto_by_enum_name_as_fqbin(E) -> error({gpb_error, {badenum, E}}). - - -get_protos_by_pkg_name_as_fqbin(<<"google.protobuf">>) -> ["empty"]; -get_protos_by_pkg_name_as_fqbin(E) -> error({gpb_error, {badpkg, E}}). - - - -gpb_version_as_string() -> - "4.19.8". - -gpb_version_as_list() -> - [4,19,8]. - -gpb_version_source() -> - "file". diff --git a/virtuerl/src/pb/route_service_bhvr.erl b/virtuerl/src/pb/route_service_bhvr.erl deleted file mode 100644 index 35673a4..0000000 --- a/virtuerl/src/pb/route_service_bhvr.erl +++ /dev/null @@ -1,45 +0,0 @@ -%%%------------------------------------------------------------------- -%% @doc Behaviour to implement for grpc service RouteService. -%% @end -%%%------------------------------------------------------------------- - -%% this module was generated and should not be modified manually - --module(route_service_bhvr). - -%% Unary RPC --callback get_route_table(ctx:t(), route_pb:route_table_identifier()) -> - {ok, route_pb:route_table(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback list_route_tables(ctx:t(), route_pb:list_route_tables_request()) -> - {ok, route_pb:list_route_tables_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback create_route_table(ctx:t(), route_pb:create_route_table_request()) -> - {ok, route_pb:route_table(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback delete_route_table(ctx:t(), route_pb:route_table_identifier()) -> - {ok, route_pb:empty(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback get_route(ctx:t(), route_pb:route_identifier()) -> - {ok, route_pb:route(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback list_routes(ctx:t(), route_pb:list_routes_request()) -> - {ok, route_pb:list_routes_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback put_route(ctx:t(), route_pb:put_route_request()) -> - {ok, route_pb:route(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback delete_route(ctx:t(), route_pb:route_identifier()) -> - {ok, route_pb:empty(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback sync(ctx:t(), route_pb:sync_request()) -> - {ok, route_pb:empty(), ctx:t()} | grpcbox_stream:grpc_error_response(). - diff --git a/virtuerl/src/pb/route_service_client.erl b/virtuerl/src/pb/route_service_client.erl deleted file mode 100644 index c36b8bf..0000000 --- a/virtuerl/src/pb/route_service_client.erl +++ /dev/null @@ -1,187 +0,0 @@ -%%%------------------------------------------------------------------- -%% @doc Client module for grpc service RouteService. -%% @end -%%%------------------------------------------------------------------- - -%% this module was generated and should not be modified manually - --module(route_service_client). - --compile(export_all). --compile(nowarn_export_all). - --include_lib("grpcbox/include/grpcbox.hrl"). - --define(is_ctx(Ctx), is_tuple(Ctx) andalso element(1, Ctx) =:= ctx). - --define(SERVICE, 'RouteService'). --define(PROTO_MODULE, 'route_pb'). --define(MARSHAL_FUN(T), fun(I) -> ?PROTO_MODULE:encode_msg(I, T) end). --define(UNMARSHAL_FUN(T), fun(I) -> ?PROTO_MODULE:decode_msg(I, T) end). --define(DEF(Input, Output, MessageType), #grpcbox_def{service=?SERVICE, - message_type=MessageType, - marshal_fun=?MARSHAL_FUN(Input), - unmarshal_fun=?UNMARSHAL_FUN(Output)}). - -%% @doc Unary RPC --spec get_route_table(route_pb:route_table_identifier()) -> - {ok, route_pb:route_table(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_route_table(Input) -> - get_route_table(ctx:new(), Input, #{}). - --spec get_route_table(ctx:t() | route_pb:route_table_identifier(), route_pb:route_table_identifier() | grpcbox_client:options()) -> - {ok, route_pb:route_table(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_route_table(Ctx, Input) when ?is_ctx(Ctx) -> - get_route_table(Ctx, Input, #{}); -get_route_table(Input, Options) -> - get_route_table(ctx:new(), Input, Options). - --spec get_route_table(ctx:t(), route_pb:route_table_identifier(), grpcbox_client:options()) -> - {ok, route_pb:route_table(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_route_table(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/RouteService/GetRouteTable">>, Input, ?DEF(route_table_identifier, route_table, <<"RouteTableIdentifier">>), Options). - -%% @doc Unary RPC --spec list_route_tables(route_pb:list_route_tables_request()) -> - {ok, route_pb:list_route_tables_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_route_tables(Input) -> - list_route_tables(ctx:new(), Input, #{}). - --spec list_route_tables(ctx:t() | route_pb:list_route_tables_request(), route_pb:list_route_tables_request() | grpcbox_client:options()) -> - {ok, route_pb:list_route_tables_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_route_tables(Ctx, Input) when ?is_ctx(Ctx) -> - list_route_tables(Ctx, Input, #{}); -list_route_tables(Input, Options) -> - list_route_tables(ctx:new(), Input, Options). - --spec list_route_tables(ctx:t(), route_pb:list_route_tables_request(), grpcbox_client:options()) -> - {ok, route_pb:list_route_tables_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_route_tables(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/RouteService/ListRouteTables">>, Input, ?DEF(list_route_tables_request, list_route_tables_response, <<"ListRouteTablesRequest">>), Options). - -%% @doc Unary RPC --spec create_route_table(route_pb:create_route_table_request()) -> - {ok, route_pb:route_table(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -create_route_table(Input) -> - create_route_table(ctx:new(), Input, #{}). - --spec create_route_table(ctx:t() | route_pb:create_route_table_request(), route_pb:create_route_table_request() | grpcbox_client:options()) -> - {ok, route_pb:route_table(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -create_route_table(Ctx, Input) when ?is_ctx(Ctx) -> - create_route_table(Ctx, Input, #{}); -create_route_table(Input, Options) -> - create_route_table(ctx:new(), Input, Options). - --spec create_route_table(ctx:t(), route_pb:create_route_table_request(), grpcbox_client:options()) -> - {ok, route_pb:route_table(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -create_route_table(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/RouteService/CreateRouteTable">>, Input, ?DEF(create_route_table_request, route_table, <<"CreateRouteTableRequest">>), Options). - -%% @doc Unary RPC --spec delete_route_table(route_pb:route_table_identifier()) -> - {ok, route_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_route_table(Input) -> - delete_route_table(ctx:new(), Input, #{}). - --spec delete_route_table(ctx:t() | route_pb:route_table_identifier(), route_pb:route_table_identifier() | grpcbox_client:options()) -> - {ok, route_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_route_table(Ctx, Input) when ?is_ctx(Ctx) -> - delete_route_table(Ctx, Input, #{}); -delete_route_table(Input, Options) -> - delete_route_table(ctx:new(), Input, Options). - --spec delete_route_table(ctx:t(), route_pb:route_table_identifier(), grpcbox_client:options()) -> - {ok, route_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_route_table(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/RouteService/DeleteRouteTable">>, Input, ?DEF(route_table_identifier, empty, <<"RouteTableIdentifier">>), Options). - -%% @doc Unary RPC --spec get_route(route_pb:route_identifier()) -> - {ok, route_pb:route(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_route(Input) -> - get_route(ctx:new(), Input, #{}). - --spec get_route(ctx:t() | route_pb:route_identifier(), route_pb:route_identifier() | grpcbox_client:options()) -> - {ok, route_pb:route(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_route(Ctx, Input) when ?is_ctx(Ctx) -> - get_route(Ctx, Input, #{}); -get_route(Input, Options) -> - get_route(ctx:new(), Input, Options). - --spec get_route(ctx:t(), route_pb:route_identifier(), grpcbox_client:options()) -> - {ok, route_pb:route(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_route(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/RouteService/GetRoute">>, Input, ?DEF(route_identifier, route, <<"RouteIdentifier">>), Options). - -%% @doc Unary RPC --spec list_routes(route_pb:list_routes_request()) -> - {ok, route_pb:list_routes_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_routes(Input) -> - list_routes(ctx:new(), Input, #{}). - --spec list_routes(ctx:t() | route_pb:list_routes_request(), route_pb:list_routes_request() | grpcbox_client:options()) -> - {ok, route_pb:list_routes_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_routes(Ctx, Input) when ?is_ctx(Ctx) -> - list_routes(Ctx, Input, #{}); -list_routes(Input, Options) -> - list_routes(ctx:new(), Input, Options). - --spec list_routes(ctx:t(), route_pb:list_routes_request(), grpcbox_client:options()) -> - {ok, route_pb:list_routes_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_routes(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/RouteService/ListRoutes">>, Input, ?DEF(list_routes_request, list_routes_response, <<"ListRoutesRequest">>), Options). - -%% @doc Unary RPC --spec put_route(route_pb:put_route_request()) -> - {ok, route_pb:route(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -put_route(Input) -> - put_route(ctx:new(), Input, #{}). - --spec put_route(ctx:t() | route_pb:put_route_request(), route_pb:put_route_request() | grpcbox_client:options()) -> - {ok, route_pb:route(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -put_route(Ctx, Input) when ?is_ctx(Ctx) -> - put_route(Ctx, Input, #{}); -put_route(Input, Options) -> - put_route(ctx:new(), Input, Options). - --spec put_route(ctx:t(), route_pb:put_route_request(), grpcbox_client:options()) -> - {ok, route_pb:route(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -put_route(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/RouteService/PutRoute">>, Input, ?DEF(put_route_request, route, <<"PutRouteRequest">>), Options). - -%% @doc Unary RPC --spec delete_route(route_pb:route_identifier()) -> - {ok, route_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_route(Input) -> - delete_route(ctx:new(), Input, #{}). - --spec delete_route(ctx:t() | route_pb:route_identifier(), route_pb:route_identifier() | grpcbox_client:options()) -> - {ok, route_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_route(Ctx, Input) when ?is_ctx(Ctx) -> - delete_route(Ctx, Input, #{}); -delete_route(Input, Options) -> - delete_route(ctx:new(), Input, Options). - --spec delete_route(ctx:t(), route_pb:route_identifier(), grpcbox_client:options()) -> - {ok, route_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_route(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/RouteService/DeleteRoute">>, Input, ?DEF(route_identifier, empty, <<"RouteIdentifier">>), Options). - -%% @doc Unary RPC --spec sync(route_pb:sync_request()) -> - {ok, route_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -sync(Input) -> - sync(ctx:new(), Input, #{}). - --spec sync(ctx:t() | route_pb:sync_request(), route_pb:sync_request() | grpcbox_client:options()) -> - {ok, route_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -sync(Ctx, Input) when ?is_ctx(Ctx) -> - sync(Ctx, Input, #{}); -sync(Input, Options) -> - sync(ctx:new(), Input, Options). - --spec sync(ctx:t(), route_pb:sync_request(), grpcbox_client:options()) -> - {ok, route_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -sync(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/RouteService/Sync">>, Input, ?DEF(sync_request, empty, <<"SyncRequest">>), Options). - diff --git a/virtuerl/src/pb/volume_pb.erl b/virtuerl/src/pb/volume_pb.erl deleted file mode 100644 index 106a556..0000000 --- a/virtuerl/src/pb/volume_pb.erl +++ /dev/null @@ -1,2159 +0,0 @@ -%% -*- coding: utf-8 -*- -%% @private -%% Automatically generated, do not edit -%% Generated by gpb_compile version 4.19.8 -%% Version source: file --module(volume_pb). - --export([encode_msg/2, encode_msg/3]). --export([decode_msg/2, decode_msg/3]). --export([merge_msgs/3, merge_msgs/4]). --export([verify_msg/2, verify_msg/3]). --export([get_msg_defs/0]). --export([get_msg_names/0]). --export([get_group_names/0]). --export([get_msg_or_group_names/0]). --export([get_enum_names/0]). --export([find_msg_def/1, fetch_msg_def/1]). --export([find_enum_def/1, fetch_enum_def/1]). --export([enum_symbol_by_value/2, enum_value_by_symbol/2]). --export([get_service_names/0]). --export([get_service_def/1]). --export([get_rpc_names/1]). --export([find_rpc_def/2, fetch_rpc_def/2]). --export([fqbin_to_service_name/1]). --export([service_name_to_fqbin/1]). --export([fqbins_to_service_and_rpc_name/2]). --export([service_and_rpc_name_to_fqbins/2]). --export([fqbin_to_msg_name/1]). --export([msg_name_to_fqbin/1]). --export([fqbin_to_enum_name/1]). --export([enum_name_to_fqbin/1]). --export([get_package_name/0]). --export([uses_packages/0]). --export([source_basename/0]). --export([get_all_source_basenames/0]). --export([get_all_proto_names/0]). --export([get_msg_containment/1]). --export([get_pkg_containment/1]). --export([get_service_containment/1]). --export([get_rpc_containment/1]). --export([get_enum_containment/1]). --export([get_proto_by_msg_name_as_fqbin/1]). --export([get_proto_by_service_name_as_fqbin/1]). --export([get_proto_by_enum_name_as_fqbin/1]). --export([get_protos_by_pkg_name_as_fqbin/1]). --export([gpb_version_as_string/0, gpb_version_as_list/0]). --export([gpb_version_source/0]). - - -%% enumerated types - --export_type([]). - -%% message types --type get_volume_request() :: - #{uuid => unicode:chardata(), % = 1, optional - host => unicode:chardata() % = 2, optional - }. - --type volume() :: - #{id => unicode:chardata(), % = 1, optional - name => unicode:chardata(), % = 2, optional - size => non_neg_integer() % = 3, optional, 64 bits - }. - --type list_volumes_request() :: - #{host => unicode:chardata() % = 1, optional - }. - --type list_volumes_response() :: - #{volumes => [volume()] % = 1, repeated - }. - --type create_volume_request() :: - #{volume => volume(), % = 1, optional - host => unicode:chardata() % = 2, optional - }. - --type update_volume_request() :: - #{host => unicode:chardata(), % = 1, optional - volume => volume() % = 2, optional - }. - --type delete_volume_request() :: - #{uuid => unicode:chardata(), % = 1, optional - host => unicode:chardata() % = 2, optional - }. - --type volume_attachment_identifier() :: - #{domain_id => unicode:chardata(), % = 1, optional - volume_id => unicode:chardata(), % = 2, optional - host => unicode:chardata() % = 3, optional - }. - --type volume_attachment() :: - #{domain_id => unicode:chardata(), % = 1, optional - volume_id => unicode:chardata(), % = 2, optional - disk_address => unicode:chardata() % = 3, optional - }. - --type list_volume_attachments_request() :: - #{domain_id => unicode:chardata(), % = 1, optional - host => unicode:chardata() % = 2, optional - }. - --type list_volume_attachments_response() :: - #{attachments => [volume_attachment()] % = 1, repeated - }. - --type empty() :: - #{ - }. - --export_type(['get_volume_request'/0, 'volume'/0, 'list_volumes_request'/0, 'list_volumes_response'/0, 'create_volume_request'/0, 'update_volume_request'/0, 'delete_volume_request'/0, 'volume_attachment_identifier'/0, 'volume_attachment'/0, 'list_volume_attachments_request'/0, 'list_volume_attachments_response'/0, 'empty'/0]). --type '$msg_name'() :: get_volume_request | volume | list_volumes_request | list_volumes_response | create_volume_request | update_volume_request | delete_volume_request | volume_attachment_identifier | volume_attachment | list_volume_attachments_request | list_volume_attachments_response | empty. --type '$msg'() :: get_volume_request() | volume() | list_volumes_request() | list_volumes_response() | create_volume_request() | update_volume_request() | delete_volume_request() | volume_attachment_identifier() | volume_attachment() | list_volume_attachments_request() | list_volume_attachments_response() | empty(). --export_type(['$msg_name'/0, '$msg'/0]). - --if(?OTP_RELEASE >= 24). --dialyzer({no_underspecs, encode_msg/2}). --endif. --spec encode_msg('$msg'(), '$msg_name'()) -> binary(). -encode_msg(Msg, MsgName) when is_atom(MsgName) -> encode_msg(Msg, MsgName, []). - --if(?OTP_RELEASE >= 24). --dialyzer({no_underspecs, encode_msg/3}). --endif. --spec encode_msg('$msg'(), '$msg_name'(), list()) -> binary(). -encode_msg(Msg, MsgName, Opts) -> - case proplists:get_bool(verify, Opts) of - true -> verify_msg(Msg, MsgName, Opts); - false -> ok - end, - TrUserData = proplists:get_value(user_data, Opts), - case MsgName of - get_volume_request -> encode_msg_get_volume_request(id(Msg, TrUserData), TrUserData); - volume -> encode_msg_volume(id(Msg, TrUserData), TrUserData); - list_volumes_request -> encode_msg_list_volumes_request(id(Msg, TrUserData), TrUserData); - list_volumes_response -> encode_msg_list_volumes_response(id(Msg, TrUserData), TrUserData); - create_volume_request -> encode_msg_create_volume_request(id(Msg, TrUserData), TrUserData); - update_volume_request -> encode_msg_update_volume_request(id(Msg, TrUserData), TrUserData); - delete_volume_request -> encode_msg_delete_volume_request(id(Msg, TrUserData), TrUserData); - volume_attachment_identifier -> encode_msg_volume_attachment_identifier(id(Msg, TrUserData), TrUserData); - volume_attachment -> encode_msg_volume_attachment(id(Msg, TrUserData), TrUserData); - list_volume_attachments_request -> encode_msg_list_volume_attachments_request(id(Msg, TrUserData), TrUserData); - list_volume_attachments_response -> encode_msg_list_volume_attachments_response(id(Msg, TrUserData), TrUserData); - empty -> encode_msg_empty(id(Msg, TrUserData), TrUserData) - end. - - -encode_msg_get_volume_request(Msg, TrUserData) -> encode_msg_get_volume_request(Msg, <<>>, TrUserData). - - -encode_msg_get_volume_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{uuid := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{host := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_volume(Msg, TrUserData) -> encode_msg_volume(Msg, <<>>, TrUserData). - - -encode_msg_volume(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{id := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - B2 = case M of - #{name := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end, - case M of - #{size := F3} -> - begin - TrF3 = id(F3, TrUserData), - if TrF3 =:= 0 -> B2; - true -> e_varint(TrF3, <>, TrUserData) - end - end; - _ -> B2 - end. - -encode_msg_list_volumes_request(Msg, TrUserData) -> encode_msg_list_volumes_request(Msg, <<>>, TrUserData). - - -encode_msg_list_volumes_request(#{} = M, Bin, TrUserData) -> - case M of - #{host := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end. - -encode_msg_list_volumes_response(Msg, TrUserData) -> encode_msg_list_volumes_response(Msg, <<>>, TrUserData). - - -encode_msg_list_volumes_response(#{} = M, Bin, TrUserData) -> - case M of - #{volumes := F1} -> - TrF1 = id(F1, TrUserData), - if TrF1 == [] -> Bin; - true -> e_field_list_volumes_response_volumes(TrF1, Bin, TrUserData) - end; - _ -> Bin - end. - -encode_msg_create_volume_request(Msg, TrUserData) -> encode_msg_create_volume_request(Msg, <<>>, TrUserData). - - -encode_msg_create_volume_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{volume := F1} -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= undefined -> Bin; - true -> e_mfield_create_volume_request_volume(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{host := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_update_volume_request(Msg, TrUserData) -> encode_msg_update_volume_request(Msg, <<>>, TrUserData). - - -encode_msg_update_volume_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{host := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{volume := F2} -> - begin - TrF2 = id(F2, TrUserData), - if TrF2 =:= undefined -> B1; - true -> e_mfield_update_volume_request_volume(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_delete_volume_request(Msg, TrUserData) -> encode_msg_delete_volume_request(Msg, <<>>, TrUserData). - - -encode_msg_delete_volume_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{uuid := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{host := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_volume_attachment_identifier(Msg, TrUserData) -> encode_msg_volume_attachment_identifier(Msg, <<>>, TrUserData). - - -encode_msg_volume_attachment_identifier(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{domain_id := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - B2 = case M of - #{volume_id := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end, - case M of - #{host := F3} -> - begin - TrF3 = id(F3, TrUserData), - case is_empty_string(TrF3) of - true -> B2; - false -> e_type_string(TrF3, <>, TrUserData) - end - end; - _ -> B2 - end. - -encode_msg_volume_attachment(Msg, TrUserData) -> encode_msg_volume_attachment(Msg, <<>>, TrUserData). - - -encode_msg_volume_attachment(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{domain_id := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - B2 = case M of - #{volume_id := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end, - case M of - #{disk_address := F3} -> - begin - TrF3 = id(F3, TrUserData), - case is_empty_string(TrF3) of - true -> B2; - false -> e_type_string(TrF3, <>, TrUserData) - end - end; - _ -> B2 - end. - -encode_msg_list_volume_attachments_request(Msg, TrUserData) -> encode_msg_list_volume_attachments_request(Msg, <<>>, TrUserData). - - -encode_msg_list_volume_attachments_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{domain_id := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{host := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_list_volume_attachments_response(Msg, TrUserData) -> encode_msg_list_volume_attachments_response(Msg, <<>>, TrUserData). - - -encode_msg_list_volume_attachments_response(#{} = M, Bin, TrUserData) -> - case M of - #{attachments := F1} -> - TrF1 = id(F1, TrUserData), - if TrF1 == [] -> Bin; - true -> e_field_list_volume_attachments_response_attachments(TrF1, Bin, TrUserData) - end; - _ -> Bin - end. - -encode_msg_empty(_Msg, _TrUserData) -> <<>>. - -e_mfield_list_volumes_response_volumes(Msg, Bin, TrUserData) -> - SubBin = encode_msg_volume(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_field_list_volumes_response_volumes([Elem | Rest], Bin, TrUserData) -> - Bin2 = <>, - Bin3 = e_mfield_list_volumes_response_volumes(id(Elem, TrUserData), Bin2, TrUserData), - e_field_list_volumes_response_volumes(Rest, Bin3, TrUserData); -e_field_list_volumes_response_volumes([], Bin, _TrUserData) -> Bin. - -e_mfield_create_volume_request_volume(Msg, Bin, TrUserData) -> - SubBin = encode_msg_volume(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_mfield_update_volume_request_volume(Msg, Bin, TrUserData) -> - SubBin = encode_msg_volume(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_mfield_list_volume_attachments_response_attachments(Msg, Bin, TrUserData) -> - SubBin = encode_msg_volume_attachment(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_field_list_volume_attachments_response_attachments([Elem | Rest], Bin, TrUserData) -> - Bin2 = <>, - Bin3 = e_mfield_list_volume_attachments_response_attachments(id(Elem, TrUserData), Bin2, TrUserData), - e_field_list_volume_attachments_response_attachments(Rest, Bin3, TrUserData); -e_field_list_volume_attachments_response_attachments([], Bin, _TrUserData) -> Bin. - --compile({nowarn_unused_function,e_type_sint/3}). -e_type_sint(Value, Bin, _TrUserData) when Value >= 0 -> e_varint(Value * 2, Bin); -e_type_sint(Value, Bin, _TrUserData) -> e_varint(Value * -2 - 1, Bin). - --compile({nowarn_unused_function,e_type_int32/3}). -e_type_int32(Value, Bin, _TrUserData) when 0 =< Value, Value =< 127 -> <>; -e_type_int32(Value, Bin, _TrUserData) -> - <> = <>, - e_varint(N, Bin). - --compile({nowarn_unused_function,e_type_int64/3}). -e_type_int64(Value, Bin, _TrUserData) when 0 =< Value, Value =< 127 -> <>; -e_type_int64(Value, Bin, _TrUserData) -> - <> = <>, - e_varint(N, Bin). - --compile({nowarn_unused_function,e_type_bool/3}). -e_type_bool(true, Bin, _TrUserData) -> <>; -e_type_bool(false, Bin, _TrUserData) -> <>; -e_type_bool(1, Bin, _TrUserData) -> <>; -e_type_bool(0, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_string/3}). -e_type_string(S, Bin, _TrUserData) -> - Utf8 = unicode:characters_to_binary(S), - Bin2 = e_varint(byte_size(Utf8), Bin), - <>. - --compile({nowarn_unused_function,e_type_bytes/3}). -e_type_bytes(Bytes, Bin, _TrUserData) when is_binary(Bytes) -> - Bin2 = e_varint(byte_size(Bytes), Bin), - <>; -e_type_bytes(Bytes, Bin, _TrUserData) when is_list(Bytes) -> - BytesBin = iolist_to_binary(Bytes), - Bin2 = e_varint(byte_size(BytesBin), Bin), - <>. - --compile({nowarn_unused_function,e_type_fixed32/3}). -e_type_fixed32(Value, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_sfixed32/3}). -e_type_sfixed32(Value, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_fixed64/3}). -e_type_fixed64(Value, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_sfixed64/3}). -e_type_sfixed64(Value, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_float/3}). -e_type_float(V, Bin, _) when is_number(V) -> <>; -e_type_float(infinity, Bin, _) -> <>; -e_type_float('-infinity', Bin, _) -> <>; -e_type_float(nan, Bin, _) -> <>. - --compile({nowarn_unused_function,e_type_double/3}). -e_type_double(V, Bin, _) when is_number(V) -> <>; -e_type_double(infinity, Bin, _) -> <>; -e_type_double('-infinity', Bin, _) -> <>; -e_type_double(nan, Bin, _) -> <>. - --compile({nowarn_unused_function,e_unknown_elems/2}). -e_unknown_elems([Elem | Rest], Bin) -> - BinR = case Elem of - {varint, FNum, N} -> - BinF = e_varint(FNum bsl 3, Bin), - e_varint(N, BinF); - {length_delimited, FNum, Data} -> - BinF = e_varint(FNum bsl 3 bor 2, Bin), - BinL = e_varint(byte_size(Data), BinF), - <>; - {group, FNum, GroupFields} -> - Bin1 = e_varint(FNum bsl 3 bor 3, Bin), - Bin2 = e_unknown_elems(GroupFields, Bin1), - e_varint(FNum bsl 3 bor 4, Bin2); - {fixed32, FNum, V} -> - BinF = e_varint(FNum bsl 3 bor 5, Bin), - <>; - {fixed64, FNum, V} -> - BinF = e_varint(FNum bsl 3 bor 1, Bin), - <> - end, - e_unknown_elems(Rest, BinR); -e_unknown_elems([], Bin) -> Bin. - --compile({nowarn_unused_function,e_varint/3}). -e_varint(N, Bin, _TrUserData) -> e_varint(N, Bin). - --compile({nowarn_unused_function,e_varint/2}). -e_varint(N, Bin) when N =< 127 -> <>; -e_varint(N, Bin) -> - Bin2 = <>, - e_varint(N bsr 7, Bin2). - -is_empty_string("") -> true; -is_empty_string(<<>>) -> true; -is_empty_string(L) when is_list(L) -> not string_has_chars(L); -is_empty_string(B) when is_binary(B) -> false. - -string_has_chars([C | _]) when is_integer(C) -> true; -string_has_chars([H | T]) -> - case string_has_chars(H) of - true -> true; - false -> string_has_chars(T) - end; -string_has_chars(B) when is_binary(B), byte_size(B) =/= 0 -> true; -string_has_chars(C) when is_integer(C) -> true; -string_has_chars(<<>>) -> false; -string_has_chars([]) -> false. - - -decode_msg(Bin, MsgName) when is_binary(Bin) -> decode_msg(Bin, MsgName, []). - -decode_msg(Bin, MsgName, Opts) when is_binary(Bin) -> - TrUserData = proplists:get_value(user_data, Opts), - decode_msg_1_catch(Bin, MsgName, TrUserData). - --ifdef('OTP_RELEASE'). -decode_msg_1_catch(Bin, MsgName, TrUserData) -> - try decode_msg_2_doit(MsgName, Bin, TrUserData) - catch - error:{gpb_error,_}=Reason:StackTrace -> - erlang:raise(error, Reason, StackTrace); - Class:Reason:StackTrace -> error({gpb_error,{decoding_failure, {Bin, MsgName, {Class, Reason, StackTrace}}}}) - end. --else. -decode_msg_1_catch(Bin, MsgName, TrUserData) -> - try decode_msg_2_doit(MsgName, Bin, TrUserData) - catch - error:{gpb_error,_}=Reason -> - erlang:raise(error, Reason, - erlang:get_stacktrace()); - Class:Reason -> - StackTrace = erlang:get_stacktrace(), - error({gpb_error,{decoding_failure, {Bin, MsgName, {Class, Reason, StackTrace}}}}) - end. --endif. - -decode_msg_2_doit(get_volume_request, Bin, TrUserData) -> id(decode_msg_get_volume_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(volume, Bin, TrUserData) -> id(decode_msg_volume(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_volumes_request, Bin, TrUserData) -> id(decode_msg_list_volumes_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_volumes_response, Bin, TrUserData) -> id(decode_msg_list_volumes_response(Bin, TrUserData), TrUserData); -decode_msg_2_doit(create_volume_request, Bin, TrUserData) -> id(decode_msg_create_volume_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(update_volume_request, Bin, TrUserData) -> id(decode_msg_update_volume_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(delete_volume_request, Bin, TrUserData) -> id(decode_msg_delete_volume_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(volume_attachment_identifier, Bin, TrUserData) -> id(decode_msg_volume_attachment_identifier(Bin, TrUserData), TrUserData); -decode_msg_2_doit(volume_attachment, Bin, TrUserData) -> id(decode_msg_volume_attachment(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_volume_attachments_request, Bin, TrUserData) -> id(decode_msg_list_volume_attachments_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_volume_attachments_response, Bin, TrUserData) -> id(decode_msg_list_volume_attachments_response(Bin, TrUserData), TrUserData); -decode_msg_2_doit(empty, Bin, TrUserData) -> id(decode_msg_empty(Bin, TrUserData), TrUserData). - - - -decode_msg_get_volume_request(Bin, TrUserData) -> dfp_read_field_def_get_volume_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_get_volume_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_get_volume_request_uuid(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_get_volume_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_get_volume_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_get_volume_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{uuid => F@_1, host => F@_2}; -dfp_read_field_def_get_volume_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_get_volume_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_get_volume_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_get_volume_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_get_volume_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_get_volume_request_uuid(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_get_volume_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_get_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_get_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_get_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_get_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_get_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_get_volume_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{uuid => F@_1, host => F@_2}. - -d_field_get_volume_request_uuid(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_get_volume_request_uuid(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_get_volume_request_uuid(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_get_volume_request(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_get_volume_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_get_volume_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_get_volume_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_get_volume_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_get_volume_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_get_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_get_volume_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_get_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_get_volume_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_get_volume_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_get_volume_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_get_volume_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_get_volume_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_get_volume_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_get_volume_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_get_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_get_volume_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_get_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_volume(Bin, TrUserData) -> dfp_read_field_def_volume(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), id(0, TrUserData), TrUserData). - -dfp_read_field_def_volume(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_volume_id(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_volume(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_volume_name(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_volume(<<24, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_volume_size(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_volume(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{id => F@_1, name => F@_2, size => F@_3}; -dfp_read_field_def_volume(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dg_read_field_def_volume(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -dg_read_field_def_volume(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 32 - 7 -> dg_read_field_def_volume(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -dg_read_field_def_volume(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_volume_id(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 18 -> d_field_volume_name(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 24 -> d_field_volume_size(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_volume(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 1 -> skip_64_volume(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 2 -> skip_length_delimited_volume(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 3 -> skip_group_volume(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 5 -> skip_32_volume(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData) - end - end; -dg_read_field_def_volume(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{id => F@_1, name => F@_2, size => F@_3}. - -d_field_volume_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_volume_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_volume_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_volume(RestF, 0, 0, F, NewFValue, F@_2, F@_3, TrUserData). - -d_field_volume_name(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_volume_name(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_volume_name(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_volume(RestF, 0, 0, F, F@_1, NewFValue, F@_3, TrUserData). - -d_field_volume_size(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_volume_size(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_volume_size(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, TrUserData) -> - {NewFValue, RestF} = {id((X bsl N + Acc) band 18446744073709551615, TrUserData), Rest}, - dfp_read_field_def_volume(RestF, 0, 0, F, F@_1, F@_2, NewFValue, TrUserData). - -skip_varint_volume(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> skip_varint_volume(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -skip_varint_volume(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_volume(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_length_delimited_volume(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> skip_length_delimited_volume(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -skip_length_delimited_volume(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_volume(Rest2, 0, 0, F, F@_1, F@_2, F@_3, TrUserData). - -skip_group_volume(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_volume(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, TrUserData). - -skip_32_volume(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_volume(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_64_volume(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_volume(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -decode_msg_list_volumes_request(Bin, TrUserData) -> dfp_read_field_def_list_volumes_request(Bin, 0, 0, 0, id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_list_volumes_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_volumes_request_host(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_list_volumes_request(<<>>, 0, 0, _, F@_1, _) -> #{host => F@_1}; -dfp_read_field_def_list_volumes_request(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_volumes_request(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_list_volumes_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_volumes_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_list_volumes_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_volumes_request_host(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_volumes_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_list_volumes_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_list_volumes_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_list_volumes_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_list_volumes_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_list_volumes_request(<<>>, 0, 0, _, F@_1, _) -> #{host => F@_1}. - -d_field_list_volumes_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_volumes_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_list_volumes_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_list_volumes_request(RestF, 0, 0, F, NewFValue, TrUserData). - -skip_varint_list_volumes_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_volumes_request(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_list_volumes_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_volumes_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_list_volumes_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_volumes_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_list_volumes_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_volumes_request(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_list_volumes_request(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_volumes_request(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_list_volumes_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_volumes_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_list_volumes_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_volumes_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_list_volumes_response(Bin, TrUserData) -> dfp_read_field_def_list_volumes_response(Bin, 0, 0, 0, id([], TrUserData), TrUserData). - -dfp_read_field_def_list_volumes_response(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_volumes_response_volumes(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_list_volumes_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{volumes => lists_reverse(R1, TrUserData)} - end; -dfp_read_field_def_list_volumes_response(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_volumes_response(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_list_volumes_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_volumes_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_list_volumes_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_volumes_response_volumes(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_volumes_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_list_volumes_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_list_volumes_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_list_volumes_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_list_volumes_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_list_volumes_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{volumes => lists_reverse(R1, TrUserData)} - end. - -d_field_list_volumes_response_volumes(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_volumes_response_volumes(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_list_volumes_response_volumes(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_volume(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_list_volumes_response(RestF, 0, 0, F, cons(NewFValue, Prev, TrUserData), TrUserData). - -skip_varint_list_volumes_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_volumes_response(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_list_volumes_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_volumes_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_list_volumes_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_volumes_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_list_volumes_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_volumes_response(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_list_volumes_response(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_volumes_response(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_list_volumes_response(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_volumes_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_list_volumes_response(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_volumes_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_create_volume_request(Bin, TrUserData) -> dfp_read_field_def_create_volume_request(Bin, 0, 0, 0, id('$undef', TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_create_volume_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_create_volume_request_volume(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_create_volume_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_create_volume_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_create_volume_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> - S1 = #{host => F@_2}, - if F@_1 == '$undef' -> S1; - true -> S1#{volume => F@_1} - end; -dfp_read_field_def_create_volume_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_create_volume_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_create_volume_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_create_volume_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_create_volume_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_create_volume_request_volume(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_create_volume_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_create_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_create_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_create_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_create_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_create_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_create_volume_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> - S1 = #{host => F@_2}, - if F@_1 == '$undef' -> S1; - true -> S1#{volume => F@_1} - end. - -d_field_create_volume_request_volume(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_create_volume_request_volume(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_create_volume_request_volume(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_volume(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_create_volume_request(RestF, - 0, - 0, - F, - if Prev == '$undef' -> NewFValue; - true -> merge_msg_volume(Prev, NewFValue, TrUserData) - end, - F@_2, - TrUserData). - -d_field_create_volume_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_create_volume_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_create_volume_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_create_volume_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_create_volume_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_create_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_create_volume_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_create_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_create_volume_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_create_volume_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_create_volume_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_create_volume_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_create_volume_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_create_volume_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_create_volume_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_create_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_create_volume_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_create_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_update_volume_request(Bin, TrUserData) -> dfp_read_field_def_update_volume_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id('$undef', TrUserData), TrUserData). - -dfp_read_field_def_update_volume_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_update_volume_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_update_volume_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_update_volume_request_volume(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_update_volume_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> - S1 = #{host => F@_1}, - if F@_2 == '$undef' -> S1; - true -> S1#{volume => F@_2} - end; -dfp_read_field_def_update_volume_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_update_volume_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_update_volume_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_update_volume_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_update_volume_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_update_volume_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_update_volume_request_volume(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_update_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_update_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_update_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_update_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_update_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_update_volume_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> - S1 = #{host => F@_1}, - if F@_2 == '$undef' -> S1; - true -> S1#{volume => F@_2} - end. - -d_field_update_volume_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_update_volume_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_update_volume_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_update_volume_request(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_update_volume_request_volume(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_update_volume_request_volume(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_update_volume_request_volume(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_volume(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_update_volume_request(RestF, - 0, - 0, - F, - F@_1, - if Prev == '$undef' -> NewFValue; - true -> merge_msg_volume(Prev, NewFValue, TrUserData) - end, - TrUserData). - -skip_varint_update_volume_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_update_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_update_volume_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_update_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_update_volume_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_update_volume_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_update_volume_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_update_volume_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_update_volume_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_update_volume_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_update_volume_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_update_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_update_volume_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_update_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_delete_volume_request(Bin, TrUserData) -> dfp_read_field_def_delete_volume_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_delete_volume_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_delete_volume_request_uuid(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_delete_volume_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_delete_volume_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_delete_volume_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{uuid => F@_1, host => F@_2}; -dfp_read_field_def_delete_volume_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_delete_volume_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_delete_volume_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_delete_volume_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_delete_volume_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_delete_volume_request_uuid(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_delete_volume_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_delete_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_delete_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_delete_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_delete_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_delete_volume_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_delete_volume_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{uuid => F@_1, host => F@_2}. - -d_field_delete_volume_request_uuid(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_delete_volume_request_uuid(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_delete_volume_request_uuid(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_delete_volume_request(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_delete_volume_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_delete_volume_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_delete_volume_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_delete_volume_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_delete_volume_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_delete_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_delete_volume_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_delete_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_delete_volume_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_delete_volume_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_delete_volume_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_delete_volume_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_delete_volume_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_delete_volume_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_delete_volume_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_delete_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_delete_volume_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_delete_volume_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_volume_attachment_identifier(Bin, TrUserData) -> dfp_read_field_def_volume_attachment_identifier(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_volume_attachment_identifier(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_volume_attachment_identifier_domain_id(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_volume_attachment_identifier(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_volume_attachment_identifier_volume_id(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_volume_attachment_identifier(<<26, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_volume_attachment_identifier_host(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_volume_attachment_identifier(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{domain_id => F@_1, volume_id => F@_2, host => F@_3}; -dfp_read_field_def_volume_attachment_identifier(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dg_read_field_def_volume_attachment_identifier(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -dg_read_field_def_volume_attachment_identifier(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 32 - 7 -> dg_read_field_def_volume_attachment_identifier(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -dg_read_field_def_volume_attachment_identifier(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_volume_attachment_identifier_domain_id(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 18 -> d_field_volume_attachment_identifier_volume_id(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 26 -> d_field_volume_attachment_identifier_host(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_volume_attachment_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 1 -> skip_64_volume_attachment_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 2 -> skip_length_delimited_volume_attachment_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 3 -> skip_group_volume_attachment_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 5 -> skip_32_volume_attachment_identifier(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData) - end - end; -dg_read_field_def_volume_attachment_identifier(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{domain_id => F@_1, volume_id => F@_2, host => F@_3}. - -d_field_volume_attachment_identifier_domain_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_volume_attachment_identifier_domain_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_volume_attachment_identifier_domain_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_volume_attachment_identifier(RestF, 0, 0, F, NewFValue, F@_2, F@_3, TrUserData). - -d_field_volume_attachment_identifier_volume_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_volume_attachment_identifier_volume_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_volume_attachment_identifier_volume_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_volume_attachment_identifier(RestF, 0, 0, F, F@_1, NewFValue, F@_3, TrUserData). - -d_field_volume_attachment_identifier_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_volume_attachment_identifier_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_volume_attachment_identifier_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_volume_attachment_identifier(RestF, 0, 0, F, F@_1, F@_2, NewFValue, TrUserData). - -skip_varint_volume_attachment_identifier(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> skip_varint_volume_attachment_identifier(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -skip_varint_volume_attachment_identifier(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_volume_attachment_identifier(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_length_delimited_volume_attachment_identifier(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> skip_length_delimited_volume_attachment_identifier(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -skip_length_delimited_volume_attachment_identifier(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_volume_attachment_identifier(Rest2, 0, 0, F, F@_1, F@_2, F@_3, TrUserData). - -skip_group_volume_attachment_identifier(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_volume_attachment_identifier(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, TrUserData). - -skip_32_volume_attachment_identifier(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_volume_attachment_identifier(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_64_volume_attachment_identifier(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_volume_attachment_identifier(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -decode_msg_volume_attachment(Bin, TrUserData) -> dfp_read_field_def_volume_attachment(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_volume_attachment(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_volume_attachment_domain_id(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_volume_attachment(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_volume_attachment_volume_id(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_volume_attachment(<<26, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_volume_attachment_disk_address(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_volume_attachment(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{domain_id => F@_1, volume_id => F@_2, disk_address => F@_3}; -dfp_read_field_def_volume_attachment(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dg_read_field_def_volume_attachment(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -dg_read_field_def_volume_attachment(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 32 - 7 -> dg_read_field_def_volume_attachment(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -dg_read_field_def_volume_attachment(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_volume_attachment_domain_id(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 18 -> d_field_volume_attachment_volume_id(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 26 -> d_field_volume_attachment_disk_address(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_volume_attachment(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 1 -> skip_64_volume_attachment(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 2 -> skip_length_delimited_volume_attachment(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 3 -> skip_group_volume_attachment(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 5 -> skip_32_volume_attachment(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData) - end - end; -dg_read_field_def_volume_attachment(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{domain_id => F@_1, volume_id => F@_2, disk_address => F@_3}. - -d_field_volume_attachment_domain_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_volume_attachment_domain_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_volume_attachment_domain_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_volume_attachment(RestF, 0, 0, F, NewFValue, F@_2, F@_3, TrUserData). - -d_field_volume_attachment_volume_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_volume_attachment_volume_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_volume_attachment_volume_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_volume_attachment(RestF, 0, 0, F, F@_1, NewFValue, F@_3, TrUserData). - -d_field_volume_attachment_disk_address(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_volume_attachment_disk_address(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_volume_attachment_disk_address(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_volume_attachment(RestF, 0, 0, F, F@_1, F@_2, NewFValue, TrUserData). - -skip_varint_volume_attachment(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> skip_varint_volume_attachment(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -skip_varint_volume_attachment(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_volume_attachment(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_length_delimited_volume_attachment(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> skip_length_delimited_volume_attachment(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -skip_length_delimited_volume_attachment(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_volume_attachment(Rest2, 0, 0, F, F@_1, F@_2, F@_3, TrUserData). - -skip_group_volume_attachment(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_volume_attachment(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, TrUserData). - -skip_32_volume_attachment(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_volume_attachment(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_64_volume_attachment(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_volume_attachment(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -decode_msg_list_volume_attachments_request(Bin, TrUserData) -> dfp_read_field_def_list_volume_attachments_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_list_volume_attachments_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_list_volume_attachments_request_domain_id(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_list_volume_attachments_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_list_volume_attachments_request_host(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_list_volume_attachments_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{domain_id => F@_1, host => F@_2}; -dfp_read_field_def_list_volume_attachments_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_list_volume_attachments_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_list_volume_attachments_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_volume_attachments_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_list_volume_attachments_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_volume_attachments_request_domain_id(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_list_volume_attachments_request_host(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_volume_attachments_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_list_volume_attachments_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_list_volume_attachments_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_list_volume_attachments_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_list_volume_attachments_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_list_volume_attachments_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{domain_id => F@_1, host => F@_2}. - -d_field_list_volume_attachments_request_domain_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_list_volume_attachments_request_domain_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_list_volume_attachments_request_domain_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_list_volume_attachments_request(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_list_volume_attachments_request_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_list_volume_attachments_request_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_list_volume_attachments_request_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_list_volume_attachments_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_list_volume_attachments_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_list_volume_attachments_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_list_volume_attachments_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_list_volume_attachments_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_list_volume_attachments_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_list_volume_attachments_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_list_volume_attachments_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_volume_attachments_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_list_volume_attachments_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_volume_attachments_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_list_volume_attachments_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_list_volume_attachments_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_list_volume_attachments_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_list_volume_attachments_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_list_volume_attachments_response(Bin, TrUserData) -> dfp_read_field_def_list_volume_attachments_response(Bin, 0, 0, 0, id([], TrUserData), TrUserData). - -dfp_read_field_def_list_volume_attachments_response(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_volume_attachments_response_attachments(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_list_volume_attachments_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{attachments => lists_reverse(R1, TrUserData)} - end; -dfp_read_field_def_list_volume_attachments_response(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_volume_attachments_response(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_list_volume_attachments_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_volume_attachments_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_list_volume_attachments_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_volume_attachments_response_attachments(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_volume_attachments_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_list_volume_attachments_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_list_volume_attachments_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_list_volume_attachments_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_list_volume_attachments_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_list_volume_attachments_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{attachments => lists_reverse(R1, TrUserData)} - end. - -d_field_list_volume_attachments_response_attachments(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_volume_attachments_response_attachments(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_list_volume_attachments_response_attachments(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_volume_attachment(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_list_volume_attachments_response(RestF, 0, 0, F, cons(NewFValue, Prev, TrUserData), TrUserData). - -skip_varint_list_volume_attachments_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_volume_attachments_response(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_list_volume_attachments_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_volume_attachments_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_list_volume_attachments_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_volume_attachments_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_list_volume_attachments_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_volume_attachments_response(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_list_volume_attachments_response(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_volume_attachments_response(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_list_volume_attachments_response(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_volume_attachments_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_list_volume_attachments_response(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_volume_attachments_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_empty(Bin, TrUserData) -> dfp_read_field_def_empty(Bin, 0, 0, 0, TrUserData). - -dfp_read_field_def_empty(<<>>, 0, 0, _, _) -> #{}; -dfp_read_field_def_empty(Other, Z1, Z2, F, TrUserData) -> dg_read_field_def_empty(Other, Z1, Z2, F, TrUserData). - -dg_read_field_def_empty(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 32 - 7 -> dg_read_field_def_empty(Rest, N + 7, X bsl N + Acc, F, TrUserData); -dg_read_field_def_empty(<<0:1, X:7, Rest/binary>>, N, Acc, _, TrUserData) -> - Key = X bsl N + Acc, - case Key band 7 of - 0 -> skip_varint_empty(Rest, 0, 0, Key bsr 3, TrUserData); - 1 -> skip_64_empty(Rest, 0, 0, Key bsr 3, TrUserData); - 2 -> skip_length_delimited_empty(Rest, 0, 0, Key bsr 3, TrUserData); - 3 -> skip_group_empty(Rest, 0, 0, Key bsr 3, TrUserData); - 5 -> skip_32_empty(Rest, 0, 0, Key bsr 3, TrUserData) - end; -dg_read_field_def_empty(<<>>, 0, 0, _, _) -> #{}. - -skip_varint_empty(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> skip_varint_empty(Rest, Z1, Z2, F, TrUserData); -skip_varint_empty(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_empty(Rest, Z1, Z2, F, TrUserData). - -skip_length_delimited_empty(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 57 -> skip_length_delimited_empty(Rest, N + 7, X bsl N + Acc, F, TrUserData); -skip_length_delimited_empty(<<0:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_empty(Rest2, 0, 0, F, TrUserData). - -skip_group_empty(Bin, _, Z2, FNum, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_empty(Rest, 0, Z2, FNum, TrUserData). - -skip_32_empty(<<_:32, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_empty(Rest, Z1, Z2, F, TrUserData). - -skip_64_empty(<<_:64, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_empty(Rest, Z1, Z2, F, TrUserData). - -read_group(Bin, FieldNum) -> - {NumBytes, EndTagLen} = read_gr_b(Bin, 0, 0, 0, 0, FieldNum), - <> = Bin, - {Group, Rest}. - -%% Like skipping over fields, but record the total length, -%% Each field is <(FieldNum bsl 3) bor FieldType> ++ -%% Record the length because varints may be non-optimally encoded. -%% -%% Groups can be nested, but assume the same FieldNum cannot be nested -%% because group field numbers are shared with the rest of the fields -%% numbers. Thus we can search just for an group-end with the same -%% field number. -%% -%% (The only time the same group field number could occur would -%% be in a nested sub message, but then it would be inside a -%% length-delimited entry, which we skip-read by length.) -read_gr_b(<<1:1, X:7, Tl/binary>>, N, Acc, NumBytes, TagLen, FieldNum) - when N < (32-7) -> - read_gr_b(Tl, N+7, X bsl N + Acc, NumBytes, TagLen+1, FieldNum); -read_gr_b(<<0:1, X:7, Tl/binary>>, N, Acc, NumBytes, TagLen, - FieldNum) -> - Key = X bsl N + Acc, - TagLen1 = TagLen + 1, - case {Key bsr 3, Key band 7} of - {FieldNum, 4} -> % 4 = group_end - {NumBytes, TagLen1}; - {_, 0} -> % 0 = varint - read_gr_vi(Tl, 0, NumBytes + TagLen1, FieldNum); - {_, 1} -> % 1 = bits64 - <<_:64, Tl2/binary>> = Tl, - read_gr_b(Tl2, 0, 0, NumBytes + TagLen1 + 8, 0, FieldNum); - {_, 2} -> % 2 = length_delimited - read_gr_ld(Tl, 0, 0, NumBytes + TagLen1, FieldNum); - {_, 3} -> % 3 = group_start - read_gr_b(Tl, 0, 0, NumBytes + TagLen1, 0, FieldNum); - {_, 4} -> % 4 = group_end - read_gr_b(Tl, 0, 0, NumBytes + TagLen1, 0, FieldNum); - {_, 5} -> % 5 = bits32 - <<_:32, Tl2/binary>> = Tl, - read_gr_b(Tl2, 0, 0, NumBytes + TagLen1 + 4, 0, FieldNum) - end. - -read_gr_vi(<<1:1, _:7, Tl/binary>>, N, NumBytes, FieldNum) - when N < (64-7) -> - read_gr_vi(Tl, N+7, NumBytes+1, FieldNum); -read_gr_vi(<<0:1, _:7, Tl/binary>>, _, NumBytes, FieldNum) -> - read_gr_b(Tl, 0, 0, NumBytes+1, 0, FieldNum). - -read_gr_ld(<<1:1, X:7, Tl/binary>>, N, Acc, NumBytes, FieldNum) - when N < (64-7) -> - read_gr_ld(Tl, N+7, X bsl N + Acc, NumBytes+1, FieldNum); -read_gr_ld(<<0:1, X:7, Tl/binary>>, N, Acc, NumBytes, FieldNum) -> - Len = X bsl N + Acc, - NumBytes1 = NumBytes + 1, - <<_:Len/binary, Tl2/binary>> = Tl, - read_gr_b(Tl2, 0, 0, NumBytes1 + Len, 0, FieldNum). - -merge_msgs(Prev, New, MsgName) when is_atom(MsgName) -> merge_msgs(Prev, New, MsgName, []). - -merge_msgs(Prev, New, MsgName, Opts) -> - TrUserData = proplists:get_value(user_data, Opts), - case MsgName of - get_volume_request -> merge_msg_get_volume_request(Prev, New, TrUserData); - volume -> merge_msg_volume(Prev, New, TrUserData); - list_volumes_request -> merge_msg_list_volumes_request(Prev, New, TrUserData); - list_volumes_response -> merge_msg_list_volumes_response(Prev, New, TrUserData); - create_volume_request -> merge_msg_create_volume_request(Prev, New, TrUserData); - update_volume_request -> merge_msg_update_volume_request(Prev, New, TrUserData); - delete_volume_request -> merge_msg_delete_volume_request(Prev, New, TrUserData); - volume_attachment_identifier -> merge_msg_volume_attachment_identifier(Prev, New, TrUserData); - volume_attachment -> merge_msg_volume_attachment(Prev, New, TrUserData); - list_volume_attachments_request -> merge_msg_list_volume_attachments_request(Prev, New, TrUserData); - list_volume_attachments_response -> merge_msg_list_volume_attachments_response(Prev, New, TrUserData); - empty -> merge_msg_empty(Prev, New, TrUserData) - end. - --compile({nowarn_unused_function,merge_msg_get_volume_request/3}). -merge_msg_get_volume_request(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{uuid := NFuuid}} -> S1#{uuid => NFuuid}; - {#{uuid := PFuuid}, _} -> S1#{uuid => PFuuid}; - _ -> S1 - end, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S2#{host => NFhost}; - {#{host := PFhost}, _} -> S2#{host => PFhost}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_volume/3}). -merge_msg_volume(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{id := NFid}} -> S1#{id => NFid}; - {#{id := PFid}, _} -> S1#{id => PFid}; - _ -> S1 - end, - S3 = case {PMsg, NMsg} of - {_, #{name := NFname}} -> S2#{name => NFname}; - {#{name := PFname}, _} -> S2#{name => PFname}; - _ -> S2 - end, - case {PMsg, NMsg} of - {_, #{size := NFsize}} -> S3#{size => NFsize}; - {#{size := PFsize}, _} -> S3#{size => PFsize}; - _ -> S3 - end. - --compile({nowarn_unused_function,merge_msg_list_volumes_request/3}). -merge_msg_list_volumes_request(PMsg, NMsg, _) -> - S1 = #{}, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S1#{host => NFhost}; - {#{host := PFhost}, _} -> S1#{host => PFhost}; - _ -> S1 - end. - --compile({nowarn_unused_function,merge_msg_list_volumes_response/3}). -merge_msg_list_volumes_response(PMsg, NMsg, TrUserData) -> - S1 = #{}, - case {PMsg, NMsg} of - {#{volumes := PFvolumes}, #{volumes := NFvolumes}} -> S1#{volumes => 'erlang_++'(PFvolumes, NFvolumes, TrUserData)}; - {_, #{volumes := NFvolumes}} -> S1#{volumes => NFvolumes}; - {#{volumes := PFvolumes}, _} -> S1#{volumes => PFvolumes}; - {_, _} -> S1 - end. - --compile({nowarn_unused_function,merge_msg_create_volume_request/3}). -merge_msg_create_volume_request(PMsg, NMsg, TrUserData) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {#{volume := PFvolume}, #{volume := NFvolume}} -> S1#{volume => merge_msg_volume(PFvolume, NFvolume, TrUserData)}; - {_, #{volume := NFvolume}} -> S1#{volume => NFvolume}; - {#{volume := PFvolume}, _} -> S1#{volume => PFvolume}; - {_, _} -> S1 - end, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S2#{host => NFhost}; - {#{host := PFhost}, _} -> S2#{host => PFhost}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_update_volume_request/3}). -merge_msg_update_volume_request(PMsg, NMsg, TrUserData) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S1#{host => NFhost}; - {#{host := PFhost}, _} -> S1#{host => PFhost}; - _ -> S1 - end, - case {PMsg, NMsg} of - {#{volume := PFvolume}, #{volume := NFvolume}} -> S2#{volume => merge_msg_volume(PFvolume, NFvolume, TrUserData)}; - {_, #{volume := NFvolume}} -> S2#{volume => NFvolume}; - {#{volume := PFvolume}, _} -> S2#{volume => PFvolume}; - {_, _} -> S2 - end. - --compile({nowarn_unused_function,merge_msg_delete_volume_request/3}). -merge_msg_delete_volume_request(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{uuid := NFuuid}} -> S1#{uuid => NFuuid}; - {#{uuid := PFuuid}, _} -> S1#{uuid => PFuuid}; - _ -> S1 - end, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S2#{host => NFhost}; - {#{host := PFhost}, _} -> S2#{host => PFhost}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_volume_attachment_identifier/3}). -merge_msg_volume_attachment_identifier(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{domain_id := NFdomain_id}} -> S1#{domain_id => NFdomain_id}; - {#{domain_id := PFdomain_id}, _} -> S1#{domain_id => PFdomain_id}; - _ -> S1 - end, - S3 = case {PMsg, NMsg} of - {_, #{volume_id := NFvolume_id}} -> S2#{volume_id => NFvolume_id}; - {#{volume_id := PFvolume_id}, _} -> S2#{volume_id => PFvolume_id}; - _ -> S2 - end, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S3#{host => NFhost}; - {#{host := PFhost}, _} -> S3#{host => PFhost}; - _ -> S3 - end. - --compile({nowarn_unused_function,merge_msg_volume_attachment/3}). -merge_msg_volume_attachment(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{domain_id := NFdomain_id}} -> S1#{domain_id => NFdomain_id}; - {#{domain_id := PFdomain_id}, _} -> S1#{domain_id => PFdomain_id}; - _ -> S1 - end, - S3 = case {PMsg, NMsg} of - {_, #{volume_id := NFvolume_id}} -> S2#{volume_id => NFvolume_id}; - {#{volume_id := PFvolume_id}, _} -> S2#{volume_id => PFvolume_id}; - _ -> S2 - end, - case {PMsg, NMsg} of - {_, #{disk_address := NFdisk_address}} -> S3#{disk_address => NFdisk_address}; - {#{disk_address := PFdisk_address}, _} -> S3#{disk_address => PFdisk_address}; - _ -> S3 - end. - --compile({nowarn_unused_function,merge_msg_list_volume_attachments_request/3}). -merge_msg_list_volume_attachments_request(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{domain_id := NFdomain_id}} -> S1#{domain_id => NFdomain_id}; - {#{domain_id := PFdomain_id}, _} -> S1#{domain_id => PFdomain_id}; - _ -> S1 - end, - case {PMsg, NMsg} of - {_, #{host := NFhost}} -> S2#{host => NFhost}; - {#{host := PFhost}, _} -> S2#{host => PFhost}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_list_volume_attachments_response/3}). -merge_msg_list_volume_attachments_response(PMsg, NMsg, TrUserData) -> - S1 = #{}, - case {PMsg, NMsg} of - {#{attachments := PFattachments}, #{attachments := NFattachments}} -> S1#{attachments => 'erlang_++'(PFattachments, NFattachments, TrUserData)}; - {_, #{attachments := NFattachments}} -> S1#{attachments => NFattachments}; - {#{attachments := PFattachments}, _} -> S1#{attachments => PFattachments}; - {_, _} -> S1 - end. - --compile({nowarn_unused_function,merge_msg_empty/3}). -merge_msg_empty(_Prev, New, _TrUserData) -> New. - - -verify_msg(Msg, MsgName) when is_atom(MsgName) -> verify_msg(Msg, MsgName, []). - -verify_msg(Msg, MsgName, Opts) -> - TrUserData = proplists:get_value(user_data, Opts), - case MsgName of - get_volume_request -> v_msg_get_volume_request(Msg, [MsgName], TrUserData); - volume -> v_msg_volume(Msg, [MsgName], TrUserData); - list_volumes_request -> v_msg_list_volumes_request(Msg, [MsgName], TrUserData); - list_volumes_response -> v_msg_list_volumes_response(Msg, [MsgName], TrUserData); - create_volume_request -> v_msg_create_volume_request(Msg, [MsgName], TrUserData); - update_volume_request -> v_msg_update_volume_request(Msg, [MsgName], TrUserData); - delete_volume_request -> v_msg_delete_volume_request(Msg, [MsgName], TrUserData); - volume_attachment_identifier -> v_msg_volume_attachment_identifier(Msg, [MsgName], TrUserData); - volume_attachment -> v_msg_volume_attachment(Msg, [MsgName], TrUserData); - list_volume_attachments_request -> v_msg_list_volume_attachments_request(Msg, [MsgName], TrUserData); - list_volume_attachments_response -> v_msg_list_volume_attachments_response(Msg, [MsgName], TrUserData); - empty -> v_msg_empty(Msg, [MsgName], TrUserData); - _ -> mk_type_error(not_a_known_message, Msg, []) - end. - - --compile({nowarn_unused_function,v_msg_get_volume_request/3}). --dialyzer({nowarn_function,v_msg_get_volume_request/3}). -v_msg_get_volume_request(#{} = M, Path, TrUserData) -> - case M of - #{uuid := F1} -> v_type_string(F1, [uuid | Path], TrUserData); - _ -> ok - end, - case M of - #{host := F2} -> v_type_string(F2, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (uuid) -> ok; - (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_get_volume_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), get_volume_request}, M, Path); -v_msg_get_volume_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, get_volume_request}, X, Path). - --compile({nowarn_unused_function,v_msg_volume/3}). --dialyzer({nowarn_function,v_msg_volume/3}). -v_msg_volume(#{} = M, Path, TrUserData) -> - case M of - #{id := F1} -> v_type_string(F1, [id | Path], TrUserData); - _ -> ok - end, - case M of - #{name := F2} -> v_type_string(F2, [name | Path], TrUserData); - _ -> ok - end, - case M of - #{size := F3} -> v_type_uint64(F3, [size | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (id) -> ok; - (name) -> ok; - (size) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_volume(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), volume}, M, Path); -v_msg_volume(X, Path, _TrUserData) -> mk_type_error({expected_msg, volume}, X, Path). - --compile({nowarn_unused_function,v_msg_list_volumes_request/3}). --dialyzer({nowarn_function,v_msg_list_volumes_request/3}). -v_msg_list_volumes_request(#{} = M, Path, TrUserData) -> - case M of - #{host := F1} -> v_type_string(F1, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_volumes_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_volumes_request}, M, Path); -v_msg_list_volumes_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_volumes_request}, X, Path). - --compile({nowarn_unused_function,v_msg_list_volumes_response/3}). --dialyzer({nowarn_function,v_msg_list_volumes_response/3}). -v_msg_list_volumes_response(#{} = M, Path, TrUserData) -> - case M of - #{volumes := F1} -> - if is_list(F1) -> - _ = [v_msg_volume(Elem, [volumes | Path], TrUserData) || Elem <- F1], - ok; - true -> mk_type_error({invalid_list_of, {msg, volume}}, F1, [volumes | Path]) - end; - _ -> ok - end, - lists:foreach(fun (volumes) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_volumes_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_volumes_response}, M, Path); -v_msg_list_volumes_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_volumes_response}, X, Path). - --compile({nowarn_unused_function,v_msg_create_volume_request/3}). --dialyzer({nowarn_function,v_msg_create_volume_request/3}). -v_msg_create_volume_request(#{} = M, Path, TrUserData) -> - case M of - #{volume := F1} -> v_msg_volume(F1, [volume | Path], TrUserData); - _ -> ok - end, - case M of - #{host := F2} -> v_type_string(F2, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (volume) -> ok; - (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_create_volume_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), create_volume_request}, M, Path); -v_msg_create_volume_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, create_volume_request}, X, Path). - --compile({nowarn_unused_function,v_msg_update_volume_request/3}). --dialyzer({nowarn_function,v_msg_update_volume_request/3}). -v_msg_update_volume_request(#{} = M, Path, TrUserData) -> - case M of - #{host := F1} -> v_type_string(F1, [host | Path], TrUserData); - _ -> ok - end, - case M of - #{volume := F2} -> v_msg_volume(F2, [volume | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (host) -> ok; - (volume) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_update_volume_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), update_volume_request}, M, Path); -v_msg_update_volume_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, update_volume_request}, X, Path). - --compile({nowarn_unused_function,v_msg_delete_volume_request/3}). --dialyzer({nowarn_function,v_msg_delete_volume_request/3}). -v_msg_delete_volume_request(#{} = M, Path, TrUserData) -> - case M of - #{uuid := F1} -> v_type_string(F1, [uuid | Path], TrUserData); - _ -> ok - end, - case M of - #{host := F2} -> v_type_string(F2, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (uuid) -> ok; - (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_delete_volume_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), delete_volume_request}, M, Path); -v_msg_delete_volume_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, delete_volume_request}, X, Path). - --compile({nowarn_unused_function,v_msg_volume_attachment_identifier/3}). --dialyzer({nowarn_function,v_msg_volume_attachment_identifier/3}). -v_msg_volume_attachment_identifier(#{} = M, Path, TrUserData) -> - case M of - #{domain_id := F1} -> v_type_string(F1, [domain_id | Path], TrUserData); - _ -> ok - end, - case M of - #{volume_id := F2} -> v_type_string(F2, [volume_id | Path], TrUserData); - _ -> ok - end, - case M of - #{host := F3} -> v_type_string(F3, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (domain_id) -> ok; - (volume_id) -> ok; - (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_volume_attachment_identifier(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), volume_attachment_identifier}, M, Path); -v_msg_volume_attachment_identifier(X, Path, _TrUserData) -> mk_type_error({expected_msg, volume_attachment_identifier}, X, Path). - --compile({nowarn_unused_function,v_msg_volume_attachment/3}). --dialyzer({nowarn_function,v_msg_volume_attachment/3}). -v_msg_volume_attachment(#{} = M, Path, TrUserData) -> - case M of - #{domain_id := F1} -> v_type_string(F1, [domain_id | Path], TrUserData); - _ -> ok - end, - case M of - #{volume_id := F2} -> v_type_string(F2, [volume_id | Path], TrUserData); - _ -> ok - end, - case M of - #{disk_address := F3} -> v_type_string(F3, [disk_address | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (domain_id) -> ok; - (volume_id) -> ok; - (disk_address) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_volume_attachment(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), volume_attachment}, M, Path); -v_msg_volume_attachment(X, Path, _TrUserData) -> mk_type_error({expected_msg, volume_attachment}, X, Path). - --compile({nowarn_unused_function,v_msg_list_volume_attachments_request/3}). --dialyzer({nowarn_function,v_msg_list_volume_attachments_request/3}). -v_msg_list_volume_attachments_request(#{} = M, Path, TrUserData) -> - case M of - #{domain_id := F1} -> v_type_string(F1, [domain_id | Path], TrUserData); - _ -> ok - end, - case M of - #{host := F2} -> v_type_string(F2, [host | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (domain_id) -> ok; - (host) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_volume_attachments_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_volume_attachments_request}, M, Path); -v_msg_list_volume_attachments_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_volume_attachments_request}, X, Path). - --compile({nowarn_unused_function,v_msg_list_volume_attachments_response/3}). --dialyzer({nowarn_function,v_msg_list_volume_attachments_response/3}). -v_msg_list_volume_attachments_response(#{} = M, Path, TrUserData) -> - case M of - #{attachments := F1} -> - if is_list(F1) -> - _ = [v_msg_volume_attachment(Elem, [attachments | Path], TrUserData) || Elem <- F1], - ok; - true -> mk_type_error({invalid_list_of, {msg, volume_attachment}}, F1, [attachments | Path]) - end; - _ -> ok - end, - lists:foreach(fun (attachments) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_volume_attachments_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_volume_attachments_response}, M, Path); -v_msg_list_volume_attachments_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_volume_attachments_response}, X, Path). - --compile({nowarn_unused_function,v_msg_empty/3}). --dialyzer({nowarn_function,v_msg_empty/3}). -v_msg_empty(#{} = M, Path, _) -> - lists:foreach(fun (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) end, maps:keys(M)), - ok; -v_msg_empty(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), empty}, M, Path); -v_msg_empty(X, Path, _TrUserData) -> mk_type_error({expected_msg, empty}, X, Path). - --compile({nowarn_unused_function,v_type_uint64/3}). --dialyzer({nowarn_function,v_type_uint64/3}). -v_type_uint64(N, _Path, _TrUserData) when 0 =< N, N =< 18446744073709551615 -> ok; -v_type_uint64(N, Path, _TrUserData) when is_integer(N) -> mk_type_error({value_out_of_range, uint64, unsigned, 64}, N, Path); -v_type_uint64(X, Path, _TrUserData) -> mk_type_error({bad_integer, uint64, unsigned, 64}, X, Path). - --compile({nowarn_unused_function,v_type_string/3}). --dialyzer({nowarn_function,v_type_string/3}). -v_type_string(S, Path, _TrUserData) when is_list(S); is_binary(S) -> - try unicode:characters_to_binary(S) of - B when is_binary(B) -> ok; - {error, _, _} -> mk_type_error(bad_unicode_string, S, Path) - catch - error:badarg -> mk_type_error(bad_unicode_string, S, Path) - end; -v_type_string(X, Path, _TrUserData) -> mk_type_error(bad_unicode_string, X, Path). - --compile({nowarn_unused_function,mk_type_error/3}). --spec mk_type_error(_, _, list()) -> no_return(). -mk_type_error(Error, ValueSeen, Path) -> - Path2 = prettify_path(Path), - erlang:error({gpb_type_error, {Error, [{value, ValueSeen}, {path, Path2}]}}). - - --compile({nowarn_unused_function,prettify_path/1}). --dialyzer({nowarn_function,prettify_path/1}). -prettify_path([]) -> top_level; -prettify_path(PathR) -> lists:append(lists:join(".", lists:map(fun atom_to_list/1, lists:reverse(PathR)))). - - --compile({nowarn_unused_function,id/2}). --compile({inline,id/2}). -id(X, _TrUserData) -> X. - --compile({nowarn_unused_function,v_ok/3}). --compile({inline,v_ok/3}). -v_ok(_Value, _Path, _TrUserData) -> ok. - --compile({nowarn_unused_function,m_overwrite/3}). --compile({inline,m_overwrite/3}). -m_overwrite(_Prev, New, _TrUserData) -> New. - --compile({nowarn_unused_function,cons/3}). --compile({inline,cons/3}). -cons(Elem, Acc, _TrUserData) -> [Elem | Acc]. - --compile({nowarn_unused_function,lists_reverse/2}). --compile({inline,lists_reverse/2}). -'lists_reverse'(L, _TrUserData) -> lists:reverse(L). --compile({nowarn_unused_function,'erlang_++'/3}). --compile({inline,'erlang_++'/3}). -'erlang_++'(A, B, _TrUserData) -> A ++ B. - - -get_msg_defs() -> - [{{msg, get_volume_request}, [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, volume}, - [#{name => id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => name, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => size, fnum => 3, rnum => 4, type => uint64, occurrence => optional, opts => []}]}, - {{msg, list_volumes_request}, [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]}, - {{msg, list_volumes_response}, [#{name => volumes, fnum => 1, rnum => 2, type => {msg, volume}, occurrence => repeated, opts => []}]}, - {{msg, create_volume_request}, [#{name => volume, fnum => 1, rnum => 2, type => {msg, volume}, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, update_volume_request}, [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => volume, fnum => 2, rnum => 3, type => {msg, volume}, occurrence => optional, opts => []}]}, - {{msg, delete_volume_request}, [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, volume_attachment_identifier}, - [#{name => domain_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => volume_id, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => host, fnum => 3, rnum => 4, type => string, occurrence => optional, opts => []}]}, - {{msg, volume_attachment}, - [#{name => domain_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => volume_id, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => disk_address, fnum => 3, rnum => 4, type => string, occurrence => optional, opts => []}]}, - {{msg, list_volume_attachments_request}, [#{name => domain_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, - {{msg, list_volume_attachments_response}, [#{name => attachments, fnum => 1, rnum => 2, type => {msg, volume_attachment}, occurrence => repeated, opts => []}]}, - {{msg, empty}, []}]. - - -get_msg_names() -> - [get_volume_request, - volume, - list_volumes_request, - list_volumes_response, - create_volume_request, - update_volume_request, - delete_volume_request, - volume_attachment_identifier, - volume_attachment, - list_volume_attachments_request, - list_volume_attachments_response, - empty]. - - -get_group_names() -> []. - - -get_msg_or_group_names() -> - [get_volume_request, - volume, - list_volumes_request, - list_volumes_response, - create_volume_request, - update_volume_request, - delete_volume_request, - volume_attachment_identifier, - volume_attachment, - list_volume_attachments_request, - list_volume_attachments_response, - empty]. - - -get_enum_names() -> []. - - -fetch_msg_def(MsgName) -> - case find_msg_def(MsgName) of - Fs when is_list(Fs) -> Fs; - error -> erlang:error({no_such_msg, MsgName}) - end. - - --spec fetch_enum_def(_) -> no_return(). -fetch_enum_def(EnumName) -> erlang:error({no_such_enum, EnumName}). - - -find_msg_def(get_volume_request) -> [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(volume) -> - [#{name => id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => name, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => size, fnum => 3, rnum => 4, type => uint64, occurrence => optional, opts => []}]; -find_msg_def(list_volumes_request) -> [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]; -find_msg_def(list_volumes_response) -> [#{name => volumes, fnum => 1, rnum => 2, type => {msg, volume}, occurrence => repeated, opts => []}]; -find_msg_def(create_volume_request) -> [#{name => volume, fnum => 1, rnum => 2, type => {msg, volume}, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(update_volume_request) -> [#{name => host, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => volume, fnum => 2, rnum => 3, type => {msg, volume}, occurrence => optional, opts => []}]; -find_msg_def(delete_volume_request) -> [#{name => uuid, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(volume_attachment_identifier) -> - [#{name => domain_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => volume_id, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => host, fnum => 3, rnum => 4, type => string, occurrence => optional, opts => []}]; -find_msg_def(volume_attachment) -> - [#{name => domain_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => volume_id, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => disk_address, fnum => 3, rnum => 4, type => string, occurrence => optional, opts => []}]; -find_msg_def(list_volume_attachments_request) -> [#{name => domain_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => host, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; -find_msg_def(list_volume_attachments_response) -> [#{name => attachments, fnum => 1, rnum => 2, type => {msg, volume_attachment}, occurrence => repeated, opts => []}]; -find_msg_def(empty) -> []; -find_msg_def(_) -> error. - - -find_enum_def(_) -> error. - - --spec enum_symbol_by_value(_, _) -> no_return(). -enum_symbol_by_value(E, V) -> erlang:error({no_enum_defs, E, V}). - - --spec enum_value_by_symbol(_, _) -> no_return(). -enum_value_by_symbol(E, V) -> erlang:error({no_enum_defs, E, V}). - - - -get_service_names() -> ['VolumeService']. - - -get_service_def('VolumeService') -> - {{service, 'VolumeService'}, - [#{name => 'GetVolume', input => get_volume_request, output => volume, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListVolumes', input => list_volumes_request, output => list_volumes_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'CreateVolume', input => create_volume_request, output => volume, input_stream => false, output_stream => false, opts => []}, - #{name => 'UpdateVolume', input => update_volume_request, output => volume, input_stream => false, output_stream => false, opts => []}, - #{name => 'DeleteVolume', input => delete_volume_request, output => empty, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListVolumeAttachments', input => list_volume_attachments_request, output => list_volume_attachments_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'GetVolumeAttachment', input => volume_attachment_identifier, output => volume_attachment, input_stream => false, output_stream => false, opts => []}, - #{name => 'AttachVolume', input => volume_attachment_identifier, output => volume_attachment, input_stream => false, output_stream => false, opts => []}, - #{name => 'DetachVolume', input => volume_attachment_identifier, output => empty, input_stream => false, output_stream => false, opts => []}]}; -get_service_def(_) -> error. - - -get_rpc_names('VolumeService') -> ['GetVolume', 'ListVolumes', 'CreateVolume', 'UpdateVolume', 'DeleteVolume', 'ListVolumeAttachments', 'GetVolumeAttachment', 'AttachVolume', 'DetachVolume']; -get_rpc_names(_) -> error. - - -find_rpc_def('VolumeService', RpcName) -> find_rpc_def_VolumeService(RpcName); -find_rpc_def(_, _) -> error. - - -find_rpc_def_VolumeService('GetVolume') -> #{name => 'GetVolume', input => get_volume_request, output => volume, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_VolumeService('ListVolumes') -> #{name => 'ListVolumes', input => list_volumes_request, output => list_volumes_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_VolumeService('CreateVolume') -> #{name => 'CreateVolume', input => create_volume_request, output => volume, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_VolumeService('UpdateVolume') -> #{name => 'UpdateVolume', input => update_volume_request, output => volume, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_VolumeService('DeleteVolume') -> #{name => 'DeleteVolume', input => delete_volume_request, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_VolumeService('ListVolumeAttachments') -> #{name => 'ListVolumeAttachments', input => list_volume_attachments_request, output => list_volume_attachments_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_VolumeService('GetVolumeAttachment') -> #{name => 'GetVolumeAttachment', input => volume_attachment_identifier, output => volume_attachment, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_VolumeService('AttachVolume') -> #{name => 'AttachVolume', input => volume_attachment_identifier, output => volume_attachment, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_VolumeService('DetachVolume') -> #{name => 'DetachVolume', input => volume_attachment_identifier, output => empty, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_VolumeService(_) -> error. - - -fetch_rpc_def(ServiceName, RpcName) -> - case find_rpc_def(ServiceName, RpcName) of - Def when is_map(Def) -> Def; - error -> erlang:error({no_such_rpc, ServiceName, RpcName}) - end. - - -%% Convert a a fully qualified (ie with package name) service name -%% as a binary to a service name as an atom. -fqbin_to_service_name(<<"VolumeService">>) -> 'VolumeService'; -fqbin_to_service_name(X) -> error({gpb_error, {badservice, X}}). - - -%% Convert a service name as an atom to a fully qualified -%% (ie with package name) name as a binary. -service_name_to_fqbin('VolumeService') -> <<"VolumeService">>; -service_name_to_fqbin(X) -> error({gpb_error, {badservice, X}}). - - -%% Convert a a fully qualified (ie with package name) service name -%% and an rpc name, both as binaries to a service name and an rpc -%% name, as atoms. -fqbins_to_service_and_rpc_name(<<"VolumeService">>, <<"GetVolume">>) -> {'VolumeService', 'GetVolume'}; -fqbins_to_service_and_rpc_name(<<"VolumeService">>, <<"ListVolumes">>) -> {'VolumeService', 'ListVolumes'}; -fqbins_to_service_and_rpc_name(<<"VolumeService">>, <<"CreateVolume">>) -> {'VolumeService', 'CreateVolume'}; -fqbins_to_service_and_rpc_name(<<"VolumeService">>, <<"UpdateVolume">>) -> {'VolumeService', 'UpdateVolume'}; -fqbins_to_service_and_rpc_name(<<"VolumeService">>, <<"DeleteVolume">>) -> {'VolumeService', 'DeleteVolume'}; -fqbins_to_service_and_rpc_name(<<"VolumeService">>, <<"ListVolumeAttachments">>) -> {'VolumeService', 'ListVolumeAttachments'}; -fqbins_to_service_and_rpc_name(<<"VolumeService">>, <<"GetVolumeAttachment">>) -> {'VolumeService', 'GetVolumeAttachment'}; -fqbins_to_service_and_rpc_name(<<"VolumeService">>, <<"AttachVolume">>) -> {'VolumeService', 'AttachVolume'}; -fqbins_to_service_and_rpc_name(<<"VolumeService">>, <<"DetachVolume">>) -> {'VolumeService', 'DetachVolume'}; -fqbins_to_service_and_rpc_name(S, R) -> error({gpb_error, {badservice_or_rpc, {S, R}}}). - - -%% Convert a service name and an rpc name, both as atoms, -%% to a fully qualified (ie with package name) service name and -%% an rpc name as binaries. -service_and_rpc_name_to_fqbins('VolumeService', 'GetVolume') -> {<<"VolumeService">>, <<"GetVolume">>}; -service_and_rpc_name_to_fqbins('VolumeService', 'ListVolumes') -> {<<"VolumeService">>, <<"ListVolumes">>}; -service_and_rpc_name_to_fqbins('VolumeService', 'CreateVolume') -> {<<"VolumeService">>, <<"CreateVolume">>}; -service_and_rpc_name_to_fqbins('VolumeService', 'UpdateVolume') -> {<<"VolumeService">>, <<"UpdateVolume">>}; -service_and_rpc_name_to_fqbins('VolumeService', 'DeleteVolume') -> {<<"VolumeService">>, <<"DeleteVolume">>}; -service_and_rpc_name_to_fqbins('VolumeService', 'ListVolumeAttachments') -> {<<"VolumeService">>, <<"ListVolumeAttachments">>}; -service_and_rpc_name_to_fqbins('VolumeService', 'GetVolumeAttachment') -> {<<"VolumeService">>, <<"GetVolumeAttachment">>}; -service_and_rpc_name_to_fqbins('VolumeService', 'AttachVolume') -> {<<"VolumeService">>, <<"AttachVolume">>}; -service_and_rpc_name_to_fqbins('VolumeService', 'DetachVolume') -> {<<"VolumeService">>, <<"DetachVolume">>}; -service_and_rpc_name_to_fqbins(S, R) -> error({gpb_error, {badservice_or_rpc, {S, R}}}). - - -fqbin_to_msg_name(<<"GetVolumeRequest">>) -> get_volume_request; -fqbin_to_msg_name(<<"Volume">>) -> volume; -fqbin_to_msg_name(<<"ListVolumesRequest">>) -> list_volumes_request; -fqbin_to_msg_name(<<"ListVolumesResponse">>) -> list_volumes_response; -fqbin_to_msg_name(<<"CreateVolumeRequest">>) -> create_volume_request; -fqbin_to_msg_name(<<"UpdateVolumeRequest">>) -> update_volume_request; -fqbin_to_msg_name(<<"DeleteVolumeRequest">>) -> delete_volume_request; -fqbin_to_msg_name(<<"VolumeAttachmentIdentifier">>) -> volume_attachment_identifier; -fqbin_to_msg_name(<<"VolumeAttachment">>) -> volume_attachment; -fqbin_to_msg_name(<<"ListVolumeAttachmentsRequest">>) -> list_volume_attachments_request; -fqbin_to_msg_name(<<"ListVolumeAttachmentsResponse">>) -> list_volume_attachments_response; -fqbin_to_msg_name(<<"google.protobuf.Empty">>) -> empty; -fqbin_to_msg_name(E) -> error({gpb_error, {badmsg, E}}). - - -msg_name_to_fqbin(get_volume_request) -> <<"GetVolumeRequest">>; -msg_name_to_fqbin(volume) -> <<"Volume">>; -msg_name_to_fqbin(list_volumes_request) -> <<"ListVolumesRequest">>; -msg_name_to_fqbin(list_volumes_response) -> <<"ListVolumesResponse">>; -msg_name_to_fqbin(create_volume_request) -> <<"CreateVolumeRequest">>; -msg_name_to_fqbin(update_volume_request) -> <<"UpdateVolumeRequest">>; -msg_name_to_fqbin(delete_volume_request) -> <<"DeleteVolumeRequest">>; -msg_name_to_fqbin(volume_attachment_identifier) -> <<"VolumeAttachmentIdentifier">>; -msg_name_to_fqbin(volume_attachment) -> <<"VolumeAttachment">>; -msg_name_to_fqbin(list_volume_attachments_request) -> <<"ListVolumeAttachmentsRequest">>; -msg_name_to_fqbin(list_volume_attachments_response) -> <<"ListVolumeAttachmentsResponse">>; -msg_name_to_fqbin(empty) -> <<"google.protobuf.Empty">>; -msg_name_to_fqbin(E) -> error({gpb_error, {badmsg, E}}). - - --spec fqbin_to_enum_name(_) -> no_return(). -fqbin_to_enum_name(E) -> error({gpb_error, {badenum, E}}). - - --spec enum_name_to_fqbin(_) -> no_return(). -enum_name_to_fqbin(E) -> error({gpb_error, {badenum, E}}). - - -get_package_name() -> 'google.protobuf'. - - -%% Whether or not the message names -%% are prepended with package name or not. -uses_packages() -> true. - - -source_basename() -> "volume.proto". - - -%% Retrieve all proto file names, also imported ones. -%% The order is top-down. The first element is always the main -%% source file. The files are returned with extension, -%% see get_all_proto_names/0 for a version that returns -%% the basenames sans extension -get_all_source_basenames() -> ["volume.proto", "empty.proto"]. - - -%% Retrieve all proto file names, also imported ones. -%% The order is top-down. The first element is always the main -%% source file. The files are returned sans .proto extension, -%% to make it easier to use them with the various get_xyz_containment -%% functions. -get_all_proto_names() -> ["volume", "empty"]. - - -get_msg_containment("volume") -> - [create_volume_request, - delete_volume_request, - get_volume_request, - list_volume_attachments_request, - list_volume_attachments_response, - list_volumes_request, - list_volumes_response, - update_volume_request, - volume, - volume_attachment, - volume_attachment_identifier]; -get_msg_containment("empty") -> [empty]; -get_msg_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_pkg_containment("volume") -> undefined; -get_pkg_containment("empty") -> 'google.protobuf'; -get_pkg_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_service_containment("volume") -> ['VolumeService']; -get_service_containment("empty") -> []; -get_service_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_rpc_containment("volume") -> - [{'VolumeService', 'GetVolume'}, - {'VolumeService', 'ListVolumes'}, - {'VolumeService', 'CreateVolume'}, - {'VolumeService', 'UpdateVolume'}, - {'VolumeService', 'DeleteVolume'}, - {'VolumeService', 'ListVolumeAttachments'}, - {'VolumeService', 'GetVolumeAttachment'}, - {'VolumeService', 'AttachVolume'}, - {'VolumeService', 'DetachVolume'}]; -get_rpc_containment("empty") -> []; -get_rpc_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_enum_containment("volume") -> []; -get_enum_containment("empty") -> []; -get_enum_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_proto_by_msg_name_as_fqbin(<<"VolumeAttachmentIdentifier">>) -> "volume"; -get_proto_by_msg_name_as_fqbin(<<"VolumeAttachment">>) -> "volume"; -get_proto_by_msg_name_as_fqbin(<<"UpdateVolumeRequest">>) -> "volume"; -get_proto_by_msg_name_as_fqbin(<<"ListVolumesRequest">>) -> "volume"; -get_proto_by_msg_name_as_fqbin(<<"ListVolumeAttachmentsRequest">>) -> "volume"; -get_proto_by_msg_name_as_fqbin(<<"GetVolumeRequest">>) -> "volume"; -get_proto_by_msg_name_as_fqbin(<<"DeleteVolumeRequest">>) -> "volume"; -get_proto_by_msg_name_as_fqbin(<<"CreateVolumeRequest">>) -> "volume"; -get_proto_by_msg_name_as_fqbin(<<"Volume">>) -> "volume"; -get_proto_by_msg_name_as_fqbin(<<"ListVolumesResponse">>) -> "volume"; -get_proto_by_msg_name_as_fqbin(<<"ListVolumeAttachmentsResponse">>) -> "volume"; -get_proto_by_msg_name_as_fqbin(<<"google.protobuf.Empty">>) -> "empty"; -get_proto_by_msg_name_as_fqbin(E) -> error({gpb_error, {badmsg, E}}). - - -get_proto_by_service_name_as_fqbin(<<"VolumeService">>) -> "volume"; -get_proto_by_service_name_as_fqbin(E) -> error({gpb_error, {badservice, E}}). - - --spec get_proto_by_enum_name_as_fqbin(_) -> no_return(). -get_proto_by_enum_name_as_fqbin(E) -> error({gpb_error, {badenum, E}}). - - -get_protos_by_pkg_name_as_fqbin(<<"google.protobuf">>) -> ["empty"]; -get_protos_by_pkg_name_as_fqbin(E) -> error({gpb_error, {badpkg, E}}). - - - -gpb_version_as_string() -> - "4.19.8". - -gpb_version_as_list() -> - [4,19,8]. - -gpb_version_source() -> - "file". diff --git a/virtuerl/src/pb/volume_service_bhvr.erl b/virtuerl/src/pb/volume_service_bhvr.erl deleted file mode 100644 index 4fcf498..0000000 --- a/virtuerl/src/pb/volume_service_bhvr.erl +++ /dev/null @@ -1,45 +0,0 @@ -%%%------------------------------------------------------------------- -%% @doc Behaviour to implement for grpc service VolumeService. -%% @end -%%%------------------------------------------------------------------- - -%% this module was generated and should not be modified manually - --module(volume_service_bhvr). - -%% Unary RPC --callback get_volume(ctx:t(), controller_pb:get_volume_request()) -> - {ok, controller_pb:volume(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback list_volumes(ctx:t(), controller_pb:list_volumes_request()) -> - {ok, controller_pb:list_volumes_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback create_volume(ctx:t(), controller_pb:create_volume_request()) -> - {ok, controller_pb:volume(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback update_volume(ctx:t(), controller_pb:update_volume_request()) -> - {ok, controller_pb:volume(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback delete_volume(ctx:t(), controller_pb:delete_volume_request()) -> - {ok, controller_pb:empty(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback list_volume_attachments(ctx:t(), controller_pb:list_volume_attachments_request()) -> - {ok, controller_pb:list_volume_attachments_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback get_volume_attachment(ctx:t(), controller_pb:volume_attachment_identifier()) -> - {ok, controller_pb:volume_attachment(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback attach_volume(ctx:t(), controller_pb:volume_attachment_identifier()) -> - {ok, controller_pb:volume_attachment(), ctx:t()} | grpcbox_stream:grpc_error_response(). - -%% Unary RPC --callback detach_volume(ctx:t(), controller_pb:volume_attachment_identifier()) -> - {ok, controller_pb:empty(), ctx:t()} | grpcbox_stream:grpc_error_response(). - diff --git a/virtuerl/src/pb/volume_service_client.erl b/virtuerl/src/pb/volume_service_client.erl deleted file mode 100644 index ad18a94..0000000 --- a/virtuerl/src/pb/volume_service_client.erl +++ /dev/null @@ -1,187 +0,0 @@ -%%%------------------------------------------------------------------- -%% @doc Client module for grpc service VolumeService. -%% @end -%%%------------------------------------------------------------------- - -%% this module was generated and should not be modified manually - --module(volume_service_client). - --compile(export_all). --compile(nowarn_export_all). - --include_lib("grpcbox/include/grpcbox.hrl"). - --define(is_ctx(Ctx), is_tuple(Ctx) andalso element(1, Ctx) =:= ctx). - --define(SERVICE, 'VolumeService'). --define(PROTO_MODULE, 'controller_pb'). --define(MARSHAL_FUN(T), fun(I) -> ?PROTO_MODULE:encode_msg(I, T) end). --define(UNMARSHAL_FUN(T), fun(I) -> ?PROTO_MODULE:decode_msg(I, T) end). --define(DEF(Input, Output, MessageType), #grpcbox_def{service=?SERVICE, - message_type=MessageType, - marshal_fun=?MARSHAL_FUN(Input), - unmarshal_fun=?UNMARSHAL_FUN(Output)}). - -%% @doc Unary RPC --spec get_volume(controller_pb:get_volume_request()) -> - {ok, controller_pb:volume(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_volume(Input) -> - get_volume(ctx:new(), Input, #{}). - --spec get_volume(ctx:t() | controller_pb:get_volume_request(), controller_pb:get_volume_request() | grpcbox_client:options()) -> - {ok, controller_pb:volume(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_volume(Ctx, Input) when ?is_ctx(Ctx) -> - get_volume(Ctx, Input, #{}); -get_volume(Input, Options) -> - get_volume(ctx:new(), Input, Options). - --spec get_volume(ctx:t(), controller_pb:get_volume_request(), grpcbox_client:options()) -> - {ok, controller_pb:volume(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_volume(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/VolumeService/GetVolume">>, Input, ?DEF(get_volume_request, volume, <<"GetVolumeRequest">>), Options). - -%% @doc Unary RPC --spec list_volumes(controller_pb:list_volumes_request()) -> - {ok, controller_pb:list_volumes_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_volumes(Input) -> - list_volumes(ctx:new(), Input, #{}). - --spec list_volumes(ctx:t() | controller_pb:list_volumes_request(), controller_pb:list_volumes_request() | grpcbox_client:options()) -> - {ok, controller_pb:list_volumes_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_volumes(Ctx, Input) when ?is_ctx(Ctx) -> - list_volumes(Ctx, Input, #{}); -list_volumes(Input, Options) -> - list_volumes(ctx:new(), Input, Options). - --spec list_volumes(ctx:t(), controller_pb:list_volumes_request(), grpcbox_client:options()) -> - {ok, controller_pb:list_volumes_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_volumes(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/VolumeService/ListVolumes">>, Input, ?DEF(list_volumes_request, list_volumes_response, <<"ListVolumesRequest">>), Options). - -%% @doc Unary RPC --spec create_volume(controller_pb:create_volume_request()) -> - {ok, controller_pb:volume(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -create_volume(Input) -> - create_volume(ctx:new(), Input, #{}). - --spec create_volume(ctx:t() | controller_pb:create_volume_request(), controller_pb:create_volume_request() | grpcbox_client:options()) -> - {ok, controller_pb:volume(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -create_volume(Ctx, Input) when ?is_ctx(Ctx) -> - create_volume(Ctx, Input, #{}); -create_volume(Input, Options) -> - create_volume(ctx:new(), Input, Options). - --spec create_volume(ctx:t(), controller_pb:create_volume_request(), grpcbox_client:options()) -> - {ok, controller_pb:volume(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -create_volume(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/VolumeService/CreateVolume">>, Input, ?DEF(create_volume_request, volume, <<"CreateVolumeRequest">>), Options). - -%% @doc Unary RPC --spec update_volume(controller_pb:update_volume_request()) -> - {ok, controller_pb:volume(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -update_volume(Input) -> - update_volume(ctx:new(), Input, #{}). - --spec update_volume(ctx:t() | controller_pb:update_volume_request(), controller_pb:update_volume_request() | grpcbox_client:options()) -> - {ok, controller_pb:volume(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -update_volume(Ctx, Input) when ?is_ctx(Ctx) -> - update_volume(Ctx, Input, #{}); -update_volume(Input, Options) -> - update_volume(ctx:new(), Input, Options). - --spec update_volume(ctx:t(), controller_pb:update_volume_request(), grpcbox_client:options()) -> - {ok, controller_pb:volume(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -update_volume(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/VolumeService/UpdateVolume">>, Input, ?DEF(update_volume_request, volume, <<"UpdateVolumeRequest">>), Options). - -%% @doc Unary RPC --spec delete_volume(controller_pb:delete_volume_request()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_volume(Input) -> - delete_volume(ctx:new(), Input, #{}). - --spec delete_volume(ctx:t() | controller_pb:delete_volume_request(), controller_pb:delete_volume_request() | grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_volume(Ctx, Input) when ?is_ctx(Ctx) -> - delete_volume(Ctx, Input, #{}); -delete_volume(Input, Options) -> - delete_volume(ctx:new(), Input, Options). - --spec delete_volume(ctx:t(), controller_pb:delete_volume_request(), grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -delete_volume(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/VolumeService/DeleteVolume">>, Input, ?DEF(delete_volume_request, empty, <<"DeleteVolumeRequest">>), Options). - -%% @doc Unary RPC --spec list_volume_attachments(controller_pb:list_volume_attachments_request()) -> - {ok, controller_pb:list_volume_attachments_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_volume_attachments(Input) -> - list_volume_attachments(ctx:new(), Input, #{}). - --spec list_volume_attachments(ctx:t() | controller_pb:list_volume_attachments_request(), controller_pb:list_volume_attachments_request() | grpcbox_client:options()) -> - {ok, controller_pb:list_volume_attachments_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_volume_attachments(Ctx, Input) when ?is_ctx(Ctx) -> - list_volume_attachments(Ctx, Input, #{}); -list_volume_attachments(Input, Options) -> - list_volume_attachments(ctx:new(), Input, Options). - --spec list_volume_attachments(ctx:t(), controller_pb:list_volume_attachments_request(), grpcbox_client:options()) -> - {ok, controller_pb:list_volume_attachments_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -list_volume_attachments(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/VolumeService/ListVolumeAttachments">>, Input, ?DEF(list_volume_attachments_request, list_volume_attachments_response, <<"ListVolumeAttachmentsRequest">>), Options). - -%% @doc Unary RPC --spec get_volume_attachment(controller_pb:volume_attachment_identifier()) -> - {ok, controller_pb:volume_attachment(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_volume_attachment(Input) -> - get_volume_attachment(ctx:new(), Input, #{}). - --spec get_volume_attachment(ctx:t() | controller_pb:volume_attachment_identifier(), controller_pb:volume_attachment_identifier() | grpcbox_client:options()) -> - {ok, controller_pb:volume_attachment(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_volume_attachment(Ctx, Input) when ?is_ctx(Ctx) -> - get_volume_attachment(Ctx, Input, #{}); -get_volume_attachment(Input, Options) -> - get_volume_attachment(ctx:new(), Input, Options). - --spec get_volume_attachment(ctx:t(), controller_pb:volume_attachment_identifier(), grpcbox_client:options()) -> - {ok, controller_pb:volume_attachment(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -get_volume_attachment(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/VolumeService/GetVolumeAttachment">>, Input, ?DEF(volume_attachment_identifier, volume_attachment, <<"VolumeAttachmentIdentifier">>), Options). - -%% @doc Unary RPC --spec attach_volume(controller_pb:volume_attachment_identifier()) -> - {ok, controller_pb:volume_attachment(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -attach_volume(Input) -> - attach_volume(ctx:new(), Input, #{}). - --spec attach_volume(ctx:t() | controller_pb:volume_attachment_identifier(), controller_pb:volume_attachment_identifier() | grpcbox_client:options()) -> - {ok, controller_pb:volume_attachment(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -attach_volume(Ctx, Input) when ?is_ctx(Ctx) -> - attach_volume(Ctx, Input, #{}); -attach_volume(Input, Options) -> - attach_volume(ctx:new(), Input, Options). - --spec attach_volume(ctx:t(), controller_pb:volume_attachment_identifier(), grpcbox_client:options()) -> - {ok, controller_pb:volume_attachment(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -attach_volume(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/VolumeService/AttachVolume">>, Input, ?DEF(volume_attachment_identifier, volume_attachment, <<"VolumeAttachmentIdentifier">>), Options). - -%% @doc Unary RPC --spec detach_volume(controller_pb:volume_attachment_identifier()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -detach_volume(Input) -> - detach_volume(ctx:new(), Input, #{}). - --spec detach_volume(ctx:t() | controller_pb:volume_attachment_identifier(), controller_pb:volume_attachment_identifier() | grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -detach_volume(Ctx, Input) when ?is_ctx(Ctx) -> - detach_volume(Ctx, Input, #{}); -detach_volume(Input, Options) -> - detach_volume(ctx:new(), Input, Options). - --spec detach_volume(ctx:t(), controller_pb:volume_attachment_identifier(), grpcbox_client:options()) -> - {ok, controller_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. -detach_volume(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/VolumeService/DetachVolume">>, Input, ?DEF(volume_attachment_identifier, empty, <<"VolumeAttachmentIdentifier">>), Options). - diff --git a/virtuerl/src/virtuerl.app.src b/virtuerl/src/virtuerl.app.src index 8d29911..ab60c7c 100644 --- a/virtuerl/src/virtuerl.app.src +++ b/virtuerl/src/virtuerl.app.src @@ -1,6 +1,6 @@ {application, virtuerl, [{description, "An OTP application"}, - {vsn, "0.1.0"}, + {vsn, git}, {registered, []}, {mod, {virtuerl_app, []}}, {applications, @@ -8,7 +8,6 @@ stdlib, inets, mochiweb, - cowboy, thoas, erlexec ]}, diff --git a/virtuerl/src/virtuerl_api_domain_col.erl b/virtuerl/src/virtuerl_api_domain_col.erl deleted file mode 100644 index 242a910..0000000 --- a/virtuerl/src/virtuerl_api_domain_col.erl +++ /dev/null @@ -1,58 +0,0 @@ -%%%------------------------------------------------------------------- -%%% @author ilya -%%% @copyright (C) 2023, -%%% @doc -%%% @end -%%%------------------------------------------------------------------- --module(virtuerl_api_domain_col). - --behaviour(cowboy_rest). - -%%-export([start_link/0]). --export([init/2, content_types_provided/2, to_text/2, allowed_methods/2, content_types_accepted/2, from_json/2]). - --define(SERVER, ?MODULE). - -%%%=================================================================== -%%% Spawning and gen_server implementation -%%%=================================================================== - -%%start_link() -> -%% Dispatch = cowboy_router:compile([ -%% {'_', [{"/", virtuerl_api, []}]} -%% ]), -%% Res = cowboy:start_clear(my_listener, [{port, 8080}], #{env => #{dispatch => Dispatch}}), -%% io:format("RESULT: ~p~n", [Res]), -%% Res. - -%% handler -%%init(Req0, State) -> -%% Req = cowboy_req:reply(200, #{<<"content-type">> => <<"text/plain">>}, <<"Hello elloh">>, Req0), -%% {ok, Req, State}. - -init(Req, State) -> - {cowboy_rest, Req, State}. - -allowed_methods(Req, State) -> - {[<<"GET">>, <<"HEAD">>, <<"OPTIONS">>, <<"POST">>], Req, State}. - -content_types_accepted(Req, State) -> - {[{{<<"application">>, <<"json">>, '*'}, from_json}], - Req, State - }. - -from_json(Req, State) -> - {ok, RawJSON, Req1} = cowboy_req:read_body(Req), - {ok, JSON} = thoas:decode(RawJSON), - #{<<"networkID">> := NetworkID} = JSON, - Conf = #{network_id => NetworkID}, -%% virtuerl_mgt:create_vm(Conf), - {true, Req1, State}. - -content_types_provided(Req, State) -> - {[{{<<"text">>, <<"plain">>, '*'}, to_text}], - Req, State - }. - -to_text(Req, State) -> - {<<"OK">>, Req, State}. diff --git a/virtuerl/src/virtuerl_api_domain_res.erl b/virtuerl/src/virtuerl_api_domain_res.erl deleted file mode 100644 index a405e1f..0000000 --- a/virtuerl/src/virtuerl_api_domain_res.erl +++ /dev/null @@ -1,58 +0,0 @@ -%%%------------------------------------------------------------------- -%%% @author ilya -%%% @copyright (C) 2023, -%%% @doc -%%% @end -%%%------------------------------------------------------------------- --module(virtuerl_api_domain_res). - --behaviour(cowboy_handler). - -%%-export([start_link/0]). --export([init/2, content_types_provided/2, to_text/2, allowed_methods/2, content_types_accepted/2, from_json/2]). - --define(SERVER, ?MODULE). - -%%%=================================================================== -%%% Spawning and gen_server implementation -%%%=================================================================== - -%%start_link() -> -%% Dispatch = cowboy_router:compile([ -%% {'_', [{"/", virtuerl_api, []}]} -%% ]), -%% Res = cowboy:start_clear(my_listener, [{port, 8080}], #{env => #{dispatch => Dispatch}}), -%% io:format("RESULT: ~p~n", [Res]), -%% Res. - -%% handler -%%init(Req0, State) -> -%% Req = cowboy_req:reply(200, #{<<"content-type">> => <<"text/plain">>}, <<"Hello elloh">>, Req0), -%% {ok, Req, State}. - -init(Req, State) -> - {cowboy_rest, Req, State}. - -allowed_methods(Req, State) -> - {[<<"GET">>, <<"HEAD">>, <<"OPTIONS">>, <<"POST">>], Req, State}. - -content_types_accepted(Req, State) -> - {[{{<<"application">>, <<"json">>, '*'}, from_json}], - Req, State - }. - -from_json(Req, State) -> - {ok, RawJSON, Req1} = cowboy_req:read_body(Req), - {ok, JSON} = thoas:decode(RawJSON), - #{<<"networkID">> := NetworkID} = JSON, - Conf = #{network_id => NetworkID}, -%% virtuerl_mgt:create_vm(Conf), - {true, Req1, State}. - -content_types_provided(Req, State) -> - {[{{<<"text">>, <<"plain">>, '*'}, to_text}], - Req, State - }. - -to_text(Req, State) -> - {<<"OK">>, Req, State}.