Browse Source

Initial commit

Billy Barrow 4 năm trước cách đây
commit
d8d7105f0f

+ 5 - 0
.gitignore

@@ -0,0 +1,5 @@
+builddir
+hlpced.p
+meson-info
+meson-logs
+meson-private

BIN
.ninja_deps


+ 80 - 0
.ninja_log

@@ -0,0 +1,80 @@
+# ninja log v5
+0	482	1618021121424412916	build.ninja	1aa63ebfb8ddb11e
+3	341	1618021121774415175	hlpced.p/Protocols/MX2/InstanceReference.c	2d7a2d7074c92a3e
+3	341	1618021121774415175	hlpced.p/Networks/Advertisement.c	2d7a2d7074c92a3e
+3	341	1618021121774415175	hlpced.p/Networks/Simulation/NetSimPeerInfo.c	2d7a2d7074c92a3e
+3	341	1618021121774415175	hlpced.p/Util/QueueCommand.c	2d7a2d7074c92a3e
+3	341	1618021121774415175	hlpced.p/Networks/Simulation/Conduit.c	2d7a2d7074c92a3e
+3	341	1618021121774415175	hlpced.p/Daemon.c	2d7a2d7074c92a3e
+343	611	1618021122083417169	hlpced.p/meson-generated_Networks_Receiption.c.o	2822ee7fec9da870
+342	697	1618021122175417763	hlpced.p/meson-generated_Networks_PeerInfo.c.o	d8b949ba01d40658
+372	729	1618021122206417963	hlpced.p/meson-generated_Networks_Simulation_NetSimPeerInfo.c.o	5da65d1cbc9c922a
+0	10	0	meson-clean	a7c70eacb11a5051
+344	577	1618021122053416975	hlpced.p/meson-generated_Networks_Simulation_Packet.c.o	67d98f1e946ac16d
+381	717	1618021122194417885	hlpced.p/meson-generated_Networks_Simulation_Conduit.c.o	2bfed11430b17ebe
+580	849	1618021122326418737	hlpced.p/meson-generated_Daemon.c.o	5687f300df9b2a05
+3	341	1618021121774415175	hlpced.p/Networks/PeerInfo.c	2d7a2d7074c92a3e
+3	341	1618021121774415175	hlpced.p/Networks/UnknownPeerInfo.c	2d7a2d7074c92a3e
+3	341	1618021121774415175	hlpced.p/Networks/Network.c	2d7a2d7074c92a3e
+341	610	1618021122083417169	hlpced.p/meson-generated_Networks_Network.c.o	952776849be5dd8d
+464	504	1615077515590918967	hlpced	26788228218aee05
+394	739	1618021122217418033	hlpced.p/meson-generated_Networks_Simulation_NetSim.c.o	a16ba704b1000e9a
+345	638	1618021122112417356	hlpced.p/meson-generated_Util_QueueCommand.c.o	a7965525aad14579
+3	341	1618021121774415175	hlpced.p/Networks/Simulation/NetSim.c	2d7a2d7074c92a3e
+344	654	1618021122132417485	hlpced.p/meson-generated_Protocols_MX2_InstanceReference.c.o	d00e9c61927c228c
+3	341	1618021121774415175	hlpced.p/Networks/Simulation/Packet.c	2d7a2d7074c92a3e
+598	765	1618021122242418195	hlpced.p/meson-generated_Networks_Advertisement.c.o	1ec7621938e192d2
+3	341	1618021121774415175	hlpced.p/Networks/Receiption.c	2d7a2d7074c92a3e
+343	597	1618021122071417092	hlpced.p/meson-generated_Networks_UnknownPeerInfo.c.o	f3e5a2dd661d6153
+0	10	0	meson-clean	a7c70eacb11a5051
+3	382	1618021133794492746	hlpced.p/Daemon.c	2d7a2d7074c92a3e
+3	382	1618021133794492746	hlpced.p/Networks/Advertisement.c	2d7a2d7074c92a3e
+3	382	1618021133794492746	hlpced.p/Networks/Network.c	2d7a2d7074c92a3e
+3	382	1618021133794492746	hlpced.p/Networks/PeerInfo.c	2d7a2d7074c92a3e
+3	382	1618021133794492746	hlpced.p/Networks/UnknownPeerInfo.c	2d7a2d7074c92a3e
+3	382	1618021133794492746	hlpced.p/Networks/Receiption.c	2d7a2d7074c92a3e
+3	382	1618021133794492746	hlpced.p/Networks/Simulation/NetSimPeerInfo.c	2d7a2d7074c92a3e
+3	382	1618021133794492746	hlpced.p/Networks/Simulation/Conduit.c	2d7a2d7074c92a3e
+3	382	1618021133794492746	hlpced.p/Networks/Simulation/NetSim.c	2d7a2d7074c92a3e
+3	382	1618021133794492746	hlpced.p/Networks/Simulation/Packet.c	2d7a2d7074c92a3e
+3	382	1618021133794492746	hlpced.p/Protocols/MX2/InstanceReference.c	2d7a2d7074c92a3e
+3	382	1618021133794492746	hlpced.p/Util/QueueCommand.c	2d7a2d7074c92a3e
+383	562	1618021134017494186	hlpced.p/meson-generated_Networks_Advertisement.c.o	1ec7621938e192d2
+405	656	1618021134110494786	hlpced.p/meson-generated_Networks_Simulation_Packet.c.o	67d98f1e946ac16d
+388	679	1618021134131494921	hlpced.p/meson-generated_Networks_Simulation_NetSimPeerInfo.c.o	5da65d1cbc9c922a
+397	707	1618021134163495128	hlpced.p/meson-generated_Networks_Simulation_NetSim.c.o	a16ba704b1000e9a
+384	711	1618021134163495128	hlpced.p/meson-generated_Networks_Network.c.o	952776849be5dd8d
+383	713	1618021134165495141	hlpced.p/meson-generated_Daemon.c.o	5687f300df9b2a05
+386	718	1618021134175495205	hlpced.p/meson-generated_Networks_Receiption.c.o	2822ee7fec9da870
+394	761	1618021134218495483	hlpced.p/meson-generated_Networks_Simulation_Conduit.c.o	2bfed11430b17ebe
+384	767	1618021134223495515	hlpced.p/meson-generated_Networks_PeerInfo.c.o	d8b949ba01d40658
+384	769	1618021134226495534	hlpced.p/meson-generated_Networks_UnknownPeerInfo.c.o	f3e5a2dd661d6153
+658	819	1618021134274495844	hlpced.p/meson-generated_Util_QueueCommand.c.o	a7965525aad14579
+563	861	1618021134316496115	hlpced.p/meson-generated_Protocols_MX2_InstanceReference.c.o	d00e9c61927c228c
+0	593	1618021555247212973	build.ninja	1aa63ebfb8ddb11e
+0	4	0	meson-clean	a7c70eacb11a5051
+3	340	1618021556816223117	hlpced.p/Daemon.c	2d7a2d7074c92a3e
+3	340	1618021556816223117	hlpced.p/Networks/Advertisement.c	2d7a2d7074c92a3e
+3	340	1618021556816223117	hlpced.p/Networks/Network.c	2d7a2d7074c92a3e
+3	340	1618021556816223117	hlpced.p/Networks/PeerInfo.c	2d7a2d7074c92a3e
+3	340	1618021556816223117	hlpced.p/Networks/UnknownPeerInfo.c	2d7a2d7074c92a3e
+3	340	1618021556816223117	hlpced.p/Networks/Receiption.c	2d7a2d7074c92a3e
+3	340	1618021556816223117	hlpced.p/Networks/Simulation/NetSimPeerInfo.c	2d7a2d7074c92a3e
+3	340	1618021556816223117	hlpced.p/Networks/Simulation/Conduit.c	2d7a2d7074c92a3e
+3	340	1618021556816223117	hlpced.p/Networks/Simulation/NetSim.c	2d7a2d7074c92a3e
+3	340	1618021556816223117	hlpced.p/Networks/Simulation/Packet.c	2d7a2d7074c92a3e
+3	340	1618021556816223117	hlpced.p/Protocols/MX2/InstanceReference.c	2d7a2d7074c92a3e
+3	340	1618021556816223117	hlpced.p/Util/QueueCommand.c	2d7a2d7074c92a3e
+342	597	1618021557116225056	hlpced.p/meson-generated_Networks_UnknownPeerInfo.c.o	f3e5a2dd661d6153
+340	625	1618021557136225185	hlpced.p/meson-generated_Daemon.c.o	5687f300df9b2a05
+341	630	1618021557138225198	hlpced.p/meson-generated_Networks_Network.c.o	952776849be5dd8d
+340	632	1618021557144225237	hlpced.p/meson-generated_Networks_Advertisement.c.o	1ec7621938e192d2
+374	671	1618021557191225541	hlpced.p/meson-generated_Networks_Simulation_Packet.c.o	67d98f1e946ac16d
+356	680	1618021557202225612	hlpced.p/meson-generated_Networks_Simulation_Conduit.c.o	2bfed11430b17ebe
+352	693	1618021557214225690	hlpced.p/meson-generated_Networks_Simulation_NetSimPeerInfo.c.o	5da65d1cbc9c922a
+364	701	1618021557223225748	hlpced.p/meson-generated_Networks_Simulation_NetSim.c.o	a16ba704b1000e9a
+341	706	1618021557228225780	hlpced.p/meson-generated_Networks_PeerInfo.c.o	d8b949ba01d40658
+343	725	1618021557247225903	hlpced.p/meson-generated_Networks_Receiption.c.o	2822ee7fec9da870
+628	776	1618021557297226226	hlpced.p/meson-generated_Util_QueueCommand.c.o	a7965525aad14579
+599	833	1618021557354226595	hlpced.p/meson-generated_Protocols_MX2_InstanceReference.c.o	d00e9c61927c228c
+833	900	1618021557421227028	hlpced	52c145f07bf35eb2

