]> andersk Git - libfaim.git/blobdiff - aim_txqueue.c
- Tue Sep 5 03:47:26 GMT 2000
[libfaim.git] / aim_txqueue.c
index 7c2da33f34ab2fc44893764abde2ba53eb179c81..11c16605d27f7d8421b917d2b38392140a7c4022 100644 (file)
@@ -7,6 +7,10 @@
 
 #include <faim/aim.h>
 
+#ifndef _WIN32
+#include <sys/socket.h>
+#endif
+
 /*
  * Allocate a new tx frame.
  *
@@ -19,7 +23,7 @@
  * chan = channel for OSCAR, hdrtype for OFT
  *
  */
-struct command_tx_struct *aim_tx_new(unsigned short framing, int chan, struct aim_conn_t *conn, int datalen)
+faim_internal struct command_tx_struct *aim_tx_new(unsigned char framing, int chan, struct aim_conn_t *conn, int datalen)
 {
   struct command_tx_struct *new;
 
@@ -70,8 +74,8 @@ struct command_tx_struct *aim_tx_new(unsigned short framing, int chan, struct ai
  * that is, when sess->tx_enqueue is set to &aim_tx_enqueue__queuebased.
  *
  */
-int aim_tx_enqueue__queuebased(struct aim_session_t *sess,
-                              struct command_tx_struct *newpacket)
+faim_internal int aim_tx_enqueue__queuebased(struct aim_session_t *sess,
+                                            struct command_tx_struct *newpacket)
 {
   struct command_tx_struct *cur;
 
@@ -122,7 +126,7 @@ int aim_tx_enqueue__queuebased(struct aim_session_t *sess,
  * right here. 
  * 
  */
-int aim_tx_enqueue__immediate(struct aim_session_t *sess, struct command_tx_struct *newpacket)
+faim_internal int aim_tx_enqueue__immediate(struct aim_session_t *sess, struct command_tx_struct *newpacket)
 {
   if (newpacket->conn == NULL) {
     faimdprintf(1, "aim_tx_enqueue: ERROR: packet has no connection\n");
@@ -156,7 +160,7 @@ int aim_tx_enqueue__immediate(struct aim_session_t *sess, struct command_tx_stru
  *   before enqueuement (in aim_tx_enqueue()).
  *
  */
-u_int aim_get_next_txseqnum(struct aim_conn_t *conn)
+faim_internal unsigned int aim_get_next_txseqnum(struct aim_conn_t *conn)
 {
   u_int ret;
   
@@ -175,7 +179,7 @@ u_int aim_get_next_txseqnum(struct aim_conn_t *conn)
  *
  */
 #if debug == 2
-int aim_tx_printqueue(struct aim_session_t *sess)
+faim_internal int aim_tx_printqueue(struct aim_session_t *sess)
 {
   struct command_tx_struct *cur;
 
@@ -225,7 +229,7 @@ int aim_tx_printqueue(struct aim_session_t *sess)
  *    9) Step to next struct in list and go back to 1.
  *
  */
-int aim_tx_sendframe(struct aim_session_t *sess, struct command_tx_struct *cur)
+faim_internal int aim_tx_sendframe(struct aim_session_t *sess, struct command_tx_struct *cur)
 {
   int buflen = 0;
   unsigned char *curPacket;
@@ -286,7 +290,7 @@ int aim_tx_sendframe(struct aim_session_t *sess, struct command_tx_struct *cur)
    * since OFT allows us to do the data in a different write (yay!).
    */
   faim_mutex_lock(&cur->conn->active);
-  if ( (u_int)write(cur->conn->fd, curPacket, buflen) != buflen) {
+  if (send(cur->conn->fd, curPacket, buflen, 0) != buflen) {
     faim_mutex_unlock(&cur->conn->active);
     cur->sent = 1;
     aim_conn_kill(sess, &cur->conn);
@@ -294,7 +298,7 @@ int aim_tx_sendframe(struct aim_session_t *sess, struct command_tx_struct *cur)
   }
 
   if ((cur->hdrtype == AIM_FRAMETYPE_OFT) && cur->commandlen) {
-    if (write(cur->conn->fd, cur->data, cur->commandlen) != cur->commandlen) {
+    if (send(cur->conn->fd, cur->data, cur->commandlen, 0) != (int)cur->commandlen) {
       /* 
        * Theres nothing we can do about this since we've already sent the 
        * header!  The connection is unstable.
@@ -327,7 +331,7 @@ int aim_tx_sendframe(struct aim_session_t *sess, struct command_tx_struct *cur)
   return 1; /* success */
 }
 
-int aim_tx_flushqueue(struct aim_session_t *sess)
+faim_export int aim_tx_flushqueue(struct aim_session_t *sess)
 {
   struct command_tx_struct *cur;
    
@@ -371,7 +375,7 @@ int aim_tx_flushqueue(struct aim_session_t *sess)
  *  reduce memory footprint at run time!  
  *
  */
-void aim_tx_purgequeue(struct aim_session_t *sess)
+faim_export void aim_tx_purgequeue(struct aim_session_t *sess)
 {
   struct command_tx_struct *cur = NULL;
   struct command_tx_struct *tmp;
This page took 0.062681 seconds and 4 git commands to generate.