From: erickson Date: Sun, 19 Jun 2005 17:34:15 +0000 (+0000) Subject: pointing to headers in this dir now X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=b66e47fa5194d27beccf21226a8a21c18e72abe9;p=opensrf%2Fbjwebb.git pointing to headers in this dir now git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@360 9efc2488-bf62-4759-914b-345cdb29e865 --- diff --git a/src/libtransport/generic_utils.c b/src/libtransport/generic_utils.c index e5092e2..daccd9c 100644 --- a/src/libtransport/generic_utils.c +++ b/src/libtransport/generic_utils.c @@ -1,8 +1,9 @@ -#include "opensrf/generic_utils.h" +#include "generic_utils.h" #include #include "pthread.h" #include +/* 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) { diff --git a/src/libtransport/transport_client.c b/src/libtransport/transport_client.c index e09a51e..3ab5fa5 100644 --- a/src/libtransport/transport_client.c +++ b/src/libtransport/transport_client.c @@ -1,4 +1,4 @@ -#include "opensrf/transport_client.h" +#include "transport_client.h" //int main( int argc, char** argv ); diff --git a/src/libtransport/transport_message.c b/src/libtransport/transport_message.c index f6135f7..5a043bb 100644 --- a/src/libtransport/transport_message.c +++ b/src/libtransport/transport_message.c @@ -1,4 +1,4 @@ -#include "opensrf/transport_message.h" +#include "transport_message.h" // --------------------------------------------------------------------------------- diff --git a/src/libtransport/transport_session.c b/src/libtransport/transport_session.c index 90b018d..c2d0d33 100644 --- a/src/libtransport/transport_session.c +++ b/src/libtransport/transport_session.c @@ -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, - "", + "", 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, - "", + "", server ); @@ -235,21 +237,10 @@ int session_connect( transport_session* session, memset( stanza2, 0, size2 ); sprintf( stanza2, - "%s%s%s", + "" + "%s%s%s", username, password, resource ); - - /* - - - bill - 48fc78be9ec8f86d8ce1c39c320c97c21d62334d - globe - - - */ - - /* 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, - "%s%s%s", + "" + "%s%s%s", username, hash, resource ); - - /* - - - bill - 48fc78be9ec8f86d8ce1c39c320c97c21d62334d - globe - - - */ - - /* 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 ); diff --git a/src/libtransport/transport_socket.c b/src/libtransport/transport_socket.c index e2e0311..893f743 100644 --- a/src/libtransport/transport_socket.c +++ b/src/libtransport/transport_socket.c @@ -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 ) {