]> git.meshlink.io Git - meshlink/blobdiff - meshlink-sample/meshlinkapp.c
Improved sample application
[meshlink] / meshlink-sample / meshlinkapp.c
index df78331c5bd54930d45f60191c56527fed8e02c2..515a2d52d86a05d1516ad3676d13a56d9830c7de 100644 (file)
@@ -2,11 +2,30 @@
 
 int main(int argc , char **argv){
 
-char *tinc_conf = "/tmp/";
+char *confbase = "/tmp/meshlink/";
 char *name = "test";
 
-tinc_setup(tinc_conf, name);
+tincremotehost* remotenode = malloc(sizeof(tincremotehost));
+char *remotename = "nameofremotenode";
 
+//TODO: change this, calling a function that returns tincremotehost
+remotenode->name = remotename;
+remotenode->publickey = NULL;
+
+tinc_setup(confbase, name);
+tinc_start(confbase);
+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;
 }