The most elemental task of a Spanning Tree Bridge is to control the forwarding state of each port. The bridge evaluates the information received from its immediate neighbors in the form of BPDUs, along with its own configured information. From this information a root is elected and then port roles may be selected for each port. For the root port and designated ports the desired state is forwarding. These ports will become forwarding by subsequent exchange of BPDUs or through the expiration of protocol timers according to the state machines defined by the Spanning Tree Protocol. The remaining ports will become discarding (shorthand for the states of blocking, listening, and learning).
To facilitate this process, the bridge transmits BPDUs out each port on a periodic basis as well as in response to events such as changes in port operational status, configuration changes, timer expiration, and changes in topology derived from received BPDUs.