This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iomanip> | |
#include <iostream> | |
#include <vector> | |
#include <termcolor.hpp> | |
void HexDump(const std::vector<uint8_t>& bytes, std::ostream& stream) | |
{ | |
char buff[17]; | |
size_t i = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* file main.c | |
* author: Zoltan Gyarmati <[email protected]> | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <syslog.h> | |
#include <signal.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd mosquitto/lib | |
cp somewhere/hows.c . | |
gcc hows.c net_mosq.c logging_mosq.c memory_mosq.c messages_mosq.c mosquitto.c read_handle.c read_handle_client.c read_handle_shared.c send_mosq.c send_client_mosq.c time_mosq.c tls_mosq.c util_mosq.c will_mosq.c -I. -I.. -DWITH_TLS -lrt -lssl -lcrypto -o hows | |
./hows |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <mosquitto.h> | |
void my_message_callback(struct mosquitto *mosq, void *obj, const struct mosquitto_message *message) | |
{ | |
if(message->payloadlen){ | |
printf("%s %s\n", message->topic, message->payload); | |
}else{ | |
printf("%s (null)\n", message->topic); | |
} |