[Freeswitch-branches] [commit] r11707 - in freeswitch/branches/gmaruzz/mod_skypiax: . asterisk

FreeSWITCH SVN gmaruzz at freeswitch.org
Mon Feb 9 08:56:44 PST 2009


Author: gmaruzz
Date: Mon Feb  9 10:56:44 2009
New Revision: 11707

Log:
skypiax: cleaning skypiax_protocol.c

Modified:
   freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.h
   freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h
   freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c

Modified: freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.h
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.h	(original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.h	Mon Feb  9 10:56:44 2009
@@ -405,6 +405,16 @@
 int outbound_channel_answered(private_t *tech_pvt);
 int skypiax_skype_senddigit(struct skypiax_pvt *p, char digit);
 int skypiax_skype_write(private_t * tech_pvt, char *msg_to_skype);
+#if defined(WIN32) && !defined(__CYGWIN__)
+int skypiax_pipe_read(switch_file_t * pipe, short *buf, int howmany);
+int skypiax_pipe_write(switch_file_t * pipe, short *buf, int howmany);
+/* Visual C do not have strsep ? */
+char *strsep(char **stringp, const char *delim);
+#else
+int skypiax_pipe_read(int pipe, short *buf, int howmany);
+int skypiax_pipe_write(int pipe, short *buf, int howmany);
+#endif /* WIN32 */
+int skypiax_close_socket(unsigned int fd);
 #define		SKYPIAX_STATE_DOWN		AST_STATE_DOWN
 #define		SKYPIAX_STATE_RING		AST_STATE_RING
 #define		SKYPIAX_STATE_DIALING	AST_STATE_DIALING

Modified: freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h	(original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h	Mon Feb  9 10:56:44 2009
@@ -259,5 +259,13 @@
 int new_inbound_channel(private_t *tech_pvt);
 int outbound_channel_answered(private_t *tech_pvt);
 int skypiax_skype_write(private_t * tech_pvt, char *msg_to_skype);
+#if defined(WIN32) && !defined(__CYGWIN__)
+int skypiax_pipe_read(switch_file_t * pipe, short *buf, int howmany);
+int skypiax_pipe_write(switch_file_t * pipe, short *buf, int howmany);
 /* Visual C do not have strsep ? */
 char *strsep(char **stringp, const char *delim);
+#else
+int skypiax_pipe_read(int pipe, short *buf, int howmany);
+int skypiax_pipe_write(int pipe, short *buf, int howmany);
+#endif /* WIN32 */
+int skypiax_close_socket(unsigned int fd);

Modified: freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c	(original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c	Mon Feb  9 10:56:44 2009
@@ -7,8 +7,6 @@
 extern char *skypiax_console_active;
 #else /* FREESWITCH */
 #define skypiax_sleep switch_sleep
-//#define skypiax_pipe_write switch_file_write
-//#define skypiax_pipe_read switch_file_read
 extern switch_memory_pool_t *skypiax_module_pool;
 extern switch_endpoint_interface_t *skypiax_endpoint_interface;
 #endif /* ASTERISK */
@@ -17,76 +15,14 @@
 extern int running;
 
 /*************************************/
-#ifndef WIN32
+#ifdef WIN32
+DWORD win32_dwThreadId;
+#else
 XErrorHandler old_handler = 0;
 int xerror = 0;
-#else
-DWORD win32_dwThreadId;
 #endif /* WIN32 */
 /*************************************/
 
-#if defined(WIN32) && !defined(__CYGWIN__)
-int skypiax_pipe_read(switch_file_t * pipe, short *buf, int howmany)
-{
-  switch_size_t quantity;
-
-  quantity = howmany;
-
-  switch_file_read(pipe, buf, &quantity);
-
-  howmany = quantity;
-
-  return howmany;
-}
-#else /* WIN32 */
-int skypiax_pipe_read(int pipe, short *buf, int howmany)
-{
-  howmany = read(pipe, buf, howmany);
-  return howmany;
-}
-#endif /* WIN32 */
-
-#if defined(WIN32) && !defined(__CYGWIN__)
-int skypiax_pipe_write(switch_file_t * pipe, short *buf, int howmany)
-{
-  switch_size_t quantity;
-
-  quantity = howmany;
-
-  switch_file_write(pipe, buf, &quantity);
-
-  howmany = quantity;
-
-  return howmany;
-}
-#else /* WIN32 */
-int skypiax_pipe_write(int pipe, short *buf, int howmany)
-{
-  howmany = write(pipe, buf, howmany);
-  return howmany;
-}
-#endif /* WIN32 */
-
-#if defined(WIN32) && !defined(__CYGWIN__)
-int skypiax_close_socket(unsigned int fd)
-{
-  int res;
-
-  res = closesocket(fd);
-
-  return res;
-}
-#else /* WIN32 */
-int skypiax_close_socket(unsigned int fd)
-{
-  int res;
-
-  res = close(fd);
-
-  return res;
-}
-#endif /* WIN32 */
-
 void *skypiax_do_tcp_srv_thread_func(void *obj)
 {
   private_t *tech_pvt = obj;
@@ -941,6 +877,63 @@
   return 0;
 }
 
+/***************************/
+/* PLATFORM SPECIFIC */
+/***************************/
+#if defined(WIN32) && !defined(__CYGWIN__)
+int skypiax_pipe_read(switch_file_t * pipe, short *buf, int howmany)
+{
+  switch_size_t quantity;
+
+  quantity = howmany;
+
+  switch_file_read(pipe, buf, &quantity);
+
+  howmany = quantity;
+
+  return howmany;
+}
+int skypiax_pipe_write(switch_file_t * pipe, short *buf, int howmany)
+{
+  switch_size_t quantity;
+
+  quantity = howmany;
+
+  switch_file_write(pipe, buf, &quantity);
+
+  howmany = quantity;
+
+  return howmany;
+}
+int skypiax_close_socket(unsigned int fd)
+{
+  int res;
+
+  res = closesocket(fd);
+
+  return res;
+}
+
+#else /* WIN32 */
+int skypiax_pipe_read(int pipe, short *buf, int howmany)
+{
+  howmany = read(pipe, buf, howmany);
+  return howmany;
+}
+int skypiax_pipe_write(int pipe, short *buf, int howmany)
+{
+  howmany = write(pipe, buf, howmany);
+  return howmany;
+}
+int skypiax_close_socket(unsigned int fd)
+{
+  int res;
+
+  res = close(fd);
+
+  return res;
+}
+#endif /* WIN32 */
 
 
 #ifdef WIN32



More information about the Freeswitch-branches mailing list