1%% This Source Code Form is subject to the terms of the Mozilla Public
2%% License, v. 2.0. If a copy of the MPL was not distributed with this
3%% file, You can obtain one at https://mozilla.org/MPL/2.0/.
4%%
5%% Copyright (c) 2020-2021 VMware, Inc. or its affiliates.  All rights reserved.
6%%
7
8-define(CLIENT_ID_MAXLEN, 23).
9
10%% reader state
11-record(state,      { socket,
12                      conn_name,
13                      await_recv,
14                      deferred_recv,
15                      received_connect_frame,
16                      connection_state,
17                      keepalive,
18                      keepalive_sup,
19                      conserve,
20                      parse_state,
21                      proc_state,
22                      connection,
23                      stats_timer }).
24
25%% processor state
26-record(proc_state, { socket,
27                      subscriptions,
28                      consumer_tags,
29                      unacked_pubs,
30                      awaiting_ack,
31                      awaiting_seqno,
32                      message_id,
33                      client_id,
34                      clean_sess,
35                      will_msg,
36                      channels,
37                      connection,
38                      exchange,
39                      adapter_info,
40                      ssl_login_name,
41                      %% Retained messages handler. See rabbit_mqtt_retainer_sup
42                      %% and rabbit_mqtt_retainer.
43                      retainer_pid,
44                      auth_state,
45                      send_fun,
46                      peer_addr,
47                      mqtt2amqp_fun,
48                      amqp2mqtt_fun,
49                      register_state }).
50
51-record(auth_state, {username,
52                     user,
53                     vhost}).
54
55%% does not include vhost: it is used in
56%% the table name
57-record(retained_message, {topic,
58                           mqtt_msg}).
59
60-define(INFO_ITEMS,
61    [host,
62     port,
63     peer_host,
64     peer_port,
65     protocol,
66     channels,
67     channel_max,
68     frame_max,
69     client_properties,
70     ssl,
71     ssl_protocol,
72     ssl_key_exchange,
73     ssl_cipher,
74     ssl_hash,
75     conn_name,
76     connection_state,
77     connection,
78     consumer_tags,
79     unacked_pubs,
80     awaiting_ack,
81     awaiting_seqno,
82     message_id,
83     client_id,
84     clean_sess,
85     will_msg,
86     exchange,
87     ssl_login_name,
88     retainer_pid,
89     user,
90     vhost]).
91
92-define(MQTT_GUIDE_URL, <<"https://rabbitmq.com/mqtt.html">>).
93