+ 173 - 0
build.ninja

@@ -0,0 +1,173 @@
+# This is the build file for project "High Level Peer Communication Engine Daemon"
+# It is autogenerated by the Meson build system.
+# Do not edit by hand.
+
+ninja_required_version = 1.7.1
+
+# Rules for compiling.
+
+rule c_COMPILER
+ command = cc $ARGS -MD -MQ $out -MF $DEPFILE -o $out -c $in
+ deps = gcc
+ depfile = $DEPFILE_UNQUOTED
+ description = Compiling C object $out
+
+rule vala_COMPILER
+ command = valac $ARGS $in
+ description = Compiling Vala source $in
+ restat = 1
+
+# Rules for linking.
+
+rule c_LINKER
+ command = cc $ARGS -o $out $in $LINK_ARGS
+ description = Linking target $out
+
+# Other rules
+
+rule CUSTOM_COMMAND
+ command = $COMMAND
+ description = $DESC
+ restat = 1
+
+rule REGENERATE_BUILD
+ command = /usr/bin/meson --internal regenerate /home/bbarrow/Projects/LibPeer-Vala/src /home/bbarrow/Projects/LibPeer-Vala --backend ninja
+ description = Regenerating build files.
+ generator = 1
+
+# Phony build target, always out of date
+
+build PHONY: phony 
+
+# Build rules for targets
+
+build hlpced.p/Daemon.c hlpced.p/Networks/Advertisement.c hlpced.p/Networks/Network.c hlpced.p/Networks/PeerInfo.c hlpced.p/Networks/UnknownPeerInfo.c hlpced.p/Networks/Receiption.c hlpced.p/Networks/Simulation/NetSimPeerInfo.c hlpced.p/Networks/Simulation/Conduit.c hlpced.p/Networks/Simulation/NetSim.c hlpced.p/Networks/Simulation/Packet.c hlpced.p/Protocols/MX2/InstanceReference.c hlpced.p/Util/QueueCommand.c: vala_COMPILER src/Daemon.vala src/Networks/Advertisement.vala src/Networks/Network.vala src/Networks/PeerInfo.vala src/Networks/UnknownPeerInfo.vala src/Networks/Receiption.vala src/Networks/Simulation/NetSimPeerInfo.vala src/Networks/Simulation/Conduit.vala src/Networks/Simulation/NetSim.vala src/Networks/Simulation/Packet.vala src/Protocols/MX2/InstanceReference.vala src/Util/QueueCommand.vala
+ ARGS = -C --debug --debug --vapidir /home/bbarrow/Projects/LibPeer-Vala/src/vapi /home/bbarrow/Projects/LibPeer-Vala/src/vapi/uuid.vapi --pkg posix --pkg gee-0.8 --pkg gio-2.0 --pkg gobject-2.0 --pkg glib-2.0 --color=always --directory hlpced.p --basedir src/
+
+build hlpced.p/meson-generated_Daemon.c.o: c_COMPILER hlpced.p/Daemon.c
+ DEPFILE = hlpced.p/meson-generated_Daemon.c.o.d
+ DEPFILE_UNQUOTED = hlpced.p/meson-generated_Daemon.c.o.d
+ ARGS = -Ihlpced.p -I. -Isrc -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gee-0.8 -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -w -g -pthread
+
+build hlpced.p/meson-generated_Networks_Advertisement.c.o: c_COMPILER hlpced.p/Networks/Advertisement.c
+ DEPFILE = hlpced.p/meson-generated_Networks_Advertisement.c.o.d
+ DEPFILE_UNQUOTED = hlpced.p/meson-generated_Networks_Advertisement.c.o.d
+ ARGS = -Ihlpced.p -I. -Isrc -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gee-0.8 -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -w -g -pthread
+
+build hlpced.p/meson-generated_Networks_Network.c.o: c_COMPILER hlpced.p/Networks/Network.c
+ DEPFILE = hlpced.p/meson-generated_Networks_Network.c.o.d
+ DEPFILE_UNQUOTED = hlpced.p/meson-generated_Networks_Network.c.o.d
+ ARGS = -Ihlpced.p -I. -Isrc -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gee-0.8 -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -w -g -pthread
+
+build hlpced.p/meson-generated_Networks_PeerInfo.c.o: c_COMPILER hlpced.p/Networks/PeerInfo.c
+ DEPFILE = hlpced.p/meson-generated_Networks_PeerInfo.c.o.d
+ DEPFILE_UNQUOTED = hlpced.p/meson-generated_Networks_PeerInfo.c.o.d
+ ARGS = -Ihlpced.p -I. -Isrc -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gee-0.8 -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -w -g -pthread
+
+build hlpced.p/meson-generated_Networks_UnknownPeerInfo.c.o: c_COMPILER hlpced.p/Networks/UnknownPeerInfo.c
+ DEPFILE = hlpced.p/meson-generated_Networks_UnknownPeerInfo.c.o.d
+ DEPFILE_UNQUOTED = hlpced.p/meson-generated_Networks_UnknownPeerInfo.c.o.d
+ ARGS = -Ihlpced.p -I. -Isrc -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gee-0.8 -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -w -g -pthread
+
+build hlpced.p/meson-generated_Networks_Receiption.c.o: c_COMPILER hlpced.p/Networks/Receiption.c
+ DEPFILE = hlpced.p/meson-generated_Networks_Receiption.c.o.d
+ DEPFILE_UNQUOTED = hlpced.p/meson-generated_Networks_Receiption.c.o.d
+ ARGS = -Ihlpced.p -I. -Isrc -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gee-0.8 -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -w -g -pthread
+
+build hlpced.p/meson-generated_Networks_Simulation_NetSimPeerInfo.c.o: c_COMPILER hlpced.p/Networks/Simulation/NetSimPeerInfo.c
+ DEPFILE = hlpced.p/meson-generated_Networks_Simulation_NetSimPeerInfo.c.o.d
+ DEPFILE_UNQUOTED = hlpced.p/meson-generated_Networks_Simulation_NetSimPeerInfo.c.o.d
+ ARGS = -Ihlpced.p -I. -Isrc -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gee-0.8 -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -w -g -pthread
+
+build hlpced.p/meson-generated_Networks_Simulation_Conduit.c.o: c_COMPILER hlpced.p/Networks/Simulation/Conduit.c
+ DEPFILE = hlpced.p/meson-generated_Networks_Simulation_Conduit.c.o.d
+ DEPFILE_UNQUOTED = hlpced.p/meson-generated_Networks_Simulation_Conduit.c.o.d
+ ARGS = -Ihlpced.p -I. -Isrc -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gee-0.8 -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -w -g -pthread
+
+build hlpced.p/meson-generated_Networks_Simulation_NetSim.c.o: c_COMPILER hlpced.p/Networks/Simulation/NetSim.c
+ DEPFILE = hlpced.p/meson-generated_Networks_Simulation_NetSim.c.o.d
+ DEPFILE_UNQUOTED = hlpced.p/meson-generated_Networks_Simulation_NetSim.c.o.d
+ ARGS = -Ihlpced.p -I. -Isrc -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gee-0.8 -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -w -g -pthread
+
+build hlpced.p/meson-generated_Networks_Simulation_Packet.c.o: c_COMPILER hlpced.p/Networks/Simulation/Packet.c
+ DEPFILE = hlpced.p/meson-generated_Networks_Simulation_Packet.c.o.d
+ DEPFILE_UNQUOTED = hlpced.p/meson-generated_Networks_Simulation_Packet.c.o.d
+ ARGS = -Ihlpced.p -I. -Isrc -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gee-0.8 -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -w -g -pthread
+
+build hlpced.p/meson-generated_Protocols_MX2_InstanceReference.c.o: c_COMPILER hlpced.p/Protocols/MX2/InstanceReference.c
+ DEPFILE = hlpced.p/meson-generated_Protocols_MX2_InstanceReference.c.o.d
+ DEPFILE_UNQUOTED = hlpced.p/meson-generated_Protocols_MX2_InstanceReference.c.o.d
+ ARGS = -Ihlpced.p -I. -Isrc -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gee-0.8 -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -w -g -pthread
+
+build hlpced.p/meson-generated_Util_QueueCommand.c.o: c_COMPILER hlpced.p/Util/QueueCommand.c
+ DEPFILE = hlpced.p/meson-generated_Util_QueueCommand.c.o.d
+ DEPFILE_UNQUOTED = hlpced.p/meson-generated_Util_QueueCommand.c.o.d
+ ARGS = -Ihlpced.p -I. -Isrc -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gee-0.8 -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -w -g -pthread
+
+build hlpced: c_LINKER hlpced.p/meson-generated_Daemon.c.o hlpced.p/meson-generated_Networks_Advertisement.c.o hlpced.p/meson-generated_Networks_Network.c.o hlpced.p/meson-generated_Networks_PeerInfo.c.o hlpced.p/meson-generated_Networks_UnknownPeerInfo.c.o hlpced.p/meson-generated_Networks_Receiption.c.o hlpced.p/meson-generated_Networks_Simulation_NetSimPeerInfo.c.o hlpced.p/meson-generated_Networks_Simulation_Conduit.c.o hlpced.p/meson-generated_Networks_Simulation_NetSim.c.o hlpced.p/meson-generated_Networks_Simulation_Packet.c.o hlpced.p/meson-generated_Protocols_MX2_InstanceReference.c.o hlpced.p/meson-generated_Util_QueueCommand.c.o | /usr/lib64/libuuid.so.1.3.0 /usr/lib64/libglib-2.0.so /usr/lib64/libgobject-2.0.so /usr/lib64/libgio-2.0.so /usr/lib64/libgee-0.8.so
+ LINK_ARGS = -Wl,--as-needed -Wl,--no-undefined -Wl,--start-group /usr/lib64/libglib-2.0.so /usr/lib64/libgobject-2.0.so /usr/lib64/libgio-2.0.so /usr/lib64/libgee-0.8.so -luuid -Wl,--end-group
+
+# Test rules
+
+build meson-test: CUSTOM_COMMAND all PHONY
+ COMMAND = /usr/bin/meson test --no-rebuild --print-errorlogs
+ DESC = Running$ all$ tests.
+ pool = console
+
+build test: phony meson-test
+
+build meson-benchmark: CUSTOM_COMMAND all PHONY
+ COMMAND = /usr/bin/meson test --benchmark --logbase benchmarklog --num-processes=1 --no-rebuild
+ DESC = Running$ benchmark$ suite.
+ pool = console
+
+build benchmark: phony meson-benchmark
+
+# Install rules
+
+build meson-install: CUSTOM_COMMAND PHONY | all
+ DESC = Installing$ files.
+ COMMAND = /usr/bin/meson install --no-rebuild
+ pool = console
+
+build install: phony meson-install
+
+build meson-dist: CUSTOM_COMMAND PHONY
+ DESC = Creating$ source$ packages
+ COMMAND = /usr/bin/meson dist
+ pool = console
+
+build dist: phony meson-dist
+
+# Suffix
+
+build meson-ctags: CUSTOM_COMMAND PHONY
+ COMMAND = /usr/bin/meson --internal tags ctags /home/bbarrow/Projects/LibPeer-Vala/src
+ pool = console
+
+build ctags: phony meson-ctags
+
+build meson-uninstall: CUSTOM_COMMAND PHONY
+ COMMAND = /usr/bin/meson --internal uninstall
+ pool = console
+
+build uninstall: phony meson-uninstall
+
+build all: phony hlpced
+
+build clean: phony meson-clean
+
+build meson-clean: CUSTOM_COMMAND PHONY
+ COMMAND = /usr/bin/ninja -t clean
+ description = Cleaning
+
+build build.ninja: REGENERATE_BUILD src/meson.build meson-private/coredata.dat
+ pool = console
+
+build reconfigure: REGENERATE_BUILD PHONY
+ pool = console
+
+build src/meson.build meson-private/coredata.dat: phony 
+
+default all
+

+ 80 - 0
compile_commands.json

@@ -0,0 +1,80 @@
+[
+  {
+    "directory": "/home/bbarrow/Projects/LibPeer-Vala",
+    "command": "valac -C --debug --debug --vapidir /home/bbarrow/Projects/LibPeer-Vala/src/vapi /home/bbarrow/Projects/LibPeer-Vala/src/vapi/uuid.vapi --pkg posix --pkg gee-0.8 --pkg gio-2.0 --pkg gobject-2.0 --pkg glib-2.0 --color=always --directory hlpced.p --basedir src/ src/Daemon.vala src/Networks/Advertisement.vala src/Networks/Network.vala src/Networks/PeerInfo.vala src/Networks/UnknownPeerInfo.vala src/Networks/Receiption.vala src/Networks/Simulation/NetSimPeerInfo.vala src/Networks/Simulation/Conduit.vala src/Networks/Simulation/NetSim.vala src/Networks/Simulation/Packet.vala src/Protocols/MX2/InstanceReference.vala src/Util/QueueCommand.vala",
+    "file": "src/Daemon.vala",
+    "output": "hlpced.p/Daemon.c"
+  },
+  {
+    "directory": "/home/bbarrow/Projects/LibPeer-Vala",
+    "command": "cc -Ihlpced.p -I. -Isrc -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gee-0.8 -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -w -g -pthread -MD -MQ hlpced.p/meson-generated_Daemon.c.o -MF hlpced.p/meson-generated_Daemon.c.o.d -o hlpced.p/meson-generated_Daemon.c.o -c hlpced.p/Daemon.c",
+    "file": "hlpced.p/Daemon.c",
+    "output": "hlpced.p/meson-generated_Daemon.c.o"
+  },
+  {
+    "directory": "/home/bbarrow/Projects/LibPeer-Vala",
+    "command": "cc -Ihlpced.p -I. -Isrc -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gee-0.8 -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -w -g -pthread -MD -MQ hlpced.p/meson-generated_Networks_Advertisement.c.o -MF hlpced.p/meson-generated_Networks_Advertisement.c.o.d -o hlpced.p/meson-generated_Networks_Advertisement.c.o -c hlpced.p/Networks/Advertisement.c",
+    "file": "hlpced.p/Networks/Advertisement.c",
+    "output": "hlpced.p/meson-generated_Networks_Advertisement.c.o"
+  },
+  {
+    "directory": "/home/bbarrow/Projects/LibPeer-Vala",
+    "command": "cc -Ihlpced.p -I. -Isrc -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gee-0.8 -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -w -g -pthread -MD -MQ hlpced.p/meson-generated_Networks_Network.c.o -MF hlpced.p/meson-generated_Networks_Network.c.o.d -o hlpced.p/meson-generated_Networks_Network.c.o -c hlpced.p/Networks/Network.c",
+    "file": "hlpced.p/Networks/Network.c",
+    "output": "hlpced.p/meson-generated_Networks_Network.c.o"
+  },
+  {
+    "directory": "/home/bbarrow/Projects/LibPeer-Vala",
+    "command": "cc -Ihlpced.p -I. -Isrc -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gee-0.8 -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -w -g -pthread -MD -MQ hlpced.p/meson-generated_Networks_PeerInfo.c.o -MF hlpced.p/meson-generated_Networks_PeerInfo.c.o.d -o hlpced.p/meson-generated_Networks_PeerInfo.c.o -c hlpced.p/Networks/PeerInfo.c",
+    "file": "hlpced.p/Networks/PeerInfo.c",
+    "output": "hlpced.p/meson-generated_Networks_PeerInfo.c.o"
+  },
+  {
+    "directory": "/home/bbarrow/Projects/LibPeer-Vala",
+    "command": "cc -Ihlpced.p -I. -Isrc -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gee-0.8 -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -w -g -pthread -MD -MQ hlpced.p/meson-generated_Networks_UnknownPeerInfo.c.o -MF hlpced.p/meson-generated_Networks_UnknownPeerInfo.c.o.d -o hlpced.p/meson-generated_Networks_UnknownPeerInfo.c.o -c hlpced.p/Networks/UnknownPeerInfo.c",
+    "file": "hlpced.p/Networks/UnknownPeerInfo.c",
+    "output": "hlpced.p/meson-generated_Networks_UnknownPeerInfo.c.o"
+  },
+  {
+    "directory": "/home/bbarrow/Projects/LibPeer-Vala",
+    "command": "cc -Ihlpced.p -I. -Isrc -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gee-0.8 -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -w -g -pthread -MD -MQ hlpced.p/meson-generated_Networks_Receiption.c.o -MF hlpced.p/meson-generated_Networks_Receiption.c.o.d -o hlpced.p/meson-generated_Networks_Receiption.c.o -c hlpced.p/Networks/Receiption.c",
+    "file": "hlpced.p/Networks/Receiption.c",
+    "output": "hlpced.p/meson-generated_Networks_Receiption.c.o"
+  },
+  {
+    "directory": "/home/bbarrow/Projects/LibPeer-Vala",
+    "command": "cc -Ihlpced.p -I. -Isrc -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gee-0.8 -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -w -g -pthread -MD -MQ hlpced.p/meson-generated_Networks_Simulation_NetSimPeerInfo.c.o -MF hlpced.p/meson-generated_Networks_Simulation_NetSimPeerInfo.c.o.d -o hlpced.p/meson-generated_Networks_Simulation_NetSimPeerInfo.c.o -c hlpced.p/Networks/Simulation/NetSimPeerInfo.c",
+    "file": "hlpced.p/Networks/Simulation/NetSimPeerInfo.c",
+    "output": "hlpced.p/meson-generated_Networks_Simulation_NetSimPeerInfo.c.o"
+  },
+  {
+    "directory": "/home/bbarrow/Projects/LibPeer-Vala",
+    "command": "cc -Ihlpced.p -I. -Isrc -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gee-0.8 -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -w -g -pthread -MD -MQ hlpced.p/meson-generated_Networks_Simulation_Conduit.c.o -MF hlpced.p/meson-generated_Networks_Simulation_Conduit.c.o.d -o hlpced.p/meson-generated_Networks_Simulation_Conduit.c.o -c hlpced.p/Networks/Simulation/Conduit.c",
+    "file": "hlpced.p/Networks/Simulation/Conduit.c",
+    "output": "hlpced.p/meson-generated_Networks_Simulation_Conduit.c.o"
+  },
+  {
+    "directory": "/home/bbarrow/Projects/LibPeer-Vala",
+    "command": "cc -Ihlpced.p -I. -Isrc -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gee-0.8 -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -w -g -pthread -MD -MQ hlpced.p/meson-generated_Networks_Simulation_NetSim.c.o -MF hlpced.p/meson-generated_Networks_Simulation_NetSim.c.o.d -o hlpced.p/meson-generated_Networks_Simulation_NetSim.c.o -c hlpced.p/Networks/Simulation/NetSim.c",
+    "file": "hlpced.p/Networks/Simulation/NetSim.c",
+    "output": "hlpced.p/meson-generated_Networks_Simulation_NetSim.c.o"
+  },
+  {
+    "directory": "/home/bbarrow/Projects/LibPeer-Vala",
+    "command": "cc -Ihlpced.p -I. -Isrc -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gee-0.8 -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -w -g -pthread -MD -MQ hlpced.p/meson-generated_Networks_Simulation_Packet.c.o -MF hlpced.p/meson-generated_Networks_Simulation_Packet.c.o.d -o hlpced.p/meson-generated_Networks_Simulation_Packet.c.o -c hlpced.p/Networks/Simulation/Packet.c",
+    "file": "hlpced.p/Networks/Simulation/Packet.c",
+    "output": "hlpced.p/meson-generated_Networks_Simulation_Packet.c.o"
+  },
+  {
+    "directory": "/home/bbarrow/Projects/LibPeer-Vala",
+    "command": "cc -Ihlpced.p -I. -Isrc -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gee-0.8 -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -w -g -pthread -MD -MQ hlpced.p/meson-generated_Protocols_MX2_InstanceReference.c.o -MF hlpced.p/meson-generated_Protocols_MX2_InstanceReference.c.o.d -o hlpced.p/meson-generated_Protocols_MX2_InstanceReference.c.o -c hlpced.p/Protocols/MX2/InstanceReference.c",
+    "file": "hlpced.p/Protocols/MX2/InstanceReference.c",
+    "output": "hlpced.p/meson-generated_Protocols_MX2_InstanceReference.c.o"
+  },
+  {
+    "directory": "/home/bbarrow/Projects/LibPeer-Vala",
+    "command": "cc -Ihlpced.p -I. -Isrc -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gee-0.8 -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -w -g -pthread -MD -MQ hlpced.p/meson-generated_Util_QueueCommand.c.o -MF hlpced.p/meson-generated_Util_QueueCommand.c.o.d -o hlpced.p/meson-generated_Util_QueueCommand.c.o -c hlpced.p/Util/QueueCommand.c",
+    "file": "hlpced.p/Util/QueueCommand.c",
+    "output": "hlpced.p/meson-generated_Util_QueueCommand.c.o"
+  }
+]

