DES-SERT - A Simple and Extensible Routing Framework for Testbeds: M E S H - I N T E R F A C E S

# M E S H - I N T E R F A C E S

EXTERNAL / PUBLIC. More...

## Defines
#define | DESSERT_MSG_NEEDNOSPARSE 1
| return code for dessert_meshrxcb_t - forces to copy the message and call again
#define | DESSERT_MSG_NEEDMSGPROC 2
| return code for dessert_meshrxcb_t - forces to generate processing info and call again
#define | DESSERT_MSG_KEEP 0
| return code for dessert_meshrxcb_t and dessert_sysrxcb_t
#define | DESSERT_MSG_DROP -1
| return code for dessert_meshrxcb_t and dessert_sysrxcb_t
#define | DESSERT_IF_PROMISC 0x0
| flag for dessert_meshif_add - set interface in promiscuous-mode (default)
#define | DESSERT_IF_NOPROMISC 0x1
| flag for dessert_meshif_add - do not set interface in promiscuous-mode
#define | DESSERT_IF_FILTER 0x0
| flag for dessert_meshif_add - filter out non-des-sert frames in libpcap (default)
#define | DESSERT_IF_NOFILTER 0x2
| flag for dessert_meshif_add - do not filter out non-des-sert frames in libpcap
## Functions
int | dessert_meshsend (const dessert_msg_t *msgin, const dessert_meshif_t *iface)
| Sends a dessert message via the specified interface or all interfaces.
int | dessert_meshsend_allbutone (const dessert_msg_t *msgin, const dessert_meshif_t *iface)
| Sends a dessert message via all interfaces, except via the specified interface.
int | dessert_meshsend_hwaddr (const dessert_msg_t *msgin, const uint8_t hwaddr[ETHER_ADDR_LEN])
| Sends a dessert message via the interface which is identified by the given hardware address.
int | dessert_meshsend_randomized (const dessert_msg_t *msgin)
| Sends a dessert message via all interfaces in a randomized fashion.
int | dessert_meshsend_fast (dessert_msg_t *msg, const dessert_meshif_t *iface)
| Sends a dessert message fast via the specified interface or all interfaces.
int | dessert_meshsend_fast_allbutone (dessert_msg_t *msg, const dessert_meshif_t *iface)
| Sends a dessert message fast via all interfaces, except the specified interface.
int | dessert_meshsend_fast_hwaddr (dessert_msg_t *msg, const uint8_t hwaddr[ETHER_ADDR_LEN])
| Sends a dessert message fast via the interface specified by the given hardware address.
int | dessert_meshsend_fast_randomized (dessert_msg_t *msgin)
| Sends a dessert message fast via all interfaces in a randomized fashion.
int | dessert_meshsend_raw (dessert_msg_t *msg, const dessert_meshif_t *iface)
| Sends a dessert message msg via the specified interface iface or all interfaces.
int | dessert_meshrxcb_add (dessert_meshrxcb_t *c, int prio)
| Adds a callback function to the meshrx pipeline.
int | dessert_meshrxcb_del (dessert_meshrxcb_t *c)
| Removes all occurrences of the given callback function c from the meshrx pipeline.
int | dessert_meshif_add (const char *dev, uint8_t flags)
| Initializes given mesh interface, starts up the packet processor thread.
int | dessert_meshif_del (const char *dev)
| Removes the corresponding dessert_meshif struct from _dessert_meshiflist and does some cleanup.
dessert_meshif_t * | dessert_meshif_get_name (const char *dev)
| Looks for mesh interface with name dev in the list of mesh interfaces and returns a pointer to it.
dessert_meshif_t * | dessert_meshif_get_hwaddr (const uint8_t hwaddr[ETHER_ADDR_LEN])
| Looks for mesh interface with hardware address hwaddr in the list of mesh interfaces and returns a pointer to it.
dessert_meshif_t * | dessert_meshiflist_get (void)
| Returns the head of the list of mesh interfaces (_desert_meshiflist).

