mqtt_message, mqtt_delivery
This commit is contained in:
parent
f166143cd0
commit
123f9b444c
|
@ -14,8 +14,6 @@
|
||||||
%% limitations under the License.
|
%% limitations under the License.
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
||||||
%% MQTT Broker Header
|
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Banner
|
%% Banner
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
@ -77,30 +75,10 @@
|
||||||
|
|
||||||
-type(mqtt_subscription() :: #mqtt_subscription{}).
|
-type(mqtt_subscription() :: #mqtt_subscription{}).
|
||||||
|
|
||||||
%% {<<"a/b/c">>, '$queue', <<"client1">>}
|
|
||||||
%% {<<"a/b/c">>, undefined, <0.31.0>}
|
|
||||||
%% {<<"a/b/c">>, <<"group1">>, <<"client2">>}
|
|
||||||
%% -record(mqtt_subscription, {topic, share, destination :: pid() | binary()}).
|
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
|
||||||
%% MQTT Credential
|
|
||||||
%%--------------------------------------------------------------------
|
|
||||||
-record(mqtt_credential, {
|
|
||||||
clientid :: binary() | undefined, %% ClientId
|
|
||||||
username :: binary() | undefined, %% Username
|
|
||||||
token :: binary() | undefined,
|
|
||||||
cookie :: binary() | undefined
|
|
||||||
}).
|
|
||||||
|
|
||||||
-type(mqtt_credential() :: #mqtt_credential{}).
|
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% MQTT Client
|
%% MQTT Client
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
||||||
-type ws_header_key() :: atom() | binary() | string().
|
|
||||||
-type ws_header_val() :: atom() | binary() | string() | integer().
|
|
||||||
|
|
||||||
-record(mqtt_client, {
|
-record(mqtt_client, {
|
||||||
client_id :: binary() | undefined,
|
client_id :: binary() | undefined,
|
||||||
client_pid :: pid(),
|
client_pid :: pid(),
|
||||||
|
@ -110,7 +88,9 @@
|
||||||
proto_ver :: 3 | 4,
|
proto_ver :: 3 | 4,
|
||||||
keepalive = 0,
|
keepalive = 0,
|
||||||
will_topic :: undefined | binary(),
|
will_topic :: undefined | binary(),
|
||||||
ws_initial_headers :: list({ws_header_key(), ws_header_val()}),
|
token :: binary() | undefined, %% auth token
|
||||||
|
cookie :: binary() | undefined, %% auth cookie
|
||||||
|
%%ws_initial_headers :: list({ws_header_key(), ws_header_val()}),
|
||||||
connected_at :: erlang:timestamp()
|
connected_at :: erlang:timestamp()
|
||||||
}).
|
}).
|
||||||
|
|
||||||
|
@ -135,20 +115,17 @@
|
||||||
-type(mqtt_pktid() :: 1..16#ffff | undefined).
|
-type(mqtt_pktid() :: 1..16#ffff | undefined).
|
||||||
|
|
||||||
-record(mqtt_message, {
|
-record(mqtt_message, {
|
||||||
msgid :: mqtt_msgid(), %% Global unique message ID
|
msgid :: mqtt_msgid(), %% Global unique message ID
|
||||||
pktid :: mqtt_pktid(), %% PacketId
|
pktid :: mqtt_pktid(), %% PacketId
|
||||||
topic :: binary(), %% Topic that the message is published to
|
topic :: binary(), %% Topic that the message is published to
|
||||||
sender :: pid(), %% Pid of the sender/publisher
|
qos = 0 :: 0 | 1 | 2, %% Message QoS
|
||||||
from,
|
flags = [] :: [retain | dup | sys], %% Message Flags
|
||||||
credential :: mqtt_credential(), %% Credential of the sender/publisher
|
retain = false :: boolean(), %% Retain flag
|
||||||
qos = 0 :: 0 | 1 | 2, %% Message QoS
|
dup = false :: boolean(), %% Dup flag
|
||||||
flags = [] :: [retain | dup | sys], %% Message Flags
|
sys = false :: boolean(), %% $SYS flag
|
||||||
retain = false :: boolean(), %% Retain flag
|
headers = [] :: list(),
|
||||||
dup = false :: boolean(), %% Dup flag
|
payload :: binary(), %% Payload
|
||||||
sys = false :: boolean(), %% $SYS flag
|
timestamp :: erlang:timestamp() %% os:timestamp
|
||||||
payload :: binary(), %% Payload
|
|
||||||
timestamp :: erlang:timestamp(), %% os:timestamp
|
|
||||||
extra = [] :: list()
|
|
||||||
}).
|
}).
|
||||||
|
|
||||||
-type(mqtt_message() :: #mqtt_message{}).
|
-type(mqtt_message() :: #mqtt_message{}).
|
||||||
|
@ -157,7 +134,9 @@
|
||||||
%% MQTT Delivery
|
%% MQTT Delivery
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
-record(mqtt_delivery, {
|
-record(mqtt_delivery, {
|
||||||
message :: mqtt_message(), %% Message
|
sender :: pid(), %% Pid of the sender/publisher
|
||||||
|
from :: binary(),
|
||||||
|
message :: mqtt_message(), %% Message
|
||||||
flows :: list()
|
flows :: list()
|
||||||
}).
|
}).
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue