Merge "BUG-2218: Keep existing link augmentations during discovery process"
[controller.git] / opendaylight / adsal / sal / api / src / main / java / org / opendaylight / controller / sal / packet / IListenDataPacket.java
1
2 /*
3  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
4  *
5  * This program and the accompanying materials are made available under the
6  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7  * and is available at http://www.eclipse.org/legal/epl-v10.html
8  */
9
10 /**
11  * @file   IListenDataPacket.java
12  *
13  * @brief  Interface a component will need to implement and export as
14  * implemented interface in order to get data packet
15  *
16  * Interface a component will need to implement and export as
17  * implemented interface in order to get data packet
18  */
19
20 package org.opendaylight.controller.sal.packet;
21
22 /**
23  * Interface that all the components that want to receive a dataPacket
24  * need to implement. The interface by itself doesn't specify any
25  * filtering or sequencing mechanism, but the model supported by Data
26  * Packet Service is such that the packets can be processed in two
27  * ways:
28  * - Serial: When a Data Packet Listener gets a packet after another,
29  * this case is necessary when the subsequent handler needs some extra
30  * information that can only be provided by another Data Packet
31  * Service Handler. If the dependent service is missing, then the one
32  * with dependencies will not be invoked. In a serial
33  * processing, a plugin has the the power to prevent the packet to be
34  * seen but other in the chain, if the return result is CONSUMED, else
35  * the packet will go through all the elements in the chain.
36  * - Parallel: When a Data Packet Listener doesn't express any
37  * dependency then it will get a copy of the packet as anybody
38  * else. Practical example, let say we have 2 handlers, both didn't
39  * express any dependency then both will get a copy of any incoming
40  * packet and they cannot step over each other feet.
41  * The Processing model is choosen by the properties with which the
42  * service is registered in the OSGi service registry.
43  * The properties that will be looked at are:
44  * salListenerName: Unique identifier of the SAL Data Packet
45  * Listener
46  * salListenerDependency: A String containing the
47  * salListenerName that consitute a dependency for this Listener, for
48  * now ONLY a SINGLE dependency is supported
49  * salListenerFilter: A Match class to be used to match a DataPacket,
50  * processing either parallel or serial will ONLY continue if the
51  * incoming DataPacket match the filter. If no filter is provided, the
52  * handler is called for EVERY packet i.e. match All is implied!
53  */
54 public interface IListenDataPacket {
55     /**
56      * Handler for receiving the packet. The application can signal
57      * back to SAL if the packet has been consumed or no. In case of
58      * packet consumed SAL will prevent to keep passing to subsequent
59      * listener in the serial chain, but for handlers without
60      * dependency things will keep going .
61      * The packet will received will have the IncomingNodeConnector
62      * set to understand where the packet is coming from
63      *
64      * @param inPkt Packet received
65      *
66      * @return An indication if the packet should still be processed
67      * or we should stop it.
68      */
69     PacketResult receiveDataPacket(RawPacket inPkt);
70 }