mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-01-29 15:43:56 +00:00
forwarding of overlay frames substantially in place, but requires
testing.
This commit is contained in:
parent
4e0c9bfd02
commit
c37d83bddd
@ -637,6 +637,7 @@ int overlay_stuff_packet_from_queue(int i,overlay_buffer *e,int q,long long now,
|
||||
}
|
||||
} else {
|
||||
WHY("bummer, I couldn't find an open route to that node");
|
||||
printf("sid=%s\n",overlay_render_sid((*p)->destination));
|
||||
}
|
||||
} else if (!(*p)->broadcast_sent_via[i])
|
||||
{
|
||||
|
@ -259,6 +259,29 @@ int op_free(overlay_frame *p)
|
||||
return 0;
|
||||
}
|
||||
|
||||
overlay_frame *op_dup(overlay_frame *in)
|
||||
{
|
||||
if (!in) return NULL;
|
||||
|
||||
/* clone the frame */
|
||||
overlay_frame *out=malloc(sizeof(overlay_frame));
|
||||
if (!out) WHYRETNULL("malloc() failed");
|
||||
|
||||
/* copy main data structure */
|
||||
bcopy(in,out,sizeof(overlay_frame));
|
||||
out->payload=ob_new(in->payload->length);
|
||||
if (!out->payload) {
|
||||
free(out);
|
||||
WHYRETNULL("ob_new() failed");
|
||||
}
|
||||
if (ob_append_bytes(out->payload,&in->payload->bytes[0],in->payload->length))
|
||||
{
|
||||
op_free(out);
|
||||
WHYRETNULL("could not duplicate payload bytes");
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
int overlay_frame_set_neighbour_as_source(overlay_frame *f,overlay_neighbour *n)
|
||||
{
|
||||
if (!n) return WHY("Neighbour was null");
|
||||
|
Loading…
x
Reference in New Issue
Block a user