Commit Graph

58 Commits

Author SHA1 Message Date
JianBo He e3489b9d46 refactor(style): improve all types declaration
- Add dialyzer for code analysis
- Correct all the module type declarations
- Use `-type()` to declaration a type instead of `-opaque`
  (It is advantageous to the code dialyzer)

BROKEN CHANGES:
- Add a ?DEFAULT_SUBOPTS for emqx_broker:subscribe/1,2,3
- Remove the needless internal function `emqx_vm:port_info(PortTerm, Keys)`
2020-06-18 17:38:34 +08:00
terry-xiaoyu 6ad65d587e feature(properties): add properties in message header
1. Add MQTT5.0 properties when invoking the hooks.

- Add a new key `properties` into the message header:

  We used to put all of the properties into the `#message.headers`:

  ```erlang
  #message{headers = #{'User-Property' => {<<"reason">>,<<"normal">>},
                       'Message-Expiry-Interval' => 60,
                       allow_publish => true}
  ```

  I put them instead under a single key:

  ```erlang
  #message{headers = #{properties =>
                        #{'User-Property' => {<<"reason">>,<<"normal">>},
                          'Message-Expiry-Interval' => 60},
                       allow_publish => true}
  ```

  Note that the column `properties` may contain all the properties for
  Publish and Will messages.

- Add `disconn_props` into the `Channel.conninfo`

- Add `puback_props` also into the message header:

  ```erlang
  #message{headers = #{puback_props =>
                        #{'User-Property' => {<<"reason">>,<<"normal">>}},
                       allow_publish => true}
  ```

2. Change the data type of `#message.headers` and `#message.flags` to map.

   It used to support `undefined`.
