NHDP

The MANET Neighborhood Discovery Protocol (RFC 6130)

MANET_PORT

Well-known MANET port from RFC 5498.

1
(269)
NHDP_STACK_SIZE

Stack size for NHDP thread.

1
(THREAD_STACKSIZE_DEFAULT + THREAD_EXTRA_STACKSIZE_PRINTF)
NHDP_WR_MSG_BUF_SIZE

Buffer size in bytes for NHDP writer’s msg buffer.

1
(256)
NHDP_WR_TLV_BUF_SIZE

Buffer size in bytes for NHDP writer’s tlv buffer.

1
(512)
NHDP_MSG_QUEUE_SIZE

Queue size for msg queue of NHDP.

1
(16)
NHDP_MAX_RFC5444_PACKET_SZ

Maximum size of handled RFC5444 packets.

1
(128)
NHDP_DEFAULT_HELLO_INT_MS

Default hello interval in milliseconds.

1
(2000)
NHDP_DEFAULT_HOLD_TIME_MS

Default hold time in milliseconds.

1
(3 * NHDP_DEFAULT_HELLO_INT_MS)
NHDP_INITIAL_PENDING

Initial pending flag value for new link tuples.

1
(0)

Do not change (link quality currently not considered)

NHDP_HP_MAXJITTER_MS

Maximum jitter for nhdp messages in milliseconds.

1
(200)
NHDP_L_HOLD_TIME_MS
1
(NHDP_DEFAULT_HOLD_TIME_MS)
NHDP_N_HOLD_TIME_MS
1
(NHDP_DEFAULT_HOLD_TIME_MS)
NHDP_I_HOLD_TIME_MS
1
(NHDP_DEFAULT_HOLD_TIME_MS)
enum nhdp_address_type_t
AF_CC110X = AF_MAX + 3
void nhdp_init(void)

Initialize NHDP for operation.

Sets up NHDP’s reader and writer. Call first before starting NHDP’s thread and registering interfaces.

kernel_types.h::kernel_pid_t nhdp_start(void)

Start NHDP’s operational thread.

Return values

  • PID of NHDP’s operational thread
  • KERNEL_PID_UNDEF on error
int nhdp_register_if_default(kernel_types.h::kernel_pid_t if_pid, uint8_t * addr, msp430_types.h::size_t addr_size, uint8_t addr_type, uint16_t max_pl_size)

Register an interface for NHDP operation with default values.

Registers the interface completely for NHDP operation. Registration includes a new Local Information Base entry, a new Interface Information Base and starting the periodical HELLO messaging.

Note

Default values are a hello interval of 2 seconds and a validity time of 6 seconds for propagated information.

Parameters

if_pid:PID of the interface
addr:A local address of this interface represented in bytes
addr_size:Length in bytes of the local address
addr_type:AF type of the local address
max_pl_size:Maximum payload size for packets send over this interface

Return values

  • 0 on success
  • -1 on error
  • -2 on maximum number of interfaces registered
int nhdp_register_if(kernel_types.h::kernel_pid_t if_pid, uint8_t * addr, msp430_types.h::size_t addr_size, uint8_t addr_type, uint16_t max_pl_size, uint16_t hello_int_ms, uint16_t val_time_ms)

Register an interface for NHDP operation.

Registers the interface completely for NHDP operation. Registration includes a new Local Information Base entry, a new Interface Information Base and starting the periodical HELLO messaging.

Parameters

if_pid:PID of the interface
addr:A local address of this interface represented in bytes
addr_size:Length of the local address (number of bytes)
addr_type:AF type of the given address
max_pl_size:Maximum payload size for packets send over this interface
hello_int_ms:Hello interval in ms for periodic message generation
val_time_ms:Validity time in ms for propagated information

Return values

  • 0 on success
  • -1 on error
  • -2 on maximum number of interfaces registered
int nhdp_register_non_manet_if(kernel_types.h::kernel_pid_t if_pid, uint8_t * addr, msp430_types.h::size_t addr_size, uint8_t addr_type)

Register a non MANET interface in NHDP.

The registered interface does not take part in NHDP operation. Its addresses will be represented only in other interfaces’ messages. No periodical messages are created for this interface and no message processing is done.

Parameters

if_pid:PID of the interface
addr:A local address of this interface represented in bytes
addr_size:Length of the local address (number of bytes)
addr_type:AF type of the given address

Return values

  • 0 on success
  • -1 on error
int nhdp_add_address(kernel_types.h::kernel_pid_t if_pid, uint8_t * addr, msp430_types.h::size_t addr_size, uint8_t addr_type)

Register an additional address for an interface in NHDP.

The address is added to the Local Information Base entry of this interface and will afterwards be propagated as a local address in newly created HELLO messages.

Parameters

if_pid:PID of the interface
addr:Additional local address of this interface represented in bytes
addr_size:Length of the local address (number of bytes)
addr_type:AF type of the given address

Return values

  • 0 on success
  • -1 on error
ENABLE_DEBUG

Definition for RIOTs debugging option.

1
(0)
struct nhdp_if_entry_t

MANET interface representation.

kernel_types.h::kernel_pid_t if_pid

PID of the interface’s handling thread.

xtimer.h::xtimer_t if_timer

xtimer used for the periodic signaling

timex_t hello_interval

Interval time for periodic HELLOs.

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.