Start of dynamic control topics.
This commit is contained in:
parent
e414d92eb6
commit
de5a820fe2
@ -8,6 +8,7 @@ set (MOSQ_SRCS
|
||||
conf.c
|
||||
conf_includedir.c
|
||||
context.c
|
||||
control.c
|
||||
database.c
|
||||
handle_auth.c
|
||||
handle_connack.c
|
||||
|
@ -15,6 +15,7 @@ OBJS= mosquitto.o \
|
||||
conf.o \
|
||||
conf_includedir.o \
|
||||
context.o \
|
||||
control.o \
|
||||
database.o \
|
||||
handle_auth.o \
|
||||
handle_connack.o \
|
||||
@ -102,6 +103,9 @@ conf_includedir.o : conf_includedir.c mosquitto_broker_internal.h
|
||||
context.o : context.c mosquitto_broker_internal.h
|
||||
${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
|
||||
|
||||
control.o : control.c mosquitto_broker_internal.h
|
||||
${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
|
||||
|
||||
database.o : database.c mosquitto_broker_internal.h
|
||||
${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
|
||||
|
||||
|
29
src/control.c
Normal file
29
src/control.c
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
Copyright (c) 2020 Roger Light <roger@atchoo.org>
|
||||
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are made available under the terms of the Eclipse Public License v1.0
|
||||
and Eclipse Distribution License v1.0 which accompany this distribution.
|
||||
|
||||
The Eclipse Public License is available at
|
||||
http://www.eclipse.org/legal/epl-v10.html
|
||||
and the Eclipse Distribution License is available at
|
||||
http://www.eclipse.org/org/documents/edl-v10.php.
|
||||
|
||||
Contributors:
|
||||
Roger Light - initial implementation and documentation.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "mqtt_protocol.h"
|
||||
#include "mosquitto_broker_internal.h"
|
||||
|
||||
/* Process messages coming in on $CONTROL/<feature>. These messages aren't
|
||||
* passed on to other clients. */
|
||||
int control__process(struct mosquitto_db *db, struct mosquitto *context, struct mosquitto_msg_store *stored)
|
||||
{
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
}
|
@ -248,6 +248,13 @@ int handle__publish(struct mosquitto_db *db, struct mosquitto *context)
|
||||
}
|
||||
|
||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Received PUBLISH from %s (d%d, q%d, r%d, m%d, '%s', ... (%ld bytes))", context->id, dup, msg->qos, msg->retain, msg->source_mid, msg->topic, (long)msg->payloadlen);
|
||||
|
||||
if(!strncmp(msg->topic, "$CONTROL/", 9)){
|
||||
rc = control__process(db, context, msg);
|
||||
db__msg_store_free(msg);
|
||||
return rc;
|
||||
}
|
||||
|
||||
if(msg->qos > 0){
|
||||
db__message_store_find(context, msg->source_mid, &stored);
|
||||
}
|
||||
|
@ -697,6 +697,13 @@ void context__remove_from_by_id(struct mosquitto_db *db, struct mosquitto *conte
|
||||
|
||||
int connect__on_authorised(struct mosquitto_db *db, struct mosquitto *context, void *auth_data_out, uint16_t auth_data_out_len);
|
||||
|
||||
|
||||
/* ============================================================
|
||||
* Control functions
|
||||
* ============================================================ */
|
||||
int control__process(struct mosquitto_db *db, struct mosquitto *context, struct mosquitto_msg_store *stored);
|
||||
|
||||
|
||||
/* ============================================================
|
||||
* Logging functions
|
||||
* ============================================================ */
|
||||
|
Loading…
Reference in New Issue
Block a user