BIN
hlpced


+ 42 - 0
src/Daemon.vala

@@ -0,0 +1,42 @@
+using Gee;
+
+namespace Hlpce {
+
+    class Daemon : Object {
+
+        public static int main(string[] args) {
+            stderr.printf("HLPCE: High Level Peer Communication Engine (LibPeer-Vala) v0.1\n");
+
+            uint8[] data = {0,1,2,3};
+            var test = new MemoryInputStream.from_data(data);
+            var reader1 = new DataInputStream(test);
+            stderr.printf(@"$(reader1.read_byte()) and then $(reader1.read_byte())\n");
+
+            var reader2 = new DataInputStream(test);
+            stderr.printf(@"$(reader1.read_byte()) and then $(reader1.read_byte())\n");
+
+            uint8[] arr1 = {2, 4, 6, 8};
+            uint8[] arr2 = {1, 3, 5, 7};
+            uint8[] arr3 = {2, 4, 6, 8};
+            uint8[] arr4 = {1, 3, 5, 7};
+
+            var b1 = new Bytes(arr1);
+            var b2 = new Bytes(arr2);
+            var b3 = new Bytes(arr3);
+            var b4 = new Bytes(arr4);
+            var b5 = new Bytes(arr1);
+            var b6 = new Bytes(arr2);
+            var b7 = new Bytes(arr3);
+            var b8 = new Bytes(arr4);
+
+            var map = new Gee.HashMap<Bytes, string>((a) => a.hash(), (a, b) => a.compare(b) == 0);
+            map.set(b1, "Even");
+            map.set(b2, "Odd");
+
+            stderr.printf(@"$(map.get(b3)) $(map.get(b4))\n");
+
+            return 0;
+        }
+    }
+
+}

