int bridge_rx_bpdu (UID_MSG_T* msg, size_t msgsize) { register int port_index; STP_IN_rx_bpdu (0, msg->header.destination_port, (BPDU_T*) (msg->body.bpdu + sizeof (MAC_HEADER_T)), msg->header.body_len - sizeof (MAC_HEADER_T)); }
int bridge_rx_bpdu(UID_MSG_T *msg, size_t msgsize) { register int port_index; if (I_am_a_stupid_hub) { // flooding msg->header.sender_pid = my_pid; for (port_index = 1; port_index <= NUMBER_OF_PORTS; port_index++) { if (BitmapGetBit(&enabled_ports, (port_index - 1)) &&msg->header.destination_port != port_index) { msg->header.source_port = port_index; UiD_SocketSendto(&uid_socket, msg, msgsize); } } } else { STP_IN_rx_bpdu(0, msg->header.destination_port, (BPDU_T*)(msg->body.bpdu + sizeof(MAC_HEADER_T)), msg->header.body_len - sizeof(MAC_HEADER_T)); } return 0; }