Using IP Multicasting With The TMS320C6000 Network Developer's Kit (NDK)
Using IP Multicasting With The TMS320C6000 Network Developer's Kit (NDK)
Using IP Multicasting With The TMS320C6000 Network Developer's Kit (NDK)
ABSTRACT
Contents
1 Overview of Multicasting in IP Networks ......................................................................................2
1.1 Broadcast vs. Multicast and How They are Supported..................................................2
1.2 How Does Multicasting Work?.......................................................................................3
1.3 A Word About Class D Addresses.................................................................................5
1.4 A Word About Multicast Filtering ...................................................................................5
2 TCP/IP Stack Multicast Support.....................................................................................................6
2.1 BSD vs. NDK TCP/IP Stacks.........................................................................................6
2.2 Limitations .....................................................................................................................7
3 Example Applications .....................................................................................................................7
3.1 Installing the Examples..................................................................................................7
3.2 Host Example ................................................................................................................8
3.2.1 Building and Running the Host Example .......................................................................9
3.3 Client Example ..............................................................................................................9
3.3.1 Building and Running the Client Example ...................................................................10
4 Conclusion.....................................................................................................................................11
5 References .....................................................................................................................................11
1
SPRAAI3
Bits
0 6 12 18 24 30 36 42 48
At the transport layer, both broadcast and multicast communications require UDP (User
Datagram Protocol) or raw IP sockets to perform communications, since TCP is a connection-
oriented protocol designed for use in point-to-point communications.
Despite being mandatory in IPv4, broadcast is losing ground to multicast due to its main
disadvantages:
It is limited to LAN environments
It creates an overhead on the network, since every host needs to process the incoming
data, even those that are not designated recipients.
Multicasting, although it is optional in IPv4, has the advantages of being usable in WAN
environments and allowing data transfers to occur selectively in groups of hosts, which
minimizes the processing overhead throughout the network. This is a clear advantage when
multiple clients reply to a single server in a video stream application, for example.
However, since multicast is an optional feature, all the hosts and routers must be specifically
enabled to perform this functionality; fortunately its a common feature nowadays with one
catchalthough multicasting can be used in WAN environments, currently only enterprise
routers implement this feature, and only using proprietary protocols.
To:
source receiving
dest IP = 239.129.1.1
application application
dest port = 5001
non-receiving application port = 5001
join
UDP UDP UDP 239.129.1.1
protocol = UDP
perfect software filtering
IPv4 IPv4 IPv4
based on dest IP address
frame type = 0800 receive
01:00:5e:01:01:01
datalink datalink imperfect hardware filtering datalink
based on dest Enet
00:04:ac:17:bf:38 00:0a:95:79:bc:b4
Similarly, to be able to send data to a multicast group, a host must create a UDP socket with the
same port and group address as the listening socket. The same socket cannot be used to send
and receive packets, since the IP standard forbids packets from having a multicast address as
the source address.
At the network-level, a multicast-enabled router manages groups inside its subnet. Every
multicast-enabled host within that subnet is then able to join groups. The groups can then send
data to all hosts in a group. However, this situation does not occur if every host is directly
connected to an interface port in the router.
Multicast communications can also be shared among peer routers in a WAN environment by
registering groups to the other routers through a Multicast Routing Protocol (MRP). However, as
mentioned before, currently only enterprise routers implement this feature using proprietary
protocols; most off-the-shelf, low-cost routers and gateways do not support it.
In summary, to be able to perform multicast communications a system needs to:
Create the UDP sending socket using the multicast address and the port ID.
Create the UDP receiving socket and bind it to the same address / port combination.
Join the multicast group by sending an IGMP IP packet to the multicast address.
Finally, functions to send data and process received data are tied to the sockets. This is heavily
dependent on the protocol stack used. See Section 2 for details on how to do it with TIs NDK.
Even when using a perfect filtering adapter, filtering is still needed at the IP layer level, since the
translation from the IP multicast address to the Ethernet address is not one-to-onea total of 32
multicast IP addresses are always mapped to the same Ethernet address. In other words, since
each multicast group ID is comprised of 28 bits, but 5 bits are dropped by the adapter, 25 or 32
different addresses share the same 48-bit MAC address, leaving to the IP layer the task of
uniquely identifying each group ID. Support for IP layer filtering started in NDK release 1.92.
32 IP Multicast Addresses
224.1.1.1
224.129.1.1
225.1.1.1 mapped to single Ethernet address
225.129.1.1
.
. 0x0100.5E01.0101
.
238.1.1.1
238.129.1.1
239.1.1.1
239.129.1.1
The following BSD socket options are not currently supported by the NDK:
IP_MULTICAST_LOOP
IP_BLOCK_SOURCE / IP_UNBLOCK_SOURCE
IP_ADD_SOURCE_MEMBERSHIP / IP_DROP_SOURCE_MEMBERSHIP
Note: The sendto() command is used to transfer UDP datagrams. They need a minimum data
size of 8.
2.2 Limitations
Currently the NDK supports membership to only 32 multicast groups. This limits the number of
groups you can tell your multicast router you wish to receive. The limit (32) is also used to
program the EMAC hardware; therefore, this limits the number of incoming multicast addresses.
There is no limit on the number of multicast addresses that can be sent out.
Not all devices supported by the NDK have perfect filtering. They all use a hash table. The 32
multicast address limit is set by the EMAC used on some of these devices. Even EMAC with
perfect filtering would have a fixed limit to the number of addresses.
3 Example Applications
This section describes the example applications provided with this document. One example is a
client-side application that receives UDP datagram packets sent to a multicast address. Another
example is a simulated host application that is responsible for sending UDP packets to the
group. The sections that follow detail both examples, pointing out the APIs and socket calls used
to support multicasting.
Examples for both the host and client applications are provided on all platforms supported by the
NDK. The examples require v1.91 or greater of the NDK to work properly.
The first action performed is to join a multicast group. It then sets up two sockets to send (port
5000) and receive (port 5001) UDP data. After the setup, a data message is sent to the multicast
address using port 5000 every few seconds until a client joins the group and begins receiving the
message. The application then listens on port 5001 for a reply from any client that received the
multicast message.
The client joins a multicast during the IP network setup. The daemon task ( dtask_udp_test)() )
listens on port 5000. Once message is received, it replies to the message on a different port
(5001).
4 Conclusion
Though the TMS320C6000 Network Developers Kit (NDK) doesnt support multicasting in a
traditional BSD socket way, it is possible to support basic multicasting capabilities as illustrated
in the example provided. The NDK supports multicasting from a client perspective only, and is
currently limited to 32 multicast addresses, but future NDK releases will address this limit.
5 References
TMS320C6000 Network Developer's Kit (NDK) Software User's Guide (SPRU523)
Unix Network Programming, Vol. 1: The Sockets Networking API, Third Edition
by W. Richard Stevens, Bill Fenner, and Andrew M. Rudoff. Addison-Wesley Professional
(2003).
Texas Instruments Incorporated and its subsidiaries (TI) reserve the right to make corrections, modifications,
enhancements, improvements, and other changes to its products and services at any time and to
discontinue any product or service without notice. Customers should obtain the latest relevant information
before placing orders and should verify that such information is current and complete. All products are sold
subject to TIs terms and conditions of sale supplied at the time of order acknowledgment.
TI warrants performance of its hardware products to the specifications applicable at the time of sale in
accordance with TIs standard warranty. Testing and other quality control techniques are used to the extent
TI deems necessary to support this warranty. Except where mandated by government requirements, testing
of all parameters of each product is not necessarily performed.
TI assumes no liability for applications assistance or customer product design. Customers are responsible
for their products and applications using TI components. To minimize the risks associated with customer
products and applications, customers should provide adequate design and operating safeguards.
TI does not warrant or represent that any license, either express or implied, is granted under any TI patent
right, copyright, mask work right, or other TI intellectual property right relating to any combination, machine,
or process in which TI products or services are used. Information published by TI regarding third-party
products or services does not constitute a license from TI to use such products or services or a warranty or
endorsement thereof. Use of such information may require a license from a third party under the patents or
other intellectual property of the third party, or a license from TI under the patents or other intellectual
property of TI.
Reproduction of information in TI data books or data sheets is permissible only if reproduction is without
alteration and is accompanied by all associated warranties, conditions, limitations, and notices.
Reproduction of this information with alteration is an unfair and deceptive business practice. TI is not
responsible or liable for such altered documentation.
Resale of TI products or services with statements different from or beyond the parameters stated by TI for
that product or service voids all express and any implied warranties for the associated TI product or service
and is an unfair and deceptive business practice. TI is not responsible or liable for any such statements.
Following are URLs where you can obtain information on other Texas Instruments products and application
solutions:
Products Applications
Amplifiers amplifier.ti.com Audio www.ti.com/audio
Data Converters dataconverter.ti.com Automotive www.ti.com/automotive
DSP dsp.ti.com Broadband www.ti.com/broadband
Interface interface.ti.com Digital Control www.ti.com/digitalcontrol
Logic logic.ti.com Military www.ti.com/military
Power Mgmt power.ti.com Optical Networking www.ti.com/opticalnetwork
Microcontrollers microcontroller.ti.com Security www.ti.com/security
Low Power Wireless www.ti.com/lpw Telephony www.ti.com/telephony
Video & Imaging www.ti.com/video
Wireless www.ti.com/wireless