#include "protocol.h"
char *hosts_dir = NULL;
+recvdata_cb_t recv_callback;
static char *name = NULL;
char *tinc_conf = NULL;
static bool tty = false;
void *tinc_main_thread(void * in) {
static bool status = false;
-
/* If nonzero, write log entries to a separate file. */
bool use_logfile = false;
bool tinc_send_packet(node_t *receiver, const char* buf, unsigned int len) {
vpn_packet_t packet;
- tincpackethdr* hdr = malloc(sizeof(tincpackethdr));
+ tincpackethdr* hdr = (tincpackethdr *)packet.data;
if (sizeof(tincpackethdr) + len > MAXSIZE) {
//log something
return false;
}
- memset(hdr->legacymtu,1,sizeof(hdr->legacymtu));
+ packet.probe = false;
+ memset(hdr, 0, sizeof *hdr);
memcpy(hdr->destination,receiver->name,sizeof(hdr->destination));
- memcpy(hdr->source,myself->name,sizeof(hdr->source));
+ memcpy(hdr->source,mesh->self->name,sizeof(hdr->source));
- packet.priority = 0;
packet.len = sizeof(tincpackethdr) + len;
-
- memcpy(packet.data,hdr,sizeof(tincpackethdr));
memcpy(packet.data+sizeof(tincpackethdr),buf,len);
- myself->in_packets++;
- myself->in_bytes += packet.len;
- route(myself, &packet);
+ mesh->self->in_packets++;
+ mesh->self->in_bytes += packet.len;
+ route(mesh->self, &packet);
return true;
}
*/
bool tinc_blacklist(node_t *host);
-
+void recvdata_register_cb(recvdata_cb_t cb) {
+recv_callback = cb;
+};