Add missing function prototypes

Signed-off-by: 's avatarGuilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
parent 6e88fdff
...@@ -68,6 +68,15 @@ typedef struct ...@@ -68,6 +68,15 @@ typedef struct
static Tree heap; /**< Tree that holds the allocation records */ static Tree heap; /**< Tree that holds the allocation records */
static char* errmsg = "Memory allocation error"; static 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(int log_level);
/** /**
* Round allocation size up to a multiple of the size of an int. Apart from possibly reducing fragmentation, * Round allocation size up to a multiple of the size of an int. Apart from possibly reducing fragmentation,
* on the old v3 gcc compilers I was hitting some weird behaviour, which might have been errors in * on the old v3 gcc compilers I was hitting some weird behaviour, which might have been errors in
......
File mode changed from 100755 to 100644
...@@ -33,6 +33,9 @@ ...@@ -33,6 +33,9 @@
#include "Heap.h" #include "Heap.h"
int ListUnlink(List* aList, void* content, int(*callback)(void*, void*), int freeContent);
/** /**
* Sets a list structure to empty - all null values. Does not remove any items from the list. * Sets a list structure to empty - all null values. Does not remove any items from the list.
* @param newl a pointer to the list structure to be initialized * @param newl a pointer to the list structure to be initialized
......
File mode changed from 100755 to 100644
...@@ -103,7 +103,13 @@ static int lines_written = 0; /**< number of lines written to the current output ...@@ -103,7 +103,13 @@ static int lines_written = 0; /**< number of lines written to the current output
static int max_lines_per_file = 1000; /**< maximum number of lines to write to one trace file */ static int max_lines_per_file = 1000; /**< maximum number of lines to write to one trace file */
static int trace_output_level = -1; static int trace_output_level = -1;
static Log_traceCallback* trace_callback = NULL; static Log_traceCallback* trace_callback = NULL;
static traceEntry* Log_pretrace(void);
static char* Log_formatTraceEntry(traceEntry* cur_entry);
static void Log_output(int log_level, char* msg); static void Log_output(int log_level, char* msg);
static void Log_posttrace(int log_level, traceEntry* cur_entry);
static void Log_trace(int log_level, char* buf);
FILE* Log_destToFile(char* dest);
int Log_compareEntries(char* entry1, char* entry2);
static int sametime_count = 0; static int sametime_count = 0;
#if defined(GETTIMEOFDAY) #if defined(GETTIMEOFDAY)
...@@ -283,7 +289,6 @@ static traceEntry* Log_pretrace(void) ...@@ -283,7 +289,6 @@ static traceEntry* Log_pretrace(void)
return cur_entry; return cur_entry;
} }
static char* Log_formatTraceEntry(traceEntry* cur_entry) static char* Log_formatTraceEntry(traceEntry* cur_entry)
{ {
struct tm *timeinfo; struct tm *timeinfo;
......
...@@ -171,14 +171,6 @@ static List* handles = NULL; ...@@ -171,14 +171,6 @@ static List* handles = NULL;
static int tostop = 0; static int tostop = 0;
static List* commands = NULL; static List* commands = NULL;
MQTTPacket* MQTTAsync_cycle(int* sock, unsigned long timeout, int* rc);
int MQTTAsync_cleanSession(Clients* client);
void MQTTAsync_stop(void);
int MQTTAsync_disconnect_internal(MQTTAsync handle, int timeout);
void MQTTAsync_closeOnly(Clients* client);
void MQTTAsync_closeSession(Clients* client);
void MQTTProtocol_closeSession(Clients* client, int sendwill);
void MQTTAsync_writeComplete(int socket);
#if defined(WIN32) || defined(WIN64) #if defined(WIN32) || defined(WIN64)
#define START_TIME_TYPE DWORD #define START_TIME_TYPE DWORD
...@@ -336,12 +328,50 @@ typedef struct ...@@ -336,12 +328,50 @@ typedef struct
unsigned int seqno; /* only used on restore */ unsigned int seqno; /* only used on restore */
} MQTTAsync_queuedCommand; } MQTTAsync_queuedCommand;
void MQTTAsync_freeCommand(MQTTAsync_queuedCommand *command);
void MQTTAsync_freeCommand1(MQTTAsync_queuedCommand *command); int clientSockCompare(void* a, void* b);
int MQTTAsync_deliverMessage(MQTTAsyncs* m, char* topicName, size_t topicLen, MQTTAsync_message* mm); 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);
#if !defined(NO_PERSISTENCE) #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); int MQTTAsync_restoreCommands(MQTTAsyncs* client);
#endif #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);
void MQTTAsync_sleep(long milliseconds) void MQTTAsync_sleep(long milliseconds)
{ {
...@@ -1003,7 +1033,7 @@ void MQTTAsync_freeCommand(MQTTAsync_queuedCommand *command) ...@@ -1003,7 +1033,7 @@ void MQTTAsync_freeCommand(MQTTAsync_queuedCommand *command)
} }
void MQTTAsync_writeComplete(int socket) void MQTTAsync_writeComplete(int socket)
{ {
ListElement* found = NULL; ListElement* found = NULL;
......
...@@ -160,14 +160,6 @@ static int running = 0; ...@@ -160,14 +160,6 @@ static int running = 0;
static int tostop = 0; static int tostop = 0;
static thread_id_type run_id = 0; static thread_id_type run_id = 0;
MQTTPacket* MQTTClient_waitfor(MQTTClient handle, int packet_type, int* rc, long timeout);
MQTTPacket* MQTTClient_cycle(int* sock, unsigned long timeout, int* rc);
int MQTTClient_cleanSession(Clients* client);
void MQTTClient_stop(void);
int MQTTClient_disconnect_internal(MQTTClient handle, int timeout);
int MQTTClient_disconnect1(MQTTClient handle, int timeout, int internal, int stop);
void MQTTClient_writeComplete(int socket);
typedef struct typedef struct
{ {
MQTTClient_message* msg; MQTTClient_message* msg;
...@@ -261,6 +253,32 @@ long MQTTClient_elapsed(struct timeval start) ...@@ -261,6 +253,32 @@ long MQTTClient_elapsed(struct timeval start)
} }
#endif #endif
void MQTTClient_terminate(void);
void MQTTClient_emptyMessageQueue(Clients* client);
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(
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);
int MQTTClient_create(MQTTClient* handle, const char* serverURI, const char* clientId, int MQTTClient_create(MQTTClient* handle, const char* serverURI, const char* clientId,
int persistence_type, void* persistence_context) int persistence_type, void* persistence_context)
...@@ -1994,7 +2012,7 @@ void MQTTProtocol_checkPendingWrites(void) ...@@ -1994,7 +2012,7 @@ void MQTTProtocol_checkPendingWrites(void)
} }
void MQTTClient_writeComplete(int socket) void MQTTClient_writeComplete(int socket)
{ {
ListElement* found = NULL; ListElement* found = NULL;
......
...@@ -86,6 +86,9 @@ pf new_packets[] = ...@@ -86,6 +86,9 @@ pf new_packets[] =
}; };
char* readUTFlen(char** pptr, char* enddata, int* len);
int MQTTPacket_send_ack(int type, int msgid, int dup, networkHandles *net);
/** /**
* Reads one MQTT packet from a socket. * Reads one MQTT packet from a socket.
* @param socket a socket from which to read an MQTT packet * @param socket a socket from which to read an MQTT packet
......
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
...@@ -31,6 +31,9 @@ ...@@ -31,6 +31,9 @@
#include "Heap.h" #include "Heap.h"
MQTTPersistence_qEntry* MQTTPersistence_restoreQueueEntry(char* buffer, size_t buflen);
void MQTTPersistence_insertInSeqOrder(List* list, MQTTPersistence_qEntry* qEntry, size_t size);
/** /**
* Creates a ::MQTTClient_persistence structure representing a persistence implementation. * Creates a ::MQTTClient_persistence structure representing a persistence implementation.
* @param persistence the ::MQTTClient_persistence structure. * @param persistence the ::MQTTClient_persistence structure.
......
File mode changed from 100755 to 100644
...@@ -41,12 +41,18 @@ ...@@ -41,12 +41,18 @@
#define min(A,B) ( (A) < (B) ? (A):(B)) #define min(A,B) ( (A) < (B) ? (A):(B))
#endif #endif
void Protocol_processPublication(Publish* publish, Clients* client);
void MQTTProtocol_closeSession(Clients* client, int sendwill);
extern MQTTProtocol state; extern MQTTProtocol state;
extern ClientStates* bstate; extern ClientStates* bstate;
void MQTTProtocol_storeQoS0(Clients* pubclient, Publish* publish);
int MQTTProtocol_startPublishCommon(
Clients* pubclient,
Publish* publish,
int qos,
int retained);
void MQTTProtocol_retries(time_t now, Clients* client, int regardless);
/** /**
* List callback function for comparing Message structures by message id * List callback function for comparing Message structures by message id
* @param a first integer value * @param a first integer value
......
...@@ -35,6 +35,7 @@ Publications* MQTTProtocol_storePublication(Publish* publish, int* len); ...@@ -35,6 +35,7 @@ Publications* MQTTProtocol_storePublication(Publish* publish, int* len);
int messageIDCompare(void* a, void* b); int messageIDCompare(void* a, void* b);
int MQTTProtocol_assignMsgId(Clients* client); int MQTTProtocol_assignMsgId(Clients* client);
void MQTTProtocol_removePublication(Publications* p); void MQTTProtocol_removePublication(Publications* p);
void Protocol_processPublication(Publish* publish, Clients* client);
int MQTTProtocol_handlePublishes(void* pack, int sock); int MQTTProtocol_handlePublishes(void* pack, int sock);
int MQTTProtocol_handlePubacks(void* pack, int sock); int MQTTProtocol_handlePubacks(void* pack, int sock);
...@@ -42,6 +43,7 @@ int MQTTProtocol_handlePubrecs(void* pack, int sock); ...@@ -42,6 +43,7 @@ int MQTTProtocol_handlePubrecs(void* pack, int sock);
int MQTTProtocol_handlePubrels(void* pack, int sock); int MQTTProtocol_handlePubrels(void* pack, int sock);
int MQTTProtocol_handlePubcomps(void* pack, int sock); int MQTTProtocol_handlePubcomps(void* pack, int sock);
void MQTTProtocol_closeSession(Clients* c, int sendwill);
void MQTTProtocol_keepalive(time_t); void MQTTProtocol_keepalive(time_t);
void MQTTProtocol_retry(time_t, int, int); void MQTTProtocol_retry(time_t, int, int);
void MQTTProtocol_freeClient(Clients* client); void MQTTProtocol_freeClient(Clients* client);
......
...@@ -37,6 +37,7 @@ extern MQTTProtocol state; ...@@ -37,6 +37,7 @@ extern MQTTProtocol state;
extern ClientStates* bstate; extern ClientStates* bstate;
/** /**
* Separates an address:port into two separate values * Separates an address:port into two separate values
* @param uri the input string - hostname:port * @param uri the input string - hostname:port
......
...@@ -56,6 +56,12 @@ ...@@ -56,6 +56,12 @@
"MQTTClientV3_Version", "MQTTClientV3_Timestamp"}; "MQTTClientV3_Version", "MQTTClientV3_Timestamp"};
char* FindString(char* filename, char* eyecatcher_input);
int printVersionInfo(MQTTAsync_nameValue* info);
int loadandcall(char* libname);
void printEyecatchers(char* filename);
/** /**
* Finds an eyecatcher in a binary file and returns the following value. * Finds an eyecatcher in a binary file and returns the following value.
* @param filename the name of the file * @param filename the name of the file
......
...@@ -42,6 +42,29 @@ ...@@ -42,6 +42,29 @@
extern Sockets s; extern Sockets s;
int SSLSocket_error(char* aString, SSL* ssl, int sock, int rc);
char* SSL_get_verify_result_string(int rc);
void SSL_CTX_info_callback(const SSL* ssl, int where, int ret);
char* SSLSocket_get_version_string(int version);
void SSL_CTX_msg_callback(
int write_p,
int version,
int content_type,
const void* buf, size_t len,
SSL* ssl, void* arg);
int pem_passwd_cb(char* buf, int size, int rwflag, void* userdata);
int SSL_create_mutex(ssl_mutex_type* mutex);
int SSL_lock_mutex(ssl_mutex_type* mutex);
int SSL_unlock_mutex(ssl_mutex_type* mutex);
void SSL_destroy_mutex(ssl_mutex_type* mutex);
#if (OPENSSL_VERSION_NUMBER >= 0x010000000)
extern void SSLThread_id(CRYPTO_THREADID *id);
#else
extern unsigned long SSLThread_id(void);
#endif
extern void SSLLocks_callback(int mode, int n, const char *file, int line);
int SSLSocket_createContext(networkHandles* net, MQTTClient_SSLOptions* opts);
void SSLSocket_destroyContext(networkHandles* net);
void SSLSocket_addPendingRead(int sock); void SSLSocket_addPendingRead(int sock);
static ssl_mutex_type* sslLocks = NULL; static ssl_mutex_type* sslLocks = NULL;
......
File mode changed from 100755 to 100644
...@@ -40,8 +40,15 @@ ...@@ -40,8 +40,15 @@
#include "Heap.h" #include "Heap.h"
int Socket_setnonblocking(int sock);
int Socket_error(char* aString, int sock);
int Socket_addSocket(int newSd);
int isReady(int socket, fd_set* read_set, fd_set* write_set);
int Socket_writev(int socket, iobuf* iovecs, int count, unsigned long* bytes);
int Socket_close_only(int socket); int Socket_close_only(int socket);
int Socket_continueWrite(int socket);
int Socket_continueWrites(fd_set* pwset); int Socket_continueWrites(fd_set* pwset);
char* Socket_getaddrname(struct sockaddr* sa, int sock);
#if defined(WIN32) || defined(WIN64) #if defined(WIN32) || defined(WIN64)
#define iov_len len #define iov_len len
......
File mode changed from 100755 to 100644
...@@ -53,6 +53,13 @@ static List* queues; ...@@ -53,6 +53,13 @@ static List* queues;
*/ */
static List writes; static List writes;
int socketcompare(void* a, void* b);
void SocketBuffer_newDefQ(void);
void SocketBuffer_freeDefQ(void);
int pending_socketcompare(void* a, void* b);
/** /**
* List callback function for comparing socket_queues by socket * List callback function for comparing socket_queues by socket
* @param a first integer value * @param a first integer value
......
File mode changed from 100755 to 100644
...@@ -72,6 +72,9 @@ static mutex_type stack_mutex = &stack_mutex_store; ...@@ -72,6 +72,9 @@ static mutex_type stack_mutex = &stack_mutex_store;
#endif #endif
int setStack(int create);
int setStack(int create) int setStack(int create)
{ {
int i = -1; int i = -1;
......
...@@ -33,6 +33,24 @@ ...@@ -33,6 +33,24 @@
#include "Heap.h" #include "Heap.h"
int isRed(Node* aNode);
int isBlack(Node* aNode);
int TreeWalk(Node* curnode, int depth);
int TreeMaxDepth(Tree *aTree);
void TreeRotate(Tree* aTree, Node* curnode, int direction, int index);
Node* TreeBAASub(Tree* aTree, Node* curnode, int which, int index);
void TreeBalanceAfterAdd(Tree* aTree, Node* curnode, int index);
void* TreeAddByIndex(Tree* aTree, void* content, size_t size, int index);
Node* TreeFindIndex1(Tree* aTree, void* key, int index, int value);
Node* TreeFindContentIndex(Tree* aTree, void* key, int index);
Node* TreeMinimum(Node* curnode);
Node* TreeSuccessor(Node* curnode);
Node* TreeNextElementIndex(Tree* aTree, Node* curnode, int index);
Node* TreeBARSub(Tree* aTree, Node* curnode, int which, int index);
void TreeBalanceAfterRemove(Tree* aTree, Node* curnode, int index);
void* TreeRemoveIndex(Tree* aTree, void* content, int index);
void TreeInitializeNoMalloc(Tree* aTree, int(*compare)(void*, void*, int)) void TreeInitializeNoMalloc(Tree* aTree, int(*compare)(void*, void*, int))
{ {
memset(aTree, '\0', sizeof(Tree)); memset(aTree, '\0', sizeof(Tree));
......
File mode changed from 100755 to 100644
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
* UTF-8 byte sequences. * UTF-8 byte sequences.
* *
*/ */
#include "utf-8.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
...@@ -63,6 +64,9 @@ valid_ranges[] = ...@@ -63,6 +64,9 @@ valid_ranges[] =
}; };
const char* UTF8_char_validate(int len, const char* data);
/** /**
* Validate a single UTF-8 character * Validate a single UTF-8 character
* @param len the length of the string in "data" * @param len the length of the string in "data"
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#if !defined(UTF8_H) #if !defined(UTF8_H)
#define UTF8_H #define UTF8_H
int UTF8_validate(int len, char* data); int UTF8_validate(int len, const char *data);
int UTF8_validateString(const char* string); int UTF8_validateString(const char* string);
#endif #endif
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