From 2e92861bb19700be5a7d1f6d7a16cd53ce9409ac Mon Sep 17 00:00:00 2001 From: scottmk Date: Mon, 2 Nov 2009 22:59:43 +0000 Subject: [PATCH] New function: client_sock_fd(). It returns the socket fd used by the transport_session underlying a specified transport_client. Purpose: increase the level of encapsulation, so that the calling code doesn't need to know about three layers of internals. M include/opensrf/transport_client.h M src/libopensrf/transport_client.c git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1837 9efc2488-bf62-4759-914b-345cdb29e865 --- include/opensrf/transport_client.h | 2 ++ src/libopensrf/transport_client.c | 14 +++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/include/opensrf/transport_client.h b/include/opensrf/transport_client.h index 83819f3..4d9dcc7 100644 --- a/include/opensrf/transport_client.h +++ b/include/opensrf/transport_client.h @@ -52,6 +52,8 @@ int client_connected( const transport_client* client ); transport_message* client_recv( transport_client* client, int timeout ); +int client_sock_fd( transport_client* client ); + #ifdef __cplusplus } #endif diff --git a/src/libopensrf/transport_client.c b/src/libopensrf/transport_client.c index df82bf1..c6c3520 100644 --- a/src/libopensrf/transport_client.c +++ b/src/libopensrf/transport_client.c @@ -58,14 +58,15 @@ int main( int argc, char** argv ) { /** @brief Allocate and initialize a transport_client. - @param server Hostname or IP address where the Jabber server resides. + @param server Domain name where the Jabber server resides. @param port Port used for connecting to Jabber (0 if using UNIX domain socket). @param unix_path Name of Jabber's socket in file system (if using UNIX domain socket). @param component Boolean; true if we're a Jabber component. @return A pointer to a newly created transport_client. - Create a transport_client with a transport_session and an empty message queue (but don't open a connection yet). - Install a callback function in the transport_session to enqueue incoming messages. + Create a transport_client with a transport_session and an empty message queue (but don't + open a connection yet). Install a callback function in the transport_session to enqueue + incoming messages. The calling code is responsible for freeing the transport_client by calling client_free(). */ @@ -318,3 +319,10 @@ int client_free( transport_client* client ){ return 1; } +int client_sock_fd( transport_client* client ) +{ + if( !client ) + return 0; + else + return client->session->sock_id; +} -- 2.43.2