Skip to content

Commit

Permalink
More function renaming.
Browse files Browse the repository at this point in the history
  • Loading branch information
ralight committed May 16, 2015
1 parent 94ef6ec commit 3c70340
Show file tree
Hide file tree
Showing 13 changed files with 66 additions and 66 deletions.
22 changes: 11 additions & 11 deletions lib/read_handle.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,33 +36,33 @@ int mosquitto__packet_handle(struct mosquitto *mosq)

switch((mosq->in_packet.command)&0xF0){
case PINGREQ:
return mosquitto__handle_pingreq(mosq);
return handle__pingreq(mosq);
case PINGRESP:
return mosquitto__handle_pingresp(mosq);
return handle__pingresp(mosq);
case PUBACK:
return mosquitto__handle_pubackcomp(mosq, "PUBACK");
return handle__pubackcomp(mosq, "PUBACK");
case PUBCOMP:
return mosquitto__handle_pubackcomp(mosq, "PUBCOMP");
return handle__pubackcomp(mosq, "PUBCOMP");
case PUBLISH:
return mosquitto__handle_publish(mosq);
return handle__publish(mosq);
case PUBREC:
return mosquitto__handle_pubrec(mosq);
return handle__pubrec(mosq);
case PUBREL:
return mosquitto__handle_pubrel(NULL, mosq);
return handle__pubrel(NULL, mosq);
case CONNACK:
return mosquitto__handle_connack(mosq);
return handle__connack(mosq);
case SUBACK:
return mosquitto__handle_suback(mosq);
return handle__suback(mosq);
case UNSUBACK:
return mosquitto__handle_unsuback(mosq);
return handle__unsuback(mosq);
default:
/* If we don't recognise the command, return an error straight away. */
mosquitto__log_printf(mosq, MOSQ_LOG_ERR, "Error: Unrecognised command %d\n", (mosq->in_packet.command)&0xF0);
return MOSQ_ERR_PROTOCOL;
}
}

