blob: f498f17e8d1ed2cb3e53cc5eb2af70a2a46c82e6 [file] [log] [blame]
Jonathan Hart06e89082016-08-08 17:21:01 -07001/*
2 * Copyright 2016-present Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package org.onosproject.incubator.net.neighbour;
18
19import com.google.common.annotations.Beta;
20import org.onlab.packet.Ethernet;
21import org.onlab.packet.IpAddress;
22import org.onlab.packet.MacAddress;
23import org.onlab.packet.VlanId;
24import org.onosproject.incubator.net.intf.Interface;
25import org.onosproject.net.ConnectPoint;
26
Jonathan Hart06e89082016-08-08 17:21:01 -070027/**
28 * Context of an incoming neighbor message (e.g. ARP, NDP).
29 *
30 * <p>This includes information about the message accessible through a
31 * protocol-agnostic interface, as well as mechanisms to perform an action in
32 * response to the incoming message.</p>
33 */
34@Beta
Jonathan Hart9bdaaec2016-08-22 13:33:45 -070035public interface NeighbourMessageContext {
Jonathan Hart06e89082016-08-08 17:21:01 -070036 /**
37 * Gets the port where the packet came in to the network.
38 *
39 * @return connect point
40 */
Jonathan Hart9bdaaec2016-08-22 13:33:45 -070041 ConnectPoint inPort();
Jonathan Hart06e89082016-08-08 17:21:01 -070042
43 /**
44 * Gets the full parsed representation of the packet.
45 *
46 * @return ethernet header
47 */
Jonathan Hart9bdaaec2016-08-22 13:33:45 -070048 Ethernet packet();
Jonathan Hart06e89082016-08-08 17:21:01 -070049
50 /**
51 * Gets the protocol of the packet.
52 *
53 * @return protocol
54 */
Jonathan Hart9bdaaec2016-08-22 13:33:45 -070055 NeighbourProtocol protocol();
Jonathan Hart06e89082016-08-08 17:21:01 -070056
57 /**
58 * Gets the message type of the packet.
59 *
60 * @return message type
61 */
Jonathan Hart9bdaaec2016-08-22 13:33:45 -070062 NeighbourMessageType type();
Jonathan Hart06e89082016-08-08 17:21:01 -070063
64 /**
65 * Gets the vlan of the packet, if any.
66 *
67 * @return vlan
68 */
Jonathan Hart9bdaaec2016-08-22 13:33:45 -070069 VlanId vlan();
Jonathan Hart06e89082016-08-08 17:21:01 -070070
71 /**
72 * Gets the source MAC address of the message.
73 *
74 * @return source MAC address
75 */
Jonathan Hart9bdaaec2016-08-22 13:33:45 -070076 MacAddress srcMac();
Jonathan Hart06e89082016-08-08 17:21:01 -070077
78 /**
79 * Gets the target IP address of the message.
80 *
81 * @return target IP address
82 */
Jonathan Hart9bdaaec2016-08-22 13:33:45 -070083 IpAddress target();
Jonathan Hart06e89082016-08-08 17:21:01 -070084
85 /**
86 * Gets the source IP address of the message.
87 *
88 * @return source IP address
89 */
Jonathan Hart9bdaaec2016-08-22 13:33:45 -070090 IpAddress sender();
Jonathan Hart06e89082016-08-08 17:21:01 -070091
92 /**
93 * Proxies the message to a given output port.
94 *
95 * @param outPort output port
96 */
Jonathan Hart9bdaaec2016-08-22 13:33:45 -070097 void proxy(ConnectPoint outPort);
Jonathan Hart06e89082016-08-08 17:21:01 -070098
99 /**
100 * Proxies the message to a given interface.
101 *
102 * @param outIntf output interface
103 */
Jonathan Hart9bdaaec2016-08-22 13:33:45 -0700104 void proxy(Interface outIntf);
Jonathan Hart06e89082016-08-08 17:21:01 -0700105
106 /**
107 * Replies to the request message with a given MAC address.
108 *
109 * @param targetMac target MAC address
110 */
Jonathan Hart9bdaaec2016-08-22 13:33:45 -0700111 void reply(MacAddress targetMac);
Jonathan Hart06e89082016-08-08 17:21:01 -0700112
113 /**
114 * Floods the incoming message out all ports except the input port.
115 */
Jonathan Hart9bdaaec2016-08-22 13:33:45 -0700116 void flood();
Jonathan Hart06e89082016-08-08 17:21:01 -0700117
118 /**
119 * Drops the incoming message.
120 */
Jonathan Hart9bdaaec2016-08-22 13:33:45 -0700121 void drop();
Jonathan Hart06e89082016-08-08 17:21:01 -0700122}