2012-08-27 00:34:59 +00:00
|
|
|
/*
|
|
|
|
Serval Daemon
|
|
|
|
Copyright (C) 2012 Serval Project Inc.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _SERVALD_OVERLAY_PACKET_H
|
|
|
|
#define _SERVALD_OVERLAY_PACKET_H
|
|
|
|
|
|
|
|
#include "overlay_address.h"
|
|
|
|
#include "serval.h"
|
|
|
|
|
|
|
|
struct overlay_frame {
|
|
|
|
struct overlay_frame *prev;
|
|
|
|
struct overlay_frame *next;
|
|
|
|
|
|
|
|
unsigned int type;
|
|
|
|
unsigned int modifiers;
|
|
|
|
|
|
|
|
unsigned char ttl;
|
2012-10-09 05:14:37 +00:00
|
|
|
unsigned char queue;
|
2013-05-15 02:03:43 +00:00
|
|
|
char resend;
|
2013-05-15 04:57:38 +00:00
|
|
|
void *send_context;
|
|
|
|
int (*send_hook)(struct overlay_frame *, int seq, void *context);
|
2012-08-27 00:34:59 +00:00
|
|
|
|
|
|
|
/* Mark which interfaces the frame has been sent on,
|
|
|
|
so that we can ensure that broadcast frames get sent
|
|
|
|
exactly once on each interface */
|
|
|
|
unsigned char broadcast_sent_via[OVERLAY_MAX_INTERFACES];
|
|
|
|
struct broadcast broadcast_id;
|
|
|
|
|
|
|
|
// null if destination is broadcast
|
|
|
|
struct subscriber *destination;
|
2012-12-03 03:14:31 +00:00
|
|
|
struct subscriber *next_hop;
|
2012-08-27 00:34:59 +00:00
|
|
|
|
2012-12-11 03:02:02 +00:00
|
|
|
int source_full;
|
2012-08-27 00:34:59 +00:00
|
|
|
struct subscriber *source;
|
|
|
|
|
2012-12-03 03:14:31 +00:00
|
|
|
/* IPv4 address the frame was received from, or should be sent to */
|
|
|
|
int destination_resolved;
|
|
|
|
struct sockaddr_in recvaddr;
|
2012-11-30 03:15:08 +00:00
|
|
|
overlay_interface *interface;
|
2012-12-14 06:30:54 +00:00
|
|
|
char unicast;
|
2013-05-15 02:03:43 +00:00
|
|
|
int sent_seq;
|
|
|
|
time_ms_t dont_send_until;
|
2012-08-27 00:34:59 +00:00
|
|
|
|
|
|
|
/* Actual payload */
|
|
|
|
struct overlay_buffer *payload;
|
|
|
|
|
|
|
|
time_ms_t enqueued_at;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
int op_free(struct overlay_frame *p);
|
|
|
|
struct overlay_frame *op_dup(struct overlay_frame *f);
|
|
|
|
|
|
|
|
#endif
|