Skip to content

Commit

Permalink
Rename remove to delete in external interface.
Browse files Browse the repository at this point in the history
This is consistent with usage in the dynsec plugin.
  • Loading branch information
ralight committed Dec 15, 2021
1 parent cd28187 commit fdc70c5
Show file tree
Hide file tree
Showing 11 changed files with 72 additions and 72 deletions.
54 changes: 27 additions & 27 deletions include/mosquitto_broker.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,17 @@ enum mosquitto_plugin_event {
MOSQ_EVT_PERSIST_RESTORE = 12,
MOSQ_EVT_PERSIST_CONFIG_ADD = 13,
MOSQ_EVT_PERSIST_MSG_ADD = 14,
MOSQ_EVT_PERSIST_MSG_REMOVE = 15,
MOSQ_EVT_PERSIST_MSG_DELETE = 15,
MOSQ_EVT_PERSIST_MSG_LOAD = 16,
MOSQ_EVT_PERSIST_RETAIN_ADD = 17,
MOSQ_EVT_PERSIST_RETAIN_REMOVE = 18,
MOSQ_EVT_PERSIST_RETAIN_DELETE = 18,
MOSQ_EVT_PERSIST_CLIENT_ADD = 19,
MOSQ_EVT_PERSIST_CLIENT_REMOVE = 20,
MOSQ_EVT_PERSIST_CLIENT_DELETE = 20,
MOSQ_EVT_PERSIST_CLIENT_UPDATE = 21,
MOSQ_EVT_PERSIST_SUBSCRIPTION_ADD = 22,
MOSQ_EVT_PERSIST_SUBSCRIPTION_REMOVE = 23,
MOSQ_EVT_PERSIST_SUBSCRIPTION_DELETE = 23,
MOSQ_EVT_PERSIST_CLIENT_MSG_ADD = 24,
MOSQ_EVT_PERSIST_CLIENT_MSG_REMOVE = 25,
MOSQ_EVT_PERSIST_CLIENT_MSG_DELETE = 25,
MOSQ_EVT_PERSIST_CLIENT_MSG_UPDATE = 26,
MOSQ_EVT_PERSIST_CLIENT_MSG_CLEAR = 27,
MOSQ_EVT_PERSIST_CLIENT_MSG_LOAD = 28,
Expand Down Expand Up @@ -210,7 +210,7 @@ struct mosquitto_evt_persist_restore {
void *future[8];
};

/* Data for the MOSQ_EVT_PERSIST_CLIENT_ADD/_REMOVE/_UPDATE event */
/* Data for the MOSQ_EVT_PERSIST_CLIENT_ADD/_DELETE/_UPDATE event */
/* NOTE: The persistence interface is currently marked as unstable, which means
* it may change in a future minor release. */
struct mosquitto_evt_persist_client {
Expand All @@ -235,7 +235,7 @@ struct mosquitto_evt_persist_client {
};


/* Data for the MOSQ_EVT_PERSIST_SUBSCRIPTION_ADD/_REMOVE event */
/* Data for the MOSQ_EVT_PERSIST_SUBSCRIPTION_ADD/_DELETE event */
/* NOTE: The persistence interface is currently marked as unstable, which means
* it may change in a future minor release. */
struct mosquitto_evt_persist_subscription {
Expand All @@ -250,7 +250,7 @@ struct mosquitto_evt_persist_subscription {
};


/* Data for the MOSQ_EVT_PERSIST_CLIENT_MSG_ADD/_REMOVE/_UPDATE event */
/* Data for the MOSQ_EVT_PERSIST_CLIENT_MSG_ADD/_DELETE/_UPDATE event */
/* NOTE: The persistence interface is currently marked as unstable, which means
* it may change in a future minor release. */
struct mosquitto_evt_persist_client_msg {
Expand All @@ -270,7 +270,7 @@ struct mosquitto_evt_persist_client_msg {
};


/* Data for the MOSQ_EVT_PERSIST_MSG_ADD/_REMOVE/_LOAD event */
/* Data for the MOSQ_EVT_PERSIST_MSG_ADD/_DELETE/_LOAD event */
/* NOTE: The persistence interface is currently marked as unstable, which means
* it may change in a future minor release. */
struct mosquitto_evt_persist_msg {
Expand All @@ -296,7 +296,7 @@ struct mosquitto_evt_persist_msg {
};


/* Data for the MOSQ_EVT_PERSIST_RETAIN/_REMOVE event */
/* Data for the MOSQ_EVT_PERSIST_RETAIN/_DELETE event */
/* NOTE: The persistence interface is currently marked as unstable, which means
* it may change in a future minor release. */
struct mosquitto_evt_persist_retain {
Expand Down Expand Up @@ -859,19 +859,19 @@ int mosquitto_persist_client_add(struct mosquitto_evt_persist_client *client);
int mosquitto_persist_client_update(struct mosquitto_evt_persist_client *client);


/* Function: mosquitto_persist_client_remove
/* Function: mosquitto_persist_client_delete
*
* Use to remove client session for a client from the broker
* Use to delete client session for a client from the broker
*
* Parameters:
* client_id - the client id of the client to remove
* client_id - the client id of the client to delete
*
* Returns:
* MOSQ_ERR_SUCCESS - on success
* MOSQ_ERR_INVAL - if client_id is NULL
* MOSQ_ERR_NOT_FOUND - the referenced client is not found
*/
int mosquitto_persist_client_remove(const char *client_id);
int mosquitto_persist_client_delete(const char *client_id);


/* Function: mosquitto_persist_client_msg_add
Expand Down Expand Up @@ -903,9 +903,9 @@ int mosquitto_persist_client_remove(const char *client_id);
int mosquitto_persist_client_msg_add(struct mosquitto_evt_persist_client_msg *client_msg);


/* Function: mosquitto_persist_client_msg_remove
/* Function: mosquitto_persist_client_msg_delete
*
* Use to remove a client message for a particular client.
* Use to delete a client message for a particular client.
*
* Parameters:
* client_msg->plugin_client_id - the client id of the client that the
Expand All @@ -924,7 +924,7 @@ int mosquitto_persist_client_msg_add(struct mosquitto_evt_persist_client_msg *cl
* MOSQ_ERR_INVAL - if client_msg or client_msg->plugin_client_id is NULL
* MOSQ_ERR_NOT_FOUND - the client is not found
*/
int mosquitto_persist_client_msg_remove(struct mosquitto_evt_persist_client_msg *client_msg);
int mosquitto_persist_client_msg_delete(struct mosquitto_evt_persist_client_msg *client_msg);


/* Function: mosquitto_persist_client_msg_update
Expand Down Expand Up @@ -990,17 +990,17 @@ int mosquitto_persist_client_msg_update(struct mosquitto_evt_persist_client_msg
int mosquitto_persist_msg_add(struct mosquitto_evt_persist_msg *msg);


/* Function: mosquitto_persist_msg_remove
/* Function: mosquitto_persist_msg_delete
*
* Use to remove a stored message.
* Use to delete a stored message.
*
* Parameters:
* store_id - the stored message ID
*
* Returns:
* MOSQ_ERR_SUCCESS - on success
*/
int mosquitto_persist_msg_remove(uint64_t store_id);
int mosquitto_persist_msg_delete(uint64_t store_id);


/* Function: mosquitto_persist_subscription_add
Expand All @@ -1022,9 +1022,9 @@ int mosquitto_persist_msg_remove(uint64_t store_id);
int mosquitto_subscription_add(const char *client_id, const char *topic, uint8_t subscription_options, uint32_t subscription_identifier);


/* Function: mosquitto_persist_subscription_remove
/* Function: mosquitto_persist_subscription_delete
*
* Use to remove a subscription for a client
* Use to delete a subscription for a client
*
* Parameters:
* client_id - the client id of the client the new subscription is for
Expand All @@ -1036,12 +1036,12 @@ int mosquitto_subscription_add(const char *client_id, const char *topic, uint8_t
* MOSQ_ERR_NOT_FOUND - the referenced client was not found
* MOSQ_ERR_NOMEM - on out of memory
*/
int mosquitto_subscription_remove(const char *client_id, const char *topic);
int mosquitto_subscription_delete(const char *client_id, const char *topic);


/* Function: mosquitto_persist_retain_add
*
* Use to add a retained message. It is not required to remove a retained
* Use to add a retained message. It is not required to delete a retained
* message for an existing topic first.
*
* Parameters:
Expand All @@ -1059,9 +1059,9 @@ int mosquitto_subscription_remove(const char *client_id, const char *topic);
int mosquitto_persist_retain_add(struct mosquitto_evt_persist_retain *retain);


/* Function: mosquitto_persist_retain_remove
/* Function: mosquitto_persist_retain_delete
*
* Use to remove a retained message.
* Use to delete a retained message.
*
* Parameters:
* msg->plugin_topic - the topic that the message references
Expand All @@ -1073,7 +1073,7 @@ int mosquitto_persist_retain_add(struct mosquitto_evt_persist_retain *retain);
* MOSQ_ERR_INVAL - if msg or msg->plugin_topic are NULL
* MOSQ_ERR_NOMEM - on out of memory
*/
int mosquitto_persist_retain_remove(const char *topic);
int mosquitto_persist_retain_delete(const char *topic);

#ifdef __cplusplus
}
Expand Down
2 changes: 1 addition & 1 deletion src/context.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ void context__disconnect(struct mosquitto *context)
context__send_will(context);
net__socket_close(context);
if(context->session_expiry_interval == 0){
plugin_persist__handle_client_remove(context);
plugin_persist__handle_client_delete(context);
/* Client session is due to be expired now */
#ifdef WITH_BRIDGE
if(context->bridge == NULL)
Expand Down
4 changes: 2 additions & 2 deletions src/database.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ void db__msg_store_remove(struct mosquitto_msg_store *store, bool notify)
db.msg_store_count--;
db.msg_store_bytes -= store->payloadlen;
if(db.shutdown == false || notify == true){
plugin_persist__handle_msg_remove(store);
plugin_persist__handle_msg_delete(store);
}
db__msg_store_free(store);
}
Expand Down Expand Up @@ -330,7 +330,7 @@ static void db__message_remove(struct mosquitto *context, struct mosquitto_msg_d
return;
}

plugin_persist__handle_client_msg_remove(context, item);
plugin_persist__handle_client_msg_delete(context, item);

DL_DELETE(msg_data->inflight, item);
if(item->store){
Expand Down
2 changes: 1 addition & 1 deletion src/handle_connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ int connect__on_authorised(struct mosquitto *context, void *auth_data_out, uint1
if(context->clean_start == true){
sub__clean_session(found_context);
found_context->session_expiry_interval = 0;
plugin_persist__handle_client_remove(found_context);
plugin_persist__handle_client_delete(found_context);
}
if((found_context->protocol == mosq_p_mqtt5 && found_context->session_expiry_interval == 0)
|| (found_context->protocol != mosq_p_mqtt5 && found_context->clean_start == true)
Expand Down
2 changes: 1 addition & 1 deletion src/handle_unsubscribe.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ int handle__unsubscribe(struct mosquitto *context)
log__printf(NULL, MOSQ_LOG_DEBUG, "\t%s", sub);
if(allowed){
rc = sub__remove(context, sub, db.subs, &reason);
plugin_persist__handle_subscription_remove(context, sub);
plugin_persist__handle_subscription_delete(context, sub);
}else{
rc = MOSQ_ERR_SUCCESS;
}
Expand Down
20 changes: 10 additions & 10 deletions src/mosquitto_broker_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,19 +166,19 @@ struct plugin__callbacks{
struct mosquitto__callback *reload;
struct mosquitto__callback *persist_restore;
struct mosquitto__callback *persist_client_add;
struct mosquitto__callback *persist_client_remove;
struct mosquitto__callback *persist_client_delete;
struct mosquitto__callback *persist_client_update;
struct mosquitto__callback *persist_subscription_add;
struct mosquitto__callback *persist_subscription_remove;
struct mosquitto__callback *persist_subscription_delete;
struct mosquitto__callback *persist_client_msg_add;
struct mosquitto__callback *persist_client_msg_remove;
struct mosquitto__callback *persist_client_msg_delete;
struct mosquitto__callback *persist_client_msg_update;
struct mosquitto__callback *persist_client_msg_clear;
struct mosquitto__callback *persist_msg_add;
struct mosquitto__callback *persist_msg_remove;
struct mosquitto__callback *persist_msg_delete;
struct mosquitto__callback *persist_msg_load;
struct mosquitto__callback *persist_retain_add;
struct mosquitto__callback *persist_retain_remove;
struct mosquitto__callback *persist_retain_delete;
};

struct mosquitto__security_options {
Expand Down Expand Up @@ -859,18 +859,18 @@ void plugin__handle_tick(void);
int plugin__callback_unregister_all(mosquitto_plugin_id_t *identifier);
void plugin_persist__handle_restore(void);
void plugin_persist__handle_client_add(struct mosquitto *context);
void plugin_persist__handle_client_remove(struct mosquitto *context);
void plugin_persist__handle_client_delete(struct mosquitto *context);
void plugin_persist__handle_client_update(struct mosquitto *context);
void plugin_persist__handle_subscription_add(struct mosquitto *context, const char *sub, uint8_t subscription_options, uint32_t subscription_identifier);
void plugin_persist__handle_subscription_remove(struct mosquitto *context, const char *sub);
void plugin_persist__handle_subscription_delete(struct mosquitto *context, const char *sub);
void plugin_persist__handle_client_msg_add(struct mosquitto *context, const struct mosquitto_client_msg *cmsg);
void plugin_persist__handle_client_msg_remove(struct mosquitto *context, const struct mosquitto_client_msg *cmsg);
void plugin_persist__handle_client_msg_delete(struct mosquitto *context, const struct mosquitto_client_msg *cmsg);
void plugin_persist__handle_client_msg_update(struct mosquitto *context, const struct mosquitto_client_msg *cmsg);
void plugin_persist__handle_client_msg_clear(struct mosquitto *context, uint8_t direction);
void plugin_persist__handle_msg_add(struct mosquitto_msg_store *msg);
void plugin_persist__handle_msg_remove(struct mosquitto_msg_store *msg);
void plugin_persist__handle_msg_delete(struct mosquitto_msg_store *msg);
void plugin_persist__handle_retain_add(struct mosquitto_msg_store *msg);
void plugin_persist__handle_retain_remove(struct mosquitto_msg_store *msg);
void plugin_persist__handle_retain_delete(struct mosquitto_msg_store *msg);

/* ============================================================
* Property related functions
Expand Down
20 changes: 10 additions & 10 deletions src/plugin_callbacks.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,32 +93,32 @@ static struct mosquitto__callback **plugin__get_callback_base(struct mosquitto__
return &security_options->plugin_callbacks.persist_restore;
case MOSQ_EVT_PERSIST_CLIENT_ADD:
return &security_options->plugin_callbacks.persist_client_add;
case MOSQ_EVT_PERSIST_CLIENT_REMOVE:
return &security_options->plugin_callbacks.persist_client_remove;
case MOSQ_EVT_PERSIST_CLIENT_DELETE:
return &security_options->plugin_callbacks.persist_client_delete;
case MOSQ_EVT_PERSIST_CLIENT_UPDATE:
return &security_options->plugin_callbacks.persist_client_update;
case MOSQ_EVT_PERSIST_SUBSCRIPTION_ADD:
return &security_options->plugin_callbacks.persist_subscription_add;
case MOSQ_EVT_PERSIST_SUBSCRIPTION_REMOVE:
return &security_options->plugin_callbacks.persist_subscription_remove;
case MOSQ_EVT_PERSIST_SUBSCRIPTION_DELETE:
return &security_options->plugin_callbacks.persist_subscription_delete;
case MOSQ_EVT_PERSIST_CLIENT_MSG_ADD:
return &security_options->plugin_callbacks.persist_client_msg_add;
case MOSQ_EVT_PERSIST_CLIENT_MSG_REMOVE:
return &security_options->plugin_callbacks.persist_client_msg_remove;
case MOSQ_EVT_PERSIST_CLIENT_MSG_DELETE:
return &security_options->plugin_callbacks.persist_client_msg_delete;
case MOSQ_EVT_PERSIST_CLIENT_MSG_UPDATE:
return &security_options->plugin_callbacks.persist_client_msg_update;
case MOSQ_EVT_PERSIST_CLIENT_MSG_CLEAR:
return &security_options->plugin_callbacks.persist_client_msg_clear;
case MOSQ_EVT_PERSIST_MSG_ADD:
return &security_options->plugin_callbacks.persist_msg_add;
case MOSQ_EVT_PERSIST_MSG_REMOVE:
return &security_options->plugin_callbacks.persist_msg_remove;
case MOSQ_EVT_PERSIST_MSG_DELETE:
return &security_options->plugin_callbacks.persist_msg_delete;
case MOSQ_EVT_PERSIST_MSG_LOAD:
return &security_options->plugin_callbacks.persist_msg_load;
case MOSQ_EVT_PERSIST_RETAIN_ADD:
return &security_options->plugin_callbacks.persist_retain_add;
case MOSQ_EVT_PERSIST_RETAIN_REMOVE:
return &security_options->plugin_callbacks.persist_retain_remove;
case MOSQ_EVT_PERSIST_RETAIN_DELETE:
return &security_options->plugin_callbacks.persist_retain_delete;
default:
return NULL;
}
Expand Down
Loading

0 comments on commit fdc70c5

Please sign in to comment.