mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
sys/nhdp: Add interface specific packet sequence number
This commit is contained in:
parent
ba14149695
commit
133aeedea5
@ -170,6 +170,8 @@ int nhdp_register_if(kernel_pid_t if_pid, uint8_t *addr, size_t addr_size, uint8
|
|||||||
if_entry->validity_time.microseconds = MS_IN_USEC * val_time_ms;
|
if_entry->validity_time.microseconds = MS_IN_USEC * val_time_ms;
|
||||||
timex_normalize(&if_entry->hello_interval);
|
timex_normalize(&if_entry->hello_interval);
|
||||||
timex_normalize(&if_entry->validity_time);
|
timex_normalize(&if_entry->validity_time);
|
||||||
|
/* Reset sequence number */
|
||||||
|
if_entry->seq_no = 0;
|
||||||
|
|
||||||
/* Everything went well */
|
/* Everything went well */
|
||||||
nhdp_decrement_addr_usage(nhdp_addr);
|
nhdp_decrement_addr_usage(nhdp_addr);
|
||||||
|
@ -92,6 +92,7 @@ typedef struct nhdp_if_entry_t {
|
|||||||
vtimer_t if_timer; /**< Vtimer used for the periodic signaling */
|
vtimer_t if_timer; /**< Vtimer used for the periodic signaling */
|
||||||
timex_t hello_interval; /**< Interval time for periodic HELLOs */
|
timex_t hello_interval; /**< Interval time for periodic HELLOs */
|
||||||
timex_t validity_time; /**< Validity time for propagated information */
|
timex_t validity_time; /**< Validity time for propagated information */
|
||||||
|
uint16_t seq_no; /**< Sequence number of last send RFC5444 packet */
|
||||||
struct rfc5444_writer_target wr_target; /**< Interface specific writer target */
|
struct rfc5444_writer_target wr_target; /**< Interface specific writer target */
|
||||||
} nhdp_if_entry_t;
|
} nhdp_if_entry_t;
|
||||||
|
|
||||||
|
@ -46,6 +46,8 @@ static void _nhdp_add_hello_msg_header_cb(struct rfc5444_writer *wr,
|
|||||||
struct rfc5444_writer_message *msg);
|
struct rfc5444_writer_message *msg);
|
||||||
static void _nhdp_add_message_tlvs_cb(struct rfc5444_writer *wr);
|
static void _nhdp_add_message_tlvs_cb(struct rfc5444_writer *wr);
|
||||||
static void _nhdp_add_addresses_cb(struct rfc5444_writer *wr);
|
static void _nhdp_add_addresses_cb(struct rfc5444_writer *wr);
|
||||||
|
static void _nhdp_add_packet_header_cb(struct rfc5444_writer *writer,
|
||||||
|
struct rfc5444_writer_target *rfc5444_target);
|
||||||
static void netaddr_from_nhdp_address(struct netaddr *target, nhdp_addr_t *n_addr);
|
static void netaddr_from_nhdp_address(struct netaddr *target, nhdp_addr_t *n_addr);
|
||||||
|
|
||||||
/* Array containing the known Address TLVs */
|
/* Array containing the known Address TLVs */
|
||||||
@ -108,6 +110,8 @@ void nhdp_writer_register_if(struct rfc5444_writer_target *new_if)
|
|||||||
{
|
{
|
||||||
mutex_lock(&mtx_packet_write);
|
mutex_lock(&mtx_packet_write);
|
||||||
|
|
||||||
|
/* Add packet header callback to writer target of the interface */
|
||||||
|
new_if->addPacketHeader = _nhdp_add_packet_header_cb;
|
||||||
/* Register target interface in writer */
|
/* Register target interface in writer */
|
||||||
rfc5444_writer_register_target(&nhdp_writer, new_if);
|
rfc5444_writer_register_target(&nhdp_writer, new_if);
|
||||||
|
|
||||||
@ -212,6 +216,17 @@ static void _nhdp_add_addresses_cb(struct rfc5444_writer *wr)
|
|||||||
nhdp_reset_addresses_tmp_usg();
|
nhdp_reset_addresses_tmp_usg();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add packet header with sequence number to current packet
|
||||||
|
* Called by oonf_api during packet creation
|
||||||
|
*/
|
||||||
|
static void _nhdp_add_packet_header_cb(struct rfc5444_writer *writer,
|
||||||
|
struct rfc5444_writer_target *rfc5444_target)
|
||||||
|
{
|
||||||
|
rfc5444_writer_set_pkt_header(writer, rfc5444_target, true);
|
||||||
|
rfc5444_writer_set_pkt_seqno(writer, rfc5444_target, ++nhdp_wr_curr_if_entry->seq_no);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a netaddr from a given NHDP address
|
* Construct a netaddr from a given NHDP address
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user