From 08aaf01016240b5650270061206ff527af9b5c04 Mon Sep 17 00:00:00 2001 From: anlicheng <244108715@qq.com> Date: Wed, 17 Sep 2025 17:11:52 +0800 Subject: [PATCH] fix --- apps/efka/src/docker/docker_deployer.erl | 22 +- apps/efka/src/docker/docker_manager.erl | 4 +- apps/efka/src/efka_codec.erl | 24 +- apps/efka/src/efka_remote_agent.erl | 57 +- apps/efka/src/efka_transport.erl | 3 +- apps/efka/src/proto/message_pb.erl | 2591 ---------------------- 6 files changed, 52 insertions(+), 2649 deletions(-) delete mode 100644 apps/efka/src/proto/message_pb.erl diff --git a/apps/efka/src/docker/docker_deployer.erl b/apps/efka/src/docker/docker_deployer.erl index d42e3d8..efceb28 100644 --- a/apps/efka/src/docker/docker_deployer.erl +++ b/apps/efka/src/docker/docker_deployer.erl @@ -82,10 +82,10 @@ deploy(Pid) when is_pid(Pid) -> gen_server:cast(Pid, deploy). %% @doc Spawns the server and registers the local name (unique) --spec(start_link(TaskId :: integer(), RootDir :: string(), Config :: map()) -> +-spec(start_link(TaskId :: integer(), ContainerDir :: string(), Config :: map()) -> {ok, Pid :: pid()} | ignore | {error, Reason :: term()}). -start_link(TaskId, RootDir, Config) when is_integer(TaskId), is_list(RootDir), is_map(Config) -> - gen_server:start_link(?MODULE, [TaskId, RootDir, Config], []). +start_link(TaskId, ContainerDir, Config) when is_integer(TaskId), is_list(ContainerDir), is_map(Config) -> + gen_server:start_link(?MODULE, [TaskId, ContainerDir, Config], []). %%%=================================================================== %%% gen_server callbacks @@ -96,8 +96,8 @@ start_link(TaskId, RootDir, Config) when is_integer(TaskId), is_list(RootDir), i -spec(init(Args :: term()) -> {ok, State :: #state{}} | {ok, State :: #state{}, timeout() | hibernate} | {stop, Reason :: term()} | ignore). -init([TaskId, RootDir, Config]) -> - {ok, #state{task_id = TaskId, root_dir = RootDir, config = Config}}. +init([TaskId, ContainerDir, Config]) -> + {ok, #state{task_id = TaskId, root_dir = ContainerDir, config = Config}}. %% @private %% @doc Handling call messages @@ -165,14 +165,13 @@ code_change(_OldVsn, State = #state{}, _Extra) -> % "command": ["nginx", "-g", "daemon off;"], % "restart": "always" %} --spec do_deploy(TaskId :: integer(), RootDir :: string(), Config :: map()) -> ok | {error, Reason :: any()}. -do_deploy(TaskId, RootDir, Config) when is_integer(TaskId), is_list(RootDir), is_map(Config) -> +-spec do_deploy(TaskId :: integer(), ContainerDir :: string(), Config :: map()) -> ok | {error, Reason :: any()}. +do_deploy(TaskId, ContainerDir, Config) when is_integer(TaskId), is_list(ContainerDir), is_map(Config) -> %% 尝试拉取镜像 ContainerName = maps:get(<<"container_name">>, Config), Image0 = maps:get(<<"image">>, Config), Image = normalize_image(Image0), - {ok, ContainerDir} = ensure_dirs(RootDir, ContainerName), case try_pull_image(Image) of ok -> %% 创建container @@ -212,13 +211,6 @@ maybe_create_env_file(ContainerDir, Envs) when is_list(Envs)-> ok = file:close(IoDevice), {ok, TargetFile}. --spec ensure_dirs(RootDir :: string(), ContainerName :: binary()) -> {ok, ServerRootDir :: string()}. -ensure_dirs(RootDir, ContainerName) when is_list(RootDir), is_binary(ContainerName) -> - %% 根目录 - ServiceRootDir = RootDir ++ "/" ++ binary_to_list(ContainerName) ++ "/", - ok = filelib:ensure_dir(ServiceRootDir), - {ok, ServiceRootDir}. - -spec normalize_image(binary()) -> binary(). normalize_image(Image) when is_binary(Image) -> Parts = binary:split(Image, <<"/">>, [global]), diff --git a/apps/efka/src/docker/docker_manager.erl b/apps/efka/src/docker/docker_manager.erl index 8ed9432..ba25f2b 100644 --- a/apps/efka/src/docker/docker_manager.erl +++ b/apps/efka/src/docker/docker_manager.erl @@ -81,8 +81,8 @@ init([]) -> {stop, Reason :: term(), NewState :: #state{}}). handle_call({deploy, TaskId, Config = #{<<"container_name">> := ContainerName}}, _From, State = #state{root_dir = RootDir, task_map = TaskMap}) -> %% 创建目录 - {ok, ContainerDir} = docker_container_helper:ensure_dir(ContainerDir, ContainerName), - {ok, TaskPid} = docker_deployer:start_link(TaskId, RootDir, Config), + {ok, ContainerDir} = docker_container_helper:ensure_dir(RootDir, ContainerName), + {ok, TaskPid} = docker_deployer:start_link(TaskId, ContainerDir, Config), docker_deployer:deploy(TaskPid), lager:debug("[efka_inetd] start deploy task_id: ~p, config: ~p", [TaskId, Config]), {reply, ok, State#state{task_map = maps:put(TaskPid, TaskId, TaskMap)}}; diff --git a/apps/efka/src/efka_codec.erl b/apps/efka/src/efka_codec.erl index b7f500f..63be82c 100644 --- a/apps/efka/src/efka_codec.erl +++ b/apps/efka/src/efka_codec.erl @@ -14,10 +14,14 @@ -define(Bytes, 2). %% API --export([encode/1, decode/1]). +-export([encode/2, decode/1]). --spec encode(Message :: any()) -> binary(). -encode(#auth_request{uuid = UUID, username = Username, salt = Salt, token = Token, timestamp = Timestamp}) -> +-spec encode0(Message :: any()) -> binary(). +encode(PacketType, Packet) when is_integer(PacketType) -> + Bin = encode0(Packet), + <>. + +encode0(#auth_request{uuid = UUID, username = Username, salt = Salt, token = Token, timestamp = Timestamp}) -> iolist_to_binary([ marshal(?Bytes, UUID), marshal(?Bytes, Username), @@ -25,40 +29,40 @@ encode(#auth_request{uuid = UUID, username = Username, salt = Salt, token = Toke marshal(?Bytes, Token), marshal(?I32, Timestamp) ]); -encode(#auth_reply{code = Code, message = Message}) -> +encode0(#auth_reply{code = Code, message = Message}) -> iolist_to_binary([ marshal(?I32, Code), marshal(?Bytes, Message) ]); -encode(#pub{topic = Topic, content = Content}) -> +encode0(#pub{topic = Topic, content = Content}) -> iolist_to_binary([ marshal(?Bytes, Topic), marshal(?Bytes, Content) ]); -encode(#command{command_type = CommandType, command = Command}) -> +encode0(#command{command_type = CommandType, command = Command}) -> iolist_to_binary([ marshal(?I32, CommandType), marshal(?Bytes, Command) ]); -encode(#rpc_deploy{task_id = TaskId, config = Config}) -> +encode0(#rpc_deploy{task_id = TaskId, config = Config}) -> iolist_to_binary([ marshal(?I32, TaskId), marshal(?Bytes, Config) ]); -encode(#rpc_container{method = Method, container_name = ContainerName, params = Params}) -> +encode0(#rpc_container{method = Method, container_name = ContainerName, params = Params}) -> iolist_to_binary([ marshal(?Bytes, Method), marshal(?Bytes, ContainerName), marshal(?Bytes, Params) ]); -encode(#data{service_id = ServiceId, device_uuid = DeviceUUID, route_key = RouteKey, metric = Metric}) -> +encode0(#data{service_id = ServiceId, device_uuid = DeviceUUID, route_key = RouteKey, metric = Metric}) -> iolist_to_binary([ marshal(?Bytes, ServiceId), marshal(?Bytes, DeviceUUID), marshal(?Bytes, RouteKey), marshal(?Bytes, Metric) ]); -encode(#event{service_id = ServiceId, event_type = EventType, params = Params}) -> +encode0(#event{service_id = ServiceId, event_type = EventType, params = Params}) -> iolist_to_binary([ marshal(?Bytes, ServiceId), marshal(?I32, EventType), diff --git a/apps/efka/src/efka_remote_agent.erl b/apps/efka/src/efka_remote_agent.erl index 98f1e2b..e9b51da 100644 --- a/apps/efka/src/efka_remote_agent.erl +++ b/apps/efka/src/efka_remote_agent.erl @@ -8,7 +8,6 @@ %%%------------------------------------------------------------------- -module(efka_remote_agent). -author("anlicheng"). --include("message_pb.hrl"). -include("efka.hrl"). -include("efka_tables.hrl"). @@ -84,35 +83,35 @@ callback_mode() -> %% 异步发送数据, 连接存在时候直接发送;否则缓存到mnesia handle_event(cast, {metric_data, ServiceId, DeviceUUID, RouteKey, Metric}, ?STATE_ACTIVATED, State = #state{transport_pid = TransportPid}) -> - Packet = message_pb:encode_msg(#data{ + Packet = efka_codec:encode(?METHOD_DATA, #data{ service_id = ServiceId, device_uuid = DeviceUUID, route_key = RouteKey, metric = Metric }), - efka_transport:send(TransportPid, ?METHOD_DATA, Packet), + efka_transport:send(TransportPid, Packet), {keep_state, State}; handle_event(cast, {metric_data, ServiceId, DeviceUUID, LineProtocolData}, _, State) -> - Packet = message_pb:encode_msg(#data{ + Packet = efka_codec:encode(?METHOD_DATA, #data{ service_id = ServiceId, device_uuid = DeviceUUID, metric = LineProtocolData }), - ok = cache_model:insert(?METHOD_DATA, Packet), + ok = cache_model:insert(Packet), {keep_state, State}; %% 异步发送事件 handle_event(cast, {event, ServiceId, EventType, Params}, ?STATE_ACTIVATED, State = #state{transport_pid = TransportPid}) -> - EventPacket = message_pb:encode_msg(#event{ + EventPacket = efka_codec:encode(?METHOD_EVENT, #event{ service_id = ServiceId, event_type = EventType, params = Params }), - efka_transport:send(TransportPid, ?METHOD_EVENT, EventPacket), + efka_transport:send(TransportPid, EventPacket), {keep_state, State}; handle_event(cast, {event, ServiceId, EventType, Params}, ?STATE_ACTIVATED, State) -> - EventPacket = message_pb:encode_msg(#event{ + EventPacket = efka_codec:encode(?METHOD_EVENT, #event{ service_id = ServiceId, event_type = EventType, params = Params @@ -120,26 +119,26 @@ handle_event(cast, {event, ServiceId, EventType, Params}, ?STATE_ACTIVATED, Stat ok = cache_model:insert(?METHOD_EVENT, EventPacket), {keep_state, State}; -handle_event(cast, {ping, AdCode, BootTime, Province, City, EfkaVersion, KernelArch, Ips, CpuCore, CpuLoad, CpuTemperature, Disk, Memory, Interfaces}, ?STATE_ACTIVATED, - State = #state{transport_pid = TransportPid}) -> - - Ping = message_pb:encode_msg(#ping{ - adcode = AdCode, - boot_time = BootTime, - province = Province, - city = City, - efka_version = EfkaVersion, - kernel_arch = KernelArch, - ips = Ips, - cpu_core = CpuCore, - cpu_load = CpuLoad, - cpu_temperature = CpuTemperature, - disk = Disk, - memory = Memory, - interfaces = Interfaces - }), - efka_transport:send(TransportPid, ?METHOD_PING, Ping), - {keep_state, State}; +%handle_event(cast, {ping, AdCode, BootTime, Province, City, EfkaVersion, KernelArch, Ips, CpuCore, CpuLoad, CpuTemperature, Disk, Memory, Interfaces}, ?STATE_ACTIVATED, +% State = #state{transport_pid = TransportPid}) -> +% +% Ping = message_pb:encode_msg(#ping{ +% adcode = AdCode, +% boot_time = BootTime, +% province = Province, +% city = City, +% efka_version = EfkaVersion, +% kernel_arch = KernelArch, +% ips = Ips, +% cpu_core = CpuCore, +% cpu_load = CpuLoad, +% cpu_temperature = CpuTemperature, +% disk = Disk, +% memory = Memory, +% interfaces = Interfaces +% }), +% efka_transport:send(TransportPid, ?METHOD_PING, Ping), +% {keep_state, State}; %% 异步建立到服务器的连接 handle_event(info, {timeout, _, create_transport}, ?STATE_DENIED, State) -> @@ -336,7 +335,7 @@ auth_request() -> Salt = proplists:get_value(salt, AuthInfo), Token = proplists:get_value(token, AuthInfo), - message_pb:encode_msg(#auth_request{ + efka_codec:encode(?METHOD_AUTH, #auth_request{ uuid = unicode:characters_to_binary(UUID), username = unicode:characters_to_binary(Username), salt = unicode:characters_to_binary(Salt), diff --git a/apps/efka/src/efka_transport.erl b/apps/efka/src/efka_transport.erl index 643a216..9397593 100644 --- a/apps/efka/src/efka_transport.erl +++ b/apps/efka/src/efka_transport.erl @@ -8,7 +8,6 @@ %%%------------------------------------------------------------------- -module(efka_transport). -author("anlicheng"). --include("message_pb.hrl"). -include("efka.hrl"). -behaviour(gen_server). @@ -115,7 +114,7 @@ handle_cast(connect, State = #state{host = Host, port = Port, parent_pid = Paren %% auth校验 handle_cast({auth_request, AuthRequestBin}, State = #state{parent_pid = ParentPid, socket = Socket}) -> PacketId = 1, - ok = ssl:send(Socket, <>), + ok = ssl:send(Socket, <>), %% 需要等待auth返回的结果 receive {ssl, Socket, <>} -> diff --git a/apps/efka/src/proto/message_pb.erl b/apps/efka/src/proto/message_pb.erl deleted file mode 100644 index 80c3673..0000000 --- a/apps/efka/src/proto/message_pb.erl +++ /dev/null @@ -1,2591 +0,0 @@ -%% -*- coding: utf-8 -*- -%% % this file is @generated -%% @private -%% Automatically generated, do not edit -%% Generated by gpb_compile version 4.21.1 -%% Version source: git --module(message_pb). - --export([encode_msg/1, encode_msg/2, encode_msg/3]). --export([decode_msg/2, decode_msg/3]). --export([merge_msgs/2, merge_msgs/3, merge_msgs/4]). --export([verify_msg/1, 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]). - --include("message_pb.hrl"). --include_lib("gpb/include/gpb.hrl"). - -%% enumerated types - --export_type([]). - -%% message types --type auth_request() :: #auth_request{}. - --type auth_reply() :: #auth_reply{}. - --type pub() :: #pub{}. - --type command() :: #command{}. - --type rpc_deploy() :: #rpc_deploy{}. - --type rpc_start_container() :: #rpc_start_container{}. - --type rpc_stop_container() :: #rpc_stop_container{}. - --type rpc_config_container() :: #rpc_config_container{}. - --type fetch_task_log() :: #fetch_task_log{}. - --type container_config() :: #container_config{}. - --type data() :: #data{}. - --type event() :: #event{}. - --type ping() :: #ping{}. - --export_type(['auth_request'/0, 'auth_reply'/0, 'pub'/0, 'command'/0, 'rpc_deploy'/0, 'rpc_start_container'/0, 'rpc_stop_container'/0, 'rpc_config_container'/0, 'fetch_task_log'/0, 'container_config'/0, 'data'/0, 'event'/0, 'ping'/0]). --type '$msg_name'() :: auth_request | auth_reply | pub | command | rpc_deploy | rpc_start_container | rpc_stop_container | rpc_config_container | fetch_task_log | container_config | data | event | ping. --type '$msg'() :: auth_request() | auth_reply() | pub() | command() | rpc_deploy() | rpc_start_container() | rpc_stop_container() | rpc_config_container() | fetch_task_log() | container_config() | data() | event() | ping(). --export_type(['$msg_name'/0, '$msg'/0]). - --if(?OTP_RELEASE >= 24). --dialyzer({no_underspecs, encode_msg/1}). --endif. --spec encode_msg('$msg'()) -> binary(). -encode_msg(Msg) when tuple_size(Msg) >= 1 -> encode_msg(Msg, element(1, Msg), []). - --if(?OTP_RELEASE >= 24). --dialyzer({no_underspecs, encode_msg/2}). --endif. --spec encode_msg('$msg'(), '$msg_name'() | list()) -> binary(). -encode_msg(Msg, MsgName) when is_atom(MsgName) -> encode_msg(Msg, MsgName, []); -encode_msg(Msg, Opts) when tuple_size(Msg) >= 1, is_list(Opts) -> encode_msg(Msg, element(1, Msg), Opts). - --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 - auth_request -> encode_msg_auth_request(id(Msg, TrUserData), TrUserData); - auth_reply -> encode_msg_auth_reply(id(Msg, TrUserData), TrUserData); - pub -> encode_msg_pub(id(Msg, TrUserData), TrUserData); - command -> encode_msg_command(id(Msg, TrUserData), TrUserData); - rpc_deploy -> encode_msg_rpc_deploy(id(Msg, TrUserData), TrUserData); - rpc_start_container -> encode_msg_rpc_start_container(id(Msg, TrUserData), TrUserData); - rpc_stop_container -> encode_msg_rpc_stop_container(id(Msg, TrUserData), TrUserData); - rpc_config_container -> encode_msg_rpc_config_container(id(Msg, TrUserData), TrUserData); - fetch_task_log -> encode_msg_fetch_task_log(id(Msg, TrUserData), TrUserData); - container_config -> encode_msg_container_config(id(Msg, TrUserData), TrUserData); - data -> encode_msg_data(id(Msg, TrUserData), TrUserData); - event -> encode_msg_event(id(Msg, TrUserData), TrUserData); - ping -> encode_msg_ping(id(Msg, TrUserData), TrUserData) - end. - - -encode_msg_auth_request(Msg, TrUserData) -> encode_msg_auth_request(Msg, <<>>, TrUserData). - - -encode_msg_auth_request(#auth_request{uuid = F1, username = F2, salt = F3, token = F4, timestamp = F5}, Bin, TrUserData) -> - B1 = if F1 == undefined -> Bin; - true -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end - end, - B2 = if F2 == undefined -> B1; - true -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end - end, - B3 = if F3 == undefined -> B2; - true -> - begin - TrF3 = id(F3, TrUserData), - case is_empty_string(TrF3) of - true -> B2; - false -> e_type_string(TrF3, <>, TrUserData) - end - end - end, - B4 = if F4 == undefined -> B3; - true -> - begin - TrF4 = id(F4, TrUserData), - case is_empty_string(TrF4) of - true -> B3; - false -> e_type_string(TrF4, <>, TrUserData) - end - end - end, - if F5 == undefined -> B4; - true -> - begin - TrF5 = id(F5, TrUserData), - if TrF5 =:= 0 -> B4; - true -> e_varint(TrF5, <>, TrUserData) - end - end - end. - -encode_msg_auth_reply(Msg, TrUserData) -> encode_msg_auth_reply(Msg, <<>>, TrUserData). - - -encode_msg_auth_reply(#auth_reply{code = F1, message = F2}, Bin, TrUserData) -> - B1 = if F1 == undefined -> Bin; - true -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= 0 -> Bin; - true -> e_varint(TrF1, <>, TrUserData) - end - end - end, - if F2 == undefined -> B1; - true -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end - end. - -encode_msg_pub(Msg, TrUserData) -> encode_msg_pub(Msg, <<>>, TrUserData). - - -encode_msg_pub(#pub{topic = F1, content = F2}, Bin, TrUserData) -> - B1 = if F1 == undefined -> Bin; - true -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end - end, - if F2 == undefined -> B1; - true -> - begin - TrF2 = id(F2, TrUserData), - case iolist_size(TrF2) of - 0 -> B1; - _ -> e_type_bytes(TrF2, <>, TrUserData) - end - end - end. - -encode_msg_command(Msg, TrUserData) -> encode_msg_command(Msg, <<>>, TrUserData). - - -encode_msg_command(#command{command_type = F1, command = F2}, Bin, TrUserData) -> - B1 = if F1 == undefined -> Bin; - true -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end - end, - if F2 == undefined -> B1; - true -> - begin - TrF2 = id(F2, TrUserData), - case iolist_size(TrF2) of - 0 -> B1; - _ -> e_type_bytes(TrF2, <>, TrUserData) - end - end - end. - -encode_msg_rpc_deploy(Msg, TrUserData) -> encode_msg_rpc_deploy(Msg, <<>>, TrUserData). - - -encode_msg_rpc_deploy(#rpc_deploy{packet_id = F1, task_id = F2, config = F3}, Bin, TrUserData) -> - B1 = if F1 == undefined -> Bin; - true -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= 0 -> Bin; - true -> e_varint(TrF1, <>, TrUserData) - end - end - end, - B2 = if F2 == undefined -> B1; - true -> - begin - TrF2 = id(F2, TrUserData), - if TrF2 =:= 0 -> B1; - true -> e_varint(TrF2, <>, TrUserData) - end - end - end, - if F3 == undefined -> B2; - true -> - begin - TrF3 = id(F3, TrUserData), - case is_empty_string(TrF3) of - true -> B2; - false -> e_type_string(TrF3, <>, TrUserData) - end - end - end. - -encode_msg_rpc_start_container(Msg, TrUserData) -> encode_msg_rpc_start_container(Msg, <<>>, TrUserData). - - -encode_msg_rpc_start_container(#rpc_start_container{packet_id = F1, container_name = F2}, Bin, TrUserData) -> - B1 = if F1 == undefined -> Bin; - true -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= 0 -> Bin; - true -> e_varint(TrF1, <>, TrUserData) - end - end - end, - if F2 == undefined -> B1; - true -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end - end. - -encode_msg_rpc_stop_container(Msg, TrUserData) -> encode_msg_rpc_stop_container(Msg, <<>>, TrUserData). - - -encode_msg_rpc_stop_container(#rpc_stop_container{packet_id = F1, container_name = F2}, Bin, TrUserData) -> - B1 = if F1 == undefined -> Bin; - true -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= 0 -> Bin; - true -> e_varint(TrF1, <>, TrUserData) - end - end - end, - if F2 == undefined -> B1; - true -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end - end. - -encode_msg_rpc_config_container(Msg, TrUserData) -> encode_msg_rpc_config_container(Msg, <<>>, TrUserData). - - -encode_msg_rpc_config_container(#rpc_config_container{packet_id = F1, container_name = F2, config = F3}, Bin, TrUserData) -> - B1 = if F1 == undefined -> Bin; - true -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= 0 -> Bin; - true -> e_varint(TrF1, <>, TrUserData) - end - end - end, - B2 = if F2 == undefined -> B1; - true -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end - end, - if F3 == undefined -> B2; - true -> - begin - TrF3 = id(F3, TrUserData), - case iolist_size(TrF3) of - 0 -> B2; - _ -> e_type_bytes(TrF3, <>, TrUserData) - end - end - end. - -encode_msg_fetch_task_log(Msg, TrUserData) -> encode_msg_fetch_task_log(Msg, <<>>, TrUserData). - - -encode_msg_fetch_task_log(#fetch_task_log{task_id = F1}, Bin, TrUserData) -> - if F1 == undefined -> Bin; - true -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= 0 -> Bin; - true -> e_varint(TrF1, <>, TrUserData) - end - end - end. - -encode_msg_container_config(Msg, TrUserData) -> encode_msg_container_config(Msg, <<>>, TrUserData). - - -encode_msg_container_config(#container_config{container_name = F1, config = F2}, Bin, TrUserData) -> - B1 = if F1 == undefined -> Bin; - true -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end - end, - if F2 == undefined -> B1; - true -> - begin - TrF2 = id(F2, TrUserData), - case iolist_size(TrF2) of - 0 -> B1; - _ -> e_type_bytes(TrF2, <>, TrUserData) - end - end - end. - -encode_msg_data(Msg, TrUserData) -> encode_msg_data(Msg, <<>>, TrUserData). - - -encode_msg_data(#data{service_id = F1, device_uuid = F2, route_key = F3, metric = F4}, Bin, TrUserData) -> - B1 = if F1 == undefined -> Bin; - true -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end - end, - B2 = if F2 == undefined -> B1; - true -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end - end, - B3 = if F3 == undefined -> B2; - true -> - begin - TrF3 = id(F3, TrUserData), - case is_empty_string(TrF3) of - true -> B2; - false -> e_type_string(TrF3, <>, TrUserData) - end - end - end, - if F4 == undefined -> B3; - true -> - begin - TrF4 = id(F4, TrUserData), - case iolist_size(TrF4) of - 0 -> B3; - _ -> e_type_bytes(TrF4, <>, TrUserData) - end - end - end. - -encode_msg_event(Msg, TrUserData) -> encode_msg_event(Msg, <<>>, TrUserData). - - -encode_msg_event(#event{service_id = F1, event_type = F2, params = F3}, Bin, TrUserData) -> - B1 = if F1 == undefined -> Bin; - true -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end - end, - B2 = if F2 == undefined -> B1; - true -> - begin - TrF2 = id(F2, TrUserData), - if TrF2 =:= 0 -> B1; - true -> e_varint(TrF2, <>, TrUserData) - end - end - end, - if F3 == undefined -> B2; - true -> - begin - TrF3 = id(F3, TrUserData), - case is_empty_string(TrF3) of - true -> B2; - false -> e_type_string(TrF3, <>, TrUserData) - end - end - end. - -encode_msg_ping(Msg, TrUserData) -> encode_msg_ping(Msg, <<>>, TrUserData). - - -encode_msg_ping(#ping{adcode = F1, boot_time = F2, province = F3, city = F4, efka_version = F5, kernel_arch = F6, ips = F7, cpu_core = F8, cpu_load = F9, cpu_temperature = F10, disk = F11, memory = F12, interfaces = F13}, Bin, TrUserData) -> - B1 = if F1 == undefined -> Bin; - true -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end - end, - B2 = if F2 == undefined -> B1; - true -> - begin - TrF2 = id(F2, TrUserData), - if TrF2 =:= 0 -> B1; - true -> e_varint(TrF2, <>, TrUserData) - end - end - end, - B3 = if F3 == undefined -> B2; - true -> - begin - TrF3 = id(F3, TrUserData), - case is_empty_string(TrF3) of - true -> B2; - false -> e_type_string(TrF3, <>, TrUserData) - end - end - end, - B4 = if F4 == undefined -> B3; - true -> - begin - TrF4 = id(F4, TrUserData), - case is_empty_string(TrF4) of - true -> B3; - false -> e_type_string(TrF4, <>, TrUserData) - end - end - end, - B5 = if F5 == undefined -> B4; - true -> - begin - TrF5 = id(F5, TrUserData), - case is_empty_string(TrF5) of - true -> B4; - false -> e_type_string(TrF5, <>, TrUserData) - end - end - end, - B6 = if F6 == undefined -> B5; - true -> - begin - TrF6 = id(F6, TrUserData), - case is_empty_string(TrF6) of - true -> B5; - false -> e_type_string(TrF6, <>, TrUserData) - end - end - end, - B7 = begin - TrF7 = id(F7, TrUserData), - if TrF7 == [] -> B6; - true -> e_field_ping_ips(TrF7, B6, TrUserData) - end - end, - B8 = if F8 == undefined -> B7; - true -> - begin - TrF8 = id(F8, TrUserData), - if TrF8 =:= 0 -> B7; - true -> e_varint(TrF8, <>, TrUserData) - end - end - end, - B9 = if F9 == undefined -> B8; - true -> - begin - TrF9 = id(F9, TrUserData), - if TrF9 =:= 0 -> B8; - true -> e_varint(TrF9, <>, TrUserData) - end - end - end, - B10 = if F10 == undefined -> B9; - true -> - begin - TrF10 = id(F10, TrUserData), - if TrF10 =:= +0.0; TrF10 =:= 0 -> B9; - true -> e_type_float(TrF10, <>, TrUserData) - end - end - end, - B11 = begin - TrF11 = id(F11, TrUserData), - if TrF11 == [] -> B10; - true -> e_field_ping_disk(TrF11, B10, TrUserData) - end - end, - B12 = begin - TrF12 = id(F12, TrUserData), - if TrF12 == [] -> B11; - true -> e_field_ping_memory(TrF12, B11, TrUserData) - end - end, - if F13 == undefined -> B12; - true -> - begin - TrF13 = id(F13, TrUserData), - case is_empty_string(TrF13) of - true -> B12; - false -> e_type_string(TrF13, <>, TrUserData) - end - end - end. - -e_field_ping_ips([Elem | Rest], Bin, TrUserData) -> - Bin2 = <>, - Bin3 = e_type_string(id(Elem, TrUserData), Bin2, TrUserData), - e_field_ping_ips(Rest, Bin3, TrUserData); -e_field_ping_ips([], Bin, _TrUserData) -> Bin. - -e_field_ping_disk(Elems, Bin, TrUserData) when Elems =/= [] -> - SubBin = e_pfield_ping_disk(Elems, <<>>, TrUserData), - Bin2 = <>, - Bin3 = e_varint(byte_size(SubBin), Bin2), - <>; -e_field_ping_disk([], Bin, _TrUserData) -> Bin. - -e_pfield_ping_disk([Value | Rest], Bin, TrUserData) -> - Bin2 = e_type_int32(id(Value, TrUserData), Bin, TrUserData), - e_pfield_ping_disk(Rest, Bin2, TrUserData); -e_pfield_ping_disk([], Bin, _TrUserData) -> Bin. - -e_field_ping_memory(Elems, Bin, TrUserData) when Elems =/= [] -> - SubBin = e_pfield_ping_memory(Elems, <<>>, TrUserData), - Bin2 = <>, - Bin3 = e_varint(byte_size(SubBin), Bin2), - <>; -e_field_ping_memory([], Bin, _TrUserData) -> Bin. - -e_pfield_ping_memory([Value | Rest], Bin, TrUserData) -> - Bin2 = e_type_int32(id(Value, TrUserData), Bin, TrUserData), - e_pfield_ping_memory(Rest, Bin2, TrUserData); -e_pfield_ping_memory([], 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(auth_request, Bin, TrUserData) -> id(decode_msg_auth_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(auth_reply, Bin, TrUserData) -> id(decode_msg_auth_reply(Bin, TrUserData), TrUserData); -decode_msg_2_doit(pub, Bin, TrUserData) -> id(decode_msg_pub(Bin, TrUserData), TrUserData); -decode_msg_2_doit(command, Bin, TrUserData) -> id(decode_msg_command(Bin, TrUserData), TrUserData); -decode_msg_2_doit(rpc_deploy, Bin, TrUserData) -> id(decode_msg_rpc_deploy(Bin, TrUserData), TrUserData); -decode_msg_2_doit(rpc_start_container, Bin, TrUserData) -> id(decode_msg_rpc_start_container(Bin, TrUserData), TrUserData); -decode_msg_2_doit(rpc_stop_container, Bin, TrUserData) -> id(decode_msg_rpc_stop_container(Bin, TrUserData), TrUserData); -decode_msg_2_doit(rpc_config_container, Bin, TrUserData) -> id(decode_msg_rpc_config_container(Bin, TrUserData), TrUserData); -decode_msg_2_doit(fetch_task_log, Bin, TrUserData) -> id(decode_msg_fetch_task_log(Bin, TrUserData), TrUserData); -decode_msg_2_doit(container_config, Bin, TrUserData) -> id(decode_msg_container_config(Bin, TrUserData), TrUserData); -decode_msg_2_doit(data, Bin, TrUserData) -> id(decode_msg_data(Bin, TrUserData), TrUserData); -decode_msg_2_doit(event, Bin, TrUserData) -> id(decode_msg_event(Bin, TrUserData), TrUserData); -decode_msg_2_doit(ping, Bin, TrUserData) -> id(decode_msg_ping(Bin, TrUserData), TrUserData). - - - -decode_msg_auth_request(Bin, TrUserData) -> dfp_read_field_def_auth_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), id(<<>>, TrUserData), id(<<>>, TrUserData), id(0, TrUserData), TrUserData). - -dfp_read_field_def_auth_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> d_field_auth_request_uuid(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); -dfp_read_field_def_auth_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> d_field_auth_request_username(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); -dfp_read_field_def_auth_request(<<34, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> d_field_auth_request_salt(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); -dfp_read_field_def_auth_request(<<42, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> d_field_auth_request_token(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); -dfp_read_field_def_auth_request(<<48, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> d_field_auth_request_timestamp(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); -dfp_read_field_def_auth_request(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, F@_5, _) -> #auth_request{uuid = F@_1, username = F@_2, salt = F@_3, token = F@_4, timestamp = F@_5}; -dfp_read_field_def_auth_request(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> dg_read_field_def_auth_request(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). - -dg_read_field_def_auth_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 32 - 7 -> dg_read_field_def_auth_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); -dg_read_field_def_auth_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_auth_request_uuid(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); - 18 -> d_field_auth_request_username(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); - 34 -> d_field_auth_request_salt(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); - 42 -> d_field_auth_request_token(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); - 48 -> d_field_auth_request_timestamp(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_auth_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); - 1 -> skip_64_auth_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); - 2 -> skip_length_delimited_auth_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); - 3 -> skip_group_auth_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); - 5 -> skip_32_auth_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) - end - end; -dg_read_field_def_auth_request(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, F@_5, _) -> #auth_request{uuid = F@_1, username = F@_2, salt = F@_3, token = F@_4, timestamp = F@_5}. - -d_field_auth_request_uuid(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> d_field_auth_request_uuid(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); -d_field_auth_request_uuid(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, F@_4, F@_5, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_auth_request(RestF, 0, 0, F, NewFValue, F@_2, F@_3, F@_4, F@_5, TrUserData). - -d_field_auth_request_username(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> d_field_auth_request_username(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); -d_field_auth_request_username(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, F@_4, F@_5, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_auth_request(RestF, 0, 0, F, F@_1, NewFValue, F@_3, F@_4, F@_5, TrUserData). - -d_field_auth_request_salt(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> d_field_auth_request_salt(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); -d_field_auth_request_salt(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, F@_4, F@_5, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_auth_request(RestF, 0, 0, F, F@_1, F@_2, NewFValue, F@_4, F@_5, TrUserData). - -d_field_auth_request_token(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> d_field_auth_request_token(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); -d_field_auth_request_token(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, _, F@_5, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_auth_request(RestF, 0, 0, F, F@_1, F@_2, F@_3, NewFValue, F@_5, TrUserData). - -d_field_auth_request_timestamp(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> d_field_auth_request_timestamp(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); -d_field_auth_request_timestamp(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, _, TrUserData) -> - {NewFValue, RestF} = {id((X bsl N + Acc) band 4294967295, TrUserData), Rest}, - dfp_read_field_def_auth_request(RestF, 0, 0, F, F@_1, F@_2, F@_3, F@_4, NewFValue, TrUserData). - -skip_varint_auth_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> skip_varint_auth_request(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); -skip_varint_auth_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> dfp_read_field_def_auth_request(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). - -skip_length_delimited_auth_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> skip_length_delimited_auth_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); -skip_length_delimited_auth_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_auth_request(Rest2, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). - -skip_group_auth_request(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_auth_request(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). - -skip_32_auth_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> dfp_read_field_def_auth_request(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). - -skip_64_auth_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> dfp_read_field_def_auth_request(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). - -decode_msg_auth_reply(Bin, TrUserData) -> dfp_read_field_def_auth_reply(Bin, 0, 0, 0, id(0, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_auth_reply(<<8, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_auth_reply_code(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_auth_reply(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_auth_reply_message(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_auth_reply(<<>>, 0, 0, _, F@_1, F@_2, _) -> #auth_reply{code = F@_1, message = F@_2}; -dfp_read_field_def_auth_reply(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_auth_reply(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_auth_reply(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_auth_reply(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_auth_reply(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 8 -> d_field_auth_reply_code(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_auth_reply_message(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_auth_reply(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_auth_reply(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_auth_reply(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_auth_reply(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_auth_reply(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_auth_reply(<<>>, 0, 0, _, F@_1, F@_2, _) -> #auth_reply{code = F@_1, message = F@_2}. - -d_field_auth_reply_code(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_auth_reply_code(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_auth_reply_code(<<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_auth_reply(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_auth_reply_message(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_auth_reply_message(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_auth_reply_message(<<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_auth_reply(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_auth_reply(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_auth_reply(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_auth_reply(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_auth_reply(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_auth_reply(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_auth_reply(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_auth_reply(<<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_auth_reply(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_auth_reply(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_auth_reply(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_auth_reply(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_auth_reply(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_auth_reply(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_auth_reply(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_pub(Bin, TrUserData) -> dfp_read_field_def_pub(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_pub(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_pub_topic(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_pub(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_pub_content(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_pub(<<>>, 0, 0, _, F@_1, F@_2, _) -> #pub{topic = F@_1, content = F@_2}; -dfp_read_field_def_pub(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_pub(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_pub(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_pub(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_pub(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_pub_topic(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_pub_content(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_pub(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_pub(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_pub(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_pub(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_pub(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_pub(<<>>, 0, 0, _, F@_1, F@_2, _) -> #pub{topic = F@_1, content = F@_2}. - -d_field_pub_topic(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_pub_topic(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_pub_topic(<<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_pub(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_pub_content(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_pub_content(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_pub_content(<<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_pub(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_pub(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_pub(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_pub(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_pub(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_pub(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_pub(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_pub(<<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_pub(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_pub(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_pub(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_pub(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_pub(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_pub(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_pub(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_command(Bin, TrUserData) -> dfp_read_field_def_command(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_command(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_command_command_type(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_command(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_command_command(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_command(<<>>, 0, 0, _, F@_1, F@_2, _) -> #command{command_type = F@_1, command = F@_2}; -dfp_read_field_def_command(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_command(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_command(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_command(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_command(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_command_command_type(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_command_command(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_command(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_command(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_command(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_command(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_command(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_command(<<>>, 0, 0, _, F@_1, F@_2, _) -> #command{command_type = F@_1, command = F@_2}. - -d_field_command_command_type(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_command_command_type(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_command_command_type(<<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_command(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_command_command(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_command_command(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_command_command(<<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_command(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_command(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_command(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_command(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_command(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_command(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_command(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_command(<<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_command(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_command(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_command(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_command(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_command(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_command(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_command(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_rpc_deploy(Bin, TrUserData) -> dfp_read_field_def_rpc_deploy(Bin, 0, 0, 0, id(0, TrUserData), id(0, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_rpc_deploy(<<8, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_rpc_deploy_packet_id(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_rpc_deploy(<<16, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_rpc_deploy_task_id(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_rpc_deploy(<<26, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_rpc_deploy_config(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_rpc_deploy(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #rpc_deploy{packet_id = F@_1, task_id = F@_2, config = F@_3}; -dfp_read_field_def_rpc_deploy(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dg_read_field_def_rpc_deploy(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -dg_read_field_def_rpc_deploy(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 32 - 7 -> dg_read_field_def_rpc_deploy(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -dg_read_field_def_rpc_deploy(<<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_rpc_deploy_packet_id(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 16 -> d_field_rpc_deploy_task_id(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 26 -> d_field_rpc_deploy_config(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_rpc_deploy(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 1 -> skip_64_rpc_deploy(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 2 -> skip_length_delimited_rpc_deploy(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 3 -> skip_group_rpc_deploy(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 5 -> skip_32_rpc_deploy(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData) - end - end; -dg_read_field_def_rpc_deploy(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #rpc_deploy{packet_id = F@_1, task_id = F@_2, config = F@_3}. - -d_field_rpc_deploy_packet_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_rpc_deploy_packet_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_rpc_deploy_packet_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_rpc_deploy(RestF, 0, 0, F, NewFValue, F@_2, F@_3, TrUserData). - -d_field_rpc_deploy_task_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_rpc_deploy_task_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_rpc_deploy_task_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_rpc_deploy(RestF, 0, 0, F, F@_1, NewFValue, F@_3, TrUserData). - -d_field_rpc_deploy_config(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_rpc_deploy_config(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_rpc_deploy_config(<<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_rpc_deploy(RestF, 0, 0, F, F@_1, F@_2, NewFValue, TrUserData). - -skip_varint_rpc_deploy(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> skip_varint_rpc_deploy(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -skip_varint_rpc_deploy(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_rpc_deploy(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_length_delimited_rpc_deploy(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> skip_length_delimited_rpc_deploy(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -skip_length_delimited_rpc_deploy(<<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_rpc_deploy(Rest2, 0, 0, F, F@_1, F@_2, F@_3, TrUserData). - -skip_group_rpc_deploy(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_rpc_deploy(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, TrUserData). - -skip_32_rpc_deploy(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_rpc_deploy(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_64_rpc_deploy(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_rpc_deploy(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -decode_msg_rpc_start_container(Bin, TrUserData) -> dfp_read_field_def_rpc_start_container(Bin, 0, 0, 0, id(0, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_rpc_start_container(<<8, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_rpc_start_container_packet_id(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_rpc_start_container(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_rpc_start_container_container_name(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_rpc_start_container(<<>>, 0, 0, _, F@_1, F@_2, _) -> #rpc_start_container{packet_id = F@_1, container_name = F@_2}; -dfp_read_field_def_rpc_start_container(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_rpc_start_container(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_rpc_start_container(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_rpc_start_container(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_rpc_start_container(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 8 -> d_field_rpc_start_container_packet_id(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_rpc_start_container_container_name(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_rpc_start_container(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_rpc_start_container(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_rpc_start_container(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_rpc_start_container(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_rpc_start_container(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_rpc_start_container(<<>>, 0, 0, _, F@_1, F@_2, _) -> #rpc_start_container{packet_id = F@_1, container_name = F@_2}. - -d_field_rpc_start_container_packet_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_rpc_start_container_packet_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_rpc_start_container_packet_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_rpc_start_container(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_rpc_start_container_container_name(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_rpc_start_container_container_name(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_rpc_start_container_container_name(<<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_rpc_start_container(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_rpc_start_container(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_rpc_start_container(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_rpc_start_container(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_rpc_start_container(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_rpc_start_container(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_rpc_start_container(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_rpc_start_container(<<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_rpc_start_container(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_rpc_start_container(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_rpc_start_container(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_rpc_start_container(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_rpc_start_container(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_rpc_start_container(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_rpc_start_container(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_rpc_stop_container(Bin, TrUserData) -> dfp_read_field_def_rpc_stop_container(Bin, 0, 0, 0, id(0, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_rpc_stop_container(<<8, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_rpc_stop_container_packet_id(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_rpc_stop_container(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_rpc_stop_container_container_name(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_rpc_stop_container(<<>>, 0, 0, _, F@_1, F@_2, _) -> #rpc_stop_container{packet_id = F@_1, container_name = F@_2}; -dfp_read_field_def_rpc_stop_container(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_rpc_stop_container(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_rpc_stop_container(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_rpc_stop_container(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_rpc_stop_container(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 8 -> d_field_rpc_stop_container_packet_id(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_rpc_stop_container_container_name(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_rpc_stop_container(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_rpc_stop_container(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_rpc_stop_container(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_rpc_stop_container(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_rpc_stop_container(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_rpc_stop_container(<<>>, 0, 0, _, F@_1, F@_2, _) -> #rpc_stop_container{packet_id = F@_1, container_name = F@_2}. - -d_field_rpc_stop_container_packet_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_rpc_stop_container_packet_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_rpc_stop_container_packet_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_rpc_stop_container(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_rpc_stop_container_container_name(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_rpc_stop_container_container_name(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_rpc_stop_container_container_name(<<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_rpc_stop_container(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_rpc_stop_container(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_rpc_stop_container(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_rpc_stop_container(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_rpc_stop_container(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_rpc_stop_container(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_rpc_stop_container(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_rpc_stop_container(<<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_rpc_stop_container(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_rpc_stop_container(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_rpc_stop_container(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_rpc_stop_container(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_rpc_stop_container(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_rpc_stop_container(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_rpc_stop_container(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_rpc_config_container(Bin, TrUserData) -> dfp_read_field_def_rpc_config_container(Bin, 0, 0, 0, id(0, TrUserData), id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_rpc_config_container(<<8, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_rpc_config_container_packet_id(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_rpc_config_container(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_rpc_config_container_container_name(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_rpc_config_container(<<26, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_rpc_config_container_config(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_rpc_config_container(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #rpc_config_container{packet_id = F@_1, container_name = F@_2, config = F@_3}; -dfp_read_field_def_rpc_config_container(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dg_read_field_def_rpc_config_container(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -dg_read_field_def_rpc_config_container(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 32 - 7 -> dg_read_field_def_rpc_config_container(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -dg_read_field_def_rpc_config_container(<<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_rpc_config_container_packet_id(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 18 -> d_field_rpc_config_container_container_name(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 26 -> d_field_rpc_config_container_config(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_rpc_config_container(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 1 -> skip_64_rpc_config_container(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 2 -> skip_length_delimited_rpc_config_container(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 3 -> skip_group_rpc_config_container(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 5 -> skip_32_rpc_config_container(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData) - end - end; -dg_read_field_def_rpc_config_container(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #rpc_config_container{packet_id = F@_1, container_name = F@_2, config = F@_3}. - -d_field_rpc_config_container_packet_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_rpc_config_container_packet_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_rpc_config_container_packet_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_rpc_config_container(RestF, 0, 0, F, NewFValue, F@_2, F@_3, TrUserData). - -d_field_rpc_config_container_container_name(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_rpc_config_container_container_name(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_rpc_config_container_container_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_rpc_config_container(RestF, 0, 0, F, F@_1, NewFValue, F@_3, TrUserData). - -d_field_rpc_config_container_config(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_rpc_config_container_config(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_rpc_config_container_config(<<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_rpc_config_container(RestF, 0, 0, F, F@_1, F@_2, NewFValue, TrUserData). - -skip_varint_rpc_config_container(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> skip_varint_rpc_config_container(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -skip_varint_rpc_config_container(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_rpc_config_container(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_length_delimited_rpc_config_container(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> skip_length_delimited_rpc_config_container(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -skip_length_delimited_rpc_config_container(<<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_rpc_config_container(Rest2, 0, 0, F, F@_1, F@_2, F@_3, TrUserData). - -skip_group_rpc_config_container(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_rpc_config_container(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, TrUserData). - -skip_32_rpc_config_container(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_rpc_config_container(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_64_rpc_config_container(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_rpc_config_container(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -decode_msg_fetch_task_log(Bin, TrUserData) -> dfp_read_field_def_fetch_task_log(Bin, 0, 0, 0, id(0, TrUserData), TrUserData). - -dfp_read_field_def_fetch_task_log(<<8, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_fetch_task_log_task_id(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_fetch_task_log(<<>>, 0, 0, _, F@_1, _) -> #fetch_task_log{task_id = F@_1}; -dfp_read_field_def_fetch_task_log(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_fetch_task_log(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_fetch_task_log(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_fetch_task_log(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_fetch_task_log(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 8 -> d_field_fetch_task_log_task_id(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_fetch_task_log(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_fetch_task_log(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_fetch_task_log(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_fetch_task_log(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_fetch_task_log(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_fetch_task_log(<<>>, 0, 0, _, F@_1, _) -> #fetch_task_log{task_id = F@_1}. - -d_field_fetch_task_log_task_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_fetch_task_log_task_id(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_fetch_task_log_task_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_fetch_task_log(RestF, 0, 0, F, NewFValue, TrUserData). - -skip_varint_fetch_task_log(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_fetch_task_log(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_fetch_task_log(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_fetch_task_log(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_fetch_task_log(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_fetch_task_log(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_fetch_task_log(<<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_fetch_task_log(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_fetch_task_log(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_fetch_task_log(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_fetch_task_log(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_fetch_task_log(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_fetch_task_log(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_fetch_task_log(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_container_config(Bin, TrUserData) -> dfp_read_field_def_container_config(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_container_config(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_container_config_container_name(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_container_config(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_container_config_config(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_container_config(<<>>, 0, 0, _, F@_1, F@_2, _) -> #container_config{container_name = F@_1, config = F@_2}; -dfp_read_field_def_container_config(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_container_config(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_container_config(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_container_config(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_container_config(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_container_config_container_name(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 18 -> d_field_container_config_config(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_container_config(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_container_config(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_container_config(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_container_config(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_container_config(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_container_config(<<>>, 0, 0, _, F@_1, F@_2, _) -> #container_config{container_name = F@_1, config = F@_2}. - -d_field_container_config_container_name(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_container_config_container_name(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_container_config_container_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_container_config(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_container_config_config(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_container_config_config(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_container_config_config(<<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_container_config(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_container_config(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_container_config(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_container_config(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_container_config(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_container_config(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_container_config(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_container_config(<<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_container_config(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_container_config(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_container_config(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_container_config(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_container_config(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_container_config(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_container_config(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_data(Bin, TrUserData) -> dfp_read_field_def_data(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_data(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_data_service_id(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dfp_read_field_def_data(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_data_device_uuid(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dfp_read_field_def_data(<<26, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_data_route_key(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dfp_read_field_def_data(<<34, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_data_metric(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dfp_read_field_def_data(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, _) -> #data{service_id = F@_1, device_uuid = F@_2, route_key = F@_3, metric = F@_4}; -dfp_read_field_def_data(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dg_read_field_def_data(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -dg_read_field_def_data(<<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_data(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -dg_read_field_def_data(<<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_data_service_id(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); - 18 -> d_field_data_device_uuid(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); - 26 -> d_field_data_route_key(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); - 34 -> d_field_data_metric(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_data(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); - 1 -> skip_64_data(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); - 2 -> skip_length_delimited_data(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); - 3 -> skip_group_data(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); - 5 -> skip_32_data(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData) - end - end; -dg_read_field_def_data(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, _) -> #data{service_id = F@_1, device_uuid = F@_2, route_key = F@_3, metric = F@_4}. - -d_field_data_service_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_data_service_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -d_field_data_service_id(<<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_data(RestF, 0, 0, F, NewFValue, F@_2, F@_3, F@_4, TrUserData). - -d_field_data_device_uuid(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_data_device_uuid(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -d_field_data_device_uuid(<<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_data(RestF, 0, 0, F, F@_1, NewFValue, F@_3, F@_4, TrUserData). - -d_field_data_route_key(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_data_route_key(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -d_field_data_route_key(<<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_data(RestF, 0, 0, F, F@_1, F@_2, NewFValue, F@_4, TrUserData). - -d_field_data_metric(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_data_metric(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -d_field_data_metric(<<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_data(RestF, 0, 0, F, F@_1, F@_2, F@_3, NewFValue, TrUserData). - -skip_varint_data(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> skip_varint_data(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -skip_varint_data(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dfp_read_field_def_data(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -skip_length_delimited_data(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> skip_length_delimited_data(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); -skip_length_delimited_data(<<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_data(Rest2, 0, 0, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -skip_group_data(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, F@_4, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_data(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, F@_4, TrUserData). - -skip_32_data(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dfp_read_field_def_data(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -skip_64_data(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dfp_read_field_def_data(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). - -decode_msg_event(Bin, TrUserData) -> dfp_read_field_def_event(Bin, 0, 0, 0, id(<<>>, TrUserData), id(0, TrUserData), id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_event(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_event_service_id(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_event(<<16, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_event_event_type(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_event(<<26, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_event_params(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_event(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #event{service_id = F@_1, event_type = F@_2, params = F@_3}; -dfp_read_field_def_event(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dg_read_field_def_event(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -dg_read_field_def_event(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 32 - 7 -> dg_read_field_def_event(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -dg_read_field_def_event(<<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_event_service_id(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 16 -> d_field_event_event_type(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 26 -> d_field_event_params(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_event(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 1 -> skip_64_event(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 2 -> skip_length_delimited_event(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 3 -> skip_group_event(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 5 -> skip_32_event(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData) - end - end; -dg_read_field_def_event(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #event{service_id = F@_1, event_type = F@_2, params = F@_3}. - -d_field_event_service_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_event_service_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_event_service_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_event(RestF, 0, 0, F, NewFValue, F@_2, F@_3, TrUserData). - -d_field_event_event_type(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_event_event_type(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_event_event_type(<<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_event(RestF, 0, 0, F, F@_1, NewFValue, F@_3, TrUserData). - -d_field_event_params(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_event_params(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_event_params(<<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_event(RestF, 0, 0, F, F@_1, F@_2, NewFValue, TrUserData). - -skip_varint_event(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> skip_varint_event(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -skip_varint_event(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_event(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_length_delimited_event(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> skip_length_delimited_event(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -skip_length_delimited_event(<<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_event(Rest2, 0, 0, F, F@_1, F@_2, F@_3, TrUserData). - -skip_group_event(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_event(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, TrUserData). - -skip_32_event(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_event(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_64_event(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_event(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -decode_msg_ping(Bin, TrUserData) -> - dfp_read_field_def_ping(Bin, - 0, - 0, - 0, - id(<<>>, TrUserData), - id(0, TrUserData), - id(<<>>, TrUserData), - id(<<>>, TrUserData), - id(<<>>, TrUserData), - id(<<>>, TrUserData), - id([], TrUserData), - id(0, TrUserData), - id(0, TrUserData), - id(0.0, TrUserData), - id([], TrUserData), - id([], TrUserData), - id(<<>>, TrUserData), - TrUserData). - -dfp_read_field_def_ping(<<10, 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, TrUserData) -> - d_field_ping_adcode(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, TrUserData); -dfp_read_field_def_ping(<<16, 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, TrUserData) -> - d_field_ping_boot_time(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, TrUserData); -dfp_read_field_def_ping(<<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, TrUserData) -> - d_field_ping_province(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, TrUserData); -dfp_read_field_def_ping(<<34, 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, TrUserData) -> - d_field_ping_city(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, TrUserData); -dfp_read_field_def_ping(<<42, 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, TrUserData) -> - d_field_ping_efka_version(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, TrUserData); -dfp_read_field_def_ping(<<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, TrUserData) -> - d_field_ping_kernel_arch(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, TrUserData); -dfp_read_field_def_ping(<<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, TrUserData) -> - d_field_ping_ips(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, TrUserData); -dfp_read_field_def_ping(<<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, TrUserData) -> - d_field_ping_cpu_core(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, TrUserData); -dfp_read_field_def_ping(<<72, 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, TrUserData) -> - d_field_ping_cpu_load(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, TrUserData); -dfp_read_field_def_ping(<<85, 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, TrUserData) -> - d_field_ping_cpu_temperature(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, TrUserData); -dfp_read_field_def_ping(<<90, 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, TrUserData) -> - d_pfield_ping_disk(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, TrUserData); -dfp_read_field_def_ping(<<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, TrUserData) -> - d_field_ping_disk(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, TrUserData); -dfp_read_field_def_ping(<<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, TrUserData) -> - d_pfield_ping_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, TrUserData); -dfp_read_field_def_ping(<<96, 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, TrUserData) -> - d_field_ping_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, TrUserData); -dfp_read_field_def_ping(<<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, TrUserData) -> - d_field_ping_interfaces(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, TrUserData); -dfp_read_field_def_ping(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, R1, F@_8, F@_9, F@_10, R2, R3, F@_13, TrUserData) -> - #ping{adcode = F@_1, boot_time = F@_2, province = F@_3, city = F@_4, efka_version = F@_5, kernel_arch = F@_6, ips = lists_reverse(R1, TrUserData), cpu_core = F@_8, cpu_load = F@_9, cpu_temperature = F@_10, disk = lists_reverse(R2, TrUserData), - memory = lists_reverse(R3, TrUserData), interfaces = F@_13}; -dfp_read_field_def_ping(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, TrUserData) -> - dg_read_field_def_ping(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, TrUserData). - -dg_read_field_def_ping(<<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, TrUserData) when N < 32 - 7 -> - dg_read_field_def_ping(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, TrUserData); -dg_read_field_def_ping(<<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, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_ping_adcode(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, TrUserData); - 16 -> d_field_ping_boot_time(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, TrUserData); - 26 -> d_field_ping_province(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, TrUserData); - 34 -> d_field_ping_city(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, TrUserData); - 42 -> d_field_ping_efka_version(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, TrUserData); - 50 -> d_field_ping_kernel_arch(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, TrUserData); - 58 -> d_field_ping_ips(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, TrUserData); - 64 -> d_field_ping_cpu_core(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, TrUserData); - 72 -> d_field_ping_cpu_load(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, TrUserData); - 85 -> d_field_ping_cpu_temperature(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, TrUserData); - 90 -> d_pfield_ping_disk(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, TrUserData); - 88 -> d_field_ping_disk(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, TrUserData); - 98 -> d_pfield_ping_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, TrUserData); - 96 -> d_field_ping_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, TrUserData); - 106 -> d_field_ping_interfaces(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, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_ping(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, TrUserData); - 1 -> skip_64_ping(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, TrUserData); - 2 -> skip_length_delimited_ping(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, TrUserData); - 3 -> skip_group_ping(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, TrUserData); - 5 -> skip_32_ping(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, TrUserData) - end - end; -dg_read_field_def_ping(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, R1, F@_8, F@_9, F@_10, R2, R3, F@_13, TrUserData) -> - #ping{adcode = F@_1, boot_time = F@_2, province = F@_3, city = F@_4, efka_version = F@_5, kernel_arch = F@_6, ips = lists_reverse(R1, TrUserData), cpu_core = F@_8, cpu_load = F@_9, cpu_temperature = F@_10, disk = lists_reverse(R2, TrUserData), - memory = lists_reverse(R3, TrUserData), interfaces = F@_13}. - -d_field_ping_adcode(<<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, TrUserData) when N < 57 -> - d_field_ping_adcode(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, TrUserData); -d_field_ping_adcode(<<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, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_ping(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, TrUserData). - -d_field_ping_boot_time(<<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, TrUserData) when N < 57 -> - d_field_ping_boot_time(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, TrUserData); -d_field_ping_boot_time(<<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, TrUserData) -> - {NewFValue, RestF} = {id((X bsl N + Acc) band 4294967295, TrUserData), Rest}, - dfp_read_field_def_ping(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, TrUserData). - -d_field_ping_province(<<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, TrUserData) when N < 57 -> - d_field_ping_province(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, TrUserData); -d_field_ping_province(<<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, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_ping(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, TrUserData). - -d_field_ping_city(<<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, TrUserData) when N < 57 -> - d_field_ping_city(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, TrUserData); -d_field_ping_city(<<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, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_ping(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, TrUserData). - -d_field_ping_efka_version(<<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, TrUserData) when N < 57 -> - d_field_ping_efka_version(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, TrUserData); -d_field_ping_efka_version(<<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, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_ping(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, TrUserData). - -d_field_ping_kernel_arch(<<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, TrUserData) when N < 57 -> - d_field_ping_kernel_arch(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, TrUserData); -d_field_ping_kernel_arch(<<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, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_ping(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, TrUserData). - -d_field_ping_ips(<<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, TrUserData) when N < 57 -> - d_field_ping_ips(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, TrUserData); -d_field_ping_ips(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, Prev, F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_ping(RestF, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, cons(NewFValue, Prev, TrUserData), F@_8, F@_9, F@_10, F@_11, F@_12, F@_13, TrUserData). - -d_field_ping_cpu_core(<<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, TrUserData) when N < 57 -> - d_field_ping_cpu_core(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, TrUserData); -d_field_ping_cpu_core(<<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, TrUserData) -> - {NewFValue, RestF} = {id((X bsl N + Acc) band 4294967295, TrUserData), Rest}, - dfp_read_field_def_ping(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, TrUserData). - -d_field_ping_cpu_load(<<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, TrUserData) when N < 57 -> - d_field_ping_cpu_load(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, TrUserData); -d_field_ping_cpu_load(<<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, TrUserData) -> - {NewFValue, RestF} = {id((X bsl N + Acc) band 4294967295, TrUserData), Rest}, - dfp_read_field_def_ping(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, TrUserData). - -d_field_ping_cpu_temperature(<<0:16, 128, 127, Rest/binary>>, Z1, Z2, 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, TrUserData) -> - dfp_read_field_def_ping(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, id(infinity, TrUserData), F@_11, F@_12, F@_13, TrUserData); -d_field_ping_cpu_temperature(<<0:16, 128, 255, Rest/binary>>, Z1, Z2, 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, TrUserData) -> - dfp_read_field_def_ping(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, id('-infinity', TrUserData), F@_11, F@_12, F@_13, TrUserData); -d_field_ping_cpu_temperature(<<_:16, 1:1, _:7, _:1, 127: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@_11, F@_12, F@_13, TrUserData) -> - dfp_read_field_def_ping(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, id(nan, TrUserData), F@_11, F@_12, F@_13, TrUserData); -d_field_ping_cpu_temperature(<>, Z1, Z2, 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, TrUserData) -> - dfp_read_field_def_ping(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, id(Value, TrUserData), F@_11, F@_12, F@_13, TrUserData). - -d_field_ping_disk(<<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, TrUserData) when N < 57 -> - d_field_ping_disk(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, TrUserData); -d_field_ping_disk(<<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, Prev, F@_12, F@_13, TrUserData) -> - {NewFValue, RestF} = {begin <> = <<(X bsl N + Acc):32/unsigned-native>>, id(Res, TrUserData) end, Rest}, - dfp_read_field_def_ping(RestF, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, cons(NewFValue, Prev, TrUserData), F@_12, F@_13, TrUserData). - -d_pfield_ping_disk(<<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, TrUserData) when N < 57 -> - d_pfield_ping_disk(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, TrUserData); -d_pfield_ping_disk(<<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, E, F@_12, F@_13, TrUserData) -> - Len = X bsl N + Acc, - <> = Rest, - NewSeq = d_packed_field_ping_disk(PackedBytes, 0, 0, F, E, TrUserData), - dfp_read_field_def_ping(Rest2, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, NewSeq, F@_12, F@_13, TrUserData). - -d_packed_field_ping_disk(<<1:1, X:7, Rest/binary>>, N, Acc, F, AccSeq, TrUserData) when N < 57 -> d_packed_field_ping_disk(Rest, N + 7, X bsl N + Acc, F, AccSeq, TrUserData); -d_packed_field_ping_disk(<<0:1, X:7, Rest/binary>>, N, Acc, F, AccSeq, TrUserData) -> - {NewFValue, RestF} = {begin <> = <<(X bsl N + Acc):32/unsigned-native>>, id(Res, TrUserData) end, Rest}, - d_packed_field_ping_disk(RestF, 0, 0, F, [NewFValue | AccSeq], TrUserData); -d_packed_field_ping_disk(<<>>, 0, 0, _, AccSeq, _) -> AccSeq. - -d_field_ping_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, TrUserData) when N < 57 -> - d_field_ping_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, TrUserData); -d_field_ping_memory(<<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, Prev, F@_13, TrUserData) -> - {NewFValue, RestF} = {begin <> = <<(X bsl N + Acc):32/unsigned-native>>, id(Res, TrUserData) end, Rest}, - dfp_read_field_def_ping(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, cons(NewFValue, Prev, TrUserData), F@_13, TrUserData). - -d_pfield_ping_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, TrUserData) when N < 57 -> - d_pfield_ping_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, TrUserData); -d_pfield_ping_memory(<<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, E, F@_13, TrUserData) -> - Len = X bsl N + Acc, - <> = Rest, - NewSeq = d_packed_field_ping_memory(PackedBytes, 0, 0, F, E, TrUserData), - dfp_read_field_def_ping(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, NewSeq, F@_13, TrUserData). - -d_packed_field_ping_memory(<<1:1, X:7, Rest/binary>>, N, Acc, F, AccSeq, TrUserData) when N < 57 -> d_packed_field_ping_memory(Rest, N + 7, X bsl N + Acc, F, AccSeq, TrUserData); -d_packed_field_ping_memory(<<0:1, X:7, Rest/binary>>, N, Acc, F, AccSeq, TrUserData) -> - {NewFValue, RestF} = {begin <> = <<(X bsl N + Acc):32/unsigned-native>>, id(Res, TrUserData) end, Rest}, - d_packed_field_ping_memory(RestF, 0, 0, F, [NewFValue | AccSeq], TrUserData); -d_packed_field_ping_memory(<<>>, 0, 0, _, AccSeq, _) -> AccSeq. - -d_field_ping_interfaces(<<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, TrUserData) when N < 57 -> - d_field_ping_interfaces(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, TrUserData); -d_field_ping_interfaces(<<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, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_ping(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, TrUserData). - -skip_varint_ping(<<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, TrUserData) -> - skip_varint_ping(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, TrUserData); -skip_varint_ping(<<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, TrUserData) -> - dfp_read_field_def_ping(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, TrUserData). - -skip_length_delimited_ping(<<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, TrUserData) when N < 57 -> - skip_length_delimited_ping(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, TrUserData); -skip_length_delimited_ping(<<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, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_ping(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, TrUserData). - -skip_group_ping(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, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_ping(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, TrUserData). - -skip_32_ping(<<_: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, TrUserData) -> - dfp_read_field_def_ping(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, TrUserData). - -skip_64_ping(<<_: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, TrUserData) -> - dfp_read_field_def_ping(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, 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) when element(1, Prev) =:= element(1, New) -> merge_msgs(Prev, New, element(1, Prev), []). - -merge_msgs(Prev, New, MsgName) when is_atom(MsgName) -> merge_msgs(Prev, New, MsgName, []); -merge_msgs(Prev, New, Opts) when element(1, Prev) =:= element(1, New), is_list(Opts) -> merge_msgs(Prev, New, element(1, Prev), Opts). - -merge_msgs(Prev, New, MsgName, Opts) -> - TrUserData = proplists:get_value(user_data, Opts), - case MsgName of - auth_request -> merge_msg_auth_request(Prev, New, TrUserData); - auth_reply -> merge_msg_auth_reply(Prev, New, TrUserData); - pub -> merge_msg_pub(Prev, New, TrUserData); - command -> merge_msg_command(Prev, New, TrUserData); - rpc_deploy -> merge_msg_rpc_deploy(Prev, New, TrUserData); - rpc_start_container -> merge_msg_rpc_start_container(Prev, New, TrUserData); - rpc_stop_container -> merge_msg_rpc_stop_container(Prev, New, TrUserData); - rpc_config_container -> merge_msg_rpc_config_container(Prev, New, TrUserData); - fetch_task_log -> merge_msg_fetch_task_log(Prev, New, TrUserData); - container_config -> merge_msg_container_config(Prev, New, TrUserData); - data -> merge_msg_data(Prev, New, TrUserData); - event -> merge_msg_event(Prev, New, TrUserData); - ping -> merge_msg_ping(Prev, New, TrUserData) - end. - --compile({nowarn_unused_function,merge_msg_auth_request/3}). -merge_msg_auth_request(#auth_request{uuid = PFuuid, username = PFusername, salt = PFsalt, token = PFtoken, timestamp = PFtimestamp}, #auth_request{uuid = NFuuid, username = NFusername, salt = NFsalt, token = NFtoken, timestamp = NFtimestamp}, _) -> - #auth_request{uuid = - if NFuuid =:= undefined -> PFuuid; - true -> NFuuid - end, - username = - if NFusername =:= undefined -> PFusername; - true -> NFusername - end, - salt = - if NFsalt =:= undefined -> PFsalt; - true -> NFsalt - end, - token = - if NFtoken =:= undefined -> PFtoken; - true -> NFtoken - end, - timestamp = - if NFtimestamp =:= undefined -> PFtimestamp; - true -> NFtimestamp - end}. - --compile({nowarn_unused_function,merge_msg_auth_reply/3}). -merge_msg_auth_reply(#auth_reply{code = PFcode, message = PFmessage}, #auth_reply{code = NFcode, message = NFmessage}, _) -> - #auth_reply{code = - if NFcode =:= undefined -> PFcode; - true -> NFcode - end, - message = - if NFmessage =:= undefined -> PFmessage; - true -> NFmessage - end}. - --compile({nowarn_unused_function,merge_msg_pub/3}). -merge_msg_pub(#pub{topic = PFtopic, content = PFcontent}, #pub{topic = NFtopic, content = NFcontent}, _) -> - #pub{topic = - if NFtopic =:= undefined -> PFtopic; - true -> NFtopic - end, - content = - if NFcontent =:= undefined -> PFcontent; - true -> NFcontent - end}. - --compile({nowarn_unused_function,merge_msg_command/3}). -merge_msg_command(#command{command_type = PFcommand_type, command = PFcommand}, #command{command_type = NFcommand_type, command = NFcommand}, _) -> - #command{command_type = - if NFcommand_type =:= undefined -> PFcommand_type; - true -> NFcommand_type - end, - command = - if NFcommand =:= undefined -> PFcommand; - true -> NFcommand - end}. - --compile({nowarn_unused_function,merge_msg_rpc_deploy/3}). -merge_msg_rpc_deploy(#rpc_deploy{packet_id = PFpacket_id, task_id = PFtask_id, config = PFconfig}, #rpc_deploy{packet_id = NFpacket_id, task_id = NFtask_id, config = NFconfig}, _) -> - #rpc_deploy{packet_id = - if NFpacket_id =:= undefined -> PFpacket_id; - true -> NFpacket_id - end, - task_id = - if NFtask_id =:= undefined -> PFtask_id; - true -> NFtask_id - end, - config = - if NFconfig =:= undefined -> PFconfig; - true -> NFconfig - end}. - --compile({nowarn_unused_function,merge_msg_rpc_start_container/3}). -merge_msg_rpc_start_container(#rpc_start_container{packet_id = PFpacket_id, container_name = PFcontainer_name}, #rpc_start_container{packet_id = NFpacket_id, container_name = NFcontainer_name}, _) -> - #rpc_start_container{packet_id = - if NFpacket_id =:= undefined -> PFpacket_id; - true -> NFpacket_id - end, - container_name = - if NFcontainer_name =:= undefined -> PFcontainer_name; - true -> NFcontainer_name - end}. - --compile({nowarn_unused_function,merge_msg_rpc_stop_container/3}). -merge_msg_rpc_stop_container(#rpc_stop_container{packet_id = PFpacket_id, container_name = PFcontainer_name}, #rpc_stop_container{packet_id = NFpacket_id, container_name = NFcontainer_name}, _) -> - #rpc_stop_container{packet_id = - if NFpacket_id =:= undefined -> PFpacket_id; - true -> NFpacket_id - end, - container_name = - if NFcontainer_name =:= undefined -> PFcontainer_name; - true -> NFcontainer_name - end}. - --compile({nowarn_unused_function,merge_msg_rpc_config_container/3}). -merge_msg_rpc_config_container(#rpc_config_container{packet_id = PFpacket_id, container_name = PFcontainer_name, config = PFconfig}, #rpc_config_container{packet_id = NFpacket_id, container_name = NFcontainer_name, config = NFconfig}, _) -> - #rpc_config_container{packet_id = - if NFpacket_id =:= undefined -> PFpacket_id; - true -> NFpacket_id - end, - container_name = - if NFcontainer_name =:= undefined -> PFcontainer_name; - true -> NFcontainer_name - end, - config = - if NFconfig =:= undefined -> PFconfig; - true -> NFconfig - end}. - --compile({nowarn_unused_function,merge_msg_fetch_task_log/3}). -merge_msg_fetch_task_log(#fetch_task_log{task_id = PFtask_id}, #fetch_task_log{task_id = NFtask_id}, _) -> - #fetch_task_log{task_id = - if NFtask_id =:= undefined -> PFtask_id; - true -> NFtask_id - end}. - --compile({nowarn_unused_function,merge_msg_container_config/3}). -merge_msg_container_config(#container_config{container_name = PFcontainer_name, config = PFconfig}, #container_config{container_name = NFcontainer_name, config = NFconfig}, _) -> - #container_config{container_name = - if NFcontainer_name =:= undefined -> PFcontainer_name; - true -> NFcontainer_name - end, - config = - if NFconfig =:= undefined -> PFconfig; - true -> NFconfig - end}. - --compile({nowarn_unused_function,merge_msg_data/3}). -merge_msg_data(#data{service_id = PFservice_id, device_uuid = PFdevice_uuid, route_key = PFroute_key, metric = PFmetric}, #data{service_id = NFservice_id, device_uuid = NFdevice_uuid, route_key = NFroute_key, metric = NFmetric}, _) -> - #data{service_id = - if NFservice_id =:= undefined -> PFservice_id; - true -> NFservice_id - end, - device_uuid = - if NFdevice_uuid =:= undefined -> PFdevice_uuid; - true -> NFdevice_uuid - end, - route_key = - if NFroute_key =:= undefined -> PFroute_key; - true -> NFroute_key - end, - metric = - if NFmetric =:= undefined -> PFmetric; - true -> NFmetric - end}. - --compile({nowarn_unused_function,merge_msg_event/3}). -merge_msg_event(#event{service_id = PFservice_id, event_type = PFevent_type, params = PFparams}, #event{service_id = NFservice_id, event_type = NFevent_type, params = NFparams}, _) -> - #event{service_id = - if NFservice_id =:= undefined -> PFservice_id; - true -> NFservice_id - end, - event_type = - if NFevent_type =:= undefined -> PFevent_type; - true -> NFevent_type - end, - params = - if NFparams =:= undefined -> PFparams; - true -> NFparams - end}. - --compile({nowarn_unused_function,merge_msg_ping/3}). -merge_msg_ping(#ping{adcode = PFadcode, boot_time = PFboot_time, province = PFprovince, city = PFcity, efka_version = PFefka_version, kernel_arch = PFkernel_arch, ips = PFips, cpu_core = PFcpu_core, cpu_load = PFcpu_load, - cpu_temperature = PFcpu_temperature, disk = PFdisk, memory = PFmemory, interfaces = PFinterfaces}, - #ping{adcode = NFadcode, boot_time = NFboot_time, province = NFprovince, city = NFcity, efka_version = NFefka_version, kernel_arch = NFkernel_arch, ips = NFips, cpu_core = NFcpu_core, cpu_load = NFcpu_load, cpu_temperature = NFcpu_temperature, - disk = NFdisk, memory = NFmemory, interfaces = NFinterfaces}, - TrUserData) -> - #ping{adcode = - if NFadcode =:= undefined -> PFadcode; - true -> NFadcode - end, - boot_time = - if NFboot_time =:= undefined -> PFboot_time; - true -> NFboot_time - end, - province = - if NFprovince =:= undefined -> PFprovince; - true -> NFprovince - end, - city = - if NFcity =:= undefined -> PFcity; - true -> NFcity - end, - efka_version = - if NFefka_version =:= undefined -> PFefka_version; - true -> NFefka_version - end, - kernel_arch = - if NFkernel_arch =:= undefined -> PFkernel_arch; - true -> NFkernel_arch - end, - ips = - if PFips /= undefined, NFips /= undefined -> 'erlang_++'(PFips, NFips, TrUserData); - PFips == undefined -> NFips; - NFips == undefined -> PFips - end, - cpu_core = - if NFcpu_core =:= undefined -> PFcpu_core; - true -> NFcpu_core - end, - cpu_load = - if NFcpu_load =:= undefined -> PFcpu_load; - true -> NFcpu_load - end, - cpu_temperature = - if NFcpu_temperature =:= undefined -> PFcpu_temperature; - true -> NFcpu_temperature - end, - disk = - if PFdisk /= undefined, NFdisk /= undefined -> 'erlang_++'(PFdisk, NFdisk, TrUserData); - PFdisk == undefined -> NFdisk; - NFdisk == undefined -> PFdisk - end, - memory = - if PFmemory /= undefined, NFmemory /= undefined -> 'erlang_++'(PFmemory, NFmemory, TrUserData); - PFmemory == undefined -> NFmemory; - NFmemory == undefined -> PFmemory - end, - interfaces = - if NFinterfaces =:= undefined -> PFinterfaces; - true -> NFinterfaces - end}. - - -verify_msg(Msg) when tuple_size(Msg) >= 1 -> verify_msg(Msg, element(1, Msg), []); -verify_msg(X) -> mk_type_error(not_a_known_message, X, []). - -verify_msg(Msg, MsgName) when is_atom(MsgName) -> verify_msg(Msg, MsgName, []); -verify_msg(Msg, Opts) when tuple_size(Msg) >= 1 -> verify_msg(Msg, element(1, Msg), Opts); -verify_msg(X, _Opts) -> mk_type_error(not_a_known_message, X, []). - -verify_msg(Msg, MsgName, Opts) -> - TrUserData = proplists:get_value(user_data, Opts), - case MsgName of - auth_request -> v_msg_auth_request(Msg, [MsgName], TrUserData); - auth_reply -> v_msg_auth_reply(Msg, [MsgName], TrUserData); - pub -> v_msg_pub(Msg, [MsgName], TrUserData); - command -> v_msg_command(Msg, [MsgName], TrUserData); - rpc_deploy -> v_msg_rpc_deploy(Msg, [MsgName], TrUserData); - rpc_start_container -> v_msg_rpc_start_container(Msg, [MsgName], TrUserData); - rpc_stop_container -> v_msg_rpc_stop_container(Msg, [MsgName], TrUserData); - rpc_config_container -> v_msg_rpc_config_container(Msg, [MsgName], TrUserData); - fetch_task_log -> v_msg_fetch_task_log(Msg, [MsgName], TrUserData); - container_config -> v_msg_container_config(Msg, [MsgName], TrUserData); - data -> v_msg_data(Msg, [MsgName], TrUserData); - event -> v_msg_event(Msg, [MsgName], TrUserData); - ping -> v_msg_ping(Msg, [MsgName], TrUserData); - _ -> mk_type_error(not_a_known_message, Msg, []) - end. - - --compile({nowarn_unused_function,v_msg_auth_request/3}). --dialyzer({nowarn_function,v_msg_auth_request/3}). -v_msg_auth_request(#auth_request{uuid = F1, username = F2, salt = F3, token = F4, timestamp = F5}, Path, TrUserData) -> - if F1 == undefined -> ok; - true -> v_type_string(F1, [uuid | Path], TrUserData) - end, - if F2 == undefined -> ok; - true -> v_type_string(F2, [username | Path], TrUserData) - end, - if F3 == undefined -> ok; - true -> v_type_string(F3, [salt | Path], TrUserData) - end, - if F4 == undefined -> ok; - true -> v_type_string(F4, [token | Path], TrUserData) - end, - if F5 == undefined -> ok; - true -> v_type_uint32(F5, [timestamp | Path], TrUserData) - end, - ok; -v_msg_auth_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, auth_request}, X, Path). - --compile({nowarn_unused_function,v_msg_auth_reply/3}). --dialyzer({nowarn_function,v_msg_auth_reply/3}). -v_msg_auth_reply(#auth_reply{code = F1, message = F2}, Path, TrUserData) -> - if F1 == undefined -> ok; - true -> v_type_uint32(F1, [code | Path], TrUserData) - end, - if F2 == undefined -> ok; - true -> v_type_string(F2, [message | Path], TrUserData) - end, - ok; -v_msg_auth_reply(X, Path, _TrUserData) -> mk_type_error({expected_msg, auth_reply}, X, Path). - --compile({nowarn_unused_function,v_msg_pub/3}). --dialyzer({nowarn_function,v_msg_pub/3}). -v_msg_pub(#pub{topic = F1, content = F2}, Path, TrUserData) -> - if F1 == undefined -> ok; - true -> v_type_string(F1, [topic | Path], TrUserData) - end, - if F2 == undefined -> ok; - true -> v_type_bytes(F2, [content | Path], TrUserData) - end, - ok; -v_msg_pub(X, Path, _TrUserData) -> mk_type_error({expected_msg, pub}, X, Path). - --compile({nowarn_unused_function,v_msg_command/3}). --dialyzer({nowarn_function,v_msg_command/3}). -v_msg_command(#command{command_type = F1, command = F2}, Path, TrUserData) -> - if F1 == undefined -> ok; - true -> v_type_string(F1, [command_type | Path], TrUserData) - end, - if F2 == undefined -> ok; - true -> v_type_bytes(F2, [command | Path], TrUserData) - end, - ok; -v_msg_command(X, Path, _TrUserData) -> mk_type_error({expected_msg, command}, X, Path). - --compile({nowarn_unused_function,v_msg_rpc_deploy/3}). --dialyzer({nowarn_function,v_msg_rpc_deploy/3}). -v_msg_rpc_deploy(#rpc_deploy{packet_id = F1, task_id = F2, config = F3}, Path, TrUserData) -> - if F1 == undefined -> ok; - true -> v_type_uint32(F1, [packet_id | Path], TrUserData) - end, - if F2 == undefined -> ok; - true -> v_type_uint32(F2, [task_id | Path], TrUserData) - end, - if F3 == undefined -> ok; - true -> v_type_string(F3, [config | Path], TrUserData) - end, - ok; -v_msg_rpc_deploy(X, Path, _TrUserData) -> mk_type_error({expected_msg, rpc_deploy}, X, Path). - --compile({nowarn_unused_function,v_msg_rpc_start_container/3}). --dialyzer({nowarn_function,v_msg_rpc_start_container/3}). -v_msg_rpc_start_container(#rpc_start_container{packet_id = F1, container_name = F2}, Path, TrUserData) -> - if F1 == undefined -> ok; - true -> v_type_uint32(F1, [packet_id | Path], TrUserData) - end, - if F2 == undefined -> ok; - true -> v_type_string(F2, [container_name | Path], TrUserData) - end, - ok; -v_msg_rpc_start_container(X, Path, _TrUserData) -> mk_type_error({expected_msg, rpc_start_container}, X, Path). - --compile({nowarn_unused_function,v_msg_rpc_stop_container/3}). --dialyzer({nowarn_function,v_msg_rpc_stop_container/3}). -v_msg_rpc_stop_container(#rpc_stop_container{packet_id = F1, container_name = F2}, Path, TrUserData) -> - if F1 == undefined -> ok; - true -> v_type_uint32(F1, [packet_id | Path], TrUserData) - end, - if F2 == undefined -> ok; - true -> v_type_string(F2, [container_name | Path], TrUserData) - end, - ok; -v_msg_rpc_stop_container(X, Path, _TrUserData) -> mk_type_error({expected_msg, rpc_stop_container}, X, Path). - --compile({nowarn_unused_function,v_msg_rpc_config_container/3}). --dialyzer({nowarn_function,v_msg_rpc_config_container/3}). -v_msg_rpc_config_container(#rpc_config_container{packet_id = F1, container_name = F2, config = F3}, Path, TrUserData) -> - if F1 == undefined -> ok; - true -> v_type_uint32(F1, [packet_id | Path], TrUserData) - end, - if F2 == undefined -> ok; - true -> v_type_string(F2, [container_name | Path], TrUserData) - end, - if F3 == undefined -> ok; - true -> v_type_bytes(F3, [config | Path], TrUserData) - end, - ok; -v_msg_rpc_config_container(X, Path, _TrUserData) -> mk_type_error({expected_msg, rpc_config_container}, X, Path). - --compile({nowarn_unused_function,v_msg_fetch_task_log/3}). --dialyzer({nowarn_function,v_msg_fetch_task_log/3}). -v_msg_fetch_task_log(#fetch_task_log{task_id = F1}, Path, TrUserData) -> - if F1 == undefined -> ok; - true -> v_type_uint32(F1, [task_id | Path], TrUserData) - end, - ok; -v_msg_fetch_task_log(X, Path, _TrUserData) -> mk_type_error({expected_msg, fetch_task_log}, X, Path). - --compile({nowarn_unused_function,v_msg_container_config/3}). --dialyzer({nowarn_function,v_msg_container_config/3}). -v_msg_container_config(#container_config{container_name = F1, config = F2}, Path, TrUserData) -> - if F1 == undefined -> ok; - true -> v_type_string(F1, [container_name | Path], TrUserData) - end, - if F2 == undefined -> ok; - true -> v_type_bytes(F2, [config | Path], TrUserData) - end, - ok; -v_msg_container_config(X, Path, _TrUserData) -> mk_type_error({expected_msg, container_config}, X, Path). - --compile({nowarn_unused_function,v_msg_data/3}). --dialyzer({nowarn_function,v_msg_data/3}). -v_msg_data(#data{service_id = F1, device_uuid = F2, route_key = F3, metric = F4}, Path, TrUserData) -> - if F1 == undefined -> ok; - true -> v_type_string(F1, [service_id | Path], TrUserData) - end, - if F2 == undefined -> ok; - true -> v_type_string(F2, [device_uuid | Path], TrUserData) - end, - if F3 == undefined -> ok; - true -> v_type_string(F3, [route_key | Path], TrUserData) - end, - if F4 == undefined -> ok; - true -> v_type_bytes(F4, [metric | Path], TrUserData) - end, - ok; -v_msg_data(X, Path, _TrUserData) -> mk_type_error({expected_msg, data}, X, Path). - --compile({nowarn_unused_function,v_msg_event/3}). --dialyzer({nowarn_function,v_msg_event/3}). -v_msg_event(#event{service_id = F1, event_type = F2, params = F3}, Path, TrUserData) -> - if F1 == undefined -> ok; - true -> v_type_string(F1, [service_id | Path], TrUserData) - end, - if F2 == undefined -> ok; - true -> v_type_uint32(F2, [event_type | Path], TrUserData) - end, - if F3 == undefined -> ok; - true -> v_type_string(F3, [params | Path], TrUserData) - end, - ok; -v_msg_event(X, Path, _TrUserData) -> mk_type_error({expected_msg, event}, X, Path). - --compile({nowarn_unused_function,v_msg_ping/3}). --dialyzer({nowarn_function,v_msg_ping/3}). -v_msg_ping(#ping{adcode = F1, boot_time = F2, province = F3, city = F4, efka_version = F5, kernel_arch = F6, ips = F7, cpu_core = F8, cpu_load = F9, cpu_temperature = F10, disk = F11, memory = F12, interfaces = F13}, Path, TrUserData) -> - if F1 == undefined -> ok; - true -> v_type_string(F1, [adcode | Path], TrUserData) - end, - if F2 == undefined -> ok; - true -> v_type_uint32(F2, [boot_time | Path], TrUserData) - end, - if F3 == undefined -> ok; - true -> v_type_string(F3, [province | Path], TrUserData) - end, - if F4 == undefined -> ok; - true -> v_type_string(F4, [city | Path], TrUserData) - end, - if F5 == undefined -> ok; - true -> v_type_string(F5, [efka_version | Path], TrUserData) - end, - if F6 == undefined -> ok; - true -> v_type_string(F6, [kernel_arch | Path], TrUserData) - end, - if is_list(F7) -> - _ = [v_type_string(Elem, [ips | Path], TrUserData) || Elem <- F7], - ok; - true -> mk_type_error({invalid_list_of, string}, F7, [ips | Path]) - end, - if F8 == undefined -> ok; - true -> v_type_uint32(F8, [cpu_core | Path], TrUserData) - end, - if F9 == undefined -> ok; - true -> v_type_uint32(F9, [cpu_load | Path], TrUserData) - end, - if F10 == undefined -> ok; - true -> v_type_float(F10, [cpu_temperature | Path], TrUserData) - end, - if is_list(F11) -> - _ = [v_type_int32(Elem, [disk | Path], TrUserData) || Elem <- F11], - ok; - true -> mk_type_error({invalid_list_of, int32}, F11, [disk | Path]) - end, - if is_list(F12) -> - _ = [v_type_int32(Elem, [memory | Path], TrUserData) || Elem <- F12], - ok; - true -> mk_type_error({invalid_list_of, int32}, F12, [memory | Path]) - end, - if F13 == undefined -> ok; - true -> v_type_string(F13, [interfaces | Path], TrUserData) - end, - ok; -v_msg_ping(X, Path, _TrUserData) -> mk_type_error({expected_msg, ping}, X, Path). - --compile({nowarn_unused_function,v_type_int32/3}). --dialyzer({nowarn_function,v_type_int32/3}). -v_type_int32(N, _Path, _TrUserData) when is_integer(N), -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_uint32/3}). --dialyzer({nowarn_function,v_type_uint32/3}). -v_type_uint32(N, _Path, _TrUserData) when is_integer(N), 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_float/3}). --dialyzer({nowarn_function,v_type_float/3}). -v_type_float(N, _Path, _TrUserData) when is_float(N) -> ok; -v_type_float(N, _Path, _TrUserData) when is_integer(N) -> ok; -v_type_float(infinity, _Path, _TrUserData) -> ok; -v_type_float('-infinity', _Path, _TrUserData) -> ok; -v_type_float(nan, _Path, _TrUserData) -> ok; -v_type_float(X, Path, _TrUserData) -> mk_type_error(bad_float_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, auth_request}, - [#field{name = uuid, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}, - #field{name = username, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []}, - #field{name = salt, fnum = 4, rnum = 4, type = string, occurrence = optional, opts = []}, - #field{name = token, fnum = 5, rnum = 5, type = string, occurrence = optional, opts = []}, - #field{name = timestamp, fnum = 6, rnum = 6, type = uint32, occurrence = optional, opts = []}]}, - {{msg, auth_reply}, [#field{name = code, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []}, #field{name = message, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []}]}, - {{msg, pub}, [#field{name = topic, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}, #field{name = content, fnum = 2, rnum = 3, type = bytes, occurrence = optional, opts = []}]}, - {{msg, command}, [#field{name = command_type, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}, #field{name = command, fnum = 2, rnum = 3, type = bytes, occurrence = optional, opts = []}]}, - {{msg, rpc_deploy}, - [#field{name = packet_id, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []}, - #field{name = task_id, fnum = 2, rnum = 3, type = uint32, occurrence = optional, opts = []}, - #field{name = config, fnum = 3, rnum = 4, type = string, occurrence = optional, opts = []}]}, - {{msg, rpc_start_container}, [#field{name = packet_id, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []}, #field{name = container_name, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []}]}, - {{msg, rpc_stop_container}, [#field{name = packet_id, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []}, #field{name = container_name, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []}]}, - {{msg, rpc_config_container}, - [#field{name = packet_id, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []}, - #field{name = container_name, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []}, - #field{name = config, fnum = 3, rnum = 4, type = bytes, occurrence = optional, opts = []}]}, - {{msg, fetch_task_log}, [#field{name = task_id, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []}]}, - {{msg, container_config}, [#field{name = container_name, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}, #field{name = config, fnum = 2, rnum = 3, type = bytes, occurrence = optional, opts = []}]}, - {{msg, data}, - [#field{name = service_id, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}, - #field{name = device_uuid, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []}, - #field{name = route_key, fnum = 3, rnum = 4, type = string, occurrence = optional, opts = []}, - #field{name = metric, fnum = 4, rnum = 5, type = bytes, occurrence = optional, opts = []}]}, - {{msg, event}, - [#field{name = service_id, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}, - #field{name = event_type, fnum = 2, rnum = 3, type = uint32, occurrence = optional, opts = []}, - #field{name = params, fnum = 3, rnum = 4, type = string, occurrence = optional, opts = []}]}, - {{msg, ping}, - [#field{name = adcode, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}, - #field{name = boot_time, fnum = 2, rnum = 3, type = uint32, occurrence = optional, opts = []}, - #field{name = province, fnum = 3, rnum = 4, type = string, occurrence = optional, opts = []}, - #field{name = city, fnum = 4, rnum = 5, type = string, occurrence = optional, opts = []}, - #field{name = efka_version, fnum = 5, rnum = 6, type = string, occurrence = optional, opts = []}, - #field{name = kernel_arch, fnum = 6, rnum = 7, type = string, occurrence = optional, opts = []}, - #field{name = ips, fnum = 7, rnum = 8, type = string, occurrence = repeated, opts = []}, - #field{name = cpu_core, fnum = 8, rnum = 9, type = uint32, occurrence = optional, opts = []}, - #field{name = cpu_load, fnum = 9, rnum = 10, type = uint32, occurrence = optional, opts = []}, - #field{name = cpu_temperature, fnum = 10, rnum = 11, type = float, occurrence = optional, opts = []}, - #field{name = disk, fnum = 11, rnum = 12, type = int32, occurrence = repeated, opts = [packed]}, - #field{name = memory, fnum = 12, rnum = 13, type = int32, occurrence = repeated, opts = [packed]}, - #field{name = interfaces, fnum = 13, rnum = 14, type = string, occurrence = optional, opts = []}]}]. - - -get_msg_names() -> [auth_request, auth_reply, pub, command, rpc_deploy, rpc_start_container, rpc_stop_container, rpc_config_container, fetch_task_log, container_config, data, event, ping]. - - -get_group_names() -> []. - - -get_msg_or_group_names() -> [auth_request, auth_reply, pub, command, rpc_deploy, rpc_start_container, rpc_stop_container, rpc_config_container, fetch_task_log, container_config, data, event, ping]. - - -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(auth_request) -> - [#field{name = uuid, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}, - #field{name = username, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []}, - #field{name = salt, fnum = 4, rnum = 4, type = string, occurrence = optional, opts = []}, - #field{name = token, fnum = 5, rnum = 5, type = string, occurrence = optional, opts = []}, - #field{name = timestamp, fnum = 6, rnum = 6, type = uint32, occurrence = optional, opts = []}]; -find_msg_def(auth_reply) -> [#field{name = code, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []}, #field{name = message, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []}]; -find_msg_def(pub) -> [#field{name = topic, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}, #field{name = content, fnum = 2, rnum = 3, type = bytes, occurrence = optional, opts = []}]; -find_msg_def(command) -> [#field{name = command_type, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}, #field{name = command, fnum = 2, rnum = 3, type = bytes, occurrence = optional, opts = []}]; -find_msg_def(rpc_deploy) -> - [#field{name = packet_id, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []}, - #field{name = task_id, fnum = 2, rnum = 3, type = uint32, occurrence = optional, opts = []}, - #field{name = config, fnum = 3, rnum = 4, type = string, occurrence = optional, opts = []}]; -find_msg_def(rpc_start_container) -> [#field{name = packet_id, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []}, #field{name = container_name, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []}]; -find_msg_def(rpc_stop_container) -> [#field{name = packet_id, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []}, #field{name = container_name, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []}]; -find_msg_def(rpc_config_container) -> - [#field{name = packet_id, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []}, - #field{name = container_name, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []}, - #field{name = config, fnum = 3, rnum = 4, type = bytes, occurrence = optional, opts = []}]; -find_msg_def(fetch_task_log) -> [#field{name = task_id, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []}]; -find_msg_def(container_config) -> [#field{name = container_name, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}, #field{name = config, fnum = 2, rnum = 3, type = bytes, occurrence = optional, opts = []}]; -find_msg_def(data) -> - [#field{name = service_id, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}, - #field{name = device_uuid, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []}, - #field{name = route_key, fnum = 3, rnum = 4, type = string, occurrence = optional, opts = []}, - #field{name = metric, fnum = 4, rnum = 5, type = bytes, occurrence = optional, opts = []}]; -find_msg_def(event) -> - [#field{name = service_id, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}, - #field{name = event_type, fnum = 2, rnum = 3, type = uint32, occurrence = optional, opts = []}, - #field{name = params, fnum = 3, rnum = 4, type = string, occurrence = optional, opts = []}]; -find_msg_def(ping) -> - [#field{name = adcode, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}, - #field{name = boot_time, fnum = 2, rnum = 3, type = uint32, occurrence = optional, opts = []}, - #field{name = province, fnum = 3, rnum = 4, type = string, occurrence = optional, opts = []}, - #field{name = city, fnum = 4, rnum = 5, type = string, occurrence = optional, opts = []}, - #field{name = efka_version, fnum = 5, rnum = 6, type = string, occurrence = optional, opts = []}, - #field{name = kernel_arch, fnum = 6, rnum = 7, type = string, occurrence = optional, opts = []}, - #field{name = ips, fnum = 7, rnum = 8, type = string, occurrence = repeated, opts = []}, - #field{name = cpu_core, fnum = 8, rnum = 9, type = uint32, occurrence = optional, opts = []}, - #field{name = cpu_load, fnum = 9, rnum = 10, type = uint32, occurrence = optional, opts = []}, - #field{name = cpu_temperature, fnum = 10, rnum = 11, type = float, occurrence = optional, opts = []}, - #field{name = disk, fnum = 11, rnum = 12, type = int32, occurrence = repeated, opts = [packed]}, - #field{name = memory, fnum = 12, rnum = 13, type = int32, occurrence = repeated, opts = [packed]}, - #field{name = interfaces, fnum = 13, rnum = 14, type = string, 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() -> []. - - -get_service_def(_) -> error. - - -get_rpc_names(_) -> error. - - -find_rpc_def(_, _) -> error. - - - --spec fetch_rpc_def(_, _) -> no_return(). -fetch_rpc_def(ServiceName, RpcName) -> erlang:error({no_such_rpc, ServiceName, RpcName}). - - -%% Convert a a fully qualified (ie with package name) service name -%% as a binary to a service name as an atom. --spec fqbin_to_service_name(_) -> no_return(). -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. --spec service_name_to_fqbin(_) -> no_return(). -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. --spec fqbins_to_service_and_rpc_name(_, _) -> no_return(). -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. --spec service_and_rpc_name_to_fqbins(_, _) -> no_return(). -service_and_rpc_name_to_fqbins(S, R) -> error({gpb_error, {badservice_or_rpc, {S, R}}}). - - -fqbin_to_msg_name(<<"AuthRequest">>) -> auth_request; -fqbin_to_msg_name(<<"AuthReply">>) -> auth_reply; -fqbin_to_msg_name(<<"Pub">>) -> pub; -fqbin_to_msg_name(<<"Command">>) -> command; -fqbin_to_msg_name(<<"RPCDeploy">>) -> rpc_deploy; -fqbin_to_msg_name(<<"RPCStartContainer">>) -> rpc_start_container; -fqbin_to_msg_name(<<"RPCStopContainer">>) -> rpc_stop_container; -fqbin_to_msg_name(<<"RPCConfigContainer">>) -> rpc_config_container; -fqbin_to_msg_name(<<"FetchTaskLog">>) -> fetch_task_log; -fqbin_to_msg_name(<<"ContainerConfig">>) -> container_config; -fqbin_to_msg_name(<<"Data">>) -> data; -fqbin_to_msg_name(<<"Event">>) -> event; -fqbin_to_msg_name(<<"Ping">>) -> ping; -fqbin_to_msg_name(E) -> error({gpb_error, {badmsg, E}}). - - -msg_name_to_fqbin(auth_request) -> <<"AuthRequest">>; -msg_name_to_fqbin(auth_reply) -> <<"AuthReply">>; -msg_name_to_fqbin(pub) -> <<"Pub">>; -msg_name_to_fqbin(command) -> <<"Command">>; -msg_name_to_fqbin(rpc_deploy) -> <<"RPCDeploy">>; -msg_name_to_fqbin(rpc_start_container) -> <<"RPCStartContainer">>; -msg_name_to_fqbin(rpc_stop_container) -> <<"RPCStopContainer">>; -msg_name_to_fqbin(rpc_config_container) -> <<"RPCConfigContainer">>; -msg_name_to_fqbin(fetch_task_log) -> <<"FetchTaskLog">>; -msg_name_to_fqbin(container_config) -> <<"ContainerConfig">>; -msg_name_to_fqbin(data) -> <<"Data">>; -msg_name_to_fqbin(event) -> <<"Event">>; -msg_name_to_fqbin(ping) -> <<"Ping">>; -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() -> undefined. - - -%% Whether or not the message names -%% are prepended with package name or not. -uses_packages() -> false. - - -source_basename() -> "message_pb.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() -> ["message_pb.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() -> ["message_pb"]. - - -get_msg_containment("message_pb") -> [auth_reply, auth_request, command, container_config, data, event, fetch_task_log, ping, pub, rpc_config_container, rpc_deploy, rpc_start_container, rpc_stop_container]; -get_msg_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_pkg_containment("message_pb") -> undefined; -get_pkg_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_service_containment("message_pb") -> []; -get_service_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_rpc_containment("message_pb") -> []; -get_rpc_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_enum_containment("message_pb") -> []; -get_enum_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_proto_by_msg_name_as_fqbin(<<"Data">>) -> "message_pb"; -get_proto_by_msg_name_as_fqbin(<<"RPCStopContainer">>) -> "message_pb"; -get_proto_by_msg_name_as_fqbin(<<"RPCStartContainer">>) -> "message_pb"; -get_proto_by_msg_name_as_fqbin(<<"RPCConfigContainer">>) -> "message_pb"; -get_proto_by_msg_name_as_fqbin(<<"Pub">>) -> "message_pb"; -get_proto_by_msg_name_as_fqbin(<<"Event">>) -> "message_pb"; -get_proto_by_msg_name_as_fqbin(<<"Command">>) -> "message_pb"; -get_proto_by_msg_name_as_fqbin(<<"AuthRequest">>) -> "message_pb"; -get_proto_by_msg_name_as_fqbin(<<"Ping">>) -> "message_pb"; -get_proto_by_msg_name_as_fqbin(<<"FetchTaskLog">>) -> "message_pb"; -get_proto_by_msg_name_as_fqbin(<<"ContainerConfig">>) -> "message_pb"; -get_proto_by_msg_name_as_fqbin(<<"RPCDeploy">>) -> "message_pb"; -get_proto_by_msg_name_as_fqbin(<<"AuthReply">>) -> "message_pb"; -get_proto_by_msg_name_as_fqbin(E) -> error({gpb_error, {badmsg, E}}). - - --spec get_proto_by_service_name_as_fqbin(_) -> no_return(). -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}}). - - --spec get_protos_by_pkg_name_as_fqbin(_) -> no_return(). -get_protos_by_pkg_name_as_fqbin(E) -> error({gpb_error, {badpkg, E}}). - - - -gpb_version_as_string() -> - "4.21.1". - -gpb_version_as_list() -> - [4,21,1]. - -gpb_version_source() -> - "git".