#include <faim/faimconfig.h>
#include <faim/aim_cbtypes.h>
+#ifndef FAIM_USEPTHREADS
+#error pthreads are currently required.
+#endif
+
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <stdarg.h>
#include <errno.h>
+#ifdef FAIM_USEPTHREADS
+#include <pthread.h>
+#define faim_mutex_t pthread_mutex_t
+#define faim_mutex_init pthread_mutex_init
+#define faim_mutex_lock pthread_mutex_lock
+#define faim_mutex_unlock pthread_mutex_unlock
+#endif
+
#ifdef _WIN32
#include <windows.h>
#include <time.h>
time_t lastactivity; /* time of last transmit */
int forcedlatency;
struct aim_rxcblist_t *handlerlist;
+#ifdef FAIM_USEPTHREADS
+ faim_mutex_t active;
+#endif
};
/* struct for incoming commands */
/*
* TX/RX queues
*/
- struct command_tx_struct *queue_outgoing;
+ struct command_tx_struct *queue_outgoing;
struct command_rx_struct *queue_incoming;
+ /*
+ * Tx Enqueuing function
+ */
+ int (*tx_enqueue)(struct aim_session_t *, struct command_tx_struct *);
+
/*
* This is a dreadful solution to the what-room-are-we-joining
* problem. (There's no connection between the service
int aim_parse_last_bad(struct aim_session_t *, struct command_rx_struct *, ...);
struct command_tx_struct *aim_tx_new(int, struct aim_conn_t *, int);
-int aim_tx_enqueue(struct aim_session_t *, struct command_tx_struct *);
+int aim_tx_enqueue__queuebased(struct aim_session_t *, struct command_tx_struct *);
+int aim_tx_enqueue__immediate(struct aim_session_t *, struct command_tx_struct *);
+#define aim_tx_enqueue(x, y) ((*(x->tx_enqueue))(x, y))
+int aim_tx_sendframe(struct command_tx_struct *cur);
u_int aim_get_next_txseqnum(struct aim_conn_t *);
int aim_tx_flushqueue(struct aim_session_t *);
int aim_tx_printqueue(struct aim_session_t *);