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 | */ |
| 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 Tseng | 483ac6f | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 55 | * @deprecated 1.12 get the address from config service |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 56 | */ |
Yi Tseng | 483ac6f | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 57 | @Deprecated |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 58 | Optional<IpAddress> getDhcpGatewayIp(); |
| 59 | |
| 60 | /** |
| 61 | * Gets DHCP connect Mac address. |
| 62 | * |
| 63 | * @return the connect Mac address of server or gateway |
Yi Tseng | 483ac6f | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 64 | * @deprecated 1.12 get host mac from host server |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 65 | */ |
Yi Tseng | 483ac6f | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 66 | @Deprecated |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 67 | Optional<MacAddress> getDhcpConnectMac(); |
| 68 | |
| 69 | /** |
| 70 | * Sets DHCP gateway IP. |
| 71 | * |
| 72 | * @param dhcpGatewayIp the DHCP gateway IP |
Yi Tseng | 483ac6f | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 73 | * @deprecated 1.12 use setDefaultDhcpServerConfigs or setindirectDhcpServerConfigs |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 74 | */ |
Yi Tseng | 483ac6f | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 75 | @Deprecated |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 76 | void setDhcpGatewayIp(IpAddress dhcpGatewayIp); |
| 77 | |
| 78 | /** |
| 79 | * Sets DHCP connect vlan. |
| 80 | * |
| 81 | * @param dhcpConnectVlan the DHCP connect vlan |
Yi Tseng | 483ac6f | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 82 | * @deprecated 1.12 use setDefaultDhcpServerConfigs or setindirectDhcpServerConfigs |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 83 | */ |
Yi Tseng | 483ac6f | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 84 | @Deprecated |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 85 | void setDhcpConnectVlan(VlanId dhcpConnectVlan); |
| 86 | |
| 87 | /** |
| 88 | * Sets DHCP connect Mac address. |
| 89 | * |
| 90 | * @param dhcpConnectMac the connect Mac address |
Yi Tseng | 483ac6f | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 91 | * @deprecated 1.12 use setDefaultDhcpServerConfigs or setindirectDhcpServerConfigs |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 92 | */ |
Yi Tseng | 483ac6f | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 93 | @Deprecated |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 94 | void setDhcpConnectMac(MacAddress dhcpConnectMac); |
| 95 | |
| 96 | /** |
| 97 | * Sets DHCP server connect point. |
| 98 | * |
| 99 | * @param dhcpServerConnectPoint the server connect point |
Yi Tseng | 483ac6f | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 100 | * @deprecated 1.12 use setDefaultDhcpServerConfigs or setindirectDhcpServerConfigs |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 101 | */ |
Yi Tseng | 483ac6f | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 102 | @Deprecated |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 103 | void setDhcpServerConnectPoint(ConnectPoint dhcpServerConnectPoint); |
| 104 | |
| 105 | /** |
| 106 | * Sets DHCP server IP. |
| 107 | * |
| 108 | * @param dhcpServerIp the DHCP server IP |
Yi Tseng | 483ac6f | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 109 | * @deprecated 1.12 use setDefaultDhcpServerConfigs or setindirectDhcpServerConfigs |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 110 | */ |
Yi Tseng | 483ac6f | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 111 | @Deprecated |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 112 | void setDhcpServerIp(IpAddress dhcpServerIp); |
Yi Tseng | 483ac6f | 2017-08-02 15:03:31 -0700 | [diff] [blame] | 113 | |
| 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 Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 127 | } |