+ 18 - 0
src/Networks/Advertisement.vala

@@ -0,0 +1,18 @@
+using LibPeer.Protocols.Mx2;
+
+namespace LibPeer.Networks
+{
+    
+    public class Advertisement {
+
+        public InstanceReference instance_reference;
+        public PeerInfo peer_info;
+
+        public Advertisement(InstanceReference instance_reference, PeerInfo peer_info) {
+            this.instance_reference = instance_reference;
+            this.peer_info = peer_info;
+        }
+
+    }
+
+}

+ 23 - 0
src/Networks/Network.vala

@@ -0,0 +1,23 @@
+using LibPeer.Protocols.Mx2;
+
+namespace LibPeer.Networks {
+
+    public abstract class Network {
+        
+        public abstract Bytes get_network_identifier();
+
+        public signal void incoming_advertisment(Advertisement advertisement);
+
+        public signal void incoming_receiption(Receiption receiption);
+
+        public abstract void bring_up() throws IOError, Error;
+
+        public abstract void bring_down() throws IOError, Error;
+
+        public abstract void advertise(InstanceReference instance_reference) throws IOError, Error;
+
+        public abstract void send(Bytes bytes, PeerInfo peer_info) throws IOError, Error;
+
+    }
+
+}

+ 74 - 0
src/Networks/PeerInfo.vala

