blob: a821be58a31f0625a8bf84a0636c5536717de955 [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 */
49 Optional<IpAddress> getDhcpServerIp();
50
51 /**
52 * Gets DHCP gateway IP.
53 *
54 * @return IP address of DHCP gateway; empty value if not exist
Yi Tseng483ac6f2017-08-02 15:03:31 -070055 * @deprecated 1.12 get the address from config service
Yi Tseng51301292017-07-28 13:02:59 -070056 */
Yi Tseng483ac6f2017-08-02 15:03:31 -070057 @Deprecated
Yi Tseng51301292017-07-28 13:02:59 -070058 Optional<IpAddress> getDhcpGatewayIp();
59
60 /**
61 * Gets DHCP connect Mac address.
62 *
63 * @return the connect Mac address of server or gateway
Yi Tseng483ac6f2017-08-02 15:03:31 -070064 * @deprecated 1.12 get host mac from host server
Yi Tseng51301292017-07-28 13:02:59 -070065 */
Yi Tseng483ac6f2017-08-02 15:03:31 -070066 @Deprecated
Yi Tseng51301292017-07-28 13:02:59 -070067 Optional<MacAddress> getDhcpConnectMac();
68
69 /**
70 * Sets DHCP gateway IP.
71 *
72 * @param dhcpGatewayIp the DHCP gateway IP
Yi Tseng483ac6f2017-08-02 15:03:31 -070073 * @deprecated 1.12 use setDefaultDhcpServerConfigs or setindirectDhcpServerConfigs
Yi Tseng51301292017-07-28 13:02:59 -070074 */
Yi Tseng483ac6f2017-08-02 15:03:31 -070075 @Deprecated
Yi Tseng51301292017-07-28 13:02:59 -070076 void setDhcpGatewayIp(IpAddress dhcpGatewayIp);
77
78 /**
79 * Sets DHCP connect vlan.
80 *
81 * @param dhcpConnectVlan the DHCP connect vlan
Yi Tseng483ac6f2017-08-02 15:03:31 -070082 * @deprecated 1.12 use setDefaultDhcpServerConfigs or setindirectDhcpServerConfigs
Yi Tseng51301292017-07-28 13:02:59 -070083 */
Yi Tseng483ac6f2017-08-02 15:03:31 -070084 @Deprecated
Yi Tseng51301292017-07-28 13:02:59 -070085 void setDhcpConnectVlan(VlanId dhcpConnectVlan);
86
87 /**
88 * Sets DHCP connect Mac address.
89 *
90 * @param dhcpConnectMac the connect Mac address
Yi Tseng483ac6f2017-08-02 15:03:31 -070091 * @deprecated 1.12 use setDefaultDhcpServerConfigs or setindirectDhcpServerConfigs
Yi Tseng51301292017-07-28 13:02:59 -070092 */
Yi Tseng483ac6f2017-08-02 15:03:31 -070093 @Deprecated
Yi Tseng51301292017-07-28 13:02:59 -070094 void setDhcpConnectMac(MacAddress dhcpConnectMac);
95
96 /**
97 * Sets DHCP server connect point.
98 *
99 * @param dhcpServerConnectPoint the server connect point
Yi Tseng483ac6f2017-08-02 15:03:31 -0700100 * @deprecated 1.12 use setDefaultDhcpServerConfigs or setindirectDhcpServerConfigs
Yi Tseng51301292017-07-28 13:02:59 -0700101 */
Yi Tseng483ac6f2017-08-02 15:03:31 -0700102 @Deprecated
Yi Tseng51301292017-07-28 13:02:59 -0700103 void setDhcpServerConnectPoint(ConnectPoint dhcpServerConnectPoint);
104
105 /**
106 * Sets DHCP server IP.
107 *
108 * @param dhcpServerIp the DHCP server IP
Yi Tseng483ac6f2017-08-02 15:03:31 -0700109 * @deprecated 1.12 use setDefaultDhcpServerConfigs or setindirectDhcpServerConfigs
Yi Tseng51301292017-07-28 13:02:59 -0700110 */
Yi Tseng483ac6f2017-08-02 15:03:31 -0700111 @Deprecated
Yi Tseng51301292017-07-28 13:02:59 -0700112 void setDhcpServerIp(IpAddress dhcpServerIp);
Yi Tseng483ac6f2017-08-02 15:03:31 -0700113
114 /**
115 * Sets DHCP server config for default case.
116 *
117 * @param configs the config
118 */
119 void setDefaultDhcpServerConfigs(Collection<DhcpServerConfig> configs);
120
121 /**
122 * Sets DHCP server config for indirect case.
123 *
124 * @param configs the config
125 */
126 void setIndirectDhcpServerConfigs(Collection<DhcpServerConfig> configs);
Yi Tseng51301292017-07-28 13:02:59 -0700127}