Don't require cJSON in mosquitto_broker.h

pull/2756/merge
Roger A. Light 2 years ago
parent daf5d5f51d
commit bc1315820c

@ -1255,24 +1255,6 @@ mosq_EXPORT int mosquitto_persist_retain_msg_delete(const char *topic);
*/
mosq_EXPORT const char *mosquitto_persistence_location(void);
/* =========================================================================
*
* Section: $CONTROL event helpers
*
* ========================================================================= */
struct mosquitto_control_cmd{
cJSON *j_responses;
cJSON *j_command;
char *correlation_data;
const char *command_name;
};
mosq_EXPORT void mosquitto_control_command_reply(struct mosquitto_control_cmd *cmd, const char *error);
mosq_EXPORT void mosquitto_control_send_response(cJSON *tree, const char* topic);
mosq_EXPORT int mosquitto_control_generic_callback(struct mosquitto_evt_control *event_data, const char *response_topic, void *userdata,
int (*cmd_cb)(struct mosquitto_control_cmd *cmd, struct mosquitto *context, void *userdata));
#ifdef __cplusplus
}
#endif

@ -0,0 +1,59 @@
/*
Copyright (c) 2009-2021 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 2.0
and Eclipse Distribution License v1.0 which accompany this distribution.
The Eclipse Public License is available at
https://www.eclipse.org/legal/epl-2.0/
and the Eclipse Distribution License is available at
http://www.eclipse.org/org/documents/edl-v10.php.
SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
Contributors:
Roger Light - initial implementation and documentation.
*/
/*
* File: mosquitto_control.h
*
* This header contains functions for use by plugins using the CONTROL event.
*/
#ifndef MOSQUITTO_CONTROL_H
#define MOSQUITTO_CONTROL_H
#ifdef __cplusplus
extern "C" {
#endif
#include <cjson/cJSON.h>
#include <mosquitto_broker.h>
#include <mosquitto.h>
#include <mqtt_protocol.h>
/* =========================================================================
*
* Section: $CONTROL event helpers
*
* ========================================================================= */
struct mosquitto_control_cmd{
cJSON *j_responses;
cJSON *j_command;
char *correlation_data;
const char *command_name;
};
mosq_EXPORT void mosquitto_control_command_reply(struct mosquitto_control_cmd *cmd, const char *error);
mosq_EXPORT void mosquitto_control_send_response(cJSON *tree, const char* topic);
mosq_EXPORT int mosquitto_control_generic_callback(struct mosquitto_evt_control *event_data, const char *response_topic, void *userdata,
int (*cmd_cb)(struct mosquitto_control_cmd *cmd, struct mosquitto *context, void *userdata));
#ifdef __cplusplus
}
#endif
#endif

@ -22,6 +22,7 @@ Contributors:
#include <uthash.h>
#include "mosquitto.h"
#include "mosquitto_broker.h"
#include "mosquitto_control.h"
#include "password_mosq.h"
#include "base64_mosq.h"

@ -226,9 +226,7 @@ if(WITH_DLT)
target_compile_definitions(mosquitto PRIVATE "WITH_DLT")
endif()
if(CJSON_FOUND)
target_link_libraries(mosquitto PRIVATE cJSON)
endif()
target_link_libraries(mosquitto PRIVATE cJSON)
target_include_directories(mosquitto
PUBLIC

@ -30,6 +30,7 @@ Contributors:
#include "mosquitto.h"
#include "mosquitto_broker_internal.h"
#include "mosquitto_broker.h"
#include "mosquitto_control.h"
#include "mosquitto_plugin.h"
#include "memory_mosq.h"
#include "mqtt_protocol.h"

@ -2,6 +2,7 @@
#include <mqtt_protocol.h>
#include <mosquitto_broker.h>
#include <mosquitto_control.h>
#include <stdlib.h>
#include <string.h>

Loading…
Cancel
Save