diff --git a/include/message.hrl b/include/protocol.hrl similarity index 57% rename from include/message.hrl rename to include/protocol.hrl index 6673fa3..671bb20 100644 --- a/include/message.hrl +++ b/include/protocol.hrl @@ -2,9 +2,8 @@ %%% @author anlicheng %%% @copyright (C) 2025, %%% @doc -%%% 扩展部分, 1: 支持基于topic的pub/sub机制; 2. 基于target的单点通讯和广播 +%%% 传输层协议常量定义 %%% @end -%%% Created : 21. 4月 2025 17:28 %%%------------------------------------------------------------------- -author("anlicheng"). @@ -39,48 +38,3 @@ %%%% 命令类型子分类, 不需要返回值 %% 授权 -define(COMMAND_AUTH, 16#08). - --record(auth_request, { - uuid :: binary(), - username :: binary(), - salt :: binary(), - token :: binary(), - timestamp :: integer() -}). - --record(auth_reply, { - code :: integer(), - payload :: binary() -}). - --record(pub, { - topic :: binary(), - qos = 0 :: integer(), - content :: binary() -}). - --record(command, { - command_type :: integer(), - command :: binary() -}). - --record(jsonrpc_request, { - method :: binary(), - params = <<>> :: any() -}). - --record(jsonrpc_reply, { - result :: any() | undefined, - error :: any() | undefined -}). - --record(data, { - route_key :: binary(), - metric :: binary() -}). - --record(task_event_stream, { - task_id :: integer(), - type :: binary(), - stream :: binary() -}). \ No newline at end of file diff --git a/src/host/iot_host.erl b/src/host/iot_host.erl index 4682f04..e2b99c8 100644 --- a/src/host/iot_host.erl +++ b/src/host/iot_host.erl @@ -9,7 +9,7 @@ -module(iot_host). -author("aresei"). -include("iot.hrl"). --include("message.hrl"). +-include("protocol.hrl"). -include("message_pb.hrl"). -behaviour(gen_statem). diff --git a/src/transport/tcp/tcp_channel.erl b/src/transport/tcp/tcp_channel.erl index b7a5513..cfb1a19 100644 --- a/src/transport/tcp/tcp_channel.erl +++ b/src/transport/tcp/tcp_channel.erl @@ -8,7 +8,7 @@ %%%------------------------------------------------------------------- -module(tcp_channel). -author("licheng5"). --include("message.hrl"). +-include("protocol.hrl"). -include("message_pb.hrl"). -behaviour(ranch_protocol).