2024-06-26 12:57:41 +02:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: 2024 Roger Light <roger@atchoo.org>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: EPL-2.0
|
|
|
|
*
|
|
|
|
* SPDX-FileContributor: 2024 Espressif Systems (Shanghai) CO LTD
|
|
|
|
*/
|
|
|
|
#include "mosquitto_internal.h"
|
|
|
|
#include "mosquitto_broker.h"
|
|
|
|
#include "memory_mosq.h"
|
|
|
|
#include "mqtt_protocol.h"
|
|
|
|
#include "send_mosq.h"
|
|
|
|
#include "util_mosq.h"
|
|
|
|
#include "utlist.h"
|
|
|
|
#include "lib_load.h"
|
2024-12-19 16:36:51 +01:00
|
|
|
#include "mosq_broker.h"
|
2024-06-26 12:57:41 +02:00
|
|
|
|
2024-12-19 16:36:51 +01:00
|
|
|
mosq_message_cb_t g_mosq_message_callback = NULL;
|
2024-06-26 12:57:41 +02:00
|
|
|
|
|
|
|
int mosquitto_callback_register(
|
|
|
|
mosquitto_plugin_id_t *identifier,
|
|
|
|
int event,
|
|
|
|
MOSQ_FUNC_generic_callback cb_func,
|
|
|
|
const void *event_data,
|
|
|
|
void *userdata)
|
|
|
|
{
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
int mosquitto_callback_unregister(
|
|
|
|
mosquitto_plugin_id_t *identifier,
|
|
|
|
int event,
|
|
|
|
MOSQ_FUNC_generic_callback cb_func,
|
|
|
|
const void *event_data)
|
|
|
|
{
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void plugin__handle_tick(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void plugin__handle_disconnect(struct mosquitto *context, int reason)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
int plugin__handle_message(struct mosquitto *context, struct mosquitto_msg_store *stored)
|
|
|
|
{
|
2024-12-19 16:36:51 +01:00
|
|
|
if (g_mosq_message_callback) {
|
|
|
|
g_mosq_message_callback(context->id, stored->topic, stored->payload, stored->payloadlen, stored->qos, stored->retain);
|
|
|
|
}
|
2024-06-26 12:57:41 +02:00
|
|
|
return MOSQ_ERR_SUCCESS;
|
|
|
|
}
|