30 lines
670 B
C
30 lines
670 B
C
/*
|
|
* DOCUMENT of sync to peer
|
|
* if a tcp connection is established, it need to send a subscribe command to
|
|
* root. and root will compare scheduled topic then send it.
|
|
*
|
|
*
|
|
* subscribe command:
|
|
* mpack formatted: [ uint8_t id = 1, char topic[TOPIC_LEN] ]
|
|
*/
|
|
#pragma once
|
|
#include "./storage.h"
|
|
|
|
#define TOPIC_LEN 20
|
|
|
|
struct Meshtalos {
|
|
struct Storage *storage;
|
|
};
|
|
|
|
// struct sync_jobs {
|
|
// // char *tag_name;
|
|
// char topic[TOPIC_LEN];
|
|
// };
|
|
// struct sub {
|
|
// char topic[TOPIC_LEN];
|
|
// struct sub *next;
|
|
// };
|
|
// extern struct sub *sub_list;
|
|
|
|
struct Meshtalos *mtsh_init();
|
|
void mtsh_listen(struct Meshtalos *mtsh, const int worker_port, int http_port);
|