## Detailed Description

EXTERNAL / PUBLIC.

## Function Documentation

int dessert_meshif_add | ( | const char * | dev,
|  | uint8_t | flags |
| ) |  |  |

Initializes given mesh interface, starts up the packet processor thread.

Parameters:

  `[in]` | *dev | interface name
  `[in]` | flags |

Todo:
  Document the flags parameter.

Return values:

  | DESSERT_OK | on success
  | DESSERT_ERR | on error

DESCRIPTION:

Here is the caller graph for this function:

int dessert_meshif_del | ( | const char * | dev | ) |

Removes the corresponding dessert_meshif struct from _dessert_meshiflist and does some cleanup.

Parameters:

  `[in]` | dev | interface name to remove from list

Return values:

  | DESSERT_OK | on success
  | -errno | on error

DESCRIPTION:

dessert_meshif_t* dessert_meshif_get_hwaddr | ( | const uint8_t | hwaddr[ETHER_ADDR_LEN] | ) |

Looks for mesh interface with hardware address hwaddr in the list of mesh interfaces and returns a pointer to it.

Parameters:

  `[in]` | *hwaddr | interface hardware address

Return values:

  | pointer | if the interface is found
  | NULL | otherwise

DESCRIPTION:

dessert_meshif_t* dessert_meshif_get_name | ( | const char * | dev | ) |

Looks for mesh interface with name dev in the list of mesh interfaces and returns a pointer to it.

Parameters:

  `[in]` | *dev | interface name

Return values:

  | pointer | if the interface is found
  | NULL | otherwise

DESCRIPTION:

dessert_meshif_t* dessert_meshiflist_get | ( | void |  | ) |

Returns the head of the list of mesh interfaces (_desert_meshiflist).

Return values:

  | pointer | if list is not empty
  | NULL | otherwise

DESCRIPTION:

Here is the caller graph for this function:

int dessert_meshrxcb_add | ( | dessert_meshrxcb_t * | c,
|  | int | prio |
| ) |  |  |

Adds a callback function to the meshrx pipeline.

The callback going to get called if a packet is received via a dessert interface.

Parameters:

  `[in]` | c | callback function
  `[in]` | prio | priority of the function - lower first!

Return values:

  | DESSERT_OK | on success
  | -errno | on error

DESCRIPTION:

int dessert_meshrxcb_del | ( | dessert_meshrxcb_t * | c | ) |

Removes all occurrences of the given callback function c from the meshrx pipeline.

Parameters:

  `[in]` | c | callback function pointer

Return values:

  | DESSERT_OK | on success
  | DESSERT_ERR | otherwise

DESCRIPTION:

int dessert_meshsend | ( | const dessert_msg_t * | msgin,
|  | const dessert_meshif_t * | iface |
| ) |  |  |

Sends a dessert message via the specified interface or all interfaces.

The original message buffer will not be altered, and the ethernet src address will be set correctly

Parameters:

  `[in]` | *msgin | message to send
  `[in]` | *iface | interface to send from - use NULL for all interfaces

Return values:

  | DESSERT_OK | on success
  | EINVAL | if message is broken
  | EIO | if message was not sent successfully

DESCRIPTION:

int dessert_meshsend_allbutone | ( | const dessert_msg_t * | msgin,
|  | const dessert_meshif_t * | iface |
| ) |  |  |

Sends a dessert message via all interfaces, except via the specified interface.

The original message buffer will not be altered, and the ethernet src address will be set correctly.

Parameters:

  `[in]` | *msgin | message to send
  `[in]` | *iface | interface NOT to send from - use NULL for all interfaces

Return values:

  | DESSERT_OK | on success
  | EINVAL | if message is broken
  | EIO | if message was not sent successfully

DESCRIPTION:

int dessert_meshsend_fast | ( | dessert_msg_t * | msg,
|  | const dessert_meshif_t * | iface |
| ) |  |  |

