Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 18 | package org.onosproject.dhcprelay.api; |
| 19 | |
| 20 | import org.onlab.packet.BasePacket; |
| 21 | import org.onlab.packet.IpAddress; |
| 22 | import org.onlab.packet.MacAddress; |
| 23 | import org.onlab.packet.VlanId; |
Yi Tseng | 483ac6f | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 24 | import org.onosproject.dhcprelay.config.DhcpServerConfig; |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 25 | import org.onosproject.net.ConnectPoint; |
| 26 | import org.onosproject.net.packet.PacketContext; |
| 27 | |
Yi Tseng | 483ac6f | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 28 | import java.util.Collection; |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 29 | import java.util.Optional; |
| 30 | |
| 31 | /** |
| 32 | * DHCP relay handler. |
| 33 | */ |
| 34 | public 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 Tseng | 483ac6f | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 47 | * @deprecated 1.12 get the address from config service |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 48 | */ |
Yi Tseng | 4f2a046 | 2017-08-31 11:21:00 -0700 | [diff] [blame^] | 49 | @Deprecated |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 50 | Optional<IpAddress> getDhcpServerIp(); |
| 51 | |
| 52 | /** |
| 53 | * Gets DHCP gateway IP. |
| 54 | * |
| 55 | * @return IP address of DHCP gateway; empty value if not exist |
Yi Tseng | 483ac6f | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 56 | * @deprecated 1.12 get the address from config service |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 57 | */ |
Yi Tseng | 483ac6f | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 58 | @Deprecated |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 59 | Optional<IpAddress> getDhcpGatewayIp(); |
| 60 | |
| 61 | /** |
| 62 | * Gets DHCP connect Mac address. |
| 63 | * |
| 64 | * @return the connect Mac address of server or gateway |
Yi Tseng | 4f2a046 | 2017-08-31 11:21:00 -0700 | [diff] [blame^] | 65 | * @deprecated 1.12 get host mac from host service |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 66 | */ |
Yi Tseng | 483ac6f | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 67 | @Deprecated |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 68 | Optional<MacAddress> getDhcpConnectMac(); |
| 69 | |
| 70 | /** |
| 71 | * Sets DHCP gateway IP. |
| 72 | * |
| 73 | * @param dhcpGatewayIp the DHCP gateway IP |
Yi Tseng | 483ac6f | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 74 | * @deprecated 1.12 use setDefaultDhcpServerConfigs or setindirectDhcpServerConfigs |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 75 | */ |
Yi Tseng | 483ac6f | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 76 | @Deprecated |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 77 | void setDhcpGatewayIp(IpAddress dhcpGatewayIp); |
| 78 | |
| 79 | /** |
| 80 | * Sets DHCP connect vlan. |
| 81 | * |
| 82 | * @param dhcpConnectVlan the DHCP connect vlan |
Yi Tseng | 483ac6f | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 83 | * @deprecated 1.12 use setDefaultDhcpServerConfigs or setindirectDhcpServerConfigs |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 84 | */ |
Yi Tseng | 483ac6f | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 85 | @Deprecated |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 86 | void setDhcpConnectVlan(VlanId dhcpConnectVlan); |
| 87 | |
| 88 | /** |
| 89 | * Sets DHCP connect Mac address. |
| 90 | * |
| 91 | * @param dhcpConnectMac the connect Mac address |
Yi Tseng | 483ac6f | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 92 | * @deprecated 1.12 use setDefaultDhcpServerConfigs or setindirectDhcpServerConfigs |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 93 | */ |
Yi Tseng | 483ac6f | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 94 | @Deprecated |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 95 | void setDhcpConnectMac(MacAddress dhcpConnectMac); |
| 96 | |
| 97 | /** |
| 98 | * Sets DHCP server connect point. |
| 99 | * |
| 100 | * @param dhcpServerConnectPoint the server connect point |
Yi Tseng | 483ac6f | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 101 | * @deprecated 1.12 use setDefaultDhcpServerConfigs or setindirectDhcpServerConfigs |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 102 | */ |
Yi Tseng | 483ac6f | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 103 | @Deprecated |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 104 | void setDhcpServerConnectPoint(ConnectPoint dhcpServerConnectPoint); |
| 105 | |
| 106 | /** |
| 107 | * Sets DHCP server IP. |
| 108 | * |
| 109 | * @param dhcpServerIp the DHCP server IP |
Yi Tseng | 483ac6f | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 110 | * @deprecated 1.12 use setDefaultDhcpServerConfigs or setindirectDhcpServerConfigs |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 111 | */ |
Yi Tseng | 483ac6f | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 112 | @Deprecated |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 113 | void setDhcpServerIp(IpAddress dhcpServerIp); |
Yi Tseng | 483ac6f | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 114 | |
| 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 Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 128 | } |