@@ -0,0 +1,74 @@
+using GLib;
+using Gee;
+
+namespace LibPeer.Networks
+{
+    
+    public abstract class PeerInfo {
+
+        private static HashMap<Bytes, Type> info_types = new HashMap<Bytes, Type>((a) => a.hash(), (a, b) => a.compare(b) == 0);
+        
+        protected abstract void build(uint8 data_length, InputStream stream) throws IOError, Error;
+        
+        public abstract Bytes get_network_identifier();
+
+        protected abstract Bytes get_data_segment();
+
+        public abstract string to_string();
+
+        public abstract bool equals(PeerInfo other);
+
+        public abstract uint hash();
+
+        public void serialise(OutputStream stream) throws IOError, Error {
+            // Create a stream writer
+            var writer = new DataOutputStream(stream);
+            writer.byte_order = DataStreamByteOrder.BIG_ENDIAN;
+
+            // Get the informational data
+            var type = get_network_identifier();
+            var data = get_data_segment();
+
+            // Write the length of the network type
+            writer.put_byte((uint8)type.length);
+
+            // Write the length of the data segment
+            writer.put_byte((uint8)data.length);
+
+            // Write the network identifier
+            writer.write_bytes(type);
+
+            // Write the data
+            writer.write_bytes(data);
+        }
+        
+        public static PeerInfo deserialise(InputStream stream) throws IOError, Error {
+            // Create a data input stream
+            var reader = new DataInputStream(stream);
+            reader.byte_order = DataStreamByteOrder.BIG_ENDIAN;
+
+            // Get the length of the network type
+            var type_length = reader.read_byte();
+
+            // Get the length of the data segment
+            var data_length = reader.read_byte();
+
+            // Read the network type
+            var network_type = reader.read_bytes(type_length);
+
+            //  Get the info subclass
+            Type peer_info_type = info_types.get(network_type);
+
+            // Create the peer info object
+            PeerInfo peer_info = Object.new(peer_info_type) as PeerInfo;
+
+            // Build out the data
+            peer_info.build(data_length, stream);
+
+            // Return the object
+            return peer_info;
+        }
+
+    }
+
+}

+ 18 - 0
src/Networks/Receiption.vala

@@ -0,0 +1,18 @@
+
+namespace LibPeer.Networks {
+
+    public class Receiption {
+
+        public InputStream stream;
+        public PeerInfo peer_info;
+        public Network network;
+
+        public Receiption(InputStream stream, PeerInfo info, Network network) {
+            this.stream = stream;
+            this.peer_info = info;
+            this.network = network;
+        }
+
+    }
+
+}

+ 54 - 0
src/Networks/Simulation/Conduit.vala

