summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael J. Chudobiak <mjc@avtechpulse.com>2012-07-19 08:52:13 -0400
committerMichael J. Chudobiak <mjc@avtechpulse.com>2012-07-19 08:52:13 -0400
commit3dbb6d06549db743bfcc76ec3e64841e1cdb0038 (patch)
treedabc4970d13edb5e6906be8cabcf310a1d799a03
parent299b166ff820e8413f0c34ed5a2e7afac46cd477 (diff)
initial commit
-rw-r--r--build/CMakeCache.txt391
-rw-r--r--instr-client.c.orig143
-rw-r--r--instr-daemon.c.orig273
-rw-r--r--response.c.orig109
-rw-r--r--response.h.orig18
-rw-r--r--signalobject.c.orig38
-rw-r--r--signalobject.h.orig44
7 files changed, 1016 insertions, 0 deletions
diff --git a/build/CMakeCache.txt b/build/CMakeCache.txt
new file mode 100644
index 0000000..4b84043
--- /dev/null
+++ b/build/CMakeCache.txt
@@ -0,0 +1,391 @@
+# This is the CMakeCache file.
+# For build in directory: /fileserver2/home/mjc/git/Instrument/build
+# It was generated by CMake: /usr/bin/cmake
+# You can edit this file to change values found and used by cmake.
+# If you do not want to change any of the values, simply exit the editor.
+# If you do want to change a value, simply edit, save, and exit the editor.
+# The syntax for the file is as follows:
+# KEY:TYPE=VALUE
+# KEY is the name of a variable in the cache.
+# TYPE is a hint to GUI's for the type of VALUE, DO NOT EDIT TYPE!.
+# VALUE is the current value for the KEY.
+
+########################
+# EXTERNAL cache entries
+########################
+
+//Path to a program.
+CMAKE_AR:FILEPATH=/usr/bin/ar
+
+//Choose the type of build, options are: None(CMAKE_CXX_FLAGS or
+// CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.
+CMAKE_BUILD_TYPE:STRING=
+
+//Enable/Disable color output during build.
+CMAKE_COLOR_MAKEFILE:BOOL=ON
+
+//CXX compiler.
+CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/c++
+
+//Flags used by the compiler during all build types.
+CMAKE_CXX_FLAGS:STRING=
+
+//Flags used by the compiler during debug builds.
+CMAKE_CXX_FLAGS_DEBUG:STRING=-g
+
+//Flags used by the compiler during release minsize builds.
+CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG
+
+//Flags used by the compiler during release builds (/MD /Ob1 /Oi
+// /Ot /Oy /Gs will produce slightly less optimized but smaller
+// files).
+CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG
+
+//Flags used by the compiler during Release with Debug Info builds.
+CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g
+
+//C compiler.
+CMAKE_C_COMPILER:FILEPATH=/usr/bin/gcc
+
+//Flags used by the compiler during all build types.
+CMAKE_C_FLAGS:STRING=
+
+//Flags used by the compiler during debug builds.
+CMAKE_C_FLAGS_DEBUG:STRING=-g
+
+//Flags used by the compiler during release minsize builds.
+CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG
+
+//Flags used by the compiler during release builds (/MD /Ob1 /Oi
+// /Ot /Oy /Gs will produce slightly less optimized but smaller
+// files).
+CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG
+
+//Flags used by the compiler during Release with Debug Info builds.
+CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g
+
+//Flags used by the linker.
+CMAKE_EXE_LINKER_FLAGS:STRING=' '
+
+//Flags used by the linker during debug builds.
+CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING=
+
+//Flags used by the linker during release minsize builds.
+CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING=
+
+//Flags used by the linker during release builds.
+CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING=
+
+//Flags used by the linker during Release with Debug Info builds.
+CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING=
+
+//Enable/Disable output of compile commands during generation.
+CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=OFF
+
+//Install path prefix, prepended onto install directories.
+CMAKE_INSTALL_PREFIX:PATH=/usr/local
+
+//Path to a program.
+CMAKE_LINKER:FILEPATH=/usr/bin/ld
+
+//Path to a program.
+CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/gmake
+
+//Flags used by the linker during the creation of modules.
+CMAKE_MODULE_LINKER_FLAGS:STRING=' '
+
+//Flags used by the linker during debug builds.
+CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING=
+
+//Flags used by the linker during release minsize builds.
+CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING=
+
+//Flags used by the linker during release builds.
+CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING=
+
+//Flags used by the linker during Release with Debug Info builds.
+CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING=
+
+//Path to a program.
+CMAKE_NM:FILEPATH=/usr/bin/nm
+
+//Path to a program.
+CMAKE_OBJCOPY:FILEPATH=/usr/bin/objcopy
+
+//Path to a program.
+CMAKE_OBJDUMP:FILEPATH=/usr/bin/objdump
+
+//Value Computed by CMake
+CMAKE_PROJECT_NAME:STATIC=glib-sock-serv
+
+//Path to a program.
+CMAKE_RANLIB:FILEPATH=/usr/bin/ranlib
+
+//Flags used by the linker during the creation of dll's.
+CMAKE_SHARED_LINKER_FLAGS:STRING=' '
+
+//Flags used by the linker during debug builds.
+CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING=
+
+//Flags used by the linker during release minsize builds.
+CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING=
+
+//Flags used by the linker during release builds.
+CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING=
+
+//Flags used by the linker during Release with Debug Info builds.
+CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING=
+
+//If set, runtime paths are not added when installing shared libraries,
+// but are added when building.
+CMAKE_SKIP_INSTALL_RPATH:BOOL=NO
+
+//If set, runtime paths are not added when using shared libraries.
+CMAKE_SKIP_RPATH:BOOL=NO
+
+//Path to a program.
+CMAKE_STRIP:FILEPATH=/usr/bin/strip
+
+//If true, cmake will use relative paths in makefiles and projects.
+CMAKE_USE_RELATIVE_PATHS:BOOL=OFF
+
+//If this value is on, makefiles will be generated without the
+// .SILENT directive, and all commands will be echoed to the console
+// during the make. This is useful for debugging only. With Visual
+// Studio IDE projects all commands are done without /nologo.
+CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE
+
+//Path to a library.
+GIO_LIBRARY:FILEPATH=/usr/lib64/libgio-2.0.so
+
+//Path to a file.
+GLIB_CONFIG_INCLUDE_DIR:PATH=/usr/lib64/glib-2.0/include
+
+//Path to a file.
+GLIB_INCLUDE_DIR:PATH=/usr/include/glib-2.0
+
+//Path to a library.
+GLIB_LIBRARIES:FILEPATH=/usr/lib64/libglib-2.0.so
+
+//pkg-config executable
+PKG_CONFIG_EXECUTABLE:FILEPATH=/usr/bin/pkg-config
+
+//Value Computed by CMake
+glib-sock-serv_BINARY_DIR:STATIC=/fileserver2/home/mjc/git/Instrument/build
+
+//Value Computed by CMake
+glib-sock-serv_SOURCE_DIR:STATIC=/fileserver2/home/mjc/git/Instrument
+
+
+########################
+# INTERNAL cache entries
+########################
+
+//ADVANCED property for variable: CMAKE_AR
+CMAKE_AR-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_BUILD_TOOL
+CMAKE_BUILD_TOOL-ADVANCED:INTERNAL=1
+//What is the target build tool cmake is generating for.
+CMAKE_BUILD_TOOL:INTERNAL=/usr/bin/gmake
+//This is the directory where this CMakeCache.txt was created
+CMAKE_CACHEFILE_DIR:INTERNAL=/fileserver2/home/mjc/git/Instrument/build
+//Major version of cmake used to create the current loaded cache
+CMAKE_CACHE_MAJOR_VERSION:INTERNAL=2
+//Minor version of cmake used to create the current loaded cache
+CMAKE_CACHE_MINOR_VERSION:INTERNAL=8
+//Patch version of cmake used to create the current loaded cache
+CMAKE_CACHE_PATCH_VERSION:INTERNAL=8
+//ADVANCED property for variable: CMAKE_COLOR_MAKEFILE
+CMAKE_COLOR_MAKEFILE-ADVANCED:INTERNAL=1
+//Path to CMake executable.
+CMAKE_COMMAND:INTERNAL=/usr/bin/cmake
+//Path to cpack program executable.
+CMAKE_CPACK_COMMAND:INTERNAL=/usr/bin/cpack
+//Path to ctest program executable.
+CMAKE_CTEST_COMMAND:INTERNAL=/usr/bin/ctest
+//ADVANCED property for variable: CMAKE_CXX_COMPILER
+CMAKE_CXX_COMPILER-ADVANCED:INTERNAL=1
+CMAKE_CXX_COMPILER_WORKS:INTERNAL=1
+//ADVANCED property for variable: CMAKE_CXX_FLAGS
+CMAKE_CXX_FLAGS-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_CXX_FLAGS_DEBUG
+CMAKE_CXX_FLAGS_DEBUG-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_CXX_FLAGS_MINSIZEREL
+CMAKE_CXX_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELEASE
+CMAKE_CXX_FLAGS_RELEASE-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELWITHDEBINFO
+CMAKE_CXX_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_C_COMPILER
+CMAKE_C_COMPILER-ADVANCED:INTERNAL=1
+CMAKE_C_COMPILER_WORKS:INTERNAL=1
+//ADVANCED property for variable: CMAKE_C_FLAGS
+CMAKE_C_FLAGS-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_C_FLAGS_DEBUG
+CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_C_FLAGS_MINSIZEREL
+CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_C_FLAGS_RELEASE
+CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_C_FLAGS_RELWITHDEBINFO
+CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
+//Result of TRY_COMPILE
+CMAKE_DETERMINE_CXX_ABI_COMPILED:INTERNAL=TRUE
+//Result of TRY_COMPILE
+CMAKE_DETERMINE_C_ABI_COMPILED:INTERNAL=TRUE
+//Path to cache edit program executable.
+CMAKE_EDIT_COMMAND:INTERNAL=/usr/bin/ccmake
+//Executable file format
+CMAKE_EXECUTABLE_FORMAT:INTERNAL=ELF
+//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS
+CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG
+CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL
+CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE
+CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO
+CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_EXPORT_COMPILE_COMMANDS
+CMAKE_EXPORT_COMPILE_COMMANDS-ADVANCED:INTERNAL=1
+//Name of generator.
+CMAKE_GENERATOR:INTERNAL=Unix Makefiles
+//Start directory with the top level CMakeLists.txt file for this
+// project
+CMAKE_HOME_DIRECTORY:INTERNAL=/fileserver2/home/mjc/git/Instrument
+//Install .so files without execute permission.
+CMAKE_INSTALL_SO_NO_EXE:INTERNAL=0
+//ADVANCED property for variable: CMAKE_LINKER
+CMAKE_LINKER-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_MAKE_PROGRAM
+CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS
+CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG
+CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL
+CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE
+CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO
+CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_NM
+CMAKE_NM-ADVANCED:INTERNAL=1
+//number of local generators
+CMAKE_NUMBER_OF_LOCAL_GENERATORS:INTERNAL=1
+//ADVANCED property for variable: CMAKE_OBJCOPY
+CMAKE_OBJCOPY-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_OBJDUMP
+CMAKE_OBJDUMP-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_RANLIB
+CMAKE_RANLIB-ADVANCED:INTERNAL=1
+//Path to CMake installation.
+CMAKE_ROOT:INTERNAL=/usr/share/cmake
+//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS
+CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG
+CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL
+CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE
+CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO
+CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_SKIP_INSTALL_RPATH
+CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_SKIP_RPATH
+CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_STRIP
+CMAKE_STRIP-ADVANCED:INTERNAL=1
+//uname command
+CMAKE_UNAME:INTERNAL=/usr/bin/uname
+//ADVANCED property for variable: CMAKE_USE_RELATIVE_PATHS
+CMAKE_USE_RELATIVE_PATHS-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_VERBOSE_MAKEFILE
+CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1
+//Details about finding PkgConfig
+FIND_PACKAGE_MESSAGE_DETAILS_PkgConfig:INTERNAL=[/usr/bin/pkg-config][v0.25()]
+//ADVANCED property for variable: GIO_LIBRARY
+GIO_LIBRARY-ADVANCED:INTERNAL=1
+GIO_PKGCONF_CFLAGS:INTERNAL=-pthread;-I/usr/include/glib-2.0;-I/usr/lib64/glib-2.0/include
+GIO_PKGCONF_CFLAGS_I:INTERNAL=
+GIO_PKGCONF_CFLAGS_OTHER:INTERNAL=-pthread
+GIO_PKGCONF_FOUND:INTERNAL=1
+GIO_PKGCONF_INCLUDEDIR:INTERNAL=/usr/include
+GIO_PKGCONF_INCLUDE_DIRS:INTERNAL=/usr/include/glib-2.0;/usr/lib64/glib-2.0/include
+GIO_PKGCONF_LDFLAGS:INTERNAL=-lgio-2.0;-lgobject-2.0;-lglib-2.0
+GIO_PKGCONF_LDFLAGS_OTHER:INTERNAL=
+GIO_PKGCONF_LIBDIR:INTERNAL=/usr/lib64
+GIO_PKGCONF_LIBRARIES:INTERNAL=gio-2.0;gobject-2.0;glib-2.0
+GIO_PKGCONF_LIBRARY_DIRS:INTERNAL=
+GIO_PKGCONF_LIBS:INTERNAL=
+GIO_PKGCONF_LIBS_L:INTERNAL=
+GIO_PKGCONF_LIBS_OTHER:INTERNAL=
+GIO_PKGCONF_LIBS_PATHS:INTERNAL=
+GIO_PKGCONF_PREFIX:INTERNAL=/usr
+GIO_PKGCONF_STATIC_CFLAGS:INTERNAL=-pthread;-I/usr/include/glib-2.0;-I/usr/lib64/glib-2.0/include
+GIO_PKGCONF_STATIC_CFLAGS_I:INTERNAL=
+GIO_PKGCONF_STATIC_CFLAGS_OTHER:INTERNAL=-pthread
+GIO_PKGCONF_STATIC_INCLUDE_DIRS:INTERNAL=/usr/include/glib-2.0;/usr/lib64/glib-2.0/include
+GIO_PKGCONF_STATIC_LDFLAGS:INTERNAL=-pthread;-lgio-2.0;-lz;-lresolv;-lgmodule-2.0;-ldl;-lgobject-2.0;-lffi;-lglib-2.0;-lrt
+GIO_PKGCONF_STATIC_LDFLAGS_OTHER:INTERNAL=
+GIO_PKGCONF_STATIC_LIBDIR:INTERNAL=
+GIO_PKGCONF_STATIC_LIBRARIES:INTERNAL=gio-2.0;z;resolv;gmodule-2.0;dl;gobject-2.0;ffi;glib-2.0;rt
+GIO_PKGCONF_STATIC_LIBRARY_DIRS:INTERNAL=
+GIO_PKGCONF_STATIC_LIBS:INTERNAL=
+GIO_PKGCONF_STATIC_LIBS_L:INTERNAL=
+GIO_PKGCONF_STATIC_LIBS_OTHER:INTERNAL=
+GIO_PKGCONF_STATIC_LIBS_PATHS:INTERNAL=
+GIO_PKGCONF_VERSION:INTERNAL=2.32.3
+GIO_PKGCONF_gio-2.0_INCLUDEDIR:INTERNAL=
+GIO_PKGCONF_gio-2.0_LIBDIR:INTERNAL=
+GIO_PKGCONF_gio-2.0_PREFIX:INTERNAL=
+GIO_PKGCONF_gio-2.0_VERSION:INTERNAL=
+//ADVANCED property for variable: GLIB_CONFIG_INCLUDE_DIR
+GLIB_CONFIG_INCLUDE_DIR-ADVANCED:INTERNAL=1
+//glib-2.0 found
+GLIB_FOUND:INTERNAL=TRUE
+//ADVANCED property for variable: GLIB_INCLUDE_DIR
+GLIB_INCLUDE_DIR-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: GLIB_LIBRARIES
+GLIB_LIBRARIES-ADVANCED:INTERNAL=1
+GLIB_PKG_CFLAGS:INTERNAL=-I/usr/include/glib-2.0;-I/usr/lib64/glib-2.0/include
+GLIB_PKG_CFLAGS_I:INTERNAL=
+GLIB_PKG_CFLAGS_OTHER:INTERNAL=
+GLIB_PKG_FOUND:INTERNAL=1
+GLIB_PKG_INCLUDEDIR:INTERNAL=/usr/include
+GLIB_PKG_INCLUDE_DIRS:INTERNAL=/usr/include/glib-2.0;/usr/lib64/glib-2.0/include
+GLIB_PKG_LDFLAGS:INTERNAL=-lglib-2.0
+GLIB_PKG_LDFLAGS_OTHER:INTERNAL=
+GLIB_PKG_LIBDIR:INTERNAL=/usr/lib64
+GLIB_PKG_LIBRARIES:INTERNAL=glib-2.0
+GLIB_PKG_LIBRARY_DIRS:INTERNAL=
+GLIB_PKG_LIBS:INTERNAL=
+GLIB_PKG_LIBS_L:INTERNAL=
+GLIB_PKG_LIBS_OTHER:INTERNAL=
+GLIB_PKG_LIBS_PATHS:INTERNAL=
+GLIB_PKG_PREFIX:INTERNAL=/usr
+GLIB_PKG_STATIC_CFLAGS:INTERNAL=-I/usr/include/glib-2.0;-I/usr/lib64/glib-2.0/include
+GLIB_PKG_STATIC_CFLAGS_I:INTERNAL=
+GLIB_PKG_STATIC_CFLAGS_OTHER:INTERNAL=
+GLIB_PKG_STATIC_INCLUDE_DIRS:INTERNAL=/usr/include/glib-2.0;/usr/lib64/glib-2.0/include
+GLIB_PKG_STATIC_LDFLAGS:INTERNAL=-pthread;-lglib-2.0;-lrt
+GLIB_PKG_STATIC_LDFLAGS_OTHER:INTERNAL=-pthread
+GLIB_PKG_STATIC_LIBDIR:INTERNAL=
+GLIB_PKG_STATIC_LIBRARIES:INTERNAL=glib-2.0;rt
+GLIB_PKG_STATIC_LIBRARY_DIRS:INTERNAL=
+GLIB_PKG_STATIC_LIBS:INTERNAL=
+GLIB_PKG_STATIC_LIBS_L:INTERNAL=
+GLIB_PKG_STATIC_LIBS_OTHER:INTERNAL=
+GLIB_PKG_STATIC_LIBS_PATHS:INTERNAL=
+GLIB_PKG_VERSION:INTERNAL=2.32.3
+GLIB_PKG_glib-2.0_INCLUDEDIR:INTERNAL=
+GLIB_PKG_glib-2.0_LIBDIR:INTERNAL=
+GLIB_PKG_glib-2.0_PREFIX:INTERNAL=
+GLIB_PKG_glib-2.0_VERSION:INTERNAL=
+//ADVANCED property for variable: PKG_CONFIG_EXECUTABLE
+PKG_CONFIG_EXECUTABLE-ADVANCED:INTERNAL=1
+__pkg_config_checked_GIO_PKGCONF:INTERNAL=1
+__pkg_config_checked_GLIB_PKG:INTERNAL=1
+
diff --git a/instr-client.c.orig b/instr-client.c.orig
new file mode 100644
index 0000000..d88f654
--- /dev/null
+++ b/instr-client.c.orig
@@ -0,0 +1,143 @@
+#include <stdio.h>
+#include <gio/gio.h>
+#include <string.h>
+#include "response.h"
+#include <stdlib.h>
+#include <strings.h>
+
+static int port = 3333;
+#define BUFSIZE 1024
+
+GMainContext *context=NULL;
+GMainLoop *mainLoop=NULL;
+GSocketConnection * connection = NULL;
+GSocketClient * client = NULL;
+
+char exitTokens[5][7] = {"quit", "exit", "logout", "logoff", "local"};
+
+//helper function to nicely terminate the client
+static void terminate(char *message, int exitCode)
+{
+ g_object_unref(client);
+ g_object_unref(connection);
+ if (message) {
+ g_print("%s\n", message);
+ }
+ exit(exitCode);
+}
+
+//a sort of strncmp but with \n or \r exception
+static gboolean Matches(char *src, char* dst, gssize size)
+{
+ for(; *src != '\0', (size--)>0; src++) {
+ if(g_ascii_toupper(*src) != g_ascii_toupper(*dst)) {
+ return FALSE;
+ }
+ dst++;
+ }
+ for(; *dst != '\0'; dst++)
+ if (*dst != '\r' && *dst != '\n') {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+//GIOChannel callback
+static gboolean
+stdinAvailable (GIOChannel *source, GIOCondition condition, gpointer data)
+{
+ char tmp[BUFSIZE];
+ memset(tmp,0,BUFSIZE);
+ int size = read(0, tmp, BUFSIZE);
+ if(size<=0) {
+ return TRUE;
+ }
+
+ //test if we have an exit word
+ int idx=0;
+ for(idx=0; idx<sizeof(exitTokens)/sizeof(exitTokens[0]); idx++) {
+ if(Matches(exitTokens[idx], tmp, strlen(exitTokens[idx]))) {
+ g_socket_close(g_socket_connection_get_socket(connection), NULL);
+ terminate("Goodbye", 0);
+ }
+ }
+
+ //write the message
+ gssize written=0;
+ GPollableOutputStream* out = (GPollableOutputStream*)data;
+ written = g_pollable_output_stream_write_nonblocking(out, tmp, size, NULL, NULL);
+ if (written <=0 || written == G_IO_ERROR_WOULD_BLOCK) {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+//callback for server input
+static gboolean cbServerInput(gpointer data, gpointer additional)
+{
+ char buffer[BUFSIZE];
+ gssize size=0;
+ memset(buffer,0,BUFSIZE);
+
+ GPollableInputStream* inStream = (GPollableInputStream*)data;
+
+ size=g_pollable_input_stream_read_nonblocking(inStream, buffer, BUFSIZE, NULL, NULL);
+ if(size <=0 || size == G_IO_ERROR_WOULD_BLOCK) {
+ terminate("Connection to server lost", -1);
+ }
+ g_print("\n%s", buffer);
+ g_print("> ");
+ return TRUE;
+}
+
+int main(int argc, char** argv)
+{
+ /* create a new connection */
+ g_type_init ();
+
+ GOutputStream *out;
+ GInputStream *in;
+ GError* error = NULL;
+ GIOChannel* stdinChannel = NULL;
+ client = g_socket_client_new();
+ GSource *source = NULL;
+
+ /* connect to the host */
+ connection = g_socket_client_connect_to_host (client,
+ (gchar*)"localhost",
+ port,
+ NULL,
+ &error);
+
+ if (error != NULL) {
+ g_print("Could not connect to server on port %d\n", port);
+ g_object_unref(client);
+ return -1;
+ }
+ g_print("> ");
+
+
+ //register Pollable sources
+ out = g_io_stream_get_output_stream (G_IO_STREAM (connection));
+ in = g_io_stream_get_input_stream (G_IO_STREAM (connection));
+ GSource *outSource = NULL;
+ GSource *inSource = g_pollable_input_stream_create_source((struct GPollableInputStream*)in, NULL);
+ outSource = g_pollable_output_stream_create_source((struct GPollableOutputStream*)out, NULL);
+
+ //register stdin channel
+ stdinChannel = g_io_channel_unix_new(0);
+ if(stdinChannel == NULL) {
+ terminate("Could not open STDIN channel", -2);
+ }
+
+ //attach the sources
+ g_io_add_watch(stdinChannel, G_IO_IN, stdinAvailable, (struct GPollableOutputStream*)out);
+ g_source_set_callback(inSource, cbServerInput, (GPollableOutputStream*)in, NULL);
+
+ g_source_attach(inSource, NULL);
+ g_main_loop_run (g_main_loop_new (NULL, FALSE));
+ return 0;
+} \ No newline at end of file
diff --git a/instr-daemon.c.orig b/instr-daemon.c.orig
new file mode 100644
index 0000000..0f07d16
--- /dev/null
+++ b/instr-daemon.c.orig
@@ -0,0 +1,273 @@
+#include "socket-common.h"
+#include "response.h"
+#include <stdlib.h>
+#include <ctype.h>
+
+#define STDIN_BUF_SIZE 1024
+
+int port=3333; //port to listen
+int connections=0;
+int maxConn=16; //max connections - 16
+
+guint signalMyCb; //signal to register which is used in cbClientInput(), step 10 from requirements
+GAsyncQueue** stdinQueue=NULL;
+GThread **peers; //actual connected peers
+
+
+//GIOChannel callback for stdin
+static gboolean
+stdinAvailable (GIOChannel *source, GIOCondition condition, gpointer data)
+{
+ static char* buffer=NULL;
+ static gint64 allocated=0;
+ GAsyncQueue* queue=NULL;
+
+ //temporary buffer to read from stdin
+ char tmp[STDIN_BUF_SIZE];
+ memset(tmp,0,STDIN_BUF_SIZE);
+
+ int size = read(0, tmp, STDIN_BUF_SIZE);
+ if(size<=0) return TRUE;
+
+ //fix for \n or \r sending
+ if(size ==1)
+ if(tmp[0] == '\r' || tmp[0] == '\n') return TRUE;
+
+ //the termination characters
+ if(!strncmp(tmp, "..", size-1))
+ {
+ //final reallocation of the buffer to accomodate the whole string
+ buffer=realloc(buffer,allocated+1);
+ buffer[allocated] = '\0';
+ int idx=0;
+
+ g_print_debug("Got the buffer: \"%s\", tid: %p\n", buffer, g_thread_self());
+
+ if (tmp[0] == '.' && tmp[1] == '.') //fix for single dot sending
+ {
+ int count=0;
+
+ //send the final buffer to the queue
+ for(count=0; count<maxConn; count++)
+ {
+ //allocate on the heap and deallocate in response.c, cbClientOutput()
+ char *toSend = realloc(NULL, allocated+1);
+ memcpy(toSend, buffer, allocated+1);
+
+ //make sure we send to only valid peers
+ if(peers[count] != 0)
+ g_async_queue_push(stdinQueue[count], toSend);
+ }
+
+ //free the buffer
+ free(buffer);
+ buffer=NULL;
+ allocated=0;
+ return TRUE;
+ }
+ }
+
+ //allocate on the heap. buffer is NULL the first time
+ buffer=realloc(buffer, allocated+size);
+ memcpy(buffer+allocated, tmp, size);
+ allocated += size; //keep track of allocation
+
+
+ return TRUE;
+}
+
+/** pulls an integer position from the vector which contains the
+ position to use for the stdinQueue vector
+ @param id - the thread id
+*/
+static int pullIndex(GThread* id)
+{
+ int i=0,ret=-1;
+ static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
+ g_static_mutex_lock (&mutex);
+ for(i=0; i<maxConn; i++)
+ if(peers[i] == id)
+ {
+ peers[i] = (GThread*)0;
+ ret=i;
+ break;
+ }
+ g_static_mutex_unlock (&mutex);
+ return ret;
+}
+
+/**
+ * pushed in the peers vector the thread id for future reference
+ * @param id
+ */
+static int pushIndex(GThread* id)
+{
+ int i=0,ret=-1;
+ static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
+ g_static_mutex_lock (&mutex);
+ for(i=0; i<maxConn; i++)
+ if(peers[i] == 0)
+ {
+ peers[i] = id;
+ ret=i;
+ break;
+ }
+
+ g_static_mutex_unlock (&mutex);
+ return ret;
+}
+
+//handler for incoming connection, closes the connection if maxCon connections are already handled
+static gboolean
+incomingConnection (GSocketService *service,
+ GSocketConnection *connection,
+ GSocketListener *listener,
+ gpointer user_data)
+{
+ if(connections +1 > maxConn)
+ {
+ g_print_debug("Connection closed. Max reached\n");
+ return TRUE;
+ }
+ connections++;
+ g_print_debug("Incoming connection\n");
+ return FALSE;
+}
+
+
+//thread connection handler
+static gboolean
+handler (GThreadedSocketService *service,
+ GSocketConnection *connection,
+ GSocketListener *listener,
+ gpointer user_data)
+{
+
+
+ GOutputStream *out;
+ GInputStream *in;
+ gssize size;
+
+
+ out = g_io_stream_get_output_stream (G_IO_STREAM (connection));
+ in = g_io_stream_get_input_stream (G_IO_STREAM (connection));
+
+ g_print_debug("Handling, connections: %d\n", connections);
+
+ //register ourselves in the peers vector, use the index obtained in the stdinQueue
+ //should not get -1
+ GThread* self = g_thread_self();
+ int index=pushIndex(self);
+
+ GSource *outSource = NULL;
+ GSource *inSource = g_pollable_input_stream_create_source((struct GPollableInputStream*)in, NULL);
+
+ //get a reference to the async queue
+ GAsyncQueue *queue = g_async_queue_ref(stdinQueue[index]);
+
+ //input from client
+ g_source_set_callback(inSource, cbClientInput, (GPollableOutputStream*)out, NULL);
+ g_source_attach(inSource, NULL);
+
+ //keep thread alive, every 1000 microseconds
+ while(g_source_is_destroyed(inSource)==FALSE)
+ {
+ g_usleep(1000);
+ gint elems;
+
+ //verify our queue length and activate/deactivate the "out" Source for this connection
+ //if we don't do this, the out Source will be scheduled frequently and will busy loop
+ if((elems=g_async_queue_length(queue))>0)
+ {
+ if(outSource == NULL)
+ {
+
+ outSource = g_pollable_output_stream_create_source((struct GPollableOutputStream*)out, NULL);
+ g_source_set_callback(outSource, cbClientOutput, queue, NULL);
+ g_source_attach(outSource, NULL);
+ }
+ else
+ {
+ g_source_destroy(outSource);
+ g_source_unref(outSource);
+ outSource = NULL;
+ }
+
+ }
+ else
+ {
+ if(outSource!= NULL && !g_source_is_destroyed(outSource))
+ {
+ g_print_debug("Destroy source\n");
+ g_source_destroy(outSource);
+ g_source_unref(outSource);
+ outSource = NULL; //added
+ }
+ }
+ //end of activate/deactivate
+ }
+
+ //reached the end of the thread
+ if (g_output_stream_close(out, NULL, NULL) == FALSE)
+ g_print_debug("out not closed\n");
+ if (g_input_stream_close(in, NULL, NULL) == FALSE)
+ g_print_debug("in not closed\n");
+
+ g_print_debug("Thread end\n");
+ connections--; //keep track of connections
+ g_async_queue_unref(queue); //unreference the queue
+ pullIndex(g_thread_self()); //unregister from the peers vector
+ return TRUE;
+}
+
+int main(int argc, char **argv)
+{
+ GSocketService *service = NULL;
+ GError *error = NULL;
+ GIOChannel* stdinChannel = NULL;
+
+ g_type_init ();
+
+ //register stdin channel
+ stdinChannel = g_io_channel_unix_new(0);
+ if(stdinChannel == NULL) { g_printerr("No io channel\n"); exit(-1); }
+ g_io_add_watch(stdinChannel, G_IO_IN, stdinAvailable, NULL);
+ int idx=0;
+
+ //allocate a maxConn queue on the heap
+ stdinQueue = malloc(sizeof(struct GAsyncQueue*) * maxConn);
+ //allocate peers vector on the heap
+ peers = malloc(sizeof(GThread*) * maxConn);
+ for(idx=0;idx<maxConn;idx++)
+ {
+ peers[idx] = 0;
+ stdinQueue[idx] = g_async_queue_new();
+ }
+
+ //create a threaded service
+ service = g_threaded_socket_service_new (maxConn+1);
+ if (!g_socket_listener_add_inet_port (G_SOCKET_LISTENER (service),
+ port,
+ NULL,
+ &error))
+ {
+ g_printerr ("%s: %s\n", argv[0], error->message);
+ free(stdinQueue);
+ free(peers);
+ return 1;
+ }
+
+ //init the signal signalMyCb
+ initSignals(&signalMyCb);
+
+ g_print_debug("Server listening on port %d\n", port);
+ g_signal_connect (service, "run", G_CALLBACK (handler), NULL);
+ g_signal_connect (service, "incoming", G_CALLBACK(incomingConnection), NULL);
+
+ g_main_loop_run (g_main_loop_new (NULL, FALSE));
+ free(stdinQueue);
+ free(peers);
+
+ return 0;
+
+}
diff --git a/response.c.orig b/response.c.orig
new file mode 100644
index 0000000..93d38b3
--- /dev/null
+++ b/response.c.orig
@@ -0,0 +1,109 @@
+#include "response.h"
+#include "socket-common.h"
+#include <string.h>
+
+//RESPONSE related functions from the server
+
+extern guint signalMyCb; //signal id
+extern GAsyncQueue* stdinQueue; //our queue
+SignalObject* signalObject; //the signal object which registered the signal id
+
+//write output to client
+static gssize writeOutput(GPollableOutputStream* stream, gchar* data, gssize size);
+
+//callback for client output, this is where the queue messages are sent to the client
+gboolean cbClientOutput(gpointer data, gpointer additional)
+{
+ GPollableOutputStream* outStream = (GPollableOutputStream*)data;
+ GAsyncQueue* queue = (GAsyncQueue*)additional;
+ if(g_async_queue_length(queue) <= 0) return FALSE;
+
+ gpointer elem;
+ g_print_debug("Try pop\n");
+ //try to pop an element from the queue
+ elem=g_async_queue_try_pop(queue);
+ g_print_debug("after pop\n");
+ if(elem)
+ {
+ char* buf = (char*)elem;
+ g_print_debug("Extracted %s\n", buf);
+ gssize size = strlen(buf);
+ gssize written = 0;
+
+ written=g_pollable_output_stream_write_nonblocking(outStream, buf, size+1, NULL, NULL);
+ if(written==-1) g_printerr("Could not write to client\n");
+
+ //free the alloc'ed memory
+ free(buf);
+ }
+
+ return FALSE;
+}
+
+//the client input callback
+gboolean cbClientInput(gpointer data, gpointer additional)
+{
+
+ char buffer[1024];
+ gssize size=0;
+ memset(buffer,0,1024);
+
+ GPollableInputStream* inStream = (GPollableInputStream*)data;
+ GPollableOutputStream* outStream = (GPollableOutputStream*)additional;
+
+ size=g_pollable_input_stream_read_nonblocking(inStream, buffer, 1024, NULL, NULL);
+ if(size <=0 || size == G_IO_ERROR_WOULD_BLOCK) { g_print_debug("Got: %d\n", size); return FALSE; }
+
+ //emit a signal which calls the echoCb function
+ SignalObjectClass myStruct;
+ myStruct.instance = NULL;
+ myStruct.cb = writeOutput;
+ myStruct.data = buffer;
+ myStruct.size = size;
+ myStruct.inStream = inStream;
+ myStruct.outStream = outStream;
+ g_signal_emit(signalObject, signalMyCb, 0, &myStruct, NULL);
+
+ return TRUE;
+}
+
+//write output to client
+static gssize writeOutput(GPollableOutputStream* stream, gchar* data, gssize size)
+{
+ gssize what=0;
+ what=g_pollable_output_stream_write_nonblocking(stream, data, size, NULL, NULL);
+ if(what < 0 || what == G_IO_ERROR_WOULD_BLOCK) { return -1; }
+ return what;
+}
+
+//initialize the signals
+void initSignals(guint *signal)
+{
+ *signal = g_signal_new("runEchoService", SIGNAL_OBJECT_TYPE, G_SIGNAL_RUN_FIRST, 0, NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER , G_TYPE_NONE, 1, G_TYPE_POINTER);
+
+ signalObject = g_object_new(SIGNAL_OBJECT_TYPE, NULL);
+ g_signal_connect (signalObject, "runEchoService", G_CALLBACK (echoCb), NULL);
+}
+
+//echo 3 times and send to client one time
+void echoCb(gpointer instance, GObject *arg1, gpointer user_data)
+{
+ static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
+ g_static_mutex_lock (&mutex);
+ SignalObjectClass *data = (SignalObjectClass*)arg1;
+ GPollableOutputStream* stream = (GPollableOutputStream*)data->outStream;
+ gchar* str = data->data;
+ gssize len = data->size;
+ gssize written = 0;
+
+ gchar* upper = g_ascii_strup(str, len);
+ int i;
+ for(i=0; i<3; i++) g_print("%s\n", upper);
+ //send response back to client
+
+ written = data->cb(stream, upper, len);
+
+ g_free(upper);
+ g_static_mutex_unlock (&mutex);
+}
diff --git a/response.h.orig b/response.h.orig
new file mode 100644
index 0000000..7b6301a
--- /dev/null
+++ b/response.h.orig
@@ -0,0 +1,18 @@
+#include <gio/gio.h>
+#include <glibconfig.h>
+#include <glib.h>
+#include "signalobject.h"
+
+
+typedef struct _streamStruct
+{
+ GPollableInputStream* in;
+ GPollableOutputStream* out;
+} streamStruct;
+
+void echoCb(gpointer instance, GObject *arg1, gpointer user_data);
+
+gboolean cbClientInput(gpointer data, gpointer additional);
+gboolean cbClientOutput(gpointer data, gpointer additional);
+void initSignals(guint *signal);
+void echoCb(gpointer instance, GObject *arg1, gpointer user_data); \ No newline at end of file
diff --git a/signalobject.c.orig b/signalobject.c.orig
new file mode 100644
index 0000000..68003fe
--- /dev/null
+++ b/signalobject.c.orig
@@ -0,0 +1,38 @@
+#include "signalobject.h"
+
+G_DEFINE_TYPE (SignalObject, signal_object, G_TYPE_OBJECT);
+
+static GObject *
+signal_object_constructor (GType gtype,
+ guint n_properties,
+ GObjectConstructParam *properties)
+{
+ GObject *obj;
+
+ {
+ /* Always chain up to the parent constructor */
+ obj = G_OBJECT_CLASS (signal_object_parent_class)->constructor (gtype, n_properties, properties);
+ }
+
+ /* update the object state depending on constructor properties */
+
+ return obj;
+}
+
+
+static void
+signal_object_class_init (SignalObjectClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+ gobject_class->constructor = signal_object_constructor;
+}
+
+
+static void
+signal_object_init (SignalObject *self)
+{
+ /* initialize the object */
+}
+
+
diff --git a/signalobject.h.orig b/signalobject.h.orig
new file mode 100644
index 0000000..8863086
--- /dev/null
+++ b/signalobject.h.orig
@@ -0,0 +1,44 @@
+#ifndef SIGNAL_OBJECT_H
+#define SIGNAL_OBJECT_H
+
+#include <gio/gio.h>
+#include <glibconfig.h>
+#include <glib.h>
+
+
+#define SIGNAL_OBJECT_TYPE (signal_object_get_type ())
+/*
+#define MAMAN_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_BAR, MamanBar))
+#define MAMAN_IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_BAR))
+#define MAMAN_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_BAR, MamanBarClass))
+#define MAMAN_IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_BAR))
+#define MAMAN_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_BAR, MamanBarClass))
+*/
+
+typedef struct _SignalObject SignalObject;
+typedef struct _SignalObjectClass SignalObjectClass;
+
+
+struct _SignalObject
+{
+ GObject parentInstance;
+ gpointer instance;
+ gssize (*cb)(GPollableOutputStream* stream, gchar* data, gssize size);
+ GPollableInputStream* inStream;
+ GPollableOutputStream* outStream;
+ gchar* data;
+ gssize size;
+};
+
+struct _SignalObjectClass
+{
+ GObjectClass parent_class;
+ gpointer instance;
+ gssize (*cb)(GPollableOutputStream* stream, gchar* data, gssize size);
+ GPollableInputStream* inStream;
+ GPollableOutputStream* outStream;
+ gchar* data;
+ gssize size;
+};
+
+#endif