blob: 7f5dd46e7551d2965af60c18f0242dacac5ebb56 [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;
Yi Tseng483ac6f2017-08-02 15:03:31 -070024import org.onosproject.dhcprelay.config.DhcpServerConfig;
Yi Tseng51301292017-07-28 13:02:59 -070025import org.onosproject.net.ConnectPoint;
26import org.onosproject.net.packet.PacketContext;
27
Yi Tseng483ac6f2017-08-02 15:03:31 -070028import java.util.Collection;
Yi Tseng51301292017-07-28 13:02:59 -070029import java.util.Optional;
30
31/**
32 * DHCP relay handler.
33 */
34public interface DhcpHandler {
35 /**
36 * Process the DHCP packet before sending to server or client.
37 *
38 * @param context the packet context
39 * @param dhcpPayload the DHCP payload
40 */
41 void processDhcpPacket(PacketContext context, BasePacket dhcpPayload);
42
43 /**
44 * Gets DHCP server IP.
45 *
46 * @return IP address of DHCP server; empty value if not exist
Yi Tseng483ac6f2017-08-02 15:03:31 -070047 * @deprecated 1.12 get the address from config service
Yi Tseng51301292017-07-28 13:02:59 -070048 */
Yi Tseng4f2a0462017-08-31 11:21:00 -070049 @Deprecated
Yi Tseng51301292017-07-28 13:02:59 -070050 Optional<IpAddress> getDhcpServerIp();
51
52 /**
53 * Gets DHCP gateway IP.
54 *
55 * @return IP address of DHCP gateway; empty value if not exist
Yi Tseng483ac6f2017-08-02 15:03:31 -070056 * @deprecated 1.12 get the address from config service
Yi Tseng51301292017-07-28 13:02:59 -070057 */
Yi Tseng483ac6f2017-08-02 15:03:31 -070058 @Deprecated
Yi Tseng51301292017-07-28 13:02:59 -070059 Optional<IpAddress> getDhcpGatewayIp();
60
61 /**
62 * Gets DHCP connect Mac address.
63 *
64 * @return the connect Mac address of server or gateway
Yi Tseng4f2a0462017-08-31 11:21:00 -070065 * @deprecated 1.12 get host mac from host service
Yi Tseng51301292017-07-28 13:02:59 -070066 */
Yi Tseng483ac6f2017-08-02 15:03:31 -070067 @Deprecated
Yi Tseng51301292017-07-28 13:02:59 -070068 Optional<MacAddress> getDhcpConnectMac();
69
70 /**
71 * Sets DHCP gateway IP.
72 *
73 * @param dhcpGatewayIp the DHCP gateway IP
Yi Tseng483ac6f2017-08-02 15:03:31 -070074 * @deprecated 1.12 use setDefaultDhcpServerConfigs or setindirectDhcpServerConfigs
Yi Tseng51301292017-07-28 13:02:59 -070075 */
Yi Tseng483ac6f2017-08-02 15:03:31 -070076 @Deprecated
Yi Tseng51301292017-07-28 13:02:59 -070077 void setDhcpGatewayIp(IpAddress dhcpGatewayIp);
78
79 /**
80 * Sets DHCP connect vlan.
81 *
82 * @param dhcpConnectVlan the DHCP connect vlan
Yi Tseng483ac6f2017-08-02 15:03:31 -070083 * @deprecated 1.12 use setDefaultDhcpServerConfigs or setindirectDhcpServerConfigs
Yi Tseng51301292017-07-28 13:02:59 -070084 */
Yi Tseng483ac6f2017-08-02 15:03:31 -070085 @Deprecated
Yi Tseng51301292017-07-28 13:02:59 -070086 void setDhcpConnectVlan(VlanId dhcpConnectVlan);
87
88 /**
89 * Sets DHCP connect Mac address.
90 *
91 * @param dhcpConnectMac the connect Mac address
Yi Tseng483ac6f2017-08-02 15:03:31 -070092 * @deprecated 1.12 use setDefaultDhcpServerConfigs or setindirectDhcpServerConfigs
Yi Tseng51301292017-07-28 13:02:59 -070093 */
Yi Tseng483ac6f2017-08-02 15:03:31 -070094 @Deprecated
Yi Tseng51301292017-07-28 13:02:59 -070095 void setDhcpConnectMac(MacAddress dhcpConnectMac);
96
97 /**
98 * Sets DHCP server connect point.
99 *
100 * @param dhcpServerConnectPoint the server connect point
Yi Tseng483ac6f2017-08-02 15:03:31 -0700101 * @deprecated 1.12 use setDefaultDhcpServerConfigs or setindirectDhcpServerConfigs
Yi Tseng51301292017-07-28 13:02:59 -0700102 */
Yi Tseng483ac6f2017-08-02 15:03:31 -0700103 @Deprecated
Yi Tseng51301292017-07-28 13:02:59 -0700104 void setDhcpServerConnectPoint(ConnectPoint dhcpServerConnectPoint);
105
106 /**
107 * Sets DHCP server IP.
108 *
109 * @param dhcpServerIp the DHCP server IP
Yi Tseng483ac6f2017-08-02 15:03:31 -0700110 * @deprecated 1.12 use setDefaultDhcpServerConfigs or setindirectDhcpServerConfigs
Yi Tseng51301292017-07-28 13:02:59 -0700111 */
Yi Tseng483ac6f2017-08-02 15:03:31 -0700112 @Deprecated
Yi Tseng51301292017-07-28 13:02:59 -0700113 void setDhcpServerIp(IpAddress dhcpServerIp);
Yi Tseng483ac6f2017-08-02 15:03:31 -0700114
115 /**
116 * Sets DHCP server config for default case.
117 *
118 * @param configs the config
119 */
120 void setDefaultDhcpServerConfigs(Collection<DhcpServerConfig> configs);
121
122 /**
123 * Sets DHCP server config for indirect case.
124 *
125 * @param configs the config
126 */
127 void setIndirectDhcpServerConfigs(Collection<DhcpServerConfig> configs);
Yi Tseng51301292017-07-28 13:02:59 -0700128}