@@ -0,0 +1,54 @@
+using LibPeer.Networks;
+
+using Gee;
+
+namespace LibPeer.Networks.Simulation {
+
+    class Conduit {
+
+        private HashMap<Bytes, NetSim> interfaces = new HashMap<Bytes, NetSim>((a) => a.hash(), (a, b) => a.compare(b) == 0);
+
+        private int count = 0;
+
+        public NetSim get_interface(int delay = 0, int latency = 100, float loss_frac = 0.0f) {
+            count ++;
+
+            // Generate the UUID for this interface
+            uint8[] identifier = new uint8[16];
+            UUID.generate_random(identifier);
+
+            // Create the interface
+            NetSim iface = new NetSim(this, identifier, count, delay, latency, loss_frac);
+
+            // Add interface to map
+            interfaces.set(iface.identifier, iface);
+
+            // Return the interface
+            return iface;
+        }
+
+        internal void send_packet(Bytes origin, Bytes destination, Bytes data) {
+            // Do we have the destination?
+            if (!interfaces.has_key(destination)) {
+                // No, skip
+                return;
+            }
+
+            // Get the destination interface
+            NetSim dest_iface = interfaces.get(destination);
+
+            // Pass on the packet
+            dest_iface.receive_data(origin, data);
+        }
+
+        internal void advertise(Bytes origin, Advertisement advertisement) {
+            foreach (var iface in interfaces) {
+                // Don't advertise to the origin
+                if (iface.key.compare(origin) != 0) {
+                    iface.value.receive_advertisment(advertisement);
+                }
+            }
+        }
+
+    }
+}

+ 103 - 0
src/Networks/Simulation/NetSim.vala

@@ -0,0 +1,103 @@
+using LibPeer.Networks;
+using LibPeer.Protocols.Mx2;
+using LibPeer.Util;
+
+namespace LibPeer.Networks.Simulation {
+
+    class NetSim : Network {
+
+        private Conduit conduit;
+        private int count;
+        public Bytes identifier;
+        public int delay;
+        public int latency;
+        public float loss_frac;
+        private bool up = false;
+        private AsyncQueue<QueueCommand<Packet>> packet_queue = new AsyncQueue<QueueCommand<Packet>>();
+        private Thread<bool> worker_thread;
+
+        public NetSim(Conduit conduit, uint8[] uuid, int count, int delay, int latency, float loss_frac) {
+            this.conduit = conduit;
+            this.count = count;
+            this.identifier = new Bytes(uuid);
+            this.delay = delay;
+            this.latency = latency;
+            this.loss_frac = loss_frac;
+        }
+
+        public override GLib.Bytes get_network_identifier () {
+            return new Bytes({'N', 'e', 't', 'S', 'i', 'm'});
+        }
+    
+        public override void bring_up() throws IOError, Error {
+            if (up) {
+                return;
+            }
+
+            up = true;
+            ThreadFunc<bool> queue_worker = () => {
+                while (true) {
+                    QueueCommand<Packet> command = packet_queue.pop();
+                    if(command.command == QueueControl.Stop) {
+                        return true;
+                    }
+
+                    assert(command.command == QueueControl.Payload);
+
+                    // Delay
+                    Posix.usleep(delay * 1000);
+
+                    // Drop
+                    if (Random.int_range(1, 100) == loss_frac * 100) {
+                        continue;
+                    }
+
+                    // Create a stream
+                    var stream = new MemoryInputStream.from_bytes(command.payload.data);
+
+                    // Create ane emit receiption
+                    var receiption = new Receiption(stream, command.payload.peer_info, this);
+                    incoming_receiption(receiption);
+                }
+            };
+
+            worker_thread = new Thread<bool>(@"NetSim-iface-$(count)", queue_worker);
+        }
+    
+        public override void bring_down() throws IOError, Error {
+            if(!up) {
+                return;
+            }
+
+            up = false;
+            this.packet_queue.push_front(new QueueCommand<Packet>.stop());
+            worker_thread.join();
+        }
+    
+        public override void advertise(InstanceReference instance_reference) throws IOError, Error {
+            var advertisement = new Advertisement(instance_reference, new NetSimPeerInfo(identifier));
+            conduit.advertise(identifier, advertisement);
+        }
+    
+        public override void send(Bytes bytes, PeerInfo peer_info) throws IOError, Error {
+            NetSimPeerInfo info = (NetSimPeerInfo)peer_info;
+            conduit.send_packet(this.identifier, new Bytes(info.identifier), bytes);
+        }
+
+        internal void receive_data(Bytes origin, Bytes data) {
+            // Create the peer info
+            var peer_info = new NetSimPeerInfo(origin);
+
+            // Create the packet
+            var packet = new Packet(peer_info, data);
+
+            // Add packet to queue
+            packet_queue.push(new QueueCommand<Packet>.with_payload(packet));
+        }
+
+        internal void receive_advertisment(Advertisement advertisement) {
+            incoming_advertisment(advertisement);
+        }
+    
+    }
+}

+ 51 - 0
src/Networks/Simulation/NetSimPeerInfo.vala

@@ -0,0 +1,51 @@
+
+using LibPeer.Networks;
+
+namespace LibPeer.Networks.Simulation {
+
+    class NetSimPeerInfo : PeerInfo {
+
+        private const int IDENTIFIER_SIZE = 16;
+
+        internal uint8[] identifier = new uint8[IDENTIFIER_SIZE];
+
+        internal NetSimPeerInfo(Bytes identifier) {
+            this.identifier = identifier.get_data();
+        }
+
+        public override GLib.Bytes get_network_identifier () {
+            return new Bytes({'N', 'e', 't', 'S', 'i', 'm'});
+        }
+
+        protected override void build(uint8 data_length, InputStream stream) throws Error {
+            identifier = stream.read_bytes(16).get_data();
+        }
+
+        protected override Bytes get_data_segment() {
+            return new Bytes(identifier);
+        }
+
+        public override bool equals (PeerInfo other) {
+            if (other is NetSimPeerInfo) {
+                var oth = (NetSimPeerInfo)other;
+                for(int i = 0; i < IDENTIFIER_SIZE; i++) {
+                    if (oth.identifier[i] != identifier[i]) {
+                        return false;
+                    }
+                }
+                return true;
+            }
+            return false;
+        }
+
+        public override uint hash() {
+            // XXX I'm sure this is the opposite of efficient
+            return (new Bytes(identifier)).hash();
+        }
+
+        public override string to_string() {
+            return "";
+        }
+    }
+
+}

+ 15 - 0
src/Networks/Simulation/Packet.vala

@@ -0,0 +1,15 @@
+
+namespace LibPeer.Networks.Simulation {
+
+    class Packet {
+        public Bytes data;
+
+        public NetSimPeerInfo peer_info;
+
+        public Packet(NetSimPeerInfo origin, Bytes payload) {
+            data = payload;
+            peer_info = origin;
+        }
+    }
+
+}

+ 41 - 0
src/Networks/UnknownPeerInfo.vala

