Make functions visible only within the module

This prevents linking problems.
Signed-off-by: 's avatarGuilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
parent f2f0390d
......@@ -72,12 +72,12 @@ static Tree heap; /**< Tree that holds the allocation records */
static const char *errmsg = "Memory allocation error";
size_t Heap_roundup(size_t size);
int ptrCompare(void* a, void* b, int value);
void Heap_check(char* string, void* ptr);
void checkEyecatchers(char* file, int line, void* p, size_t size);
int Internal_heap_unlink(char* file, int line, void* p);
void HeapScan(enum LOG_LEVELS log_level);
static size_t Heap_roundup(size_t size);
static int ptrCompare(void* a, void* b, int value);
static void Heap_check(char* string, void* ptr);
static void checkEyecatchers(char* file, int line, void* p, size_t size);
static int Internal_heap_unlink(char* file, int line, void* p);
static void HeapScan(enum LOG_LEVELS log_level);
/**
......@@ -87,7 +87,7 @@ void HeapScan(enum LOG_LEVELS log_level);
* @param size the size actually needed
* @return the rounded up size
*/
size_t Heap_roundup(size_t size)
static size_t Heap_roundup(size_t size)
{
static int multsize = 4*sizeof(int);
......@@ -103,7 +103,7 @@ size_t Heap_roundup(size_t size)
* @param b pointer to the memory to free
* @return boolean indicating whether a and b are equal
*/
int ptrCompare(void* a, void* b, int value)
static int ptrCompare(void* a, void* b, int value)
{
a = ((storageElement*)a)->ptr;
if (value)
......@@ -113,7 +113,7 @@ int ptrCompare(void* a, void* b, int value)
}
void Heap_check(char* string, void* ptr)
static void Heap_check(char* string, void* ptr)
{
return;
/*Node* curnode = NULL;
......@@ -192,7 +192,7 @@ void* mymalloc(char* file, int line, size_t size)
}
void checkEyecatchers(char* file, int line, void* p, size_t size)
static void checkEyecatchers(char* file, int line, void* p, size_t size)
{
int *sp = (int*)p;
char *cp = (char*)p;
......@@ -215,7 +215,7 @@ void checkEyecatchers(char* file, int line, void* p, size_t size)
* @param line use the __LINE__ macro to indicate which line this item was allocated at
* @param p pointer to the item to be removed
*/
int Internal_heap_unlink(char* file, int line, void* p)
static int Internal_heap_unlink(char* file, int line, void* p)
{
Node* e = NULL;
int rc = 0;
......@@ -345,7 +345,7 @@ void* Heap_findItem(void* p)
* Scans the heap and reports any items currently allocated.
* To be used at shutdown if any heap items have not been freed.
*/
void HeapScan(enum LOG_LEVELS log_level)
static void HeapScan(enum LOG_LEVELS log_level)
{
Node* current = NULL;
......
......@@ -33,7 +33,7 @@
#include "Heap.h"
int ListUnlink(List* aList, void* content, int(*callback)(void*, void*), int freeContent);
static int ListUnlink(List* aList, void* content, int(*callback)(void*, void*), int freeContent);
/**
......@@ -197,7 +197,7 @@ ListElement* ListFindItem(List* aList, void* content, int(*callback)(void*, void
* @param freeContent boolean value to indicate whether the item found is to be freed
* @return 1=item removed, 0=item not removed
*/
int ListUnlink(List* aList, void* content, int(*callback)(void*, void*), int freeContent)
static int ListUnlink(List* aList, void* content, int(*callback)(void*, void*), int freeContent)
{
ListElement* next = NULL;
ListElement* saved = aList->current;
......
......@@ -109,8 +109,8 @@ static void Log_output(enum LOG_LEVELS log_level, const char *msg);
static void Log_posttrace(enum LOG_LEVELS log_level, traceEntry* cur_entry);
static void Log_trace(enum LOG_LEVELS log_level, const char *buf);
#if 0
FILE* Log_destToFile(const char *dest);
int Log_compareEntries(const char *entry1, const char *entry2);
static FILE* Log_destToFile(const char *dest);
static int Log_compareEntries(const char *entry1, const char *entry2);
#endif
static int sametime_count = 0;
......@@ -471,7 +471,7 @@ void Log_stackTrace(enum LOG_LEVELS log_level, int msgno, int thread_id, int cur
#if 0
FILE* Log_destToFile(const char *dest)
static FILE* Log_destToFile(const char *dest)
{
FILE* file = NULL;
......@@ -490,7 +490,7 @@ FILE* Log_destToFile(const char *dest)
}
int Log_compareEntries(const char *entry1, const char *entry2)
static int Log_compareEntries(const char *entry1, const char *entry2)
{
int comp = strncmp(&entry1[7], &entry2[7], 19);
......
......@@ -327,48 +327,48 @@ typedef struct
} MQTTAsync_queuedCommand;
int clientSockCompare(void* a, void* b);
void MQTTAsync_lock_mutex(mutex_type amutex);
void MQTTAsync_unlock_mutex(mutex_type amutex);
int MQTTAsync_checkConn(MQTTAsync_command* command, MQTTAsyncs* client);
void MQTTAsync_terminate(void);
static int clientSockCompare(void* a, void* b);
static void MQTTAsync_lock_mutex(mutex_type amutex);
static void MQTTAsync_unlock_mutex(mutex_type amutex);
static int MQTTAsync_checkConn(MQTTAsync_command* command, MQTTAsyncs* client);
static void MQTTAsync_terminate(void);
#if !defined(NO_PERSISTENCE)
int MQTTAsync_unpersistCommand(MQTTAsync_queuedCommand* qcmd);
int MQTTAsync_persistCommand(MQTTAsync_queuedCommand* qcmd);
MQTTAsync_queuedCommand* MQTTAsync_restoreCommand(char* buffer, int buflen);
void MQTTAsync_insertInOrder(List* list, void* content, int size);
int MQTTAsync_restoreCommands(MQTTAsyncs* client);
static int MQTTAsync_unpersistCommand(MQTTAsync_queuedCommand* qcmd);
static int MQTTAsync_persistCommand(MQTTAsync_queuedCommand* qcmd);
static MQTTAsync_queuedCommand* MQTTAsync_restoreCommand(char* buffer, int buflen);
static void MQTTAsync_insertInOrder(List* list, void* content, int size);
static int MQTTAsync_restoreCommands(MQTTAsyncs* client);
#endif
int MQTTAsync_addCommand(MQTTAsync_queuedCommand* command, int command_size);
void MQTTAsync_startConnectRetry(MQTTAsyncs* m);
void MQTTAsync_checkDisconnect(MQTTAsync handle, MQTTAsync_command* command);
void MQTTProtocol_checkPendingWrites(void);
void MQTTAsync_freeServerURIs(MQTTAsyncs* m);
void MQTTAsync_freeCommand1(MQTTAsync_queuedCommand *command);
void MQTTAsync_freeCommand(MQTTAsync_queuedCommand *command);
void MQTTAsync_writeComplete(int socket);
int MQTTAsync_processCommand(void);
void MQTTAsync_checkTimeouts(void);
thread_return_type WINAPI MQTTAsync_sendThread(void* n);
void MQTTAsync_emptyMessageQueue(Clients* client);
void MQTTAsync_removeResponsesAndCommands(MQTTAsyncs* m);
int MQTTAsync_completeConnection(MQTTAsyncs* m, MQTTPacket* pack);
thread_return_type WINAPI MQTTAsync_receiveThread(void* n);
void MQTTAsync_stop(void);
void MQTTAsync_closeOnly(Clients* client);
void MQTTAsync_closeSession(Clients* client);
int clientStructCompare(void* a, void* b);
int MQTTAsync_cleanSession(Clients* client);
int MQTTAsync_deliverMessage(MQTTAsyncs* m, char* topicName, size_t topicLen, MQTTAsync_message* mm);
int MQTTAsync_disconnect1(MQTTAsync handle, const MQTTAsync_disconnectOptions* options, int internal);
int MQTTAsync_disconnect_internal(MQTTAsync handle, int timeout);
int cmdMessageIDCompare(void* a, void* b);
int MQTTAsync_assignMsgId(MQTTAsyncs* m);
int MQTTAsync_countBufferedMessages(MQTTAsyncs* m);
void MQTTAsync_retry(void);
int MQTTAsync_connecting(MQTTAsyncs* m);
MQTTPacket* MQTTAsync_cycle(int* sock, unsigned long timeout, int* rc);
int pubCompare(void* a, void* b);
static int MQTTAsync_addCommand(MQTTAsync_queuedCommand* command, int command_size);
static void MQTTAsync_startConnectRetry(MQTTAsyncs* m);
static void MQTTAsync_checkDisconnect(MQTTAsync handle, MQTTAsync_command* command);
static void MQTTProtocol_checkPendingWrites(void);
static void MQTTAsync_freeServerURIs(MQTTAsyncs* m);
static void MQTTAsync_freeCommand1(MQTTAsync_queuedCommand *command);
static void MQTTAsync_freeCommand(MQTTAsync_queuedCommand *command);
static void MQTTAsync_writeComplete(int socket);
static int MQTTAsync_processCommand(void);
static void MQTTAsync_checkTimeouts(void);
static thread_return_type WINAPI MQTTAsync_sendThread(void* n);
static void MQTTAsync_emptyMessageQueue(Clients* client);
static void MQTTAsync_removeResponsesAndCommands(MQTTAsyncs* m);
static int MQTTAsync_completeConnection(MQTTAsyncs* m, MQTTPacket* pack);
static thread_return_type WINAPI MQTTAsync_receiveThread(void* n);
static void MQTTAsync_stop(void);
static void MQTTAsync_closeOnly(Clients* client);
static void MQTTAsync_closeSession(Clients* client);
static int clientStructCompare(void* a, void* b);
static int MQTTAsync_cleanSession(Clients* client);
static int MQTTAsync_deliverMessage(MQTTAsyncs* m, char* topicName, size_t topicLen, MQTTAsync_message* mm);
static int MQTTAsync_disconnect1(MQTTAsync handle, const MQTTAsync_disconnectOptions* options, int internal);
static int MQTTAsync_disconnect_internal(MQTTAsync handle, int timeout);
static int cmdMessageIDCompare(void* a, void* b);
static int MQTTAsync_assignMsgId(MQTTAsyncs* m);
static int MQTTAsync_countBufferedMessages(MQTTAsyncs* m);
static void MQTTAsync_retry(void);
static int MQTTAsync_connecting(MQTTAsyncs* m);
static MQTTPacket* MQTTAsync_cycle(int* sock, unsigned long timeout, int* rc);
static int pubCompare(void* a, void* b);
void MQTTAsync_sleep(long milliseconds)
......@@ -389,14 +389,14 @@ void MQTTAsync_sleep(long milliseconds)
* @param b second integer value
* @return boolean indicating whether a and b are equal
*/
int clientSockCompare(void* a, void* b)
static int clientSockCompare(void* a, void* b)
{
MQTTAsyncs* m = (MQTTAsyncs*)a;
return m->c->net.socket == *(int*)b;
}
void MQTTAsync_lock_mutex(mutex_type amutex)
static void MQTTAsync_lock_mutex(mutex_type amutex)
{
int rc = Thread_lock_mutex(amutex);
if (rc != 0)
......@@ -404,7 +404,7 @@ void MQTTAsync_lock_mutex(mutex_type amutex)
}
void MQTTAsync_unlock_mutex(mutex_type amutex)
static void MQTTAsync_unlock_mutex(mutex_type amutex)
{
int rc = Thread_unlock_mutex(amutex);
if (rc != 0)
......@@ -416,7 +416,7 @@ void MQTTAsync_unlock_mutex(mutex_type amutex)
Check whether there are any more connect options. If not then we are finished
with connect attempts.
*/
int MQTTAsync_checkConn(MQTTAsync_command* command, MQTTAsyncs* client)
static int MQTTAsync_checkConn(MQTTAsync_command* command, MQTTAsyncs* client)
{
int rc;
......@@ -531,7 +531,7 @@ int MQTTAsync_create(MQTTAsync* handle, const char* serverURI, const char* clien
}
void MQTTAsync_terminate(void)
static void MQTTAsync_terminate(void)
{
FUNC_ENTRY;
MQTTAsync_stop();
......@@ -559,7 +559,7 @@ void MQTTAsync_terminate(void)
#if !defined(NO_PERSISTENCE)
int MQTTAsync_unpersistCommand(MQTTAsync_queuedCommand* qcmd)
static int MQTTAsync_unpersistCommand(MQTTAsync_queuedCommand* qcmd)
{
int rc = 0;
char key[PERSISTENCE_MAX_KEY_LENGTH + 1];
......@@ -573,7 +573,7 @@ int MQTTAsync_unpersistCommand(MQTTAsync_queuedCommand* qcmd)
}
int MQTTAsync_persistCommand(MQTTAsync_queuedCommand* qcmd)
static int MQTTAsync_persistCommand(MQTTAsync_queuedCommand* qcmd)
{
int rc = 0;
MQTTAsyncs* aclient = qcmd->client;
......@@ -679,7 +679,7 @@ int MQTTAsync_persistCommand(MQTTAsync_queuedCommand* qcmd)
}
MQTTAsync_queuedCommand* MQTTAsync_restoreCommand(char* buffer, int buflen)
static MQTTAsync_queuedCommand* MQTTAsync_restoreCommand(char* buffer, int buflen)
{
MQTTAsync_command* command = NULL;
MQTTAsync_queuedCommand* qcommand = NULL;
......@@ -763,7 +763,7 @@ MQTTAsync_queuedCommand* MQTTAsync_restoreCommand(char* buffer, int buflen)
}
void MQTTAsync_insertInOrder(List* list, void* content, int size)
static void MQTTAsync_insertInOrder(List* list, void* content, int size)
{
ListElement* index = NULL;
ListElement* current = NULL;
......@@ -780,7 +780,7 @@ void MQTTAsync_insertInOrder(List* list, void* content, int size)
}
int MQTTAsync_restoreCommands(MQTTAsyncs* client)
static int MQTTAsync_restoreCommands(MQTTAsyncs* client)
{
int rc = 0;
char **msgkeys;
......@@ -829,7 +829,7 @@ int MQTTAsync_restoreCommands(MQTTAsyncs* client)
#endif
int MQTTAsync_addCommand(MQTTAsync_queuedCommand* command, int command_size)
static int MQTTAsync_addCommand(MQTTAsync_queuedCommand* command, int command_size)
{
int rc = 0;
......@@ -871,7 +871,7 @@ int MQTTAsync_addCommand(MQTTAsync_queuedCommand* command, int command_size)
}
void MQTTAsync_startConnectRetry(MQTTAsyncs* m)
static void MQTTAsync_startConnectRetry(MQTTAsyncs* m)
{
if (m->automaticReconnect && m->shouldBeConnected)
{
......@@ -928,7 +928,7 @@ int MQTTAsync_reconnect(MQTTAsync handle)
}
void MQTTAsync_checkDisconnect(MQTTAsync handle, MQTTAsync_command* command)
static void MQTTAsync_checkDisconnect(MQTTAsync handle, MQTTAsync_command* command)
{
MQTTAsyncs* m = handle;
......@@ -962,7 +962,7 @@ void MQTTAsync_checkDisconnect(MQTTAsync handle, MQTTAsync_command* command)
* Cleaning up means removing any publication data that was stored because the write did
* not originally complete.
*/
void MQTTProtocol_checkPendingWrites(void)
static void MQTTProtocol_checkPendingWrites(void)
{
FUNC_ENTRY;
if (state.pending_writes.count > 0)
......@@ -985,7 +985,7 @@ void MQTTProtocol_checkPendingWrites(void)
}
void MQTTAsync_freeServerURIs(MQTTAsyncs* m)
static void MQTTAsync_freeServerURIs(MQTTAsyncs* m)
{
int i;
......@@ -996,7 +996,7 @@ void MQTTAsync_freeServerURIs(MQTTAsyncs* m)
}
void MQTTAsync_freeCommand1(MQTTAsync_queuedCommand *command)
static void MQTTAsync_freeCommand1(MQTTAsync_queuedCommand *command)
{
if (command->command.type == SUBSCRIBE)
{
......@@ -1026,14 +1026,14 @@ void MQTTAsync_freeCommand1(MQTTAsync_queuedCommand *command)
}
}
void MQTTAsync_freeCommand(MQTTAsync_queuedCommand *command)
static void MQTTAsync_freeCommand(MQTTAsync_queuedCommand *command)
{
MQTTAsync_freeCommand1(command);
free(command);
}
void MQTTAsync_writeComplete(int socket)
static void MQTTAsync_writeComplete(int socket)
{
ListElement* found = NULL;
......@@ -1086,7 +1086,7 @@ void MQTTAsync_writeComplete(int socket)
}
int MQTTAsync_processCommand(void)
static int MQTTAsync_processCommand(void)
{
int rc = 0;
MQTTAsync_queuedCommand* command = NULL;
......@@ -1334,7 +1334,7 @@ exit:
}
void MQTTAsync_checkTimeouts(void)
static void MQTTAsync_checkTimeouts(void)
{
ListElement* current = NULL;
static time_t last = 0L;
......@@ -1438,7 +1438,7 @@ exit:
}
thread_return_type WINAPI MQTTAsync_sendThread(void* n)
static thread_return_type WINAPI MQTTAsync_sendThread(void* n)
{
FUNC_ENTRY;
MQTTAsync_lock_mutex(mqttasync_mutex);
......@@ -1474,7 +1474,7 @@ thread_return_type WINAPI MQTTAsync_sendThread(void* n)
}
void MQTTAsync_emptyMessageQueue(Clients* client)
static void MQTTAsync_emptyMessageQueue(Clients* client)
{
FUNC_ENTRY;
/* empty message queue */
......@@ -1494,7 +1494,7 @@ void MQTTAsync_emptyMessageQueue(Clients* client)
}
void MQTTAsync_removeResponsesAndCommands(MQTTAsyncs* m)
static void MQTTAsync_removeResponsesAndCommands(MQTTAsyncs* m)
{
int count = 0;
ListElement* current = NULL;
......@@ -1629,7 +1629,7 @@ void MQTTAsync_free(void* memory)
}
int MQTTAsync_completeConnection(MQTTAsyncs* m, MQTTPacket* pack)
static int MQTTAsync_completeConnection(MQTTAsyncs* m, MQTTPacket* pack)
{
int rc = MQTTASYNC_FAILURE;
......@@ -1674,7 +1674,7 @@ int MQTTAsync_completeConnection(MQTTAsyncs* m, MQTTPacket* pack)
}
/* This is the thread function that handles the calling of callback functions if set */
thread_return_type WINAPI MQTTAsync_receiveThread(void* n)
static thread_return_type WINAPI MQTTAsync_receiveThread(void* n)
{
long timeout = 10L; /* first time in we have a small timeout. Gets things started more quickly */
......@@ -1920,7 +1920,7 @@ thread_return_type WINAPI MQTTAsync_receiveThread(void* n)
}
void MQTTAsync_stop(void)
static void MQTTAsync_stop(void)
{
int rc = 0;
......@@ -2010,7 +2010,7 @@ int MQTTAsync_setConnected(MQTTAsync handle, void* context, MQTTAsync_connected*
}
void MQTTAsync_closeOnly(Clients* client)
static void MQTTAsync_closeOnly(Clients* client)
{
FUNC_ENTRY;
client->good = 0;
......@@ -2036,7 +2036,7 @@ void MQTTAsync_closeOnly(Clients* client)
}
void MQTTAsync_closeSession(Clients* client)
static void MQTTAsync_closeSession(Clients* client)
{
FUNC_ENTRY;
MQTTAsync_closeOnly(client);
......@@ -2054,14 +2054,14 @@ void MQTTAsync_closeSession(Clients* client)
* @param b Client structure
* @return boolean indicating whether a and b are equal
*/
int clientStructCompare(void* a, void* b)
static int clientStructCompare(void* a, void* b)
{
MQTTAsyncs* m = (MQTTAsyncs*)a;
return m->c == (Clients*)b;
}
int MQTTAsync_cleanSession(Clients* client)
static int MQTTAsync_cleanSession(Clients* client)
{
int rc = 0;
ListElement* found = NULL;
......@@ -2087,7 +2087,7 @@ int MQTTAsync_cleanSession(Clients* client)
}
int MQTTAsync_deliverMessage(MQTTAsyncs* m, char* topicName, size_t topicLen, MQTTAsync_message* mm)
static int MQTTAsync_deliverMessage(MQTTAsyncs* m, char* topicName, size_t topicLen, MQTTAsync_message* mm)
{
int rc;
......@@ -2333,7 +2333,7 @@ exit:
}
int MQTTAsync_disconnect1(MQTTAsync handle, const MQTTAsync_disconnectOptions* options, int internal)
static int MQTTAsync_disconnect1(MQTTAsync handle, const MQTTAsync_disconnectOptions* options, int internal)
{
MQTTAsyncs* m = handle;
int rc = MQTTASYNC_SUCCESS;
......@@ -2374,7 +2374,7 @@ exit:
}
int MQTTAsync_disconnect_internal(MQTTAsync handle, int timeout)
static int MQTTAsync_disconnect_internal(MQTTAsync handle, int timeout)
{
MQTTAsync_disconnectOptions options = MQTTAsync_disconnectOptions_initializer;
......@@ -2410,7 +2410,7 @@ int MQTTAsync_isConnected(MQTTAsync handle)
}
int cmdMessageIDCompare(void* a, void* b)
static int cmdMessageIDCompare(void* a, void* b)
{
MQTTAsync_queuedCommand* cmd = (MQTTAsync_queuedCommand*)a;
return cmd->command.token == *(int*)b;
......@@ -2423,7 +2423,7 @@ int cmdMessageIDCompare(void* a, void* b)
* @param m a client structure
* @return the next message id to use, or 0 if none available
*/
int MQTTAsync_assignMsgId(MQTTAsyncs* m)
static int MQTTAsync_assignMsgId(MQTTAsyncs* m)
{
int start_msgid = m->c->msgID;
int msgid = start_msgid;
......@@ -2607,7 +2607,7 @@ int MQTTAsync_unsubscribe(MQTTAsync handle, const char* topic, MQTTAsync_respons
}
int MQTTAsync_countBufferedMessages(MQTTAsyncs* m)
static int MQTTAsync_countBufferedMessages(MQTTAsyncs* m)
{
ListElement* current = NULL;
int count = 0;
......@@ -2702,7 +2702,7 @@ exit:
}
void MQTTAsync_retry(void)
static void MQTTAsync_retry(void)
{
static time_t last = 0L;
time_t now;
......@@ -2721,7 +2721,7 @@ void MQTTAsync_retry(void)
}
int MQTTAsync_connecting(MQTTAsyncs* m)
static int MQTTAsync_connecting(MQTTAsyncs* m)
{
int rc = -1;
......@@ -2847,7 +2847,7 @@ exit:
}
MQTTPacket* MQTTAsync_cycle(int* sock, unsigned long timeout, int* rc)
static MQTTPacket* MQTTAsync_cycle(int* sock, unsigned long timeout, int* rc)
{
struct timeval tp = {0L, 0L};
static Ack ack;
......@@ -2990,7 +2990,7 @@ MQTTPacket* MQTTAsync_cycle(int* sock, unsigned long timeout, int* rc)
}
int pubCompare(void* a, void* b)
static int pubCompare(void* a, void* b)
{
Messages* msg = (Messages*)a;
return msg->publish == (Publications*)b;
......
......@@ -253,31 +253,31 @@ long MQTTClient_elapsed(struct timeval start)
}
#endif
void MQTTClient_terminate(void);
void MQTTClient_emptyMessageQueue(Clients* client);
int MQTTClient_deliverMessage(
static void MQTTClient_terminate(void);
static void MQTTClient_emptyMessageQueue(Clients* client);
static int MQTTClient_deliverMessage(
int rc, MQTTClients* m,
char** topicName, int* topicLen,
MQTTClient_message** message);
int clientSockCompare(void* a, void* b);
thread_return_type WINAPI connectionLost_call(void* context);
thread_return_type WINAPI MQTTClient_run(void* n);
void MQTTClient_stop(void);
void MQTTClient_closeSession(Clients* client);
int MQTTClient_cleanSession(Clients* client);
int MQTTClient_connectURIVersion(
static int clientSockCompare(void* a, void* b);
static thread_return_type WINAPI connectionLost_call(void* context);
static thread_return_type WINAPI MQTTClient_run(void* n);
static void MQTTClient_stop(void);
static void MQTTClient_closeSession(Clients* client);
static int MQTTClient_cleanSession(Clients* client);
static int MQTTClient_connectURIVersion(
MQTTClient handle, MQTTClient_connectOptions* options,
const char* serverURI, int MQTTVersion,
START_TIME_TYPE start, long millisecsTimeout);
int MQTTClient_connectURI(MQTTClient handle, MQTTClient_connectOptions* options, const char* serverURI);
int MQTTClient_disconnect1(MQTTClient handle, int timeout, int internal, int stop);
int MQTTClient_disconnect_internal(MQTTClient handle, int timeout);
void MQTTClient_retry(void);
MQTTPacket* MQTTClient_cycle(int* sock, unsigned long timeout, int* rc);
MQTTPacket* MQTTClient_waitfor(MQTTClient handle, int packet_type, int* rc, long timeout);
int pubCompare(void* a, void* b);
void MQTTProtocol_checkPendingWrites(void);
void MQTTClient_writeComplete(int socket);
static int MQTTClient_connectURI(MQTTClient handle, MQTTClient_connectOptions* options, const char* serverURI);
static int MQTTClient_disconnect1(MQTTClient handle, int timeout, int internal, int stop);
static int MQTTClient_disconnect_internal(MQTTClient handle, int timeout);
static void MQTTClient_retry(void);
static MQTTPacket* MQTTClient_cycle(int* sock, unsigned long timeout, int* rc);
static MQTTPacket* MQTTClient_waitfor(MQTTClient handle, int packet_type, int* rc, long timeout);
static int pubCompare(void* a, void* b);
static void MQTTProtocol_checkPendingWrites(void);
static void MQTTClient_writeComplete(int socket);
int MQTTClient_create(MQTTClient* handle, const char* serverURI, const char* clientId,
......@@ -361,7 +361,7 @@ exit:
}
void MQTTClient_terminate(void)
static void MQTTClient_terminate(void)
{
FUNC_ENTRY;
MQTTClient_stop();
......@@ -384,7 +384,7 @@ void MQTTClient_terminate(void)
}
void MQTTClient_emptyMessageQueue(Clients* client)
static void MQTTClient_emptyMessageQueue(Clients* client)
{
FUNC_ENTRY;
/* empty message queue */
......@@ -465,7 +465,7 @@ void MQTTClient_free(void* memory)
}
int MQTTClient_deliverMessage(int rc, MQTTClients* m, char** topicName, int* topicLen, MQTTClient_message** message)
static int MQTTClient_deliverMessage(int rc, MQTTClients* m, char** topicName, int* topicLen, MQTTClient_message** message)
{
qEntry* qe = (qEntry*)(m->c->messageQueue->first->content);
......@@ -491,7 +491,7 @@ int MQTTClient_deliverMessage(int rc, MQTTClients* m, char** topicName, int* top
* @param b second integer value
* @return boolean indicating whether a and b are equal
*/
int clientSockCompare(void* a, void* b)
static int clientSockCompare(void* a, void* b)
{
MQTTClients* m = (MQTTClients*)a;
return m->c->net.socket == *(int*)b;
......@@ -504,7 +504,7 @@ int clientSockCompare(void* a, void* b)
* @param context a pointer to the relevant client
* @return thread_return_type standard thread return value - not used here
*/
thread_return_type WINAPI connectionLost_call(void* context)
static thread_return_type WINAPI connectionLost_call(void* context)
{
MQTTClients* m = (MQTTClients*)context;
......@@ -514,7 +514,7 @@ thread_return_type WINAPI connectionLost_call(void* context)
/* This is the thread function that handles the calling of callback functions if set */
thread_return_type WINAPI MQTTClient_run(void* n)
static thread_return_type WINAPI MQTTClient_run(void* n)
{
long timeout = 10L; /* first time in we have a small timeout. Gets things started more quickly */
......@@ -647,7 +647,7 @@ thread_return_type WINAPI MQTTClient_run(void* n)
}
void MQTTClient_stop(void)
static void MQTTClient_stop(void)
{
int rc = 0;
......@@ -715,7 +715,7 @@ int MQTTClient_setCallbacks(MQTTClient handle, void* context, MQTTClient_connect
}
void MQTTClient_closeSession(Clients* client)
static void MQTTClient_closeSession(Clients* client)
{
FUNC_ENTRY;
client->good = 0;
......@@ -744,7 +744,7 @@ void MQTTClient_closeSession(Clients* client)
}
int MQTTClient_cleanSession(Clients* client)
static int MQTTClient_cleanSession(Clients* client)
{
int rc = 0;
......@@ -805,7 +805,7 @@ void Protocol_processPublication(Publish* publish, Clients* client)
}
int MQTTClient_connectURIVersion(MQTTClient handle, MQTTClient_connectOptions* options, const char* serverURI, int MQTTVersion,
static int MQTTClient_connectURIVersion(MQTTClient handle, MQTTClient_connectOptions* options, const char* serverURI, int MQTTVersion,
START_TIME_TYPE start, long millisecsTimeout)
{
MQTTClients* m = handle;
......@@ -987,7 +987,7 @@ exit:
}
int MQTTClient_connectURI(MQTTClient handle, MQTTClient_connectOptions* options, const char* serverURI)
static int MQTTClient_connectURI(MQTTClient handle, MQTTClient_connectOptions* options, const char* serverURI)
{
MQTTClients* m = handle;
START_TIME_TYPE start;
......@@ -1167,7 +1167,7 @@ exit:
/**
* mqttclient_mutex must be locked when you call this function, if multi threaded
*/
int MQTTClient_disconnect1(MQTTClient handle, int timeout, int call_connection_lost, int stop)
static int MQTTClient_disconnect1(MQTTClient handle, int timeout, int call_connection_lost, int stop)
{
MQTTClients* m = handle;
START_TIME_TYPE start;
......@@ -1226,7 +1226,7 @@ exit:
/**
* mqttclient_mutex must be locked when you call this function, if multi threaded
*/
int MQTTClient_disconnect_internal(MQTTClient handle, int timeout)
static int MQTTClient_disconnect_internal(MQTTClient handle, int timeout)
{
return MQTTClient_disconnect1(handle, timeout, 1, 1);
}
......@@ -1572,7 +1572,7 @@ exit:
}
void MQTTClient_retry(void)
static void MQTTClient_retry(void)
{
time_t now;
......@@ -1590,7 +1590,7 @@ void MQTTClient_retry(void)
}
MQTTPacket* MQTTClient_cycle(int* sock, unsigned long timeout, int* rc)
static MQTTPacket* MQTTClient_cycle(int* sock, unsigned long timeout, int* rc)
{
struct timeval tp = {0L, 0L};
static Ack ack;
......@@ -1671,7 +1671,7 @@ MQTTPacket* MQTTClient_cycle(int* sock, unsigned long timeout, int* rc)
}
MQTTPacket* MQTTClient_waitfor(MQTTClient handle, int packet_type, int* rc, long timeout)
static MQTTPacket* MQTTClient_waitfor(MQTTClient handle, int packet_type, int* rc, long timeout)
{
MQTTPacket* pack = NULL;
MQTTClients* m = handle;
......@@ -1857,7 +1857,7 @@ exit:
}
int pubCompare(void* a, void* b)
static int pubCompare(void* a, void* b)
{
Messages* msg = (Messages*)a;
return msg->publish == (Publications*)b;
......@@ -1989,7 +1989,7 @@ MQTTClient_nameValue* MQTTClient_getVersionInfo(void)
* Cleaning up means removing any publication data that was stored because the write did
* not originally complete.
*/
void MQTTProtocol_checkPendingWrites(void)
static void MQTTProtocol_checkPendingWrites(void)
{
FUNC_ENTRY;
if (state.pending_writes.count > 0)
......@@ -2012,7 +2012,7 @@ void MQTTProtocol_checkPendingWrites(void)
}
void MQTTClient_writeComplete(int socket)
static void MQTTClient_writeComplete(int socket)
{
ListElement* found = NULL;
......
......@@ -86,8 +86,8 @@ pf new_packets[] =
};
char* readUTFlen(char** pptr, char* enddata, int* len);
int MQTTPacket_send_ack(int type, int msgid, int dup, networkHandles *net);
static char* readUTFlen(char** pptr, char* enddata, int* len);
static int MQTTPacket_send_ack(int type, int msgid, int dup, networkHandles *net);
/**
* Reads one MQTT packet from a socket.
......@@ -349,7 +349,7 @@ int readInt(char** pptr)
* have caused an overrun.
*
*/
char* readUTFlen(char** pptr, char* enddata, int* len)
static char* readUTFlen(char** pptr, char* enddata, int* len)
{
char* string = NULL;
......@@ -530,7 +530,7 @@ void MQTTPacket_freePublish(Publish* pack)
* @param net the network handle to send the data to
* @return the completion code (e.g. TCPSOCKET_COMPLETE)
*/
int MQTTPacket_send_ack(int type, int msgid, int dup, networkHandles *net)
static int MQTTPacket_send_ack(int type, int msgid, int dup, networkHandles *net)
{
Header header;
int rc;
......
......@@ -31,8 +31,8 @@
#include "Heap.h"
MQTTPersistence_qEntry* MQTTPersistence_restoreQueueEntry(char* buffer, size_t buflen);
void MQTTPersistence_insertInSeqOrder(List* list, MQTTPersistence_qEntry* qEntry, size_t size);
static MQTTPersistence_qEntry* MQTTPersistence_restoreQueueEntry(char* buffer, size_t buflen);
static void MQTTPersistence_insertInSeqOrder(List* list, MQTTPersistence_qEntry* qEntry, size_t size);
/**
* Creates a ::MQTTClient_persistence structure representing a persistence implementation.
......@@ -538,7 +538,7 @@ int MQTTPersistence_persistQueueEntry(Clients* aclient, MQTTPersistence_qEntry*
}
MQTTPersistence_qEntry* MQTTPersistence_restoreQueueEntry(char* buffer, size_t buflen)
static MQTTPersistence_qEntry* MQTTPersistence_restoreQueueEntry(char* buffer, size_t buflen)
{
MQTTPersistence_qEntry* qe = NULL;
char* ptr = buffer;
......@@ -584,7 +584,7 @@ MQTTPersistence_qEntry* MQTTPersistence_restoreQueueEntry(char* buffer, size_t b
}
void MQTTPersistence_insertInSeqOrder(List* list, MQTTPersistence_qEntry* qEntry, size_t size)
static void MQTTPersistence_insertInSeqOrder(List* list, MQTTPersistence_qEntry* qEntry, size_t size)
{
ListElement* index = NULL;
ListElement* current = NULL;
......
......@@ -45,13 +45,13 @@ extern MQTTProtocol state;
extern ClientStates* bstate;
void MQTTProtocol_storeQoS0(Clients* pubclient, Publish* publish);
int MQTTProtocol_startPublishCommon(
static void MQTTProtocol_storeQoS0(Clients* pubclient, Publish* publish);
static int MQTTProtocol_startPublishCommon(
Clients* pubclient,
Publish* publish,
int qos,
int retained);
void MQTTProtocol_retries(time_t now, Clients* client, int regardless);
static void MQTTProtocol_retries(time_t now, Clients* client, int regardless);
/**
* List callback function for comparing Message structures by message id
......@@ -95,7 +95,7 @@ int MQTTProtocol_assignMsgId(Clients* client)
}
void MQTTProtocol_storeQoS0(Clients* pubclient, Publish* publish)
static void MQTTProtocol_storeQoS0(Clients* pubclient, Publish* publish)
{
int len;
pending_write* pw = NULL;
......@@ -123,7 +123,7 @@ void MQTTProtocol_storeQoS0(Clients* pubclient, Publish* publish)
* @param retained boolean - whether to set the MQTT retained flag
* @return the completion code
*/
int MQTTProtocol_startPublishCommon(Clients* pubclient, Publish* publish, int qos, int retained)
static int MQTTProtocol_startPublishCommon(Clients* pubclient, Publish* publish, int qos, int retained)
{
int rc = TCPSOCKET_COMPLETE;
......@@ -558,7 +558,7 @@ void MQTTProtocol_keepalive(time_t now)
* @param client - the client to which to apply the retry processing
* @param regardless boolean - retry packets regardless of retry interval (used on reconnect)
*/
void MQTTProtocol_retries(time_t now, Clients* client, int regardless)
static void MQTTProtocol_retries(time_t now, Clients* client, int regardless)
{
ListElement* outcurrent = NULL;
......
......@@ -64,7 +64,7 @@ valid_ranges[] =
};
const char* UTF8_char_validate(int len, const char* data);
static const char* UTF8_char_validate(int len, const char* data);
/**
......@@ -73,7 +73,7 @@ const char* UTF8_char_validate(int len, const char* data);
* @param data the bytes to check for a valid UTF-8 char
* @return pointer to the start of the next UTF-8 character in "data"
*/
const char* UTF8_char_validate(int len, const char* data)
static const char* UTF8_char_validate(int len, const char* data)
{
int good = 0;
int charlen = 2;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment