1 /* 2 * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 3 * 4 * HDF is dual licensed: you can use it either under the terms of 5 * the GPL, or the BSD license, at your option. 6 * See the LICENSE file in the root of this repository for complete details. 7 */ 8 9 #ifndef HDF_NET_DEVICE_IMPL_MODULE_H 10 #define HDF_NET_DEVICE_IMPL_MODULE_H 11 12 #include "net_device.h" 13 14 #define MAX_NETDEVICE_COUNT 20 15 16 struct NetDeviceImpl { 17 struct NetDevice *netDevice; 18 struct NetDeviceImplOp *interFace; 19 void *osPrivate; 20 }; 21 typedef enum { 22 NO_IN_INTERRUPT, 23 IN_INTERRUPT, 24 MAX_RECEIVE_FLAG 25 } ReceiveFlag; 26 27 struct NetDeviceImplOp { 28 int32_t (*init)(struct NetDeviceImpl *netDevice); 29 int32_t (*deInit)(struct NetDeviceImpl *netDevice); 30 int32_t (*add)(struct NetDeviceImpl *netDevice); 31 int32_t (*delete)(struct NetDeviceImpl *netDevice); 32 int32_t (*setStatus)(struct NetDeviceImpl *netDevice, NetIfStatus status); 33 int32_t (*setLinkStatus)(struct NetDeviceImpl *netDevice, NetIfLinkStatus status); 34 int32_t (*getLinkStatus)(struct NetDeviceImpl *netDevice, NetIfLinkStatus *status); 35 int32_t (*receive)(struct NetDeviceImpl *netDevice, NetBuf *buff, ReceiveFlag flag); 36 int32_t (*setIpAddr)(struct NetDeviceImpl *netDevice, const IpV4Addr *ipAddr, const IpV4Addr *netMask, 37 const IpV4Addr *gw); 38 int32_t (*dhcpsStart)(struct NetDeviceImpl *netDevice, char *ip, uint16_t ipNum); 39 int32_t (*dhcpsStop)(struct NetDeviceImpl *netDevice); 40 int32_t (*dhcpStart)(struct NetDeviceImpl *netDevice); 41 int32_t (*dhcpStop)(struct NetDeviceImpl *netDevice); 42 int32_t (*dhcpIsBound)(struct NetDeviceImpl *netDevice); 43 int32_t (*changeMacAddr)(struct NetDeviceImpl *netDevice); 44 }; 45 46 #endif /* HDF_NET_DEVICE_IMPL_MODULE_H */