I'm implementing a plugin for the mosquitto MQTT broker (version 1.5) and I'm struggling at accessing some elements of the pointer to the struct of mosquitto client inside of my plugin implementation:
#include <mosquitto_plugin.h>
...
int mosquitto_auth_acl_check(void *userdata, int access, const struct mosquitto *client, const struct mosquitto_acl_msg *msg)
{
const char *clientid = client->id;
const char *username = client->username;
...
}
At compile time I retrieve the error:
error: dereferencing pointer to incomplete type const char *clientid = client->id;
Can anybody give me some advice how to access the client data?
Edit: struct mosquitto is defined inside of the mosquitto source code (mosquitto_internal.h):
struct mosquitto {
...
char *id;
char *username;
...
}
But mosquitto_internal.h is just for internal usage at mosquitto and cannot be accessed by my plugin (At least I think so...)
Inside of mosquitto_plugin.h (which is provided by the mosquitto and included by my plugin) there is just a "reference" to the mosquitto struct:
struct mosquitto;
Thus, as long as I'm not accessing any data of the mosquitto struct it compiles successfully, but if I try to access some data like the id it crashes.