2020-06-17 18:46:26 +08:00
张奇怪 78144c0ca5
Update error log (#3342)
Optimize content of error log
2020-03-27 10:10:23 +08:00
zhouzb caed16f57b Fix `acl_deny_action` 2020-03-05 14:27:41 +08:00
张奇怪 f29a8b0d5c
Mqtt protocol tests (#3237)
Add more test cases for MQTT
2020-02-07 10:07:36 +08:00
JianBo He 7d3a08dc13
Improve 'client.connect', 'client.connack' hooks (#3153) 2020-01-04 10:44:17 +08:00
zhouzb 7ea75f4289 Update copyright 2020-01-03 18:31:08 +08:00
Feng Lee 9a3d16c654 Add 'emqx_packet:info/2' function and test cases 2019-12-30 09:28:38 +08:00
Feng Lee 9c3273a2c6 Improve the process of handling MQTT control packets (#3079) 2019-12-06 19:51:06 +08:00
Feng Lee 20ddd498fc Rename the 'client_id' field to 'clientid' 2019-09-24 17:06:25 +08:00
Feng Lee 98b7e3d948 Rename the type 'client()' to 'client_info()'
- Rename tye type 'client()' to 'client_info()'
- Rename the 'client' field of channel to 'client_info'
- Fix the function specs
2019-09-21 15:27:05 +08:00
Feng Lee 1a3261b186
Merge branch 'develop' into remove-protocol-module 2019-09-20 16:17:44 +08:00
Feng Lee ad7e0ae436 Use 'peerhost' to replace 'peername' 2019-09-18 19:44:28 +08:00
zhouzb 1667cbd359 Fix test cases 2019-09-16 16:05:06 +08:00
Feng Lee 4764a7707c Rewrite the emqx_packet module and improve channel pipeline (#2903)
Add use_username_as_clientid/1 function and Improve function 'pipeline/3'
2019-09-16 14:17:36 +08:00
tigercl 35822ff97a
Fix handling for MQTT spec (#2892)
Fix invalid QoS and protocol name, fix handling for Topic-Alias-Maximum and Maximum-Packet-Size, and send DISCONNECT Packet to client when the session is taken over
2019-09-16 13:51:50 +08:00
zhouzb 5a3645c97e Remove proto_ver field stored in the headers of message 2019-09-06 14:51:52 +08:00
Feng Lee 451f0451ce Add type/1, qos/1 functions 2019-09-05 15:00:54 +08:00
Feng Lee 8b03371a4a Improve the keepalive, connection, channel and session modules (#2813) 2019-08-22 16:38:25 +08:00
Mousse bf942e4bec Handle the retained flag correctly (#2811)
Handle the retained flag correctly
2019-08-22 16:21:27 +08:00
tigercl c1fd5f89f1 Make codes compliance with mqtt protocol specifications (#2790)
* Make codes compliance with mqtt protocol specifications

* Fix test case

* Remove emqx_protocol:puback/4
2019-08-17 09:15:43 +08:00
turtled 91a8dbda56 Fix conflicts 2019-08-09 16:41:11 +08:00
Feng Lee 0a6468cf48 Introduce the 'pipeline' design pattern
- Introduce the 'pipeline' design pattern in emqx_protocol module
- Reame the '{dispatch, ...' to '{deliver, ...' in emqx_broker module
- Rename type 'credentials' to 'client'
2019-07-31 08:09:47 +08:00
terry-xiaoyu b0e2b7db0c Support inter-node messages via RPC cast 2019-07-27 12:59:07 +08:00
Feng Lee 6b84eb0595 Rewrite the channel, protocol and session modules. 2019-07-22 17:08:53 +08:00
Feng Lee c4eb283517 Add spec for validate/1 function 2019-06-25 14:50:51 +08:00
Feng Lee 21162f88b8 Update copyright 2019-06-18 14:27:06 +08:00
JianBo He aad2d7378e Put peername into messsage headers (#2390)
* Put peername into the message.heaers
2019-04-04 13:41:03 +08:00
HeeeJianBo fc2df9aff5 Adapt to new export style 2019-03-22 14:58:24 +08:00
turtled 31e95b56c4 Update Copyright to 2019 2019-01-29 10:43:25 +08:00
spring2maz a2c658ba19 Add acking mechamism for shared dispatch (#1872)
* Add acking mechamism for shared dispatch

For QoS0 messages, no acking
For QoS1/2 messages, 'ACK' at any of events below:
 - ACK when QoS is downgraded to 0
 - Message is sent to connection process
'NACK' at any of events below:
 - Message queue is full and the receiving session starts to drop old messages
 - The receiving session crash
Upon 'NACK', messages are dispatched to the 'next' subscriber in the group,
depending on the shared subscription dispatch strategy.
2018-11-21 22:49:45 +08:00
Gilbert Wong 32d3826440 Replace macro QOS$i to QOS_$I
The two styles of qos macro name in one project is chaotic. It is not
a good practice.

So I change the QOS$i to QOS_$i
2018-11-08 20:42:31 +08:00
Gilbert 4c40f75f4b Request & Response (broker and client) (#1819)
Add request & response support for CONNECT & CONNACK

Prior to this change, there is no validate and specified process for
Request-Response-Information and Response-Information

Also added basic Request/Response functionality to emqx_client implementation
2018-10-18 19:21:05 +02:00
Gilbert Wong d36a34fb59 Fix topic_name validation bug
Prior to this change, Prior to this change, the validation for the mqtt5.0 publish packet
which both contains zero-length topic name and topic alias is wrong.
2018-10-09 17:45:40 +08:00
周子博 1638aff0f9 Remove duplicate match 2018-09-29 14:47:21 +08:00
周子博 064db65206 improve receive maximum in connect packet 2018-09-29 14:47:21 +08:00
Gilbert Wong c145cb89f4 add validate_properties for PUBLISH and fix error for SUB 2018-09-06 15:45:18 +08:00
Gilbert Wong 876a983e93 Pub Packet delivered from client to server cannot contain sub id 2018-09-06 13:37:26 +08:00
Gilbert Wong e6fd7faa4b add format_variable for disconnect packet 2018-08-31 16:24:10 +08:00
Gilbert Wong 1c94566141 add topic alias validate 2018-08-30 23:49:08 +08:00
Feng Lee 2db64cf53c Support 'Message-Expiry-Interval property 2018-08-30 11:42:24 +08:00
Feng Lee a282c7625e Add properties for delivered messages 2018-08-30 00:03:38 +08:00
Feng Lee 567aeb274f Define types in emqx_types, emqx_mqtt_types modules 2018-08-29 23:08:55 +08:00
Feng Lee 1a7d60a7e3 Improve the hooks design for emqx 3.0 2018-08-29 17:27:56 +08:00
Feng Lee 594819b752 Upgrade the publish sequence of QoS1/2 messages 2018-08-29 02:53:22 +08:00
Feng Lee 68cfcf6e0e Pass paho mqtt interoperability tests 2018-08-24 23:19:11 +08:00
Feng Lee 0f052ce352 Upgrade connection, protocol and session modules for MQTT 5.0 2018-08-24 18:39:59 +08:00
Feng Lee f80cd2d986 Improve the MQTT over Websocket connection 2018-08-11 17:57:19 +08:00
Feng Lee 7d0cba9427 Add MQTT 5.0 supports for connection, protocol and session modules 2018-08-06 16:33:10 +08:00
Feng Lee 62aa072f2f Upgrade for MQTT Version 5.0 and Erlang/OTP R21 2018-07-18 13:43:17 +08:00