summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/.gitignore1
-rw-r--r--examples/Makefile.am11
-rw-r--r--examples/sandbox.c33
3 files changed, 45 insertions, 0 deletions
diff --git a/examples/.gitignore b/examples/.gitignore
new file mode 100644
index 0000000..b04600a
--- /dev/null
+++ b/examples/.gitignore
@@ -0,0 +1 @@
+sandbox
diff --git a/examples/Makefile.am b/examples/Makefile.am
new file mode 100644
index 0000000..f2e28b1
--- /dev/null
+++ b/examples/Makefile.am
@@ -0,0 +1,11 @@
+# Builds a minimal example program
+#bin_PROGRAMS = example
+#example_CFLAGS = -I$(top_srcdir)/src/include $(LWS_CFLAGS)
+#example_LDADD = $(top_builddir)/src/liburtc.la $(LWS_LIBS)
+#example_SOURCES = server.c
+
+# Builds a minimal example program
+bin_PROGRAMS = sandbox
+sandbox_CFLAGS = -I$(top_srcdir)/src
+sandbox_LDADD = $(top_builddir)/src/liburtc.la
+sandbox_SOURCES = sandbox.c
diff --git a/examples/sandbox.c b/examples/sandbox.c
new file mode 100644
index 0000000..2f3728d
--- /dev/null
+++ b/examples/sandbox.c
@@ -0,0 +1,33 @@
+#include <signal.h>
+#include <unistd.h>
+
+#include "mdns.h"
+#include "urtc.h"
+
+
+int main() {
+ sigset_t ss;
+ int signal;
+
+ const char *stun[] = {
+ "stun.l.google.com:19302",
+ "stun2.l.google.com:19302",
+ NULL
+ };
+
+ sigemptyset(&ss);
+ sigaddset(&ss, SIGINT);
+ sigaddset(&ss, SIGTERM);
+ sigaddset(&ss, SIGQUIT);
+
+ urtc_peerconn_t *pc = urtc_peerconn_create(stun);
+
+ // query for raspberry.local
+ mdns_query("raspberry");
+
+ sigwait(&ss, &signal);
+
+ urtc_peerconn_destroy(pc);
+
+ return 0;
+}