int mosquitto__handle_publish(struct mosquitto *mosq)
int handle__publish(struct mosquitto *mosq)
{
uint8_t header;
struct mosquitto_message_all *message;
Expand Down
20 changes: 10 additions & 10 deletions lib/read_handle.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ and the Eclipse Distribution License is available at
struct mosquitto_db;

int mosquitto__packet_handle(struct mosquitto *mosq);
int mosquitto__handle_connack(struct mosquitto *mosq);
int mosquitto__handle_pingreq(struct mosquitto *mosq);
int mosquitto__handle_pingresp(struct mosquitto *mosq);
int handle__pingreq(struct mosquitto *mosq);
int handle__pingresp(struct mosquitto *mosq);
#ifdef WITH_BROKER
int mosquitto__handle_pubackcomp(struct mosquitto_db *db, struct mosquitto *mosq, const char *type);
int handle__pubackcomp(struct mosquitto_db *db, struct mosquitto *mosq, const char *type);
#else
int mosquitto__handle_pubackcomp(struct mosquitto *mosq, const char *type);
int handle__connack(struct mosquitto *mosq);
int handle__pubackcomp(struct mosquitto *mosq, const char *type);
int handle__publish(struct mosquitto *mosq);
#endif
int mosquitto__handle_publish(struct mosquitto *mosq);
int mosquitto__handle_pubrec(struct mosquitto *mosq);
int mosquitto__handle_pubrel(struct mosquitto_db *db, struct mosquitto *mosq);
int mosquitto__handle_suback(struct mosquitto *mosq);
int mosquitto__handle_unsuback(struct mosquitto *mosq);
int handle__pubrec(struct mosquitto *mosq);
int handle__pubrel(struct mosquitto_db *db, struct mosquitto *mosq);
int handle__suback(struct mosquitto *mosq);
int handle__unsuback(struct mosquitto *mosq);


#endif
2 changes: 1 addition & 1 deletion lib/read_handle_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ and the Eclipse Distribution License is available at
#include "packet_mosq.h"
#include "read_handle.h"

int mosquitto__handle_connack(struct mosquitto *mosq)
int handle__connack(struct mosquitto *mosq)
{
uint8_t byte;
uint8_t result;
Expand Down
16 changes: 8 additions & 8 deletions lib/read_handle_shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ and the Eclipse Distribution License is available at
#include "mosquitto_broker.h"
#endif

int mosquitto__handle_pingreq(struct mosquitto *mosq)
int handle__pingreq(struct mosquitto *mosq)
{
assert(mosq);
#ifdef WITH_BROKER
Expand All @@ -43,7 +43,7 @@ int mosquitto__handle_pingreq(struct mosquitto *mosq)
return send__pingresp(mosq);
}

int mosquitto__handle_pingresp(struct mosquitto *mosq)
int handle__pingresp(struct mosquitto *mosq)
{
assert(mosq);
mosq->ping_t = 0; /* No longer waiting for a PINGRESP. */
Expand All @@ -56,9 +56,9 @@ int mosquitto__handle_pingresp(struct mosquitto *mosq)
}

#ifdef WITH_BROKER
int mosquitto__handle_pubackcomp(struct mosquitto_db *db, struct mosquitto *mosq, const char *type)
int handle__pubackcomp(struct mosquitto_db *db, struct mosquitto *mosq, const char *type)
#else
int mosquitto__handle_pubackcomp(struct mosquitto *mosq, const char *type)
int handle__pubackcomp(struct mosquitto *mosq, const char *type)
#endif
{
uint16_t mid;
Expand Down Expand Up @@ -92,7 +92,7 @@ int mosquitto__handle_pubackcomp(struct mosquitto *mosq, const char *type)
return MOSQ_ERR_SUCCESS;
}

int mosquitto__handle_pubrec(struct mosquitto *mosq)
int handle__pubrec(struct mosquitto *mosq)
{
uint16_t mid;
int rc;
Expand All @@ -116,7 +116,7 @@ int mosquitto__handle_pubrec(struct mosquitto *mosq)
return MOSQ_ERR_SUCCESS;
}

int mosquitto__handle_pubrel(struct mosquitto_db *db, struct mosquitto *mosq)
int handle__pubrel(struct mosquitto_db *db, struct mosquitto *mosq)
{
uint16_t mid;
#ifndef WITH_BROKER
Expand Down Expand Up @@ -161,7 +161,7 @@ int mosquitto__handle_pubrel(struct mosquitto_db *db, struct mosquitto *mosq)
return MOSQ_ERR_SUCCESS;
}

int mosquitto__handle_suback(struct mosquitto *mosq)
int handle__suback(struct mosquitto *mosq)
{
uint16_t mid;
uint8_t qos;
Expand Down Expand Up @@ -205,7 +205,7 @@ int mosquitto__handle_suback(struct mosquitto *mosq)
return MOSQ_ERR_SUCCESS;
}

int mosquitto__handle_unsuback(struct mosquitto *mosq)
int handle__unsuback(struct mosquitto *mosq)
{
uint16_t mid;
int rc;
Expand Down
2 changes: 1 addition & 1 deletion src/context.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ struct mosquitto *context__init(struct mosquitto_db *db, int sock)

context->address = NULL;
if((int)sock >= 0){
if(!mosquitto__socket_get_address(sock, address, 1024)){
if(!net__socket_get_address(sock, address, 1024)){
context->address = mosquitto__strdup(address);
}
if(!context->address){
Expand Down
2 changes: 1 addition & 1 deletion src/loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ int mosquitto_main_loop(struct mosquitto_db *db, int *listensock, int listensock

for(i=0; i<listensock_count; i++){
if(pollfds[i].revents & (POLLIN | POLLPRI)){
while(mqtt3_socket_accept(db, listensock[i]) != -1){
while(net__socket_accept(db, listensock[i]) != -1){
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/mosquitto.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ int main(int argc, char *argv[])
listensock_index = 0;
for(i=0; i<config.listener_count; i++){
if(config.listeners[i].protocol == mp_mqtt){
if(mqtt3_socket_listen(&config.listeners[i])){
if(net__socket_listen(&config.listeners[i])){
db__close(&int_db);
if(config.pid_file){
remove(config.pid_file);
Expand Down
18 changes: 9 additions & 9 deletions src/mosquitto_broker.h
Original file line number Diff line number Diff line change
Expand Up @@ -437,20 +437,20 @@ int send__suback(struct mosquitto *context, uint16_t mid, uint32_t payloadlen, c
/* ============================================================
* Network functions
* ============================================================ */
int mqtt3_socket_accept(struct mosquitto_db *db, int listensock);
int mqtt3_socket_listen(struct mqtt3__listener *listener);
int mosquitto__socket_get_address(int sock, char *buf, int len);
int net__socket_accept(struct mosquitto_db *db, int listensock);
int net__socket_listen(struct mqtt3__listener *listener);
int net__socket_get_address(int sock, char *buf, int len);

/* ============================================================
* Read handling functions
* ============================================================ */
int mqtt3_packet_handle(struct mosquitto_db *db, struct mosquitto *context);
int mqtt3_handle_connack(struct mosquitto_db *db, struct mosquitto *context);
int mqtt3_handle_connect(struct mosquitto_db *db, struct mosquitto *context);
int mqtt3_handle_disconnect(struct mosquitto_db *db, struct mosquitto *context);
int mqtt3_handle_publish(struct mosquitto_db *db, struct mosquitto *context);
int mqtt3_handle_subscribe(struct mosquitto_db *db, struct mosquitto *context);
int mqtt3_handle_unsubscribe(struct mosquitto_db *db, struct mosquitto *context);
int handle__connack(struct mosquitto_db *db, struct mosquitto *context);
int handle__connect(struct mosquitto_db *db, struct mosquitto *context);
int handle__disconnect(struct mosquitto_db *db, struct mosquitto *context);
int handle__publish(struct mosquitto_db *db, struct mosquitto *context);
int handle__subscribe(struct mosquitto_db *db, struct mosquitto *context);
int handle__unsubscribe(struct mosquitto_db *db, struct mosquitto *context);

/* ============================================================
* Database handling
Expand Down
6 changes: 3 additions & 3 deletions src/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static int tls_ex_index_listener = -1;

#include "sys_tree.h"

int mqtt3_socket_accept(struct mosquitto_db *db, int listensock)
int net__socket_accept(struct mosquitto_db *db, int listensock)
{
int i;
int j;
Expand Down Expand Up @@ -315,7 +315,7 @@ static int mosquitto__tls_server_ctx(struct mqtt3__listener *listener)
* Returns 1 on failure
* Returns 0 on success.
*/
int mqtt3_socket_listen(struct mqtt3__listener *listener)
int net__socket_listen(struct mqtt3__listener *listener)
{
int sock = -1;
struct addrinfo hints;
Expand Down Expand Up @@ -496,7 +496,7 @@ int mqtt3_socket_listen(struct mqtt3__listener *listener)
}
}

int mosquitto__socket_get_address(int sock, char *buf, int len)
int net__socket_get_address(int sock, char *buf, int len)
{
struct sockaddr_storage addr;
socklen_t addrlen;
Expand Down
30 changes: 15 additions & 15 deletions src/read_handle.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,42 +35,42 @@ int mqtt3_packet_handle(struct mosquitto_db *db, struct mosquitto *context)

switch((context->in_packet.command)&0xF0){
case PINGREQ:
return mosquitto__handle_pingreq(context);
return handle__pingreq(context);
case PINGRESP:
return mosquitto__handle_pingresp(context);
return handle__pingresp(context);
case PUBACK:
return mosquitto__handle_pubackcomp(db, context, "PUBACK");
return handle__pubackcomp(db, context, "PUBACK");
case PUBCOMP:
return mosquitto__handle_pubackcomp(db, context, "PUBCOMP");
return handle__pubackcomp(db, context, "PUBCOMP");
case PUBLISH:
return mqtt3_handle_publish(db, context);
return handle__publish(db, context);
case PUBREC:
return mosquitto__handle_pubrec(context);
return handle__pubrec(context);
case PUBREL:
return mosquitto__handle_pubrel(db, context);
return handle__pubrel(db, context);
case CONNECT:
return mqtt3_handle_connect(db, context);
return handle__connect(db, context);
case DISCONNECT:
return mqtt3_handle_disconnect(db, context);
return handle__disconnect(db, context);
case SUBSCRIBE:
return mqtt3_handle_subscribe(db, context);
return handle__subscribe(db, context);
case UNSUBSCRIBE:
return mqtt3_handle_unsubscribe(db, context);
return handle__unsubscribe(db, context);
#ifdef WITH_BRIDGE
case CONNACK:
return mqtt3_handle_connack(db, context);
return handle__connack(db, context);
case SUBACK:
return mosquitto__handle_suback(context);
return handle__suback(context);
case UNSUBACK:
return mosquitto__handle_unsuback(context);
return handle__unsuback(context);
#endif
default:
/* If we don't recognise the command, return an error straight away. */
return MOSQ_ERR_PROTOCOL;
}
}

int mqtt3_handle_publish(struct mosquitto_db *db, struct mosquitto *context)
int handle__publish(struct mosquitto_db *db, struct mosquitto *context)
{
char *topic;
void *payload = NULL;
Expand Down
2 changes: 1 addition & 1 deletion src/read_handle_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ and the Eclipse Distribution License is available at
#include "send_mosq.h"
#include "util_mosq.h"

int mqtt3_handle_connack(struct mosquitto_db *db, struct mosquitto *context)
int handle__connack(struct mosquitto_db *db, struct mosquitto *context)
{
uint8_t byte;
uint8_t rc;
Expand Down
8 changes: 4 additions & 4 deletions src/read_handle_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static char *client_id_gen(struct mosquitto_db *db)
return client_id;
}

int mqtt3_handle_connect(struct mosquitto_db *db, struct mosquitto *context)
int handle__connect(struct mosquitto_db *db, struct mosquitto *context)
{
char *protocol_name = NULL;
uint8_t protocol_version;
Expand Down Expand Up @@ -566,7 +566,7 @@ int mqtt3_handle_connect(struct mosquitto_db *db, struct mosquitto *context)
return rc;
}

int mqtt3_handle_disconnect(struct mosquitto_db *db, struct mosquitto *context)
int handle__disconnect(struct mosquitto_db *db, struct mosquitto *context)
{
if(!context){
return MOSQ_ERR_INVAL;
Expand All @@ -587,7 +587,7 @@ int mqtt3_handle_disconnect(struct mosquitto_db *db, struct mosquitto *context)
}


int mqtt3_handle_subscribe(struct mosquitto_db *db, struct mosquitto *context)
int handle__subscribe(struct mosquitto_db *db, struct mosquitto *context)
{
int rc = 0;
int rc2;
Expand Down Expand Up @@ -730,7 +730,7 @@ int mqtt3_handle_subscribe(struct mosquitto_db *db, struct mosquitto *context)
return rc;
}

int mqtt3_handle_unsubscribe(struct mosquitto_db *db, struct mosquitto *context)
int handle__unsubscribe(struct mosquitto_db *db, struct mosquitto *context)
{
uint16_t mid;
char *sub;
Expand Down
2 changes: 1 addition & 1 deletion src/websockets.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ static void easy_address(int sock, struct mosquitto *mosq)
{
char address[1024];

if(!mosquitto__socket_get_address(sock, address, 1024)){
if(!net__socket_get_address(sock, address, 1024)){
mosq->address = mosquitto__strdup(address);
}
}
Expand Down

0 comments on commit 3c70340

Please sign in to comment.