]> andersk Git - libfaim.git/commitdiff
- Tue Sep 5 03:47:26 GMT 2000
authormid <mid>
Tue, 5 Sep 2000 04:12:41 +0000 (04:12 +0000)
committermid <mid>
Tue, 5 Sep 2000 04:12:41 +0000 (04:12 +0000)
   - More ANSIfication for win32
   - Forgot aim_misc last time.

14 files changed:
CHANGES
aim_chat.c
aim_conn.c
aim_ft.c
aim_im.c
aim_info.c
aim_login.c
aim_misc.c
aim_rxqueue.c
aim_tlv.c
aim_txqueue.c
faim/aim.h
faim/faimconfig.h
md5.c

diff --git a/CHANGES b/CHANGES
index 07efd4b883efc31da5792f1bcb02618fd84907b4..7c926c21d17165b9444dec98ea89a7028315b55c 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,10 @@
 
 No release numbers
 ------------------
+ - Tue Sep  5 03:47:26 GMT 2000
+   - More ANSIfication for win32
+   - Forgot aim_misc last time.
+
  - Mon Sep  4 22:08:35 GMT 2000
    - Forgot aim_snac and aim_search
 
index cf7a21b5394fe13ac4eccaab402ba70d6f30a4ca..ee40b0ab281107bdb9669f7d907a1f1b5c3c303a 100644 (file)
@@ -68,7 +68,7 @@ faim_export unsigned long aim_chat_send_im(struct aim_session_t *sess,
    * Generate a random message cookie 
    */
   for (i=0;i<8;i++)
-    curbyte += aimutil_put8(newpacket->data+curbyte, (u_char) random());
+    curbyte += aimutil_put8(newpacket->data+curbyte, (u_char) rand());
 
   aim_cachecookie(sess, aim_mkcookie(newpacket->data+curbyte-8, AIM_COOKIETYPE_CHAT, NULL));
 
index f76eeba666d7ff06dded8c9b4d8c1bad6f4a1efa..edf61648c7d9dff3beb5673f96baa2965a28b09f 100644 (file)
@@ -202,7 +202,7 @@ faim_export struct aim_conn_t *aim_newconn(struct aim_session_t *sess,
    *
    */
 
-  for(i=0;i<strlen(dest);i++) {
+  for(i=0;i<(int)strlen(dest);i++) {
     if (dest[i] == ':') {
       port = atoi(&(dest[i+1]));
       break;
index 53075774c51ea13c2b98c70270bd23bafc2640ed..d475078f662eb2a2bb36fce988f76de11ecc34a7 100644 (file)
--- a/aim_ft.c
+++ b/aim_ft.c
@@ -1,10 +1,12 @@
 #include <faim/aim.h>
 
+#ifndef _WIN32
 #include <netdb.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <sys/utsname.h> /* for aim_directim_initiate */
 #include <arpa/inet.h> /* for inet_ntoa */
+#endif
 
 /* aim_msgcookies.c is mostly new. just look at the diff and replace yours, easiest. */
 
@@ -59,8 +61,6 @@ faim_export int aim_handlerendconnect(struct aim_session_t *sess, struct aim_con
   case AIM_CONN_SUBTYPE_OFT_GETFILE: {
     struct aim_filetransfer_priv *priv;
 
-    priv->state = 0;
-
     priv = (struct aim_filetransfer_priv *)calloc(1, sizeof(struct aim_filetransfer_priv));
 
     snprintf(priv->ip, sizeof(priv->ip), "%s:%u", inet_ntoa(((struct sockaddr_in *)&cliaddr)->sin_addr), ntohs(((struct sockaddr_in *)&cliaddr)->sin_port));
@@ -261,7 +261,7 @@ faim_export struct aim_conn_t *aim_directim_initiate(struct aim_session_t *sess,
   short port = 4443;
 
   struct hostent *hptr;
-  struct utsname myname;
+  char localhost[129];
 
   unsigned char cap[16];
   char d[4]; /* XXX: IPv6. *cough* */
@@ -277,10 +277,10 @@ faim_export struct aim_conn_t *aim_directim_initiate(struct aim_session_t *sess,
    * get our local IP
    */
 
-  if(uname(&myname) < 0)
+  if(gethostname(localhost, 128) < 0)
     return NULL;
 
-  if( (hptr = gethostbyname(myname.nodename)) == NULL)
+  if( (hptr = gethostbyname(localhost)) == NULL)
     return NULL;
 
   memcpy(&d, hptr->h_addr_list[0], 4); /* XXX: this probably isn't quite kosher, but it works */
@@ -305,7 +305,7 @@ faim_export struct aim_conn_t *aim_directim_initiate(struct aim_session_t *sess,
    * This cookie needs to be alphanumeric and NULL-terminated to be TOC-compatible.
    */
   for (i=0;i<7;i++)
-    curbyte += aimutil_put8(newpacket->data+curbyte, 0x30 + ((u_char) random() % 20));
+    curbyte += aimutil_put8(newpacket->data+curbyte, 0x30 + ((u_char) rand() % 20));
   curbyte += aimutil_put8(newpacket->data+curbyte, 0x00);
 
   /*
@@ -406,8 +406,10 @@ faim_export struct aim_conn_t *aim_directim_initiate(struct aim_session_t *sess,
    * allocate and set up our connection
    */
 
+#if 0
   i = fcntl(listenfd, F_GETFL, 0);
   fcntl(listenfd, F_SETFL, i | O_NONBLOCK);
+#endif
 
   newconn = aim_newconn(sess, AIM_CONN_TYPE_RENDEZVOUS_OUT, NULL);
   if (!newconn) { 
@@ -644,6 +646,7 @@ faim_internal struct aim_fileheader_t *aim_getlisting(struct aim_session_t *sess
 
 faim_internal int aim_listenestablish(u_short portnum)
 {
+#if defined(__linux__) /* XXX what other OS's support getaddrinfo? */
   int listenfd;
   const int on = 1;
   struct addrinfo hints, *res, *ressave;
@@ -675,6 +678,37 @@ faim_internal int aim_listenestablish(u_short portnum)
   }
   freeaddrinfo(ressave);
   return listenfd;
+#else 
+  int listenfd;
+  const int on = 1;
+  struct sockaddr_in sockin;
+  
+  if ((listenfd = socket(PF_INET, SOCK_STREAM, AF_INET)) < 0) {
+    perror("socket(listenfd)");
+    return -1;
+  } 
+  if (setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on) != 0)) {
+    perror("setsockopt(listenfd)");
+    close(listenfd);
+    return -1;
+  }
+  memset(&sockin, 0, sizeof(struct sockaddr_in));
+  sockin.sin_family = AF_INET;
+  sockin.sin_port = htons(portnum);
+  if (bind(listenfd, (struct sockaddr *)&sockin, sizeof(struct sockaddr_in)) != 0) {
+    perror("bind(listenfd)");
+    close(listenfd);
+    return -1;
+  }
+  if (listen(listenfd, 4) != 0) {
+    perror("listen(listenfd)");
+    close(listenfd);
+    return -1;
+  }
+
+  return listenfd;
+}
+#endif
 }
 
 faim_internal int aim_get_command_rendezvous(struct aim_session_t *sess, struct aim_conn_t *conn)
@@ -693,7 +727,7 @@ faim_internal int aim_get_command_rendezvous(struct aim_session_t *sess, struct
 
   faim_mutex_lock(&conn->active); /* gets locked down for the entirety */
 
-  if ( (hdrlen = read(conn->fd, hdrbuf1, 6)) < 6) {    
+  if ( (hdrlen = aim_recv(conn->fd, hdrbuf1, 6)) < 6) {    
     if(hdrlen < 0)
       perror("read");
     printf("faim: rend: read error (fd: %i) %02x%02x%02x%02x%02x%02x (%i)\n", conn->fd, hdrbuf1[0],hdrbuf1[1],hdrbuf1[0],hdrbuf1[0],hdrbuf1[0],hdrbuf1[0],hdrlen);
@@ -708,7 +742,7 @@ faim_internal int aim_get_command_rendezvous(struct aim_session_t *sess, struct
   if (!(hdr = malloc(hdrlen)))
     return -1;
 
-  if (read(conn->fd, hdr, hdrlen) < hdrlen) {
+  if (aim_recv(conn->fd, hdr, hdrlen) < hdrlen) {
     perror("read");
     printf("faim: rend: read2 error\n");
     free(hdr);
@@ -750,7 +784,7 @@ faim_internal int aim_get_command_rendezvous(struct aim_session_t *sess, struct
        return 0;
       }
       
-      if (recv(conn->fd, msg, payloadlength, MSG_WAITALL) < payloadlength) {
+      if (aim_recv(conn->fd, msg, payloadlength) < payloadlength) {
        perror("read");
        printf("faim: rend: read3 error\n");
        free(msg);
@@ -809,7 +843,7 @@ faim_internal int aim_get_command_rendezvous(struct aim_session_t *sess, struct
     data = calloc(1, commandlen);
     memcpy(data, "01/01/1999 00:00      100 file.txt\r\n", commandlen);
 
-    if (write(conn->fd, data, commandlen) != commandlen) {
+    if (send(conn->fd, data, commandlen, 0) != commandlen) {
       perror("listing write error");
     }
     faim_mutex_unlock(&conn->active);
@@ -905,8 +939,8 @@ faim_internal int aim_get_command_rendezvous(struct aim_session_t *sess, struct
 
     if(newoft->commandlen > 0) {
       int i;
-      bzero(newoft->data, newoft->commandlen);
-      for(i = 0; i < newoft->commandlen; i++)
+      memset(newoft->data, 0, newoft->commandlen);
+      for(i = 0; i < (signed)newoft->commandlen; i++)
        newoft->data[i] = 0x30 + (i%10);
 
       //      memcpy(newoft->data, "This has been a Test\r\n-josh\r\n", newoft->commandlen);
@@ -988,7 +1022,7 @@ faim_internal int aim_get_command_rendezvous(struct aim_session_t *sess, struct
     for(i = 0; i < fh->size; i++)
       c[i] = 0x30 + (i%10);
 
-    if ( (i = write(conn->fd, c, fh->size)) != fh->size ) {
+    if ( (i = send(conn->fd, c, fh->size, 0)) != fh->size ) {
       printf("whoopsy, didn't write it all...\n");
     }
 
index ed2e021b91b170422c5e173f1506662af0d26ef0..82ce16cbfe4437217382bfe243434d66524ff18a 100644 (file)
--- a/aim_im.c
+++ b/aim_im.c
@@ -47,7 +47,7 @@ faim_export unsigned long aim_send_im(struct aim_session_t *sess,
    *
    */
   for (i=0;i<8;i++)
-    curbyte += aimutil_put8(newpacket->data+curbyte, (u_char) random());
+    curbyte += aimutil_put8(newpacket->data+curbyte, (u_char) rand());
 
   /*
    * Channel ID
index 06051b86389b59d7df0d0b5d5bc4eb3c5f0b088f..4f53747954a400de1db7ad711775f34999bbd3cd 100644 (file)
@@ -568,7 +568,7 @@ faim_internal int aim_putuserinfo(u_char *buf, int buflen, struct aim_userinfo_s
   aim_addtlvtochain32(&tlvlist, 0x0003, info->onlinesince);
   aim_addtlvtochain16(&tlvlist, 0x0004, info->idletime);
   /* XXX: should put caps here */
-  aim_addtlvtochain32(&tlvlist, (info->class)&AIM_CLASS_AOL?0x0010:0x000f, info->sessionlen);
+  aim_addtlvtochain32(&tlvlist, (unsigned short)((info->class)&AIM_CLASS_AOL?0x0010:0x000f), info->sessionlen);
   
   i += aim_writetlvchain(buf+i, buflen-i, &tlvlist);
   aim_freetlvchain(&tlvlist);
index 30e3e87aef587dcb2aafd91dafdd165d99d8b6af..44202567f1a6cbfe954e11b77bb3fd26deabd58e 100644 (file)
@@ -107,11 +107,11 @@ faim_export int aim_send_login (struct aim_session_t *sess,
   if (strlen(clientinfo->clientstring))
     curbyte += aim_puttlv_str(newpacket->data+curbyte, 0x0003, strlen(clientinfo->clientstring), clientinfo->clientstring);
 
-  curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0016, clientinfo->major2);
-  curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0017, clientinfo->major);
-  curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0018, clientinfo->minor);
-  curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0019, clientinfo->minor2);
-  curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x001a, clientinfo->build);
+  curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0016, (unsigned short)clientinfo->major2);
+  curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0017, (unsigned short)clientinfo->major);
+  curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0018, (unsigned short)clientinfo->minor);
+  curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0019, (unsigned short)clientinfo->minor2);
+  curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x001a, (unsigned short)clientinfo->build);
   
   curbyte += aim_puttlv_32(newpacket->data+curbyte, 0x0014, clientinfo->unknown);
   curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0009, 0x0015);
@@ -352,7 +352,7 @@ faim_export unsigned long aim_sendauthresp(struct aim_session_t *sess,
     aim_addtlvtochain_str(&tlvlist, 0x0005, bosip, strlen(bosip));
     aim_addtlvtochain_str(&tlvlist, 0x0006, cookie, AIM_COOKIELEN);
     aim_addtlvtochain_str(&tlvlist, 0x0011, email, strlen(email));
-    aim_addtlvtochain16(&tlvlist, 0x0013, regstatus);
+    aim_addtlvtochain16(&tlvlist, 0x0013, (unsigned short)regstatus);
   }
 
   tx->commandlen = aim_writetlvchain(tx->data, tx->commandlen, &tlvlist);
index eddf377d4da77c3222cdc7278fe3192807b110de..3ba77226c1a7c22116a15a7697b37ca4f96ba936 100644 (file)
@@ -21,9 +21,9 @@
  *  time.  
  *
  */
-u_long aim_bos_setidle(struct aim_session_t *sess,
-                      struct aim_conn_t *conn, 
-                      u_long idletime)
+faim_export unsigned long aim_bos_setidle(struct aim_session_t *sess,
+                                         struct aim_conn_t *conn, 
+                                         u_long idletime)
 {
   return aim_genericreq_l(sess, conn, 0x0001, 0x0011, &idletime);
 }
@@ -57,9 +57,10 @@ u_long aim_bos_setidle(struct aim_session_t *sess,
  *
  *
  */
-u_long aim_bos_changevisibility(struct aim_session_t *sess,
-                               struct aim_conn_t *conn, 
-                               int changetype, char *denylist)
+faim_export unsigned long aim_bos_changevisibility(struct aim_session_t *sess,
+                                                  struct aim_conn_t *conn, 
+                                                  int changetype, 
+                                                  char *denylist)
 {
   struct command_tx_struct *newpacket;
   int packlen = 0;
@@ -134,9 +135,9 @@ u_long aim_bos_changevisibility(struct aim_session_t *sess,
  * XXX: I can't stress the TODO enough.
  *
  */
-u_long aim_bos_setbuddylist(struct aim_session_t *sess,
-                           struct aim_conn_t *conn, 
-                           char *buddy_list)
+faim_export unsigned long aim_bos_setbuddylist(struct aim_session_t *sess,
+                                              struct aim_conn_t *conn, 
+                                              char *buddy_list)
 {
   int i, j;
 
@@ -206,11 +207,11 @@ u_long aim_bos_setbuddylist(struct aim_session_t *sess,
  *
  * 
  */
-u_long aim_bos_setprofile(struct aim_session_t *sess,
-                         struct aim_conn_t *conn, 
-                         char *profile,
-                         char *awaymsg,
-                         unsigned int caps)
+faim_export unsigned long aim_bos_setprofile(struct aim_session_t *sess,
+                                            struct aim_conn_t *conn, 
+                                            char *profile,
+                                            char *awaymsg,
+                                            unsigned short caps)
 {
   struct command_tx_struct *newpacket;
   int i = 0, tmp, caplen;
@@ -253,15 +254,15 @@ u_long aim_bos_setprofile(struct aim_session_t *sess,
  * a bitwise OR of all the user classes you want to see you.
  *
  */
-u_long aim_bos_setgroupperm(struct aim_session_t *sess,
-                           struct aim_conn_t *conn, 
-                           u_long mask)
+faim_export unsigned long aim_bos_setgroupperm(struct aim_session_t *sess,
+                                              struct aim_conn_t *conn, 
+                                              u_long mask)
 {
   return aim_genericreq_l(sess, conn, 0x0009, 0x0004, &mask);
 }
 
-int aim_parse_bosrights(struct aim_session_t *sess,
-                       struct command_rx_struct *command, ...)
+faim_internal int aim_parse_bosrights(struct aim_session_t *sess,
+                                     struct command_rx_struct *command, ...)
 {
   rxcallback_t userfunc = NULL;
   int ret=1;
@@ -307,8 +308,8 @@ int aim_parse_bosrights(struct aim_session_t *sess,
  * TODO: Dynamisize.
  *
  */
-u_long aim_bos_clientready(struct aim_session_t *sess,
-                          struct aim_conn_t *conn)
+faim_export unsigned long aim_bos_clientready(struct aim_session_t *sess,
+                                             struct aim_conn_t *conn)
 {
   u_char command_2[] = {
      /* placeholders for dynamic data */
@@ -380,8 +381,8 @@ u_long aim_bos_clientready(struct aim_session_t *sess,
  *  Request Rate Information.
  * 
  */
-u_long aim_bos_reqrate(struct aim_session_t *sess,
-                      struct aim_conn_t *conn)
+faim_export unsigned long aim_bos_reqrate(struct aim_session_t *sess,
+                                         struct aim_conn_t *conn)
 {
   return aim_genericreq_n(sess, conn, 0x0001, 0x0006);
 }
@@ -390,8 +391,8 @@ u_long aim_bos_reqrate(struct aim_session_t *sess,
  *  Rate Information Response Acknowledge.
  *
  */
-u_long aim_bos_ackrateresp(struct aim_session_t *sess,
-                          struct aim_conn_t *conn)
+faim_export unsigned long aim_bos_ackrateresp(struct aim_session_t *sess,
+                                             struct aim_conn_t *conn)
 {
   struct command_tx_struct *newpacket;
   int packlen = 20, i=0;
@@ -422,9 +423,9 @@ u_long aim_bos_ackrateresp(struct aim_session_t *sess,
  *  Bit 2:  Allows other AIM users to see how long you've been a member.
  *
  */
-u_long aim_bos_setprivacyflags(struct aim_session_t *sess,
-                              struct aim_conn_t *conn, 
-                              u_long flags)
+faim_export unsigned long aim_bos_setprivacyflags(struct aim_session_t *sess,
+                                                 struct aim_conn_t *conn, 
+                                                 u_long flags)
 {
   return aim_genericreq_l(sess, conn, 0x0001, 0x0014, &flags);
 }
@@ -436,14 +437,14 @@ u_long aim_bos_setprivacyflags(struct aim_session_t *sess,
  * because aparently it uses SNAC flags.
  *
  */
-u_long aim_bos_reqpersonalinfo(struct aim_session_t *sess,
-                              struct aim_conn_t *conn)
+faim_export unsigned long aim_bos_reqpersonalinfo(struct aim_session_t *sess,
+                                                 struct aim_conn_t *conn)
 {
   return aim_genericreq_n(sess, conn, 0x0001, 0x000e);
 }
 
-u_long aim_setversions(struct aim_session_t *sess,
-                               struct aim_conn_t *conn)
+faim_export unsigned long aim_setversions(struct aim_session_t *sess,
+                                         struct aim_conn_t *conn)
 {
   struct command_tx_struct *newpacket;
   int i;
@@ -510,7 +511,7 @@ u_long aim_setversions(struct aim_session_t *sess,
  * Service request. 
  *
  */
-u_long aim_bos_reqservice(struct aim_session_t *sess,
+faim_export unsigned long aim_bos_reqservice(struct aim_session_t *sess,
                          struct aim_conn_t *conn, 
                          u_short serviceid)
 {
@@ -524,8 +525,8 @@ u_long aim_bos_reqservice(struct aim_session_t *sess,
  * the connection alive.  Its not real necessary.
  *
  */
-u_long aim_bos_nop(struct aim_session_t *sess,
-                  struct aim_conn_t *conn)
+faim_export unsigned long aim_bos_nop(struct aim_session_t *sess,
+                                     struct aim_conn_t *conn)
 {
   return aim_genericreq_n(sess, conn, 0x0001, 0x0016);
 }
@@ -536,8 +537,8 @@ u_long aim_bos_nop(struct aim_session_t *sess,
  * Request BOS rights.
  *
  */
-u_long aim_bos_reqrights(struct aim_session_t *sess,
-                        struct aim_conn_t *conn)
+faim_export unsigned long aim_bos_reqrights(struct aim_session_t *sess,
+                                           struct aim_conn_t *conn)
 {
   return aim_genericreq_n(sess, conn, 0x0009, 0x0002);
 }
@@ -548,8 +549,8 @@ u_long aim_bos_reqrights(struct aim_session_t *sess,
  * Request Buddy List rights.
  *
  */
-u_long aim_bos_reqbuddyrights(struct aim_session_t *sess,
-                             struct aim_conn_t *conn)
+faim_export unsigned long aim_bos_reqbuddyrights(struct aim_session_t *sess,
+                                                struct aim_conn_t *conn)
 {
   return aim_genericreq_n(sess, conn, 0x0003, 0x0002);
 }
@@ -564,7 +565,7 @@ u_long aim_bos_reqbuddyrights(struct aim_session_t *sess,
  * returns -1 on error (couldn't alloc packet), next snacid on success.
  *
  */
-int aim_send_warning(struct aim_session_t *sess, struct aim_conn_t *conn, char *destsn, int anon)
+faim_export int aim_send_warning(struct aim_session_t *sess, struct aim_conn_t *conn, char *destsn, int anon)
 {
   struct command_tx_struct *newpacket;
   int curbyte;
@@ -592,15 +593,13 @@ int aim_send_warning(struct aim_session_t *sess, struct aim_conn_t *conn, char *
   return (sess->snac_nextid++);
 }
 
-
-
 /*
  * aim_debugconn_sendconnect()
  *
  * For aimdebugd.  If you don't know what it is, you don't want to.
  */
-u_long aim_debugconn_sendconnect(struct aim_session_t *sess,
-                                struct aim_conn_t *conn)
+faim_export unsigned long aim_debugconn_sendconnect(struct aim_session_t *sess,
+                                                   struct aim_conn_t *conn)
 {
   return aim_genericreq_n(sess, conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_DEBUGCONN_CONNECT);
 }
@@ -617,9 +616,9 @@ u_long aim_debugconn_sendconnect(struct aim_session_t *sess,
  * back to the single.  I don't see any advantage to doing it either way.
  *
  */
-u_long aim_genericreq_n(struct aim_session_t *sess,
-                       struct aim_conn_t *conn, 
-                       u_short family, u_short subtype)
+faim_internal unsigned long aim_genericreq_n(struct aim_session_t *sess,
+                                            struct aim_conn_t *conn, 
+                                            u_short family, u_short subtype)
 {
   struct command_tx_struct *newpacket;
 
@@ -638,9 +637,10 @@ u_long aim_genericreq_n(struct aim_session_t *sess,
  *
  *
  */
-u_long aim_genericreq_l(struct aim_session_t *sess,
-                       struct aim_conn_t *conn, 
-                       u_short family, u_short subtype, u_long *longdata)
+faim_internal unsigned long aim_genericreq_l(struct aim_session_t *sess,
+                                            struct aim_conn_t *conn, 
+                                            u_short family, u_short subtype, 
+                                            u_long *longdata)
 {
   struct command_tx_struct *newpacket;
   u_long newlong;
@@ -664,9 +664,10 @@ u_long aim_genericreq_l(struct aim_session_t *sess,
   return (sess->snac_nextid++);
 }
 
-u_long aim_genericreq_s(struct aim_session_t *sess,
-                       struct aim_conn_t *conn, 
-                       u_short family, u_short subtype, u_short *shortdata)
+faim_internal unsigned long aim_genericreq_s(struct aim_session_t *sess,
+                                            struct aim_conn_t *conn, 
+                                            u_short family, u_short subtype, 
+                                            u_short *shortdata)
 {
   struct command_tx_struct *newpacket;
   u_short newshort;
@@ -696,8 +697,8 @@ u_long aim_genericreq_s(struct aim_session_t *sess,
  * Request Location services rights.
  *
  */
-u_long aim_bos_reqlocaterights(struct aim_session_t *sess,
-                              struct aim_conn_t *conn)
+faim_export unsigned long aim_bos_reqlocaterights(struct aim_session_t *sess,
+                                                 struct aim_conn_t *conn)
 {
   return aim_genericreq_n(sess, conn, 0x0002, 0x0002);
 }
@@ -708,8 +709,8 @@ u_long aim_bos_reqlocaterights(struct aim_session_t *sess,
  * Request ICBM parameter information.
  *
  */
-u_long aim_bos_reqicbmparaminfo(struct aim_session_t *sess,
-                               struct aim_conn_t *conn)
+faim_export unsigned long aim_bos_reqicbmparaminfo(struct aim_session_t *sess,
+                                                  struct aim_conn_t *conn)
 {
   return aim_genericreq_n(sess, conn, 0x0004, 0x0004);
 }
@@ -717,8 +718,8 @@ u_long aim_bos_reqicbmparaminfo(struct aim_session_t *sess,
 /*
  * Add ICBM parameter? Huh?
  */
-unsigned long aim_addicbmparam(struct aim_session_t *sess,
-                              struct aim_conn_t *conn)
+faim_export unsigned long aim_addicbmparam(struct aim_session_t *sess,
+                                          struct aim_conn_t *conn)
 {
   struct command_tx_struct *newpacket;
   int packlen = 10+16, i=0;
index 8a1a50d9e99d1fec44ea95a808a327812ba0ca52..021fe955c8fb38f707131bd672f440a933ddbb61 100644 (file)
@@ -18,7 +18,7 @@
  * take more for a badly fragmented packet.
  *
  */
-static int aim_recv(int fd, void *buf, size_t count)
+faim_internal int aim_recv(int fd, void *buf, size_t count)
 {
 #ifdef MSG_WAITALL
   return recv(fd, buf, count, MSG_WAITALL);
@@ -28,7 +28,7 @@ static int aim_recv(int fd, void *buf, size_t count)
   left = count;
 
   while (left) {
-    ret = read(fd, ((unsigned char *)buf)+cur, left);
+    ret = recv(fd, ((unsigned char *)buf)+cur, left, 0);
     if (ret == -1)
       return -1;
     if (ret == 0)
index 17aebc7b57810eb60fe7d2f0261eda179264f357..838259daf7dee4679f68058f044053e4f83a9931 100644 (file)
--- a/aim_tlv.c
+++ b/aim_tlv.c
@@ -349,7 +349,7 @@ faim_internal int aim_puttlv_32(u_char *buf, u_short t, u_long v)
   return curbyte;
 }
 
-faim_internal int aim_puttlv_str(u_char *buf, u_short t, u_short l, char *v)
+faim_internal int aim_puttlv_str(u_char *buf, u_short t, int l, char *v)
 {
   int curbyte;
   
index 3b78f86950a878f223b0b174dd1d480e351a3d2a..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
  *
  */
-faim_internal 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;
 
@@ -286,7 +290,7 @@ faim_internal int aim_tx_sendframe(struct aim_session_t *sess, struct command_tx
    * 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 @@ faim_internal int aim_tx_sendframe(struct aim_session_t *sess, struct command_tx
   }
 
   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.
index 98bd142a8d0cfacade170dd402ccb72e5d6bb087..ddeaaddb43978976feb2743629200a95aef494a7 100644 (file)
@@ -60,7 +60,8 @@
 
 #ifdef _WIN32
 #define sleep Sleep
-#define strlen(x) (int)strlen(x)  /* win32 has a unsigned size_t */
+#define socklen_t int /* this must be a POSIXy thing */
+#define snprintf _snprintf /* I'm not sure whats wrong with Microsoft here */
 #endif
 
 #if defined(mach) && defined(__APPLE__)
@@ -73,7 +74,7 @@
 #define faim_shortfunc inline
 #endif
 
-#if defined(_WIN32)
+#if defined(_WIN32) && !defined(WIN32_STATIC)
 /*
  * For a win32 DLL, we define WIN32_INDLL if this file
  * is included while compiling the DLL. If its not 
@@ -386,7 +387,7 @@ faim_internal struct aim_tlv_t *aim_createtlv(void);
 faim_internal int aim_freetlv(struct aim_tlv_t **oldtlv);
 faim_internal int aim_puttlv_16(u_char *, u_short, u_short);
 faim_internal int aim_puttlv_32(u_char *, u_short, u_long);
-faim_internal int aim_puttlv_str(u_char *buf, u_short t, u_short l, char *v);
+faim_internal int aim_puttlv_str(u_char *buf, u_short t, int l, char *v);
 faim_internal int aim_writetlvchain(u_char *buf, int buflen, struct aim_tlvlist_t **list);
 faim_internal int aim_addtlvtochain16(struct aim_tlvlist_t **list, unsigned short type, unsigned short val);
 faim_internal int aim_addtlvtochain32(struct aim_tlvlist_t **list, unsigned short type, unsigned long val);
@@ -400,7 +401,7 @@ faim_internal int aim_counttlvchain(struct aim_tlvlist_t **list);
 faim_export int aim_get_command(struct aim_session_t *, struct aim_conn_t *);
 int aim_rxdispatch(struct aim_session_t *);
 
-u_long aim_debugconn_sendconnect(struct aim_session_t *sess, struct aim_conn_t *conn);
+faim_export unsigned long aim_debugconn_sendconnect(struct aim_session_t *sess, struct aim_conn_t *conn);
 
 int aim_logoff(struct aim_session_t *);
 
@@ -409,9 +410,9 @@ faim_export void aim_conn_kill(struct aim_session_t *sess, struct aim_conn_t **d
 typedef int (*rxcallback_t)(struct aim_session_t *, struct command_rx_struct *, ...);
 int aim_register_callbacks(rxcallback_t *);
 
-u_long aim_genericreq_n(struct aim_session_t *, struct aim_conn_t *conn, u_short family, u_short subtype);
-u_long aim_genericreq_l(struct aim_session_t *, struct aim_conn_t *conn, u_short family, u_short subtype, u_long *);
-u_long aim_genericreq_s(struct aim_session_t *, struct aim_conn_t *conn, u_short family, u_short subtype, u_short *);
+faim_internal unsigned long aim_genericreq_n(struct aim_session_t *, struct aim_conn_t *conn, u_short family, u_short subtype);
+faim_internal unsigned long aim_genericreq_l(struct aim_session_t *, struct aim_conn_t *conn, u_short family, u_short subtype, u_long *);
+faim_internal unsigned long aim_genericreq_s(struct aim_session_t *, struct aim_conn_t *conn, u_short family, u_short subtype, u_short *);
 
 faim_internal struct aim_fileheader_t *aim_oft_getfh(unsigned char *hdr);
 
@@ -426,13 +427,14 @@ faim_internal int aim_authkeyparse(struct aim_session_t *sess, struct command_rx
 faim_export unsigned long aim_sendredirect(struct aim_session_t *sess, struct aim_conn_t *conn, unsigned short servid, char *ip, char *cookie);
 faim_export void aim_purge_rxqueue(struct aim_session_t *);
 faim_internal void aim_rxqueue_cleanbyconn(struct aim_session_t *sess, struct aim_conn_t *conn);
+faim_internal int aim_recv(int fd, void *buf, size_t count);
 
 int aim_parse_unknown(struct aim_session_t *, struct command_rx_struct *command, ...);
 int aim_parse_missed_im(struct aim_session_t *, struct command_rx_struct *, ...);
 int aim_parse_last_bad(struct aim_session_t *, struct command_rx_struct *, ...);
 faim_internal int aim_get_command_rendezvous(struct aim_session_t *sess, struct aim_conn_t *conn);
 
-faim_internal 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);
 faim_internal int aim_tx_enqueue__queuebased(struct aim_session_t *, struct command_tx_struct *);
 faim_internal int aim_tx_enqueue__immediate(struct aim_session_t *, struct command_tx_struct *);
 #define aim_tx_enqueue(x, y) ((*(x->tx_enqueue))(x, y))
@@ -498,25 +500,25 @@ faim_export void aim_session_init(struct aim_session_t *);
 
 #define AIM_WARN_ANON                     0x01
 
-int aim_send_warning(struct aim_session_t *sess, struct aim_conn_t *conn, char *destsn, int anon);
-u_long aim_bos_nop(struct aim_session_t *, struct aim_conn_t *);
-u_long aim_bos_setidle(struct aim_session_t *, struct aim_conn_t *, u_long);
-u_long aim_bos_changevisibility(struct aim_session_t *, struct aim_conn_t *, int, char *);
-u_long aim_bos_setbuddylist(struct aim_session_t *, struct aim_conn_t *, char *);
-u_long aim_bos_setprofile(struct aim_session_t *, struct aim_conn_t *, char *, char *, unsigned int);
-u_long aim_bos_setgroupperm(struct aim_session_t *, struct aim_conn_t *, u_long);
-unsigned long aim_bos_clientready(struct aim_session_t *, struct aim_conn_t *);
-u_long aim_bos_reqrate(struct aim_session_t *, struct aim_conn_t *);
-u_long aim_bos_ackrateresp(struct aim_session_t *, struct aim_conn_t *);
-u_long aim_bos_setprivacyflags(struct aim_session_t *, struct aim_conn_t *, u_long);
-u_long aim_bos_reqpersonalinfo(struct aim_session_t *, struct aim_conn_t *);
-u_long aim_bos_reqservice(struct aim_session_t *, struct aim_conn_t *, u_short);
-unsigned long aim_bos_reqrights(struct aim_session_t *, struct aim_conn_t *);
-u_long aim_bos_reqbuddyrights(struct aim_session_t *, struct aim_conn_t *);
-u_long aim_bos_reqlocaterights(struct aim_session_t *, struct aim_conn_t *);
-u_long aim_bos_reqicbmparaminfo(struct aim_session_t *, struct aim_conn_t *);
-unsigned long aim_addicbmparam(struct aim_session_t *sess,struct aim_conn_t *conn);
-u_long aim_setversions(struct aim_session_t *sess, struct aim_conn_t *conn);
+faim_export int aim_send_warning(struct aim_session_t *sess, struct aim_conn_t *conn, char *destsn, int anon);
+faim_export unsigned long aim_bos_nop(struct aim_session_t *, struct aim_conn_t *);
+faim_export unsigned long aim_bos_setidle(struct aim_session_t *, struct aim_conn_t *, u_long);
+faim_export unsigned long aim_bos_changevisibility(struct aim_session_t *, struct aim_conn_t *, int, char *);
+faim_export unsigned long aim_bos_setbuddylist(struct aim_session_t *, struct aim_conn_t *, char *);
+faim_export unsigned long aim_bos_setprofile(struct aim_session_t *, struct aim_conn_t *, char *, char *, unsigned short);
+faim_export unsigned long aim_bos_setgroupperm(struct aim_session_t *, struct aim_conn_t *, u_long);
+faim_export unsigned long aim_bos_clientready(struct aim_session_t *, struct aim_conn_t *);
+faim_export unsigned long aim_bos_reqrate(struct aim_session_t *, struct aim_conn_t *);
+faim_export unsigned long aim_bos_ackrateresp(struct aim_session_t *, struct aim_conn_t *);
+faim_export unsigned long aim_bos_setprivacyflags(struct aim_session_t *, struct aim_conn_t *, u_long);
+faim_export unsigned long aim_bos_reqpersonalinfo(struct aim_session_t *, struct aim_conn_t *);
+faim_export unsigned long aim_bos_reqservice(struct aim_session_t *, struct aim_conn_t *, u_short);
+faim_export unsigned long aim_bos_reqrights(struct aim_session_t *, struct aim_conn_t *);
+faim_export unsigned long aim_bos_reqbuddyrights(struct aim_session_t *, struct aim_conn_t *);
+faim_export unsigned long aim_bos_reqlocaterights(struct aim_session_t *, struct aim_conn_t *);
+faim_export unsigned long aim_bos_reqicbmparaminfo(struct aim_session_t *, struct aim_conn_t *);
+faim_export unsigned long aim_addicbmparam(struct aim_session_t *sess,struct aim_conn_t *conn);
+faim_export unsigned long aim_setversions(struct aim_session_t *sess, struct aim_conn_t *conn);
 
 faim_internal struct aim_fileheader_t *aim_getlisting(struct aim_session_t*);
 faim_internal int aim_listenestablish(u_short);
@@ -552,7 +554,7 @@ faim_internal int aim_parse_outgoing_im_middle(struct aim_session_t *, struct co
 faim_export unsigned long aim_seticbmparam(struct aim_session_t *, struct aim_conn_t *conn);
 faim_internal int aim_parse_msgerror_middle(struct aim_session_t *, struct command_rx_struct *);
 faim_internal int aim_negchan_middle(struct aim_session_t *sess, struct command_rx_struct *command);
-int aim_parse_bosrights(struct aim_session_t *sess, struct command_rx_struct *command, ...);
+faim_internal int aim_parse_bosrights(struct aim_session_t *sess, struct command_rx_struct *command, ...);
 faim_internal int aim_parse_missedcall(struct aim_session_t *sess, struct command_rx_struct *command);
 
 faim_export struct aim_conn_t * aim_directim_initiate(struct aim_session_t *, struct aim_conn_t *, struct aim_directim_priv *, char *);
index c5d3d6bd9ef387c46f5d4a930b430af443b3b9e5..5beb92fe6e1a7a4c7929d8e7a9f1b422266a26f8 100644 (file)
  */
 #define FAIM_SNAC_HASH_SIZE 16
 
+/*
+ * If building on Win32,define WIN32_STATIC if you don't want
+ * to compile libfaim as a DLL (and instead link it right into
+ * your app).
+ */
+#define WIN32_STATIC
+
 #endif /* __FAIMCONFIG_H__ */
 
 
diff --git a/md5.c b/md5.c
index 037612dac1a3ffbfcc43aec241c6277bb396bc3b..9b1ce6fa86ef91b2761434a089e9821b44ce89d9 100644 (file)
--- a/md5.c
+++ b/md5.c
@@ -39,6 +39,7 @@
  */
 
 #include "md5.h"
+#include <string.h>
 
 #ifdef TEST
 /*
This page took 0.926304 seconds and 5 git commands to generate.