diff --git a/ethernet/bundle.json b/ethernet/bundle.json new file mode 100644 index 0000000000000000000000000000000000000000..f4b1571b2eb3ad4c4d49f56bd6c37981c45929e2 --- /dev/null +++ b/ethernet/bundle.json @@ -0,0 +1,61 @@ +{ + "name": "@ohos/drivers_interface_ethernet", + "description": "ethernet device driver interface", + "version": "6.0", + "license": "Apache License 2.0", + "publishAs": "code-segment", + "segment": { + "destPath": "drivers/interface/ethernet" + }, + "dirs": {}, + "scripts": {}, + "component": { + "name": "drivers_interface_ethernet", + "subsystem": "hdf", + "adapted_system_type": ["standard"], + "rom": "700KB", + "ram": "1MB", + "deps": { + "components": [ + "ipc", + "hdf_core", + "hilog", + "c_utils" + ], + "third_party": [] + }, + "build": { + "sub_component": [ + "//drivers/interface/ethernet/v1_0:ethernet_idl_target" + ], + "test": [ + ], + "inner_kits": [ + { + "name": "//drivers/interface/ethernet/v1_0:libethernet_proxy_1.0", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/ethernet" + } + }, + { + "name": "//drivers/interface/ethernet/v1_0:ethernet_idl_headers", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/ethernet" + } + }, + { + "name": "//drivers/interface/ethernet/v1_0:libethernet_stub_1.0", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/ethernet" + } + } + ] + } + } +} diff --git a/ethernet/v1_0/BUILD.gn b/ethernet/v1_0/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..ee63aed60ce09ea2c5d15949e9696ca0ff704c6d --- /dev/null +++ b/ethernet/v1_0/BUILD.gn @@ -0,0 +1,33 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/config/components/hdi/hdi.gni") + +if (defined(ohos_lite)) { + group("libethernet_proxy_1.0") { + deps = [] + public_configs = [] + } +} else { + hdi("ethernet") { + module_name = "ethernet_service" + sources = [ + "IEthernetCallback.idl", + "IEthernet.idl", + ] + language = "c" + mode = "ipc" + subsystem_name = "hdf" + part_name = "drivers_interface_ethernet" + } +} diff --git a/ethernet/v1_0/IEthernet.idl b/ethernet/v1_0/IEthernet.idl new file mode 100644 index 0000000000000000000000000000000000000000..cab0aa6da387cdc12d47b7fb5c4f45a7bdfb761d --- /dev/null +++ b/ethernet/v1_0/IEthernet.idl @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Ethernet + * + * @brief Provides APIs for the upper-layer Ethernet service. + * + * You can use the APIs to enable or disable Extensible Authentication Protocol(EAP) via Ethernet. + * + * @since 6.0 + * @version 1.0 + */ + +/** + * @file IEthernet.idl + * + * @brief Provides APIs to enable or disable EAP via Ethernet. + * + * @since 6.0 + * @version 1.0 + */ + +/** + * @brief Defines the package path of the Ethernet module interface. + * + * @since 6.0 + * @version 1.0 + */ +package ohos.hdi.ethernet.v1_0; + +import ohos.hdi.ethernet.v1_0.IEthernetCallback; + +/** + * @brief Defines an interface for the upper-layer Ethernet service. + * + * @since 6.0 + * @version 1.0 + */ +interface IEthernet { + /** + * @brief Creates a channel to start EAP via Ethernet. + * + * @param ifName indicates the interface to start EAP(eg: eth0). + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 6.0 + * @version 1.0 + */ + StartEap([in] String ifName); + + /** + * @brief Destroys the channel to stop EAP via Ethernet. + * + * @param ifName indicates the interface to stop EAP(eg: eth0). + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 6.0 + * @version 1.0 + */ + StopEap([in] String ifName); + + /** + * @brief Registers a callback to listen for asynchronous EAP events. + * + * @param cbFunc Indicates the callback to register. + * @param ifName Indicates the interface name. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 6.0 + * @version 1.0 + */ + RegisterEapEventCallback([in] IEthernetCallback cbFunc, [in] String ifName); + + /** + * @brief Unregisters a callback. + * + * @param cbFunc Indicates the callback to unregister. + * @param ifName Indicates the interface name. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 6.0 + * @version 1.0 + */ + UnregisterEapEventCallback([in] IEthernetCallback cbFunc, [in] String ifName); + + /** + * @brief Send EAP shell command. + * + * @param ifName Indicates the interface name. + * @param cmd Indicates shell command for EAP via Ethernet. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 6.0 + * @version 1.0 + */ + EapShellCmd([in] String ifName, [in] String cmd); +} diff --git a/ethernet/v1_0/IEthernetCallback.idl b/ethernet/v1_0/IEthernetCallback.idl new file mode 100644 index 0000000000000000000000000000000000000000..216a9903878ab11ff1bfd3986128520277f47377 --- /dev/null +++ b/ethernet/v1_0/IEthernetCallback.idl @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Ethernet + * + * @brief Provides APIs for the upper-layer Ethernet service. + * + * You can use the APIs to enable or disable Extensible Authentication Protocol(EAP) via Ethernet. + * + * @since 6.0 + * @version 1.0 + */ + +/** + * @file IEthernetCallback.idl + * + * @brief Provides callbacks to be invoked when EAP event is received. + * + * @since 6.0 + * @version 1.0 + */ + +/** + * @brief Defines the package path of the Ethernet module interface. + * + * @since 6.0 + * @version 1.0 + */ +package ohos.hdi.ethernet.v1_0; + +/** + * @brief Defines the callbacks of EAP event in Ethernet module. + * + * The callback is invoked when EAP event is received. + * + * @since 6.0 + * @version 1.0 + */ +[callback] interface IEthernetCallback { + /** + * Used to handle EAP event callback parameters + * + * @param ifName Indicates the interface name(eg:eth0). + * @param value Indicates EAP event. + * + * @since 6.0 + * @version 1.0 + */ + OnEapEventNotify([in] String ifName, [in] String value); +}