[libvirt] [libvirt-php][PATCH 08/11] src: Introduce sockets.h

Michal Privoznik mprivozn at redhat.com
Tue Sep 27 13:11:11 UTC 2016


Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/Makefile.am   |  2 +-
 src/libvirt-php.c |  6 +-----
 src/libvirt-php.h |  5 -----
 src/sockets.c     |  1 +
 src/sockets.h     | 32 ++++++++++++++++++++++++++++++++
 src/vncfunc.c     |  1 +
 6 files changed, 36 insertions(+), 11 deletions(-)
 create mode 100644 src/sockets.h

diff --git a/src/Makefile.am b/src/Makefile.am
index 5720ddd..bbee667 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -20,7 +20,7 @@ php_plugin_LTLIBRARIES = libvirt-php.la
 libvirt_php_la_SOURCES = \
 	util.c util.h	\
 	vncfunc.c vncfunc.h	\
-	sockets.c \
+	sockets.c sockets.h \
 	libvirt-php.c libvirt-php.h
 libvirt_php_la_CFLAGS = \
 	$(AM_CFLAGS) \
diff --git a/src/libvirt-php.c b/src/libvirt-php.c
index 01e9b57..faa7200 100644
--- a/src/libvirt-php.c
+++ b/src/libvirt-php.c
@@ -29,11 +29,7 @@
 #include "libvirt-php.h"
 #include "util.h"
 #include "vncfunc.h"
-
-#ifndef EXTWIN
-// From sockets.c
-int connect_socket(char *server, char *port, int keepalive, int nodelay, int allow_server_override);
-#endif
+#include "sockets.h"
 
 #ifdef DEBUG_SUPPORT
 int gdebug;
diff --git a/src/libvirt-php.h b/src/libvirt-php.h
index 1225c0b..6b6df21 100644
--- a/src/libvirt-php.h
+++ b/src/libvirt-php.h
@@ -132,11 +132,6 @@ typedef long zend_long;
 typedef unsigned long zend_ulong;
 #endif /* PHP_MAJOR_VERSION < 7 */
 
-int connect_socket(char *server, char *port, int keepalive, int nodelay, int allow_server_override);
-int socket_has_data(int sfd, long maxtime, int ignoremsg);
-void socket_read(int sfd, long length);
-int socket_read_and_save(int sfd, char *fn, long length);
-
 typedef struct tTokenizer {
     char **tokens;
     int numTokens;
diff --git a/src/sockets.c b/src/sockets.c
index 92ea373..a175450 100644
--- a/src/sockets.c
+++ b/src/sockets.c
@@ -7,6 +7,7 @@
  *   Michal Novotny <minovotn at redhat.com>
  */
 
+#include "sockets.h"
 #include "libvirt-php.h"
 #include "util.h"
 
diff --git a/src/sockets.h b/src/sockets.h
new file mode 100644
index 0000000..52b5866
--- /dev/null
+++ b/src/sockets.h
@@ -0,0 +1,32 @@
+/*
+ * sockets.h: Socket functions for libvirt-php
+ *
+ * See COPYING for the license of this software
+ *
+ * Written by:
+ *   Michal Novotny <minovotn at redhat.com>
+ *   Michal Privoznik <mprivozn at redhat.com>
+ */
+
+#ifndef __SOCKETS_H__
+# define __SOCKETS_H__
+
+int connect_socket(char *server,
+                   char *port,
+                   int keepalive,
+                   int nodelay,
+                   int allow_server_override);
+
+int socket_has_data(int sfd,
+                    long maxtime,
+                    int ignoremsg);
+
+void socket_read(int sfd,
+                 long length);
+
+int socket_read_and_save(int sfd,
+                         char *fn,
+                         long length);
+
+#endif /* __SOCKETS_H__ */
+
diff --git a/src/vncfunc.c b/src/vncfunc.c
index b1a994d..447881e 100644
--- a/src/vncfunc.c
+++ b/src/vncfunc.c
@@ -10,6 +10,7 @@
 #include "vncfunc.h"
 #include "libvirt-php.h"
 #include "util.h"
+#include "sockets.h"
 
 #ifdef DEBUG_VNC
 #define DPRINTF(fmt, ...) \
-- 
2.8.4




More information about the libvir-list mailing list