Commit 25a786f3 authored by Axel Auweter's avatar Axel Auweter
Browse files

Started implementing simple MQTT server. Pushed upstream to take home for the weekend.

parent 097466b7
/*
* simplemqttserver.cpp
*
* Created on: Apr 5, 2013
* Author: Axel Auweter
*/
#include "simplemqttserver.h"
SimpleMQTTServer::SimpleMQTTServer()
{
// TODO Auto-generated constructor stub
}
SimpleMQTTServer::~SimpleMQTTServer()
{
// TODO Auto-generated destructor stub
}
/*
* simplemqttserver.h
*
* Created on: Apr 5, 2013
* Author: Axel Auweter
*/
#include <cstdint>
#ifndef SIMPLEMQTTSERVER_H_
#define SIMPLEMQTTSERVER_H_
/*
* Define the number of connections that are handled by each thread.
* If the number of clients exceeds the specified value, a new thread will be spawned.
*/
#define SimpleMQTTConnectionsPerThread 10
#define MQTT_CONNECT 0x1
#define MQTT_CONNACK 0x2
#define MQTT_PUBLISH 0x3
#define MQTT_PUBACK 0x4
#define MQTT_PUBREC 0x5
#define MQTT_PUBREL 0x6
#define MQTT_PUBCOMP 0x7
#define MQTT_SUBSCRIBE 0x8
#define MQTT_SUBACK 0x9
#define MQTT_UNSUBSCRIBE 0xa
#define MQTT_UNSUBACK 0xb
#define MQTT_PINGREQ 0xc
#define MQTT_PINGRESP 0xd
#define MQTT_DISCONNECT 0xe
#pragma pack(push,1)
typedef union {
uint8_t raw[5];
struct {
uint8_t retain :1;
uint8_t qos :2;
uint8_t dup :1;
uint8_t type :4;
uint8_t remaining_length[4];
} bits;
} MQTTFixedHeader;
#pragma pack(pop)
class SimpleMQTTServer
{
protected:
void* run_server_thread(void*);
public:
SimpleMQTTServer();
virtual
~SimpleMQTTServer();
};
#endif /* SIMPLEMQTTSERVER_H_ */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment