[Freeswitch-svn] [commit] r10043 - in freeswitch/trunk/src: . include

Freeswitch SVN anthm at freeswitch.org
Thu Oct 16 11:24:03 EDT 2008


Author: anthm
Date: Thu Oct 16 11:24:02 2008
New Revision: 10043

Modified:
   freeswitch/trunk/src/include/switch_apr.h
   freeswitch/trunk/src/switch_apr.c

Log:
expose more of apr socket code

Modified: freeswitch/trunk/src/include/switch_apr.h
==============================================================================
--- freeswitch/trunk/src/include/switch_apr.h	(original)
+++ freeswitch/trunk/src/include/switch_apr.h	Thu Oct 16 11:24:02 2008
@@ -1171,13 +1171,36 @@
 
 /** @} */
 
+typedef enum {
+    SWITCH_NO_DESC,                /**< nothing here */
+    SWITCH_POLL_SOCKET,            /**< descriptor refers to a socket */
+    SWITCH_POLL_FILE,              /**< descriptor refers to a file */
+    SWITCH_POLL_LASTDESC           /**< descriptor is the last one in the list */
+} switch_pollset_type_t;
+
+typedef union {
+    switch_file_t *f;              /**< file */
+    switch_socket_t *s;            /**< socket */
+} switch_descriptor_t;
+
+struct switch_pollfd {
+    switch_memory_pool_t *p;              /**< associated pool */
+    switch_pollset_type_t desc_type;   /**< descriptor type */
+    int16_t reqevents;      /**< requested events */
+    int16_t rtnevents;      /**< returned events */
+    switch_descriptor_t desc;        /**< @see apr_descriptor */
+    void *client_data;          /**< allows app to associate context */
+};
+
+
+
 /**
  * @defgroup apr_poll Poll Routines
  * @ingroup switch_apr
  * @{
  */
 /** Poll descriptor set. */
-	 typedef struct apr_pollfd_t switch_pollfd_t;
+	 typedef struct switch_pollfd switch_pollfd_t;
 
 /** Opaque structure used for pollset API */
 	 typedef struct apr_pollset_t switch_pollset_t;

Modified: freeswitch/trunk/src/switch_apr.c
==============================================================================
--- freeswitch/trunk/src/switch_apr.c	(original)
+++ freeswitch/trunk/src/switch_apr.c	Thu Oct 16 11:24:02 2008
@@ -751,12 +751,12 @@
 
 SWITCH_DECLARE(switch_status_t) switch_pollset_add(switch_pollset_t *pollset, const switch_pollfd_t *descriptor)
 {
-	return apr_pollset_add(pollset, descriptor);
+	return apr_pollset_add((apr_pollset_t *)pollset, (apr_pollfd_t *)descriptor);
 }
 
 SWITCH_DECLARE(switch_status_t) switch_poll(switch_pollfd_t *aprset, int32_t numsock, int32_t *nsds, switch_interval_time_t timeout)
 {
-	return apr_poll(aprset, numsock, nsds, timeout);
+	return apr_poll((apr_pollfd_t *)aprset, numsock, nsds, timeout);
 }
 
 SWITCH_DECLARE(switch_status_t) switch_socket_create_pollfd(switch_pollfd_t **poll, switch_socket_t *sock, int16_t flags, switch_memory_pool_t *pool)



More information about the Freeswitch-svn mailing list