Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
dcdb
dcdb
Commits
25a786f3
Commit
25a786f3
authored
Apr 05, 2013
by
Axel Auweter
Browse files
Started implementing simple MQTT server. Pushed upstream to take home for the weekend.
parent
097466b7
Changes
2
Hide whitespace changes
Inline
Side-by-side
CollectAgent/simplemqttserver.cpp
0 → 100644
View file @
25a786f3
/*
* 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
}
CollectAgent/simplemqttserver.h
0 → 100644
View file @
25a786f3
/*
* 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_ */
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment