mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-01-18 02:39:44 +00:00
Use decode structure for tracking previous sid
This commit is contained in:
parent
3d14e2f3db
commit
ce63e96db2
@ -50,9 +50,6 @@ struct tree_node{
|
||||
|
||||
static struct tree_node root;
|
||||
|
||||
static struct subscriber *previous=NULL;
|
||||
static struct subscriber *sender=NULL;
|
||||
static struct broadcast *previous_broadcast=NULL;
|
||||
struct subscriber *my_subscriber=NULL;
|
||||
|
||||
static unsigned char get_nibble(const unsigned char *sid, int pos){
|
||||
@ -336,21 +333,21 @@ int overlay_broadcast_drop_check(struct broadcast *addr)
|
||||
}
|
||||
}
|
||||
|
||||
int overlay_broadcast_append(struct overlay_buffer *b, struct broadcast *broadcast)
|
||||
int overlay_broadcast_append(struct decode_context *context, struct overlay_buffer *b, struct broadcast *broadcast)
|
||||
{
|
||||
if (ob_append_byte(b, OA_CODE_BROADCAST)) return -1;
|
||||
if (ob_append_bytes(b, broadcast->id, BROADCAST_LEN)) return -1;
|
||||
previous=NULL;
|
||||
context->previous=NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// append an appropriate abbreviation into the address
|
||||
int overlay_address_append(struct overlay_buffer *b, struct subscriber *subscriber)
|
||||
int overlay_address_append(struct decode_context *context, struct overlay_buffer *b, struct subscriber *subscriber)
|
||||
{
|
||||
if (subscriber==sender){
|
||||
if (context && subscriber==context->sender){
|
||||
ob_append_byte(b, OA_CODE_SELF);
|
||||
|
||||
}else if(subscriber==previous){
|
||||
}else if(context && subscriber==context->previous){
|
||||
ob_append_byte(b, OA_CODE_PREVIOUS);
|
||||
|
||||
}else if(subscriber->send_full || subscriber->abbreviate_len >= 20){
|
||||
@ -369,12 +366,12 @@ int overlay_address_append(struct overlay_buffer *b, struct subscriber *subscrib
|
||||
ob_append_byte(b, OA_CODE_PREFIX11);
|
||||
ob_append_bytes(b, subscriber->sid, 11);
|
||||
}
|
||||
|
||||
previous = subscriber;
|
||||
if (context)
|
||||
context->previous = subscriber;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int overlay_address_append_self(overlay_interface *interface, struct overlay_buffer *b){
|
||||
int overlay_address_append_self(struct decode_context *context, overlay_interface *interface, struct overlay_buffer *b){
|
||||
static int ticks_per_full_address = -1;
|
||||
if (ticks_per_full_address == -1) {
|
||||
ticks_per_full_address = confValueGetInt64Range("mdp.selfannounce.ticks_per_full_address", 4LL, 1LL, 1000000LL);
|
||||
@ -389,9 +386,10 @@ int overlay_address_append_self(overlay_interface *interface, struct overlay_buf
|
||||
my_subscriber->send_full=1;
|
||||
}
|
||||
|
||||
if (overlay_address_append(b, my_subscriber))
|
||||
if (overlay_address_append(context, b, my_subscriber))
|
||||
return WHY("Could not append my sid");
|
||||
|
||||
context->sender = my_subscriber;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -450,8 +448,8 @@ int find_subscr_buffer(struct decode_context *context, struct overlay_buffer *b,
|
||||
ob_append_bytes(context->please_explain->payload, id, len);
|
||||
|
||||
}else{
|
||||
previous=*subscriber;
|
||||
previous_broadcast=NULL;
|
||||
context->previous=*subscriber;
|
||||
context->previous_broadcast=NULL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -474,8 +472,8 @@ int overlay_address_parse(struct decode_context *context, struct overlay_buffer
|
||||
}else{
|
||||
ob_get_bytes(b, broadcast->id, BROADCAST_LEN);
|
||||
}
|
||||
previous_broadcast=broadcast;
|
||||
previous=NULL;
|
||||
context->previous_broadcast=broadcast;
|
||||
context->previous=NULL;
|
||||
return 0;
|
||||
|
||||
case OA_CODE_SELF:
|
||||
@ -483,12 +481,12 @@ int overlay_address_parse(struct decode_context *context, struct overlay_buffer
|
||||
if (!subscriber){
|
||||
WARN("Could not resolve address, no buffer supplied");
|
||||
context->invalid_addresses=1;
|
||||
}else if (!sender){
|
||||
}else if (!context->sender){
|
||||
INFO("Could not resolve address, sender has not been set");
|
||||
context->invalid_addresses=1;
|
||||
}else{
|
||||
*subscriber=sender;
|
||||
previous=sender;
|
||||
*subscriber=context->sender;
|
||||
context->previous=context->sender;
|
||||
}
|
||||
return 0;
|
||||
|
||||
@ -501,13 +499,13 @@ int overlay_address_parse(struct decode_context *context, struct overlay_buffer
|
||||
if (!subscriber){
|
||||
WARN("Could not resolve address, no buffer supplied");
|
||||
context->invalid_addresses=1;
|
||||
}else if (previous){
|
||||
*subscriber=previous;
|
||||
}else if (previous_broadcast){
|
||||
}else if (context->previous){
|
||||
*subscriber=context->previous;
|
||||
}else if (context->previous_broadcast){
|
||||
*subscriber=NULL;
|
||||
// not an error if broadcast is NULL, as the previous OA_CODE_BROADCAST address must have been valid.
|
||||
if (broadcast)
|
||||
bcopy(previous_broadcast->id, broadcast->id, BROADCAST_LEN);
|
||||
bcopy(context->previous_broadcast->id, broadcast->id, BROADCAST_LEN);
|
||||
}else{
|
||||
INFO("Unable to decode previous address");
|
||||
context->invalid_addresses=1;
|
||||
@ -546,7 +544,7 @@ int send_please_explain(struct decode_context *context, struct subscriber *sourc
|
||||
else
|
||||
context->please_explain->source = my_subscriber;
|
||||
|
||||
if (destination){
|
||||
if (context->sender){
|
||||
context->please_explain->destination = destination;
|
||||
context->please_explain->ttl=64;
|
||||
}else{
|
||||
@ -609,13 +607,3 @@ int process_explain(struct overlay_frame *frame){
|
||||
send_please_explain(&context, frame->destination, frame->source);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void overlay_address_clear(void){
|
||||
sender=NULL;
|
||||
previous=NULL;
|
||||
previous_broadcast=NULL;
|
||||
}
|
||||
|
||||
void overlay_address_set_sender(struct subscriber *subscriber){
|
||||
sender = subscriber;
|
||||
}
|
||||
|
@ -108,6 +108,9 @@ struct decode_context{
|
||||
int abbreviations_only;
|
||||
int invalid_addresses;
|
||||
struct overlay_frame *please_explain;
|
||||
struct subscriber *sender;
|
||||
struct subscriber *previous;
|
||||
struct broadcast *previous_broadcast;
|
||||
};
|
||||
|
||||
extern struct subscriber *my_subscriber;
|
||||
@ -124,15 +127,11 @@ int process_explain(struct overlay_frame *frame);
|
||||
int overlay_broadcast_drop_check(struct broadcast *addr);
|
||||
int overlay_broadcast_generate_address(struct broadcast *addr);
|
||||
|
||||
int overlay_broadcast_append(struct overlay_buffer *b, struct broadcast *broadcast);
|
||||
int overlay_address_append(struct overlay_buffer *b, struct subscriber *subscriber);
|
||||
int overlay_address_append_self(overlay_interface *interface, struct overlay_buffer *b);
|
||||
int overlay_broadcast_append(struct decode_context *context, struct overlay_buffer *b, struct broadcast *broadcast);
|
||||
int overlay_address_append(struct decode_context *context, struct overlay_buffer *b, struct subscriber *subscriber);
|
||||
int overlay_address_append_self(struct decode_context *context, overlay_interface *interface, struct overlay_buffer *b);
|
||||
|
||||
int overlay_address_parse(struct decode_context *context, struct overlay_buffer *b, struct broadcast *broadcast, struct subscriber **subscriber);
|
||||
int send_please_explain(struct decode_context *context, struct subscriber *source, struct subscriber *destination);
|
||||
|
||||
void overlay_address_clear(void);
|
||||
void overlay_address_set_sender(struct subscriber *subscriber);
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -71,7 +71,7 @@ int add_advertisement(struct subscriber *subscriber, void *context){
|
||||
// never send the full sid in an advertisement
|
||||
subscriber->send_full=0;
|
||||
|
||||
if (overlay_address_append(e,subscriber) ||
|
||||
if (overlay_address_append(NULL,e,subscriber) ||
|
||||
ob_append_byte(e,n->best_link_score -1) ||
|
||||
ob_append_byte(e,n->observations[n->best_observation].gateways_en_route +1)){
|
||||
|
||||
@ -88,7 +88,8 @@ int add_advertisement(struct subscriber *subscriber, void *context){
|
||||
return 0;
|
||||
}
|
||||
|
||||
int overlay_route_add_advertisements(overlay_interface *interface, struct overlay_buffer *e)
|
||||
int overlay_route_add_advertisements(struct decode_context *context, overlay_interface *interface,
|
||||
struct overlay_buffer *e)
|
||||
{
|
||||
/* Construct a route advertisement frame and append it to e.
|
||||
|
||||
@ -128,12 +129,11 @@ int overlay_route_add_advertisements(overlay_interface *interface, struct overla
|
||||
/* Add address fields */
|
||||
struct broadcast broadcast;
|
||||
overlay_broadcast_generate_address(&broadcast);
|
||||
overlay_broadcast_append(e,&broadcast);
|
||||
overlay_broadcast_append(context,e,&broadcast);
|
||||
|
||||
ob_append_byte(e,OA_CODE_PREVIOUS);
|
||||
|
||||
overlay_address_append_self(interface,e);
|
||||
overlay_address_set_sender(my_subscriber);
|
||||
overlay_address_append(context, e, my_subscriber);
|
||||
|
||||
// TODO high priority advertisements first....
|
||||
/*
|
||||
@ -164,7 +164,6 @@ int overlay_route_add_advertisements(overlay_interface *interface, struct overla
|
||||
if (e->position == start_pos){
|
||||
// no advertisements? don't bother to send the payload at all.
|
||||
ob_rewind(e);
|
||||
overlay_address_clear();
|
||||
}else
|
||||
ob_patch_rfs(e,COMPUTE_RFS_LENGTH);
|
||||
|
||||
@ -185,6 +184,7 @@ int overlay_route_saw_advertisements(int i, struct overlay_frame *f, struct deco
|
||||
{
|
||||
IN();
|
||||
context->abbreviations_only=1;
|
||||
struct subscriber *previous=context->previous;
|
||||
// minimum record length is (address code, 3 byte sid, score, gateways)
|
||||
while(f->payload->position +6 <= f->payload->sizeLimit)
|
||||
{
|
||||
@ -221,6 +221,8 @@ int overlay_route_saw_advertisements(int i, struct overlay_frame *f, struct deco
|
||||
score,gateways_en_route);
|
||||
|
||||
}
|
||||
// restore the previous subscriber id for parsing the next header
|
||||
context->previous=previous;
|
||||
context->abbreviations_only=0;
|
||||
RETURN(0);
|
||||
}
|
||||
|
@ -130,7 +130,6 @@ static void parse_frame(struct overlay_buffer *buff){
|
||||
WHYF("Unexpected magic number %d", magic);
|
||||
return;
|
||||
}
|
||||
overlay_address_clear();
|
||||
|
||||
frame.ttl = ob_get(buff);
|
||||
addr_len = ob_get(buff);
|
||||
@ -142,26 +141,23 @@ static void parse_frame(struct overlay_buffer *buff){
|
||||
addr = (struct in_addr *)ob_get_bytes_ptr(buff, addr_len);
|
||||
|
||||
// read subscriber id of transmitter
|
||||
struct subscriber *sender;
|
||||
if (overlay_address_parse(&context, buff, NULL, &sender))
|
||||
if (overlay_address_parse(&context, buff, NULL, &context.sender))
|
||||
goto end;
|
||||
|
||||
if (context.invalid_addresses)
|
||||
goto end;
|
||||
|
||||
overlay_address_set_sender(sender);
|
||||
|
||||
// locate the interface we should send outgoing unicast packets to
|
||||
overlay_interface *interface = overlay_interface_find(*addr);
|
||||
if (interface){
|
||||
// always update the IP address we heard them from, even if we don't need to use it right now
|
||||
sender->address.sin_family = AF_INET;
|
||||
sender->address.sin_addr = *addr;
|
||||
context.sender->address.sin_family = AF_INET;
|
||||
context.sender->address.sin_addr = *addr;
|
||||
// assume the port number of the other servald matches our local port number configuration
|
||||
sender->address.sin_port = htons(interface->port);
|
||||
context.sender->address.sin_port = htons(interface->port);
|
||||
|
||||
if (sender->reachable==REACHABLE_NONE){
|
||||
reachable_unicast(sender, interface, *addr, interface->port);
|
||||
if (context.sender->reachable==REACHABLE_NONE){
|
||||
reachable_unicast(context.sender, interface, *addr, interface->port);
|
||||
}
|
||||
}
|
||||
|
||||
@ -194,7 +190,7 @@ static void parse_frame(struct overlay_buffer *buff){
|
||||
|
||||
end:
|
||||
// if we didn't understand one of the address abreviations, ask for explanation
|
||||
send_please_explain(&context, my_subscriber, sender);
|
||||
send_please_explain(&context, my_subscriber, context.sender);
|
||||
}
|
||||
|
||||
static void olsr_read(struct sched_ent *alarm){
|
||||
@ -266,19 +262,19 @@ int olsr_send(struct overlay_frame *frame){
|
||||
if (frame->destination)
|
||||
return 0;
|
||||
|
||||
struct decode_context context;
|
||||
bzero(&context, sizeof context);
|
||||
struct overlay_buffer *b=ob_new();
|
||||
overlay_address_clear();
|
||||
|
||||
// build olsr specific frame header
|
||||
ob_append_byte(b, PACKET_FORMAT_NUMBER);
|
||||
ob_append_byte(b, frame->ttl);
|
||||
|
||||
// address the packet as transmitted by me
|
||||
overlay_address_append(b, my_subscriber);
|
||||
overlay_address_set_sender(my_subscriber);
|
||||
overlay_address_append(&context, b, my_subscriber);
|
||||
|
||||
overlay_address_append(b, frame->source);
|
||||
overlay_broadcast_append(b, &frame->broadcast_id);
|
||||
overlay_address_append(&context, b, frame->source);
|
||||
overlay_broadcast_append(&context, b, &frame->broadcast_id);
|
||||
ob_append_byte(b, frame->modifiers);
|
||||
|
||||
if (debug&DEBUG_OVERLAYINTERFACES)
|
||||
|
@ -28,7 +28,8 @@ struct sockaddr_in loopback;
|
||||
unsigned char magic_header[]={/* Magic */ 'O',0x10,
|
||||
/* Version */ 0x00,0x01};
|
||||
|
||||
int overlay_packet_init_header(struct overlay_buffer *buff){
|
||||
int overlay_packet_init_header(struct overlay_interface *interface, struct decode_context *context,
|
||||
struct overlay_buffer *buff){
|
||||
return ob_append_bytes(buff,magic_header,4);
|
||||
}
|
||||
|
||||
@ -169,7 +170,6 @@ int packetOkOverlay(struct overlay_interface *interface,unsigned char *packet, s
|
||||
*/
|
||||
|
||||
struct overlay_frame f;
|
||||
struct subscriber *sender=NULL;
|
||||
struct decode_context context={
|
||||
.please_explain=NULL,
|
||||
};
|
||||
@ -204,8 +204,6 @@ int packetOkOverlay(struct overlay_interface *interface,unsigned char *packet, s
|
||||
f.recvaddr=NULL;
|
||||
}
|
||||
|
||||
overlay_address_clear();
|
||||
|
||||
// TODO put sender of packet and sequence number in envelope header
|
||||
// Then we can quickly drop reflected broadcast packets
|
||||
// currently we see annoying errors as we attempt to parse each payload
|
||||
@ -285,10 +283,10 @@ int packetOkOverlay(struct overlay_interface *interface,unsigned char *packet, s
|
||||
}
|
||||
|
||||
if (f.type==OF_TYPE_SELFANNOUNCE){
|
||||
sender = f.source;
|
||||
// skip the entire packet if it came from me
|
||||
if (sender->reachable==REACHABLE_SELF)
|
||||
if (f.source->reachable==REACHABLE_SELF)
|
||||
break;
|
||||
context.sender = f.source;
|
||||
|
||||
overlay_address_set_sender(f.source);
|
||||
|
||||
@ -358,11 +356,11 @@ int packetOkOverlay(struct overlay_interface *interface,unsigned char *packet, s
|
||||
|
||||
ob_free(b);
|
||||
|
||||
send_please_explain(&context, my_subscriber, sender);
|
||||
send_please_explain(&context, my_subscriber, context.sender);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int overlay_add_selfannouncement(int interface,struct overlay_buffer *b)
|
||||
int overlay_add_selfannouncement(struct decode_context *context, int interface,struct overlay_buffer *b)
|
||||
{
|
||||
|
||||
/* Pull the first record from the HLR database and turn it into a
|
||||
@ -399,7 +397,7 @@ int overlay_add_selfannouncement(int interface,struct overlay_buffer *b)
|
||||
/* Add next-hop address. Always link-local broadcast for self-announcements */
|
||||
struct broadcast broadcast_id;
|
||||
overlay_broadcast_generate_address(&broadcast_id);
|
||||
if (overlay_broadcast_append(b, &broadcast_id))
|
||||
if (overlay_broadcast_append(context, b, &broadcast_id))
|
||||
return WHY("Could not write broadcast address to self-announcement");
|
||||
|
||||
/* Add final destination. Always broadcast for self-announcments. */
|
||||
@ -407,11 +405,9 @@ int overlay_add_selfannouncement(int interface,struct overlay_buffer *b)
|
||||
return WHY("Could not add self-announcement header");
|
||||
|
||||
/* Add our SID to the announcement as sender */
|
||||
if (overlay_address_append_self(&overlay_interfaces[interface], b))
|
||||
if (overlay_address_append_self(context, &overlay_interfaces[interface], b))
|
||||
return -1;
|
||||
|
||||
overlay_address_set_sender(my_subscriber);
|
||||
|
||||
/* Sequence number range. Based on one tick per millisecond. */
|
||||
time_ms_t last_ms = overlay_interfaces[interface].last_tick_ms;
|
||||
// If this interface has not been ticked yet (no selfannounce sent) then invent the prior sequence
|
||||
|
@ -28,7 +28,8 @@ int overlay_packet_append_header(struct overlay_buffer *buff, int type, int ttl,
|
||||
return ob_append_rfs(buff, approx_size);
|
||||
}
|
||||
|
||||
int overlay_frame_append_payload(overlay_interface *interface, struct overlay_frame *p, struct subscriber *next_hop, struct overlay_buffer *b)
|
||||
int overlay_frame_append_payload(struct decode_context *context, overlay_interface *interface,
|
||||
struct overlay_frame *p, struct subscriber *next_hop, struct overlay_buffer *b)
|
||||
{
|
||||
/* Convert a payload (frame) structure into a series of bytes.
|
||||
Assumes that any encryption etc has already been done.
|
||||
@ -78,19 +79,19 @@ int overlay_frame_append_payload(overlay_interface *interface, struct overlay_fr
|
||||
|
||||
/* Write out addresses as abbreviated as possible */
|
||||
if (p->sendBroadcast){
|
||||
overlay_broadcast_append(headers, &p->broadcast_id);
|
||||
overlay_broadcast_append(context, headers, &p->broadcast_id);
|
||||
}else{
|
||||
overlay_address_append(headers, next_hop);
|
||||
overlay_address_append(context, headers, next_hop);
|
||||
}
|
||||
if (p->destination)
|
||||
overlay_address_append(headers,p->destination);
|
||||
overlay_address_append(context, headers,p->destination);
|
||||
else
|
||||
ob_append_byte(headers, OA_CODE_PREVIOUS);
|
||||
|
||||
if (p->source==my_subscriber){
|
||||
overlay_address_append_self(interface, headers);
|
||||
overlay_address_append_self(context, interface, headers);
|
||||
}else{
|
||||
overlay_address_append(headers,p->source);
|
||||
overlay_address_append(context, headers,p->source);
|
||||
}
|
||||
|
||||
int addrs_len=headers->position-addrs_start;
|
||||
|
@ -59,6 +59,7 @@ struct outgoing_packet{
|
||||
int add_advertisements;
|
||||
struct sockaddr_in dest;
|
||||
struct overlay_buffer *buffer;
|
||||
struct decode_context context;
|
||||
};
|
||||
|
||||
struct sched_ent next_packet;
|
||||
@ -257,18 +258,16 @@ overlay_init_packet(struct outgoing_packet *packet, overlay_interface *interface
|
||||
packet->add_advertisements=1;
|
||||
ob_limitsize(packet->buffer, packet->interface->mtu);
|
||||
|
||||
overlay_packet_init_header(packet->buffer);
|
||||
|
||||
overlay_address_clear();
|
||||
overlay_packet_init_header(interface, &packet->context, packet->buffer);
|
||||
|
||||
if (tick){
|
||||
/* 1. Send announcement about ourselves, including one SID that we host if we host more than one SID
|
||||
(the first SID we host becomes our own identity, saving a little bit of data here).
|
||||
*/
|
||||
overlay_add_selfannouncement(packet->i, packet->buffer);
|
||||
overlay_add_selfannouncement(&packet->context, packet->i, packet->buffer);
|
||||
|
||||
/* Add advertisements for ROUTES */
|
||||
overlay_route_add_advertisements(packet->interface, packet->buffer);
|
||||
overlay_route_add_advertisements(&packet->context, packet->interface, packet->buffer);
|
||||
|
||||
}else{
|
||||
overlay_add_sender_header(packet->buffer, interface);
|
||||
@ -415,7 +414,7 @@ overlay_stuff_packet(struct outgoing_packet *packet, overlay_txqueue *queue, tim
|
||||
frame->sendBroadcast?alloca_tohex(frame->broadcast_id.id, BROADCAST_LEN):alloca_tohex_sid(next_hop->sid));
|
||||
}
|
||||
|
||||
if (overlay_frame_append_payload(packet->interface, frame, next_hop, packet->buffer))
|
||||
if (overlay_frame_append_payload(&packet->context, packet->interface, frame, next_hop, packet->buffer))
|
||||
// payload was not queued
|
||||
goto skip;
|
||||
|
||||
@ -482,7 +481,7 @@ overlay_fill_send_packet(struct outgoing_packet *packet, time_ms_t now) {
|
||||
if (packet->buffer->position>=HEADERFIELDS_LEN){
|
||||
// stuff rhizome announcements at the last moment
|
||||
if (packet->add_advertisements)
|
||||
overlay_rhizome_add_advertisements(packet->i,packet->buffer);
|
||||
overlay_rhizome_add_advertisements(&packet->context, packet->i,packet->buffer);
|
||||
|
||||
if (debug&DEBUG_PACKETCONSTRUCTION)
|
||||
dump("assembled packet",&packet->buffer->bytes[0],packet->buffer->position);
|
||||
@ -495,7 +494,6 @@ overlay_fill_send_packet(struct outgoing_packet *packet, time_ms_t now) {
|
||||
}
|
||||
}
|
||||
ob_free(packet->buffer);
|
||||
overlay_address_clear();
|
||||
RETURN(1);
|
||||
}
|
||||
RETURN(0);
|
||||
|
@ -134,7 +134,7 @@ unsigned long long rhizome_bar_bidprefix_ll(unsigned char *bar)
|
||||
|
||||
int bundles_available=-1;
|
||||
int bundle_offset[2]={0,0};
|
||||
int overlay_rhizome_add_advertisements(int interface_number, struct overlay_buffer *e)
|
||||
int overlay_rhizome_add_advertisements(struct decode_context *context, int interface_number, struct overlay_buffer *e)
|
||||
{
|
||||
IN();
|
||||
|
||||
@ -163,9 +163,9 @@ int overlay_rhizome_add_advertisements(int interface_number, struct overlay_buff
|
||||
/* Stuff in dummy address fields (11 bytes) */
|
||||
struct broadcast broadcast_id;
|
||||
overlay_broadcast_generate_address(&broadcast_id);
|
||||
overlay_broadcast_append(e, &broadcast_id);
|
||||
overlay_broadcast_append(context, e, &broadcast_id);
|
||||
ob_append_byte(e, OA_CODE_PREVIOUS);
|
||||
overlay_address_append_self(&overlay_interfaces[interface_number], e);
|
||||
overlay_address_append_self(context, &overlay_interfaces[interface_number], e);
|
||||
|
||||
/* Randomly choose whether to advertise manifests or BARs first. */
|
||||
int skipmanifests=random()&1;
|
||||
|
12
serval.h
12
serval.h
@ -439,12 +439,14 @@ int overlay_frame_resolve_addresses(struct overlay_frame *f);
|
||||
|
||||
time_ms_t overlay_time_until_next_tick();
|
||||
|
||||
int overlay_add_selfannouncement();
|
||||
int overlay_frame_append_payload(overlay_interface *interface, struct overlay_frame *p, struct subscriber *next_hop, struct overlay_buffer *b);
|
||||
int overlay_packet_init_header(struct overlay_buffer *buff);
|
||||
int overlay_add_selfannouncement(struct decode_context *context, int interface,struct overlay_buffer *b);
|
||||
int overlay_frame_append_payload(struct decode_context *context, overlay_interface *interface,
|
||||
struct overlay_frame *p, struct subscriber *next_hop, struct overlay_buffer *b);
|
||||
int overlay_packet_init_header(struct overlay_interface *interface, struct decode_context *context,
|
||||
struct overlay_buffer *buff);
|
||||
int overlay_packet_append_header(struct overlay_buffer *buff, int type, int ttl, int approx_size);
|
||||
int overlay_interface_args(const char *arg);
|
||||
int overlay_rhizome_add_advertisements(int interface_number,struct overlay_buffer *e);
|
||||
int overlay_rhizome_add_advertisements(struct decode_context *context, int interface_number, struct overlay_buffer *e);
|
||||
int overlay_add_local_identity(unsigned char *s);
|
||||
|
||||
extern int overlay_interface_count;
|
||||
@ -492,7 +494,7 @@ int overlay_route_record_link( time_ms_t now,unsigned char *to,
|
||||
unsigned char *via,int sender_interface,
|
||||
unsigned int s1,unsigned int s2,int score,int gateways_en_route);
|
||||
int overlay_route_dump();
|
||||
int overlay_route_add_advertisements(overlay_interface *interface, struct overlay_buffer *e);
|
||||
int overlay_route_add_advertisements(struct decode_context *context, overlay_interface *interface, struct overlay_buffer *e);
|
||||
int ovleray_route_please_advertise(overlay_node *n);
|
||||
|
||||
int overlay_route_saw_advertisements(int i, struct overlay_frame *f, struct decode_context *context, time_ms_t now);
|
||||
|
Loading…
Reference in New Issue
Block a user