libfaim/aim_ft.c

changeset 840
b80a628d935f
parent 642
ac99c78fa9d5
child 889
070eb1c6db95
--- a/libfaim/aim_ft.c	Mon Sep 04 01:15:38 2000 +0000
+++ b/libfaim/aim_ft.c	Mon Sep 04 23:37:32 2000 +0000
@@ -1,5 +1,8 @@
 #include <faim/aim.h>
 
+#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 */
 
@@ -14,11 +17,11 @@
    aim_filetransfer_accept aim_im.c
    aim_getlisting aim_misc.c (?!) -- prototype function. can be ignored.
    establish aim_misc.c
-   aim_get_command_rendezvous aim_rxqueue.c
+   aim_get_command_rendezvous aim_r
    oft_getfh aim_rxqueue.c
 */
 
-int aim_handlerendconnect(struct aim_session_t *sess, struct aim_conn_t *cur)
+faim_export int aim_handlerendconnect(struct aim_session_t *sess, struct aim_conn_t *cur)
 {
   int acceptfd = 0;
   rxcallback_t userfunc;
@@ -86,9 +89,9 @@
  * msg  - null-terminated string to send
  */
 
-int aim_send_im_direct(struct aim_session_t *sess, 
-		       struct aim_conn_t *conn,
-		       char *msg)
+faim_export int aim_send_im_direct(struct aim_session_t *sess, 
+				   struct aim_conn_t *conn,
+				   char *msg)
 {
   struct command_tx_struct *newpacket , *newpacket2; 
 
@@ -132,7 +135,7 @@
   i += aimutil_put16(newpacket2->hdr.oft.hdr2+i, 0x0006);
   i += aimutil_put16(newpacket2->hdr.oft.hdr2+i, 0x0000);
 
-  i += aimutil_putstr(newpacket2->hdr.oft.hdr2+i, priv->cookie, 8);
+  i += aimutil_putstr(newpacket2->hdr.oft.hdr2+i, (char *)priv->cookie, 8);
 
   i += aimutil_put16(newpacket2->hdr.oft.hdr2+i, 0x0000);
   i += aimutil_put16(newpacket2->hdr.oft.hdr2+i, 0x0000);
@@ -188,7 +191,7 @@
   i += aimutil_put16(newpacket->hdr.oft.hdr2+i, 0x0006);
   i += aimutil_put16(newpacket->hdr.oft.hdr2+i, 0x0000);
 
-  i += aimutil_putstr(newpacket->hdr.oft.hdr2+i, priv->cookie, 8);
+  i += aimutil_putstr(newpacket->hdr.oft.hdr2+i, (char *)priv->cookie, 8);
 
   i += aimutil_put16(newpacket->hdr.oft.hdr2+i, 0x0000);
   i += aimutil_put16(newpacket->hdr.oft.hdr2+i, 0x0000);
@@ -246,10 +249,10 @@
  */
 
 
-struct aim_conn_t *aim_directim_initiate(struct aim_session_t *sess,
-			  struct aim_conn_t *conn,
-			  struct aim_directim_priv *priv,
-			  char *destsn)
+faim_export struct aim_conn_t *aim_directim_initiate(struct aim_session_t *sess,
+						     struct aim_conn_t *conn,
+						     struct aim_directim_priv *priv,
+						     char *destsn)
 {
   struct command_tx_struct *newpacket;
   struct aim_conn_t *newconn;
@@ -262,7 +265,7 @@
   struct hostent *hptr;
   struct utsname myname;
 
-  char cap[16];
+  unsigned char cap[16];
   char d[4]; /* XXX: IPv6. *cough* */
 
   /*
@@ -447,9 +450,9 @@
 } 
 
 
-struct aim_conn_t *aim_directim_connect(struct aim_session_t *sess,
-					struct aim_conn_t *conn,
-					struct aim_directim_priv *priv )
+faim_export struct aim_conn_t *aim_directim_connect(struct aim_session_t *sess,
+						    struct aim_conn_t *conn,
+						    struct aim_directim_priv *priv )
 {
   struct aim_conn_t *newconn = NULL;;
 
@@ -468,12 +471,12 @@
   return newconn;
 }
 
-u_long aim_accepttransfer(struct aim_session_t *sess,
-			  struct aim_conn_t *conn, 
-			  struct aim_conn_t *oftconn,
-			  char *sn,
-			  char *cookie,
-			  unsigned short rendid)
+faim_export unsigned long aim_accepttransfer(struct aim_session_t *sess,
+					     struct aim_conn_t *conn, 
+					     struct aim_conn_t *oftconn,
+					     char *sn,
+					     char *cookie,
+					     unsigned short rendid)
 {
   struct command_tx_struct *newpacket, *newoft;
   struct aim_fileheader_t *listingfh;
@@ -585,7 +588,7 @@
  *  
  */
 
-struct aim_fileheader_t *aim_getlisting(struct aim_session_t *sess) 
+faim_internal struct aim_fileheader_t *aim_getlisting(struct aim_session_t *sess) 
 {
   struct aim_fileheader_t *fh;
 
@@ -641,7 +644,7 @@
  * returns your fd
  */
 
-int aim_listenestablish(u_short portnum)
+faim_internal int aim_listenestablish(u_short portnum)
 {
 #if HAVE_GETADDRINFO
   int listenfd;
@@ -680,7 +683,7 @@
 #endif
 }
 
-int aim_get_command_rendezvous(struct aim_session_t *sess, struct aim_conn_t *conn)
+faim_internal int aim_get_command_rendezvous(struct aim_session_t *sess, struct aim_conn_t *conn)
 {
 
   /* XXX: NOT THREAD SAFE RIGHT NOW. the locks are acting up. deal. -- jbm */
@@ -733,7 +736,7 @@
 
     payloadlength = aimutil_get32(hdr+22);
     flags = aimutil_get16(hdr+32);
-    snptr = hdr+38;
+    snptr = (char *)hdr+38;
 
     strncpy(priv->sn, snptr, MAXSNLEN);
 
@@ -798,7 +801,7 @@
 
     memcpy(&(ft->fh), fh, sizeof(struct aim_fileheader_t));
     
-    cook = aim_checkcookie(sess, ft->fh.bcookie, AIM_COOKIETYPE_OFTGET);
+    cook = aim_checkcookie(sess, (unsigned char *)ft->fh.bcookie, AIM_COOKIETYPE_OFTGET);
 
     if(cook->data)
       free(cook->data); /* XXX */
@@ -842,7 +845,7 @@
 
     memcpy(&(ft->fh), fh, sizeof(struct aim_fileheader_t));
     
-    cook = aim_checkcookie(sess, ft->fh.bcookie, AIM_COOKIETYPE_OFTGET);
+    cook = aim_checkcookie(sess, (unsigned char *)ft->fh.bcookie, AIM_COOKIETYPE_OFTGET);
   
     if(cook->data)
       free(cook->data); /* XXX: integrate cookie caching */
@@ -873,11 +876,11 @@
     if(hdrlen != 0x100)
       printf("faim: fileget_command(120c): um. hdrlen != 0x100..\n");
 
-    listingfh = aim_oft_getfh((char *)hdr);
+    listingfh = aim_oft_getfh(hdr);
 
     memcpy(&(ft->fh), listingfh, sizeof(struct aim_fileheader_t));
     
-    cook = aim_checkcookie(sess, ft->fh.bcookie, AIM_COOKIETYPE_OFTGET);
+    cook = aim_checkcookie(sess, (unsigned char *)ft->fh.bcookie, AIM_COOKIETYPE_OFTGET);
   
     if(cook->data)
       free(cook->data); /* XXX */
@@ -948,7 +951,7 @@
     curbyte += aimutil_put32(newoft->hdr.oft.hdr2+curbyte, 0 /*listingfh->nrecvd*/);
     curbyte += aimutil_put32(newoft->hdr.oft.hdr2+curbyte, 0/*listingfh->recvcsum*/);
 
-    strncpy(newoft->hdr.oft.hdr2+curbyte, listingfh->idstring, 32);
+    strncpy((char *)newoft->hdr.oft.hdr2+curbyte, listingfh->idstring, 32);
     curbyte += 32;
 
     curbyte += aimutil_put8(newoft->hdr.oft.hdr2+curbyte, 0x20 /*listingfh->flags */);
@@ -964,7 +967,7 @@
     curbyte += aimutil_put16(newoft->hdr.oft.hdr2+curbyte, listingfh->nencode);
     curbyte += aimutil_put16(newoft->hdr.oft.hdr2+curbyte, listingfh->nlanguage);
 
-    strncpy(newoft->hdr.oft.hdr2+curbyte, listingfh->name, 64);
+    strncpy((char *)newoft->hdr.oft.hdr2+curbyte, listingfh->name, 64);
     curbyte += 64;
 
     free(listingfh);
@@ -980,7 +983,7 @@
     int i;
 
     struct aim_fileheader_t *fh;    
-    fh = aim_oft_getfh((char *)hdr);
+    fh = aim_oft_getfh(hdr);
 
     c = (char *)calloc(1, fh->size);
 
@@ -1022,7 +1025,7 @@
  * this currently feeds totally bogus data
  */
 
-struct aim_fileheader_t *aim_oft_getfh(char *hdr) 
+faim_internal struct aim_fileheader_t *aim_oft_getfh(unsigned char *hdr) 
 {
   struct aim_fileheader_t *fh;
   int i, j;

mercurial