]> git.meshlink.io Git - meshlink/blobdiff - meshlink-sample/meshlinkapp.c
Get rid of tincremotehost structure, we use directly node_t
[meshlink] / meshlink-sample / meshlinkapp.c
index a7d5a15f9fec49f6bea425deaaf7b801bf8688b1..647e6b77630c66b05b2d14e664ae3d1a4899ebbf 100644 (file)
@@ -2,6 +2,31 @@
 
 int main(int argc , char **argv){
 
+char *confbase = "/tmp/meshlink/";
+char *name = "test";
+
+node_t* remotenode = new_node();
+char *remotename = "nameofremotenode";
+
+//TODO: change this, calling a function that returns node_t
+remotenode->name = malloc(16);
+remotenode->name = remotename;
+
+tinc_setup(confbase, name);
+tinc_start(confbase);
+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;
 }