From: Saverio Proto Date: Wed, 23 Apr 2014 22:11:36 +0000 (+0200) Subject: Untested changes to meshlinkapp to make the tree compile X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=0e9443d08d75c94c679676d0bfd7a4e0c8bbce5b;p=meshlink Untested changes to meshlinkapp to make the tree compile --- diff --git a/examples/meshlinkapp.c b/examples/meshlinkapp.c index aa9b30c5..115f85dc 100644 --- a/examples/meshlinkapp.c +++ b/examples/meshlinkapp.c @@ -1,4 +1,5 @@ -#include +#include +#include void handle_recv_data(void *data); @@ -8,23 +9,24 @@ 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; +//debug_level = 5; -node_t* remotenode = new_node(); +meshlink_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; +//remotenode->name = malloc(16); +//remotenode->name = remotename; + +meshlink_handle_t* myhandle; -tinc_setup(confbase, name); -tinc_start(confbase); +meshlink_open(confbase, name); +meshlink_start(myhandle); //Register callback function for incoming data -recvdata_register_cb(handle_recv_data); +meshlink_receive_cb_t(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) { @@ -35,7 +37,7 @@ memset(mydata,0,200); strcpy(mydata,"Hello World!"); //send out data -tinc_send_packet(remotenode,mydata,sizeof(mydata)); +meshlink_send(myhandle,remotenode,mydata,sizeof(mydata)); sleep(10); //give time to this thread to finish before we exit } free(remotenode);