The method and the apparatus for processing and forwarding data packets (pkt)
in a computer network comprise at least one route table that contains entries each
having an input index field (s-in), an operation code or a program (op) for the
execution of an operation and an output selector field (s-out). The data packets
(pkt) to be processed are each assigned a selector (sel) serving as indexing datum,
the data packet (pkt) and the selector (sel) together constituting a token. The
selector (sel) of a packet is matched with the input index field (s-in) of the
entries of the at least one route table and the operation (op) contained in the
matched route table entry or route table entries is/are executed on the matched
token. This processing step can be repeated if the operation (op) results in one
or more output token/tokens. Since according to the invention, programs to be executed
on data packets (pkt) are stored in the route table, data packets (pkt) are directly
processed in the fast data path, while at the same time the router can be dynamically reprogrammed.