From 6d88c555019f32509f303e23dcfbba824fecd2ee Mon Sep 17 00:00:00 2001 From: Chris Hiszpanski Date: Thu, 18 Apr 2019 00:55:30 -0700 Subject: Initial public commit. mDNS and SDP are functional. Otherwise, library is still very much a work in progress. All tests pass. --- examples/.gitignore | 1 + examples/Makefile.am | 11 +++++++++++ examples/sandbox.c | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 examples/.gitignore create mode 100644 examples/Makefile.am create mode 100644 examples/sandbox.c (limited to 'examples') 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 +#include + +#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; +} -- cgit v1.2.3