Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core.app: support link-specific push methods
An app's link() method is now called with four arguments: mode, direction, name and link. Mode is either 'link' or 'unlink', direction is either 'input' or 'output', name is the name of the link link and link is the link object itself. This allows the app to perform link-specific actions. The breathe_push_order array is organized such that the dispatcher in the breathe() loop calls each app once for each of its input links. Since the link is known when constructing the array, it can be passed to the push() method, which may use it to narrow the processing of incoming packets to that specific link. If the mode is 'link' and direction is 'input', the link() method may return two optional objects, a method and an arbitrary argument. If a method is given, it is called by the dispatcher in the breathe() loop instead of the regular push() method for this particular link. Apart from the link in question, the dispatcher also passes the argument to the method. The argument is private to the app and is treated as an opaque object by the dispatcher. An app may also define link-specific push methods by using the naming convention 'push_<linkname>', where <linkname> is the name of the input link. If such a method exists, it is preferred over the regular push() method for that link by the dispatcher. The method returned by link(), if supplied, takes precedence over the name-based push method.
- Loading branch information