Task #1189
Updated by Junxiao Shi over 10 years ago
Implement UdpChannelFactory, UdpChannel, and UdpFace. **UdpChannelFactory** can * create a UdpChannel for unicast communication on a local endpoint If a UdpChannel with the same local endpoint exists, that one should be returned. * create a UdpFace for multicast communication on a multicast group and port number via a local NIC Only IPv4 multicast is supported. If a multicast-UdpFace of the same multicast group, port number, and local NIC exists, that one should be returned. A local port number can be used to create either one or more unicast channel with different local IPs, or one or more multicast faces on different NICs. Creation should fail on violation of this rule. **UdpChannel** represents a local endpoint (IP:port tuple). It can * create a UdpFace for unicast communication with one remote endpoint If a unicast-UdpFace with the same remote endpoint exists, that one should be returned. * listen on the local endpoint for incoming packets not received by unicast-UdpFace, and create new unicast-UdpFace for new remote endpoint UdpChannel should have a socket *bind(2)* to local endpoint but without *connect(2)* for this purpose. **UdpFace** represents either a point-to-point tunnel (unicast) or a broadcast tunnel (multicast). A unicast-UdpFace should have a socket that is *bind(2)* to local endpoint and *connect(2)* to remote endpoint, so that kernel will dispatch incoming packets from the specific remote endpoint to this socket. A multicast-UdpFace should have one or two sockets as necessary to receive packets sent to the specific multicast group and port number via the specific local NIC, and to send packets to the specific multicast group and port number via the specific local NIC.