]> git.meshlink.io Git - meshlink/commitdiff
Renamed meshlink-sample/ to examples/.
authorGuus Sliepen <guus@meshlink.io>
Sat, 19 Apr 2014 11:49:31 +0000 (13:49 +0200)
committerGuus Sliepen <guus@meshlink.io>
Sat, 19 Apr 2014 11:49:31 +0000 (13:49 +0200)
examples/.gitignore [new file with mode: 0644]
examples/Makefile [new file with mode: 0644]
examples/fixlib.txt [new file with mode: 0644]
examples/meshlinkapp.c [new file with mode: 0644]
meshlink-sample/.gitignore [deleted file]
meshlink-sample/Makefile [deleted file]
meshlink-sample/fixlib.txt [deleted file]
meshlink-sample/meshlinkapp.c [deleted file]

diff --git a/examples/.gitignore b/examples/.gitignore
new file mode 100644 (file)
index 0000000..2460008
--- /dev/null
@@ -0,0 +1 @@
+!Makefile
diff --git a/examples/Makefile b/examples/Makefile
new file mode 100644 (file)
index 0000000..6c69ac8
--- /dev/null
@@ -0,0 +1,18 @@
+# Simple Makefile
+
+CC=gcc
+LIBS= -L../src/.libs/ -lmeshlink -lcrypto -lz -ldl -lpthread -static
+INCLUDE= -I../src/
+LOADLIBES= $(LIBS)
+OBJS= meshlinkapp.o
+CFLAGS= -g -D_PC_ $(INCLUDE) -Wall
+EXEC=meshlinkapp
+default: all
+all: $(OBJS) $(EXEC)
+$(EXEC): $(OBJS)
+clean:
+       -rm -f $(OBJS)
+       -rm -f $(EXEC)
+
+
+rebuild: clean all
diff --git a/examples/fixlib.txt b/examples/fixlib.txt
new file mode 100644 (file)
index 0000000..e230dcd
--- /dev/null
@@ -0,0 +1,3 @@
+MYPATH=`pwd`
+echo $MYPATH
+export LD_LIBRARY_PATH=$MYPATH'/../src/.libs/'
diff --git a/examples/meshlinkapp.c b/examples/meshlinkapp.c
new file mode 100644 (file)
index 0000000..aa9b30c
--- /dev/null
@@ -0,0 +1,44 @@
+#include <libmeshlink.h>
+
+
+void handle_recv_data(void *data);
+void handle_recv_data(void *data) {
+printf("Data received is %s\n",data);
+
+}
+
+int main(int argc , char **argv){
+
+char *confbase = argc > 1 ? argv[1] : "/tmp/meshlink/";
+char *name = argc > 2 ? argv[2] : "foo";
+debug_level = 5;
+
+node_t* remotenode = new_node();
+char *remotename = argc > 3 ? argv[3] : "bar";
+
+//TODO: change this, calling a function that returns node_t
+remotenode->name = malloc(16);
+remotenode->name = remotename;
+
+tinc_setup(confbase, name);
+tinc_start(confbase);
+
+//Register callback function for incoming data
+recvdata_register_cb(handle_recv_data);
+
+sleep(2); //there is a race condition here, tinc_start detaches to a thread the needs time to setup stuff
+while(1) {
+
+//sample data to send out
+char mydata[200];
+memset(mydata,0,200);
+strcpy(mydata,"Hello World!");
+
+//send out data
+tinc_send_packet(remotenode,mydata,sizeof(mydata));
+sleep(10); //give time to this thread to finish before we exit
+}
+free(remotenode);
+return 0;
+}
+
diff --git a/meshlink-sample/.gitignore b/meshlink-sample/.gitignore
deleted file mode 100644 (file)
index 2460008..0000000
+++ /dev/null
@@ -1 +0,0 @@
-!Makefile
diff --git a/meshlink-sample/Makefile b/meshlink-sample/Makefile
deleted file mode 100644 (file)
index 6c69ac8..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-# Simple Makefile
-
-CC=gcc
-LIBS= -L../src/.libs/ -lmeshlink -lcrypto -lz -ldl -lpthread -static
-INCLUDE= -I../src/
-LOADLIBES= $(LIBS)
-OBJS= meshlinkapp.o
-CFLAGS= -g -D_PC_ $(INCLUDE) -Wall
-EXEC=meshlinkapp
-default: all
-all: $(OBJS) $(EXEC)
-$(EXEC): $(OBJS)
-clean:
-       -rm -f $(OBJS)
-       -rm -f $(EXEC)
-
-
-rebuild: clean all
diff --git a/meshlink-sample/fixlib.txt b/meshlink-sample/fixlib.txt
deleted file mode 100644 (file)
index e230dcd..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-MYPATH=`pwd`
-echo $MYPATH
-export LD_LIBRARY_PATH=$MYPATH'/../src/.libs/'
diff --git a/meshlink-sample/meshlinkapp.c b/meshlink-sample/meshlinkapp.c
deleted file mode 100644 (file)
index aa9b30c..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-#include <libmeshlink.h>
-
-
-void handle_recv_data(void *data);
-void handle_recv_data(void *data) {
-printf("Data received is %s\n",data);
-
-}
-
-int main(int argc , char **argv){
-
-char *confbase = argc > 1 ? argv[1] : "/tmp/meshlink/";
-char *name = argc > 2 ? argv[2] : "foo";
-debug_level = 5;
-
-node_t* remotenode = new_node();
-char *remotename = argc > 3 ? argv[3] : "bar";
-
-//TODO: change this, calling a function that returns node_t
-remotenode->name = malloc(16);
-remotenode->name = remotename;
-
-tinc_setup(confbase, name);
-tinc_start(confbase);
-
-//Register callback function for incoming data
-recvdata_register_cb(handle_recv_data);
-
-sleep(2); //there is a race condition here, tinc_start detaches to a thread the needs time to setup stuff
-while(1) {
-
-//sample data to send out
-char mydata[200];
-memset(mydata,0,200);
-strcpy(mydata,"Hello World!");
-
-//send out data
-tinc_send_packet(remotenode,mydata,sizeof(mydata));
-sleep(10); //give time to this thread to finish before we exit
-}
-free(remotenode);
-return 0;
-}
-