pointing to headers in this dir now
authorerickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Sun, 19 Jun 2005 17:34:15 +0000 (17:34 +0000)
committererickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Sun, 19 Jun 2005 17:34:15 +0000 (17:34 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@360 9efc2488-bf62-4759-914b-345cdb29e865

src/libtransport/generic_utils.c
src/libtransport/transport_client.c
src/libtransport/transport_message.c
src/libtransport/transport_session.c
src/libtransport/transport_socket.c

index e5092e2..daccd9c 100644 (file)
@@ -1,8 +1,9 @@
-#include "opensrf/generic_utils.h"
+#include "generic_utils.h"
 #include <stdio.h>
 #include "pthread.h"
 #include <sys/timeb.h>
 
+/*
 void get_timestamp( char buf_36chars[]) {
 
        struct timeb tb;
@@ -17,25 +18,6 @@ void get_timestamp( char buf_36chars[]) {
        free(localtime);
 }
 
-/*
-double get_timestamp_millis() {
-       struct timeb t;
-       ftime(&t);
-       double time     = ( (int)t.time + ( ((double)t.millitm) / 1000 ) );
-       return time;
-}
-       
-
-inline void* safe_malloc( int size ) {
-       void* ptr = (void*) malloc( size );
-       if( ptr == NULL ) 
-               fatal_handler("safe_malloc(): Out of Memory" );
-       memset( ptr, 0, size );
-       return ptr;
-}
-*/
-
-
 static FILE* log_file = NULL;
 static int log_level = -1;
 static int logging = 0;
@@ -69,7 +51,6 @@ void fatal_handler( char* msg, ... ) {
 
        }
        
-       /* also log to stderr  for ERRORS*/
        fprintf( stderr, "[%s %d] [%s] ", buf, pid, "ERR " );
        va_start(args, msg);
        vfprintf(stderr, msg, args);
@@ -205,6 +186,8 @@ int log_init( int llevel, char* lfile ) {
 
 }
 
+*/
+
 
 /*
 growing_buffer* buffer_init(int num_initial_bytes) {
index e09a51e..3ab5fa5 100644 (file)
@@ -1,4 +1,4 @@
-#include "opensrf/transport_client.h"
+#include "transport_client.h"
 
 
 //int main( int argc, char** argv );
index f6135f7..5a043bb 100644 (file)
@@ -1,4 +1,4 @@
-#include "opensrf/transport_message.h"
+#include "transport_message.h"
 
 
 // ---------------------------------------------------------------------------------
index 90b018d..c2d0d33 100644 (file)
@@ -1,4 +1,4 @@
-#include "opensrf/transport_session.h"
+#include "transport_session.h"
 
 
 
@@ -172,7 +172,8 @@ int session_connect( transport_session* session,
                char stanza1[ size1 ]; 
                memset( stanza1, 0, size1 );
                sprintf( stanza1, 
-                               "<stream:stream version='1.0' xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:component:accept' to='%s' from='%s' xml:lang='en'>",
+                               "<stream:stream version='1.0' xmlns:stream='http://etherx.jabber.org/streams' "
+                               "xmlns='jabber:component:accept' to='%s' from='%s' xml:lang='en'>",
                                username, our_hostname );
 
                /* send the first stanze */
@@ -212,7 +213,8 @@ int session_connect( transport_session* session,
                char stanza1[ size1 ]; 
                memset( stanza1, 0, size1 );
                sprintf( stanza1, 
-                               "<stream:stream to='%s' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams'>",
+                               "<stream:stream to='%s' xmlns='jabber:client' "
+                               "xmlns:stream='http://etherx.jabber.org/streams'>",
                        server );
        
 
@@ -235,21 +237,10 @@ int session_connect( transport_session* session,
                        memset( stanza2, 0, size2 );
                
                        sprintf( stanza2, 
-                                       "<iq id='123456789' type='set'><query xmlns='jabber:iq:auth'><username>%s</username><password>%s</password><resource>%s</resource></query></iq>",
+                                       "<iq id='123456789' type='set'><query xmlns='jabber:iq:auth'>"
+                                       "<username>%s</username><password>%s</password><resource>%s</resource></query></iq>",
                                        username, password, resource );
        
-
-               /*
-               <iq type='set' id='auth2'>
-                       <query xmlns='jabber:iq:auth'>
-                               <username>bill</username>
-                          <digest>48fc78be9ec8f86d8ce1c39c320c97c21d62334d</digest>
-                               <resource>globe</resource>
-                       </query>
-               </iq>
-               */
-       
-       
                        /* server acknowledges our existence, now see if we can login */
                        if( session->state_machine->connecting == CONNECTING_2 ) {
                                if( ! tcp_send( session->sock_obj, stanza2 )  ) {
@@ -273,21 +264,10 @@ int session_connect( transport_session* session,
                        memset( stanza2, 0, size2 );
                
                        sprintf( stanza2, 
-                                       "<iq id='123456789' type='set'><query xmlns='jabber:iq:auth'><username>%s</username><digest>%s</digest><resource>%s</resource></query></iq>",
+                                       "<iq id='123456789' type='set'><query xmlns='jabber:iq:auth'>"
+                                       "<username>%s</username><digest>%s</digest><resource>%s</resource></query></iq>",
                                        username, hash, resource );
        
-
-               /*
-               <iq type='set' id='auth2'>
-                       <query xmlns='jabber:iq:auth'>
-                               <username>bill</username>
-                          <digest>48fc78be9ec8f86d8ce1c39c320c97c21d62334d</digest>
-                               <resource>globe</resource>
-                       </query>
-               </iq>
-               */
-       
-       
                        /* server acknowledges our existence, now see if we can login */
                        if( session->state_machine->connecting == CONNECTING_2 ) {
                                if( ! tcp_send( session->sock_obj, stanza2 )  ) {
@@ -449,6 +429,15 @@ void endElementHandler( void *session, const xmlChar *name) {
 
        if( strcmp( name, "message" ) == 0 ) {
 
+
+               /*
+               int                     bufsize;
+               xmlChar*                xmlbuf;
+               xmlDocDumpFormatMemory( ses->parser_ctxt->myDoc, &xmlbuf, &bufsize, 0 );
+               debug_handler("endElementHandler SAX Doc:\n%s\n", (char*) xmlbuf );
+               xmlFree(xmlbuf);
+               */
+
                /* pass off the message info the callback */
                if( ses->message_callback ) {
 
@@ -599,7 +588,7 @@ void  parseWarningHandler( void *session, const char* msg, ... ) {
 
        va_list args;
        va_start(args, msg);
-       fprintf(stdout, "WARNING");
+       fprintf(stdout, "transport_session XML WARNING");
        vfprintf(stdout, msg, args);
        va_end(args);
        fprintf(stderr, "XML WARNING: %s\n", msg ); 
@@ -609,7 +598,7 @@ void  parseErrorHandler( void *session, const char* msg, ... ){
 
        va_list args;
        va_start(args, msg);
-       fprintf(stdout, "ERROR");
+       fprintf(stdout, "transport_session XML ERROR");
        vfprintf(stdout, msg, args);
        va_end(args);
        fprintf(stderr, "XML ERROR: %s\n", msg ); 
index e2e0311..893f743 100644 (file)
@@ -1,4 +1,4 @@
-#include "opensrf/transport_socket.h"
+#include "transport_socket.h"
 
 
 /*
@@ -34,10 +34,12 @@ int main( char* argc, char** argv ) {
 // returns the socket fd, -1 on error
 int tcp_connect( transport_socket* sock_obj ){
 
+
        if( sock_obj == NULL ) {
                fatal_handler( "connect(): null sock_obj" );
                return -1;
        }
+
        struct sockaddr_in remoteAddr, localAddr;
        struct hostent *hptr;
        int sock_fd;
@@ -52,7 +54,6 @@ int tcp_connect( transport_socket* sock_obj ){
        #endif
 
 
-
        // ------------------------------------------------------------------
        // Create the socket
        // ------------------------------------------------------------------
@@ -131,6 +132,7 @@ int tcp_send( transport_socket* sock_obj, const char* data ){
 }
 
 
+
 int tcp_disconnect( transport_socket* sock_obj ){
 
        if( sock_obj == NULL ) {
@@ -161,12 +163,12 @@ int tcp_wait( transport_socket* sock_obj, int timeout ){
                return 0;
        }
 
+
        int n = 0; 
        int retval = 0;
        char buf[BUFSIZE];
        int sock_fd = sock_obj->sock_fd;
 
-
        fd_set read_set;
 
        FD_ZERO( &read_set );
@@ -236,47 +238,11 @@ int tcp_wait( transport_socket* sock_obj, int timeout ){
 #ifdef _ROUTER
        return n;
 #else
-       return 1;
+       return sock_fd;
 #endif
 
 }
 
-int set_fl( int fd, int flags ) {
-       
-       int val;
-
-       if( (val = fcntl( fd, F_GETFL, 0) ) < 0 ) {
-               fatal_handler("fcntl F_GETFL error");
-               return -1;
-       }
-
-       val |= flags;
-
-       if( fcntl( fd, F_SETFL, val ) < 0 ) {
-               fatal_handler( "fcntl F_SETFL error" );
-               return -1;
-       }
-       return 0;
-}
-       
-int clr_fl( int fd, int flags ) {
-       
-       int val;
-
-       if( (val = fcntl( fd, F_GETFL, 0) ) < 0 ) {
-               fatal_handler("fcntl F_GETFL error" );
-               return -1;
-       }
-
-       val &= ~flags;
-
-       if( fcntl( fd, F_SETFL, val ) < 0 ) {
-               fatal_handler( "fcntl F_SETFL error" );
-               return -1;
-       }
-       return 0;
-}
-       
 
 /*
 int tcp_connected( transport_socket* obj ) {