Update: Add Aggregate Gateway functions. #127

Signed-off-by: tomoaki <tomoaki@tomy-tech.com>
This commit is contained in:
tomoaki
2018-08-04 17:46:42 +09:00
parent 862e501512
commit f7fc5c49f5
65 changed files with 4368 additions and 1982 deletions

View File

@@ -2,7 +2,7 @@
### **step1. Build the gateway**
````
$ git clone https://github.com/eclipse/paho.mqtt-sn.embedded-c
$ git clone -b experiment https://github.com/eclipse/paho.mqtt-sn.embedded-c
$ cd paho.mqtt-sn.embedded-c/MQTTSNGateway
$ make
$ make install
@@ -22,58 +22,69 @@ $ ./MQTT-SNGateway [-f Config file name]
### **How to Change the configuration of the gateway**
**../gateway.conf** Contents are follows:
````
<pre><dev>
# config file of MQTT-SN Gateway
#
BrokerName=iot.eclipse.org
BrokerPortNo=1883
BrokerSecurePortNo=8883
BrokerSecurePortNo=8883
#
# When AggregateGateway=YES or ClientAuthentication=YES,
# All clients must be specified by the ClientList File
#
AggregateGateway=NO
ClientAuthentication=NO
#ClientsList=/path/to/your_clients.conf
PredefinedTopic=NO
#ClientsList=/path/to/your_clients.conf
QoS-1=NO
OoS-1ProxyName=Proxy007
#PredefinedTopicList=/path/to/your_predefinedTopic.conf
Forwarder=NO
#ForwardersList=/home/tomoaki/tmp/forwarders.conf
#ForwardersList=/path/to/your_forwarers.conf
#RootCAfile=/etc/ssl/certs/ca-certificates.crt
#RootCApath=/etc/ssl/certs/
#CertsFile=/path/to/certKey.pem
#PrivateKey=/path/to/privateKey.pem
GatewayID=1
GatewayName=PahoGateway-01
KeepAlive=900
#LoginID=your_ID
#Password=your_Password
QoS-1=NO
QoS-1ProxyName=Proxy007
#QoS-1ClientsList=/path/to/your_qos-1clients.conf
#RootCAfile=/path/to/your_Root_CA.crt
#RootCApath=/path/to/your_certs_directory/
#CertKey=/path/to/your_cert.pem
#PrivateKey=/path/to/your_private-key.pem
GatewayID=1
GatewayName=PahoGateway-01
KeepAlive=900
#LoginID=your_ID
#Password=your_Password
# UDP
GatewayPortNo=10000
MulticastIP=225.1.1.1
MulticastPortNo=1883
GatewayPortNo=10000
MulticastIP=225.1.1.1
MulticastPortNo=1883
# XBee
Baudrate=38400
SerialDevice=/dev/ttyUSB0
ApiMode=2
````
Baudrate=38400
SerialDevice=/dev/ttyUSB0
ApiMode=2
# LOG
ShearedMemory=NO;
</dev></pre>
**BrokerName** to specify a domain name of the Broker, and **BrokerPortNo** is a port No of the Broker. **BrokerSecurePortNo** is for TLS connection.
**MulticastIP** and **MulticastPortNo** is a multicast address for GWSEARCH messages. Gateway is waiting GWSEARCH and when receiving it send GWINFO message via MulticastIP address. Clients can get the gateway address (Gateway IP address and **GatewayPortNo**) from GWINFO message by means of std::recvfrom().
Client should know the MulticastIP and MulticastPortNo to send a SEARCHGW message.
**GatewayId** is used by GWINFO message.
**KeepAlive** is a duration of ADVERTISE message in seconds.
when **ClientAuthentication** is YES, see MQTTSNGWClient.cpp line53, clients file specified by ClientsList is required. This file defines connect allowed clients by ClientId and SensorNetwork Address. e.g. IP address and Port No.
When **PredefinedTopic** is YES, Pre-definedTopicID file specified by PredefinedTopicList is effective. This file defines Pre-definedTopics of the clients. In this file, ClientID,TopicName and TopicID are declared in CSV format.
When **Forwarder** is YES, Forwarder Encapsulation Message is available. Connectable Forwarders are specifed by ForwardersList file. In this file, ForwarderIds and those sensorNet addresses are declared in CSV format.
When **QoS-1** is YES, QoS-1 PUBLISH Message is available. Clients which allow to send it, are specifed by QoS-1ClientsList file. In this file, ClientsId and those sensorNet addresses are declared in CSV format. QoS-1ProxyName is a ClientId of the proxy.
when **AggregateGateway** or **ClientAuthentication** is **YES**, All clients which connect to the gateway must be declared by a **ClientsList** file.
Format of the file is ClientId and SensorNetwork Address. e.g. IP address and Port No etc, in CSV. more detail see clients.conf
When **PredefinedTopic** is **YES**, **Pre-definedTopicId**s specified by **PredefinedTopicList** are effective. This file defines Pre-definedTopics of the clients. In this file, ClientID,TopicName and TopicID are declared in CSV format.
When **Forwarder** is **YE**S, Forwarder Encapsulation Message is available. Connectable Forwarders are specifed by **ForwardersList** file. In this file, ForwarderIds and those sensorNet addresses are declared in CSV format.