blob: d015532be6a181c69db3ad6d9b11bcca5c0b1e59 [file] [log] [blame]
Yi Tseng51301292017-07-28 13:02:59 -07001/*
2 * Copyright 2017-present Open Networking Foundation
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 */
17
18package org.onosproject.dhcprelay.api;
19
20import org.onlab.packet.BasePacket;
21import org.onlab.packet.IpAddress;
22import org.onlab.packet.MacAddress;
23import org.onlab.packet.VlanId;
24import org.onosproject.net.ConnectPoint;
25import org.onosproject.net.packet.PacketContext;
26
27import java.util.Optional;
28
29/**
30 * DHCP relay handler.
31 */
32public interface DhcpHandler {
33 /**
34 * Process the DHCP packet before sending to server or client.
35 *
36 * @param context the packet context
37 * @param dhcpPayload the DHCP payload
38 */
39 void processDhcpPacket(PacketContext context, BasePacket dhcpPayload);
40
41 /**
42 * Gets DHCP server IP.
43 *
44 * @return IP address of DHCP server; empty value if not exist
45 */
46 Optional<IpAddress> getDhcpServerIp();
47
48 /**
49 * Gets DHCP gateway IP.
50 *
51 * @return IP address of DHCP gateway; empty value if not exist
52 */
53 Optional<IpAddress> getDhcpGatewayIp();
54
55 /**
56 * Gets DHCP connect Mac address.
57 *
58 * @return the connect Mac address of server or gateway
59 */
60 Optional<MacAddress> getDhcpConnectMac();
61
62 /**
63 * Sets DHCP gateway IP.
64 *
65 * @param dhcpGatewayIp the DHCP gateway IP
66 */
67 void setDhcpGatewayIp(IpAddress dhcpGatewayIp);
68
69 /**
70 * Sets DHCP connect vlan.
71 *
72 * @param dhcpConnectVlan the DHCP connect vlan
73 */
74 void setDhcpConnectVlan(VlanId dhcpConnectVlan);
75
76 /**
77 * Sets DHCP connect Mac address.
78 *
79 * @param dhcpConnectMac the connect Mac address
80 */
81 void setDhcpConnectMac(MacAddress dhcpConnectMac);
82
83 /**
84 * Sets DHCP server connect point.
85 *
86 * @param dhcpServerConnectPoint the server connect point
87 */
88 void setDhcpServerConnectPoint(ConnectPoint dhcpServerConnectPoint);
89
90 /**
91 * Sets DHCP server IP.
92 *
93 * @param dhcpServerIp the DHCP server IP
94 */
95 void setDhcpServerIp(IpAddress dhcpServerIp);
96}