mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-01-29 15:43:56 +00:00
More little fixes, especially initialising of overlay_buffers in
overlay_payload structures.
This commit is contained in:
parent
cbb1939241
commit
37c0955494
15
mphlr.h
15
mphlr.h
@ -566,12 +566,14 @@ typedef struct overlay_txqueue {
|
||||
*/
|
||||
} overlay_txqueue;
|
||||
|
||||
extern overlay_txqueue overlay_tx[5];
|
||||
#define OVERLAY_ISOCHRONOUS_VOICE 0
|
||||
#define OVERLAY_MESH_MANAGEMENT 1
|
||||
#define OVERLAY_ISOCHRONOUS_VIDEO 2
|
||||
#define OVERLAY_ORDINARY 3
|
||||
#define OVERLAY_OPPORTUNISTIC 4
|
||||
|
||||
#define OQ_ISOCHRONOUS_VOICE 0
|
||||
#define OQ_MESH_MANAGEMENT 1
|
||||
#define OQ_ISOCHRONOUS_VIDEO 2
|
||||
#define OQ_ORDINARY 3
|
||||
#define OQ_OPPORTUNISTIC 4
|
||||
#define OQ_MAX 5
|
||||
extern overlay_txqueue overlay_tx[OQ_MAX];
|
||||
|
||||
int setReason(char *fmt, ...);
|
||||
#define WHY(X) setReason("%s:%d:%s() %s",__FILE__,__LINE__,__FUNCTION__,X)
|
||||
@ -773,4 +775,5 @@ int overlay_frame_set_me_as_source(overlay_frame *f);
|
||||
int overlay_frame_set_neighbour_as_source(overlay_frame *f,overlay_neighbour *n);
|
||||
int overlay_update_sequence_number();
|
||||
int packetEncipher(unsigned char *packet,int maxlen,int *len,int cryptoflags);
|
||||
int overlayServerMode();
|
||||
|
||||
|
@ -47,7 +47,7 @@
|
||||
|
||||
int overlayMode=0;
|
||||
|
||||
overlay_txqueue overlay_tx[5];
|
||||
overlay_txqueue overlay_tx[OQ_MAX];
|
||||
|
||||
int overlayServerMode()
|
||||
{
|
||||
|
@ -543,14 +543,14 @@ int overlay_tick_interface(int i, long long now)
|
||||
overlay_add_selfannouncement(i,e);
|
||||
|
||||
/* 2. Add any queued high-priority isochronous data (i.e. voice) to the frame. */
|
||||
p=&overlay_tx[OVERLAY_ISOCHRONOUS_VOICE].first;
|
||||
p=&overlay_tx[OQ_ISOCHRONOUS_VOICE].first;
|
||||
overlay_stuff_packet_from_queue(i,e,p,now,pax,&frame_pax,MAX_FRAME_PAX);
|
||||
|
||||
/* 3. Add some mesh reachability reports (unlike BATMAN we announce reachability to peers progressively).
|
||||
Give priority to newly observed nodes so that good news travels quickly to help roaming.
|
||||
XXX - Don't forget about PONGing reachability reports to allow use of monodirectional links.
|
||||
*/
|
||||
p=&overlay_tx[OVERLAY_MESH_MANAGEMENT].first;
|
||||
p=&overlay_tx[OQ_MESH_MANAGEMENT].first;
|
||||
overlay_stuff_packet_from_queue(i,e,p,now,pax,&frame_pax,MAX_FRAME_PAX);
|
||||
|
||||
/* 4. XXX Add lower-priority queued data */
|
||||
@ -566,18 +566,21 @@ int overlay_tick_interface(int i, long long now)
|
||||
fprintf(stderr,"Successfully transmitted tick frame #%d on interface #%d (%d bytes)\n",
|
||||
overlay_sequence_number,i,e->length);
|
||||
/* De-queue the passengers who were aboard. */
|
||||
int j;
|
||||
overlay_frame **p=&overlay_tx[OVERLAY_ISOCHRONOUS_VOICE].first;
|
||||
for(j=0;j<frame_pax;j++)
|
||||
int j,q;
|
||||
for(q=0;q<OQ_MAX;q++)
|
||||
{
|
||||
/* Skip any frames that didn't get queued */
|
||||
while ((*p)&&(*p!=pax[j])) p=&(*p)->next;
|
||||
/* Now get rid of this frame once we have found it */
|
||||
if (*p) {
|
||||
*p=pax[j]->next;
|
||||
if (pax[j]->next) pax[j]->next->prev=pax[j]->prev;
|
||||
if (op_free(pax[j])) WHY("op_free() failed");
|
||||
}
|
||||
overlay_frame **p=&overlay_tx[q].first;
|
||||
for(j=0;j<frame_pax;j++)
|
||||
{
|
||||
/* Skip any frames that didn't get queued */
|
||||
while ((*p)&&(*p!=pax[j])) p=&(*p)->next;
|
||||
/* Now get rid of this frame once we have found it */
|
||||
if (*p) {
|
||||
*p=pax[j]->next;
|
||||
if (pax[j]->next) pax[j]->next->prev=pax[j]->prev;
|
||||
if (op_free(pax[j])) WHY("op_free() failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ int overlay_frame_set_neighbour_as_source(overlay_frame *f,overlay_neighbour *n)
|
||||
bcopy(n->sid,f->source,SID_SIZE);
|
||||
f->source_address_status=OA_RESOLVED;
|
||||
|
||||
return WHY("Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned char *overlay_get_my_sid()
|
||||
@ -180,5 +180,5 @@ int overlay_frame_set_me_as_source(overlay_frame *f)
|
||||
|
||||
f->source_address_status=OA_RESOLVED;
|
||||
|
||||
return WHY("Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
@ -408,7 +408,7 @@ int overlay_route_ack_selfannounce(overlay_frame *f,overlay_neighbour *n)
|
||||
overlay_frame_set_me_as_source(out);
|
||||
/* (next-hop will get set at TX time, so no need to set it here) */
|
||||
out->nexthop_address_status=OA_UNINITIALISED;
|
||||
|
||||
|
||||
/* Set the time in the ack. Use the last sequence number we have seen
|
||||
from this neighbour, as that may be helpful information for that neighbour
|
||||
down the track. My policy is to communicate that information which should
|
||||
@ -422,6 +422,9 @@ int overlay_route_ack_selfannounce(overlay_frame *f,overlay_neighbour *n)
|
||||
numbers means we can't just take the highest-numbered sequence number.
|
||||
So we need to take the observation which was most recently received.
|
||||
*/
|
||||
out->payload=ob_new(4+32*2+1); /* will grow if it isn't big enough, but let's try to
|
||||
avoid a realloc() if possible */
|
||||
|
||||
int i;
|
||||
int best_obs_id=-1;
|
||||
long long best_obs_time=0;
|
||||
@ -461,7 +464,7 @@ int overlay_route_ack_selfannounce(overlay_frame *f,overlay_neighbour *n)
|
||||
ob_append_byte(out->payload,0);
|
||||
|
||||
/* XXX Add to queue */
|
||||
|
||||
|
||||
/* XXX Remove any stale versions (or should we just freshen, and forget making
|
||||
a new one, since it would be more efficient). */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user