@@ -0,0 +1,41 @@
+
+namespace LibPeer.Networks
+{
+    /**
+     * Used when a network type is encountered
+     * that is not handled by the implementation
+     */
+    public class UnknownPeerInfo : PeerInfo {
+
+        private Bytes information;
+
+        public override GLib.Bytes get_network_identifier () {
+            return new Bytes({});
+        }
+
+        protected override void build(uint8 data_length, InputStream stream) throws Error {
+            information = stream.read_bytes(data_length);
+        }
+
+        protected override Bytes get_data_segment() {
+            return information;
+        }
+
+        public override bool equals (PeerInfo other) {
+            if (other is UnknownPeerInfo) {
+                return ((UnknownPeerInfo)other).information.compare(information) == 0;
+            }
+            return false;
+        }
+
+        public override uint hash() {
+            return information.hash();
+        }
+
+        public override string to_string() {
+            return "Unknown-Network-Type";
+        }
+
+    }
+
+}

+ 32 - 0
src/Protocols/MX2/InstanceReference.vala

@@ -0,0 +1,32 @@
+
+namespace LibPeer.Protocols.Mx2 {
+
+    public class InstanceReference {
+
+        protected uint8[] verification_key;
+        protected uint8[] public_key;
+
+        public InstanceReference(uint8[] verification_key, uint8[] public_key) 
+        requires (verification_key.length == 32)
+        requires (public_key.length == 32)
+        {
+            this.verification_key = verification_key;
+            this.public_key = public_key;
+        }
+
+        public InstanceReference.from_stream(InputStream stream) throws IOError {
+            verification_key = new uint8[32];
+            stream.read(verification_key);
+
+            public_key = new uint8[32];
+            stream.read(verification_key);
+        }
+
+        public void serialise(OutputStream stream) throws IOError {
+            stream.write(verification_key);
+            stream.write(public_key);
+        }
+
+    }
+
+}

+ 2 - 0
src/Stream/Stream.vala

@@ -0,0 +1,2 @@
+
+

+ 29 - 0
src/Util/QueueCommand.vala

@@ -0,0 +1,29 @@
+namespace LibPeer.Util {
+
+    public enum QueueControl {
+        Payload,
+        Stop,
+    }
+
+    public class QueueCommand<T> {
+
+        public T payload;
+
+        public QueueControl command;
+
+        public QueueCommand(QueueControl command, T payload) {
+            this.payload = payload;
+            this.command = command;
+        }
+
+        public QueueCommand.stop() {
+            this(QueueControl.Stop, null);
+        }
+
+        public QueueCommand.with_payload(T payload){
+            this(QueueControl.Payload, payload);
+        }
+
+    }
+
+}

+ 30 - 0
src/meson.build

@@ -0,0 +1,30 @@
+project('High Level Peer Communication Engine Daemon', 'vala', 'c')
+
+vapi_dir = meson.current_source_dir() / 'vapi'
+
+add_project_arguments(['--vapidir', vapi_dir], language: 'vala')
+
+dependencies = [
+    dependency('glib-2.0'),
+    dependency('gobject-2.0'),
+    dependency('gio-2.0'),
+    dependency('gee-0.8'),
+    meson.get_compiler('vala').find_library('posix'),
+    meson.get_compiler('vala').find_library('uuid', dirs: vapi_dir),
+    meson.get_compiler('c').find_library('uuid')
+]
+
+sources = files('Daemon.vala')
+sources += files('Networks/Advertisement.vala')
+sources += files('Networks/Network.vala')
+sources += files('Networks/PeerInfo.vala')
+sources += files('Networks/UnknownPeerInfo.vala')
+sources += files('Networks/Receiption.vala')
+sources += files('Networks/Simulation/NetSimPeerInfo.vala')
+sources += files('Networks/Simulation/Conduit.vala')
+sources += files('Networks/Simulation/NetSim.vala')
+sources += files('Networks/Simulation/Packet.vala')
+sources += files('Protocols/MX2/InstanceReference.vala')
+sources += files('Util/QueueCommand.vala')
+
+executable('hlpced', sources, dependencies: dependencies)

+ 1 - 0
src/vapi/uuid.deps

@@ -0,0 +1 @@
+posix

+ 61 - 0
src/vapi/uuid.vapi

@@ -0,0 +1,61 @@
+/* libuuid Vala Bindings
+ * Copyright 2014 Evan Nemerson <evan@nemerson.com>
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+ [CCode (cheader_filename = "uuid/uuid.h", lower_case_cprefix = "uuid_")]
+ namespace UUID {
+     [CCode (cname = "int", has_type_id = false)]
+     public enum Variant {
+         NCS,
+         DCE,
+         MICROSOFT,
+         OTHER
+     }
+ 
+     [CCode (cname = "int", has_type_id = false)]
+     public enum Type {
+         DCE_TIME,
+         DCE_RANDOM
+     }
+ 
+     public static void clear ([CCode (array_length = false)] uint8 uu[16]);
+     public static void copy (uint8 dst[16], uint8 src[16]);
+ 
+     public static void generate ([CCode (array_length = false)] uint8 @out[16]);
+     public static void generate_random ([CCode (array_length = false)] uint8 @out[16]);
+     public static void generate_time ([CCode (array_length = false)] uint8 @out[16]);
+     public static void generate_time_safe ([CCode (array_length = false)] uint8 @out[16]);
+ 
+     public static bool is_null ([CCode (array_length = false)] uint8 uu[16]);
+ 
+     public static int parse (string in, [CCode (array_length = false)] uint8 uu[16]);
+ 
+     public static void unparse ([CCode (array_length = false)] uint8 uu[16], [CCode (array_length = false)] char @out[37]);
+     public static void unparse_lower ([CCode (array_length = false)] uint8 uu[16], [CCode (array_length = false)] char @out[37]);
+     public static void unparse_upper ([CCode (array_length = false)] uint8 uu[16], [CCode (array_length = false)] char @out[37]);
+ 
+     public static time_t time ([CCode (array_length = false)] uint8 uu[16], out Posix.timeval ret_tv);
+     public static UUID.Type type ([CCode (array_length = false)] uint8 uu[16]);
+     public static UUID.Variant variant ([CCode (array_length = false)] uint8 uu[16]);
+ }
+