A uniform method for implementing multiple tunneling protocols in a switch
or router is disclosed. The method is based on the realization that
although the tunneling protocols are very different, they do share a
similar overall structure which can be exploited to create a unified
method of dealing with multiple protocols. By using similar data
structures to implement multiple protocols, the invention makes data
management and programming simple and, therefore, cost effective.
According to the invention, all tunneling protocols are abstracted as the
mapping of input L2 or L3 streams with output L2 or L3 streams. Mapping
is provided by a finite set of tunnel interfaces. The tunnel interfaces
map the input streams to output interfaces. As traffic streams flow
through these interfaces, they are processed according to defined
attributes of these interfaces.