# software/wrsw_rtud/rtu_fd.h File Reference

`#include "rtu.h"`

Go to the source code of this file.

## Defines

#define | STATIC 0
#define | DYNAMIC 1

## Functions

int | rtu_fd_init (uint16_t poly, unsigned long aging) __attribute__((warn_unused_result))
| Initializes the RTU filtering database.
int | rtu_fd_create_entry (uint8_t mac[ETH_ALEN], uint16_t vid, uint32_t port_map, int dynamic) __attribute__((warn_unused_result))
| Creates or updates a filtering entry in the filtering database.
int | rtu_fd_set_aging_time (unsigned long t) __attribute__((warn_unused_result))
| Sets the aging time for dynamic filtering entries.
void | rtu_fd_set_hash_poly (uint16_t poly)
| Set the polynomial used for hash calculation. Changing the hash polynomial requires removing any existing entry from RTU table. Note in case RTU table becomes full, this function may be used to change hash polynomial (thus leading to a different hash distribution).
void | rtu_fd_flush (void)
| Deletes old filtering entries from filtering database to support changes in active topology.
struct filtering_entry * | rtu_fd_lookup_htab_entry (int index)

## Define Documentation

#define DYNAMIC 1

#define STATIC 0

## Function Documentation

int rtu_fd_create_entry | ( | uint8_t | mac[ETH_ALEN],
|  | uint16_t | vid,
|  | uint32_t | port_map,
|  | int | dynamic
| ) |  |

Creates or updates a filtering entry in the filtering database.

Parameters:

  mac | MAC address specification
  vid | VLAN identifier
  port_map | a port map specification with a control element for each outbound port to specify filtering for that MAC address specification and VID
  dynamic | it indicates whether it's a dynamic entry

Returns:
  0 if entry was created or updated. -ENOMEM if no space is available.

void rtu_fd_flush | ( | void | ) |

Deletes old filtering entries from filtering database to support changes in active topology.

int rtu_fd_init | ( | uint16_t | poly,
|  | unsigned long | aging
| ) |  |

Initializes the RTU filtering database.

Parameters:

  poly | hash polinomial.
  aging | aging time

struct filtering_entry* rtu_fd_lookup_htab_entry | ( | int | index ) | `[read]`

int rtu_fd_set_aging_time | ( | unsigned long | t ) |

Sets the aging time for dynamic filtering entries.

Parameters:

  t | new aging time value [seconds].

Returns:
  -EINVAL if t < 10 or t > 1000000 (802.1Q, Table 8.3); 0 otherwise.

void rtu_fd_set_hash_poly | ( | uint16_t | poly ) |

Set the polynomial used for hash calculation. Changing the hash polynomial requires removing any existing entry from RTU table. Note in case RTU table becomes full, this function may be used to change hash polynomial (thus leading to a different hash distribution).

Parameters:

  poly | binary polynomial representation. CRC-16-CCITT -> 1+x^5+x^12+x^16 -> 0x1021 CRC-16-IBM -> 1+x^2+x^15+x^16 -> 0x8005 CRC-16-DECT -> 1+x^3+x^7+x^8+x^10+x^16 -> 0x0589

All Data Structures Files Functions Variables Defines