Sends a dessert message fast via the specified interface or all interfaces.

This method is faster than dessert_meshsend(), but does not check the message and may alter the message buffer.

Parameters:

  `[in]` | *msg | message to send
  `[in]` | *iface | interface to send from

Return values:

  | DESSERT_OK | on success
  | EINVAL | if message is broken
  | EIO | if message was not sent successfully

DESCRIPTION:

Here is the caller graph for this function:

int dessert_meshsend_fast_allbutone | ( | dessert_msg_t * | msg,
|  | const dessert_meshif_t * | iface |
| ) |  |  |

Sends a dessert message fast via all interfaces, except the specified interface.

This method is faster than dessert_meshsend_allbutone(), but does not check the message and may alter the message buffer.

Parameters:

  `[in]` | *msg | message to send
  `[in]` | *iface | interface to NOT send from - use NULL for all interfaces

Return values:

  | DESSERT_OK | on success
  | EINVAL | if message is broken
  | EIO | if message was not sent successfully

DESCRIPTION:

Here is the caller graph for this function:

int dessert_meshsend_fast_hwaddr | ( | dessert_msg_t * | msg,
|  | const uint8_t | hwaddr[ETHER_ADDR_LEN] |
| ) |  |  |

Sends a dessert message fast via the interface specified by the given hardware address.

This method is faster than dessert_meshsend_hwaddr(), but does not check the message and may alter the message buffer.

Parameters:

  `[in]` | *msg | message to send
  `[in]` | *hwaddr | hardware address of the interface to send from

Return values:

  | DESSERT_OK | on success
  | EINVAL | if message is broken
  | EIO | if message was not sent successfully

DESCRIPTION:

Here is the caller graph for this function:

int dessert_meshsend_fast_randomized | ( | dessert_msg_t * | msgin | ) |

Sends a dessert message fast via all interfaces in a randomized fashion.

This method is faster than dessert_meshsend_randomized(), but does not check the message and may alter the message buffer.

Parameters:

  `[in]` | *msgin | message to send

Return values:

  | DESSERT_OK | on success
  | EINVAL | if message is broken
  | EIO | if message was not sent successfully

DESCRIPTION:

Here is the caller graph for this function:

int dessert_meshsend_hwaddr | ( | const dessert_msg_t * | msgin,
|  | const uint8_t | hwaddr[ETHER_ADDR_LEN] |
| ) |  |  |

Sends a dessert message via the interface which is identified by the given hardware address.

The original message buffer will not be altered, and the ethernet src address will be set correctly.

Parameters:

  `[in]` | *msgin | message to send
  `[in]` | *hwaddr | hardware address of the interface to send from

Return values:

  | DESSERT_OK | on success
  | EINVAL | if message is broken
  | EIO | if message was not sent successfully

DESCRIPTION:

int dessert_meshsend_randomized | ( | const dessert_msg_t * | msgin | ) |

Sends a dessert message via all interfaces in a randomized fashion.

The original message buffer will not be altered, and the ethernet src address will be set correctly.

Parameters:

  `[in]` | *msgin | message to send

Return values:

  | DESSERT_OK | on success
  | EINVAL | if message is broken
  | EIO | if message was not sent successfully

DESCRIPTION:

int dessert_meshsend_raw | ( | dessert_msg_t * | msg,
|  | const dessert_meshif_t * | iface |
| ) |  |  |

Sends a dessert message msg via the specified interface iface or all interfaces.

This method is faster than dessert_meshsend(), but does not check the message and may alter the message buffer. In contrast to dessert_meshsend_fast() it does not write the ether_shost address.

Parameters:

  `[in]` | *msg | message to send
  `[in]` | *iface | interface to send from

Return values:

  | DESSERT_OK | on success
  | EINVAL | if message is broken
  | EIO | if message was not sent successfully

DESCRIPTION: