03wireless网络系统

上传人:平*** 文档编号:12960678 上传时间:2017-10-21 格式:DOCX 页数:16 大小:168.62KB
返回 下载 相关 举报
03wireless网络系统_第1页
第1页 / 共16页
03wireless网络系统_第2页
第2页 / 共16页
03wireless网络系统_第3页
第3页 / 共16页
03wireless网络系统_第4页
第4页 / 共16页
03wireless网络系统_第5页
第5页 / 共16页
点击查看更多>>
资源描述

《03wireless网络系统》由会员分享,可在线阅读,更多相关《03wireless网络系统(16页珍藏版)》请在金锄头文库上搜索。

1、linux 无线网络系统Cfg80211下面是网络的对 cfg80211 的描述:cfg80211 is the Linux 802.11 configuration API. cfg80211 replaces Wireless-Extensions. nl80211 is used to configure a cfg80211 device and is used for kernel userspace communication. Wireless extensions is now in maintenance mode, no new features will be added

2、 to it, well only fix bugs for it. cfg80211 is now feature-par complete with wireless-extensions, it actually has a lot more features that are simply not available and will never be available through wireless extensions. When implementing a cfg80211 driver wireless extensions support is still provid

3、ed automatically for you through cfg80211 through CONFIG_CFG80211_WEXT. Distributions no longer needing wireless extensions can remove this and are encouraged to do so. cfg80211 also provides full regulatory support, this is done through wireless-regdb and the usage of CRDA. All new Linux wireless d

4、rivers should be written targeting either cfg80211 for fullmac devices or mac80211 for softmac devices. 参考:http:/wireless.kernel.org/en/developers/Documentation/cfg80211关键数据结构:头文件:Cfg80211.h (includenet):cfg80211 is the configuration API for 802.11 devices in Linux. It bridges userspace and drivers,

5、 and offers some utility functionality associated with 802.11Core.h (netwireless):Wireless configuration interface internals.Nl80211.h (includelinux):定义的 netlink 接口函数(接收 netlink 命令,发送 netlink 事件)Regulatory.h (includenet):regulatory support structures。数据结构:struct cfg80211_registered_device :设备注册的时用,包

6、含注册的 struct cfg80211_ops,供上层应用通过 nl80211_ops 供上层应用调用.包含了 struct wiphy 结构实体。struct net_device :The DEVICE structure,网络设备结构,网卡名,包含了共享内核资源,中断号,网卡操作函数接口:(struct net_device_ops *netdev_ops,struct ethtool_ops *ethtool_ops, ) ,设备地址,广播地址, net_namespace, sys 文件结构,协议相关设备(struct wireless_dev,struct in_device,s

7、truct inet6_dev) 。等等struct wireless_dev :wireless device state:包含 struct wiphy,接口类型(AP.STA,AD-HOC,P2P-GO, P2P-GC,) ,网络设备指针(struct net_device*) ,SME 状态,ssid,支持的信道类型(enum nl80211_channel_type) ,cfg80211 连接状态(struct cfg80211_conn) ,struct wiphy:wireless hardware description。定义在 Cfg80211.h (includenet),

8、struct cfg80211_ops mac80211_config_ops:无线设备驱动需要实现的函数功能,在cfg80211 驱动层通过 struct genl_ops nl80211_ops供调用。struct genl_ops nl80211_ops:通过 genl_register_family_with_ops 函数注册的 netlink 接口操作数组。接收 wpa_supplicant 下发的命令。struct ieee80211_ops:具体芯片驱动实现的功能,如 TI 驱动为:struct ieee80211_ops wl1271_ops。Cfg80211 注册的 clas

9、s参考代码:static struct device_attribute ieee80211_dev_attrs = _ATTR_RO(index),_ATTR_RO(macaddress),_ATTR_RO(address_mask),_ATTR_RO(addresses),_ATTR_RO(name),;struct class ieee80211_class = .name = ieee80211,.owner = THIS_MODULE,.dev_release = wiphy_dev_release,.dev_attrs = ieee80211_dev_attrs,#ifdef CO

10、NFIG_HOTPLUG.dev_uevent = wiphy_uevent,#endif.suspend = wiphy_suspend,.resume = wiphy_resume,.ns_type = &net_ns_type_operations,.namespace = wiphy_namespace,;int wiphy_sysfs_init(void)return class_register(&ieee80211_class);注册 class:是为了绑定无线网络设备与 cfg80211 关系。参考 sysfs 中 class 的作用:根据device 类型来区分。struct

11、 class ieee80211_class 的属性在具体的设备中生效这里生效的是底层调用了 struct wiphy *wiphy_new()函数来实现的。#define PHY_NAME phystruct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv)static int wiphy_counter;rdev = kzalloc(alloc_size, GFP_KERNEL);dev_set_name(&rdev-wiphy.dev, PHY_NAME %d, rdev-wiphy_idx);device

12、_initialize(&rdev-wiphy.dev);rdev-wiphy.dev.class = &ieee80211_class;rdev-wiphy.dev.platform_data = rdev;return &rdev-wiphy;而 wiphy_new 可以在 mac80211 模块(soft MAC)或者无线网卡驱动 (full MAC)调用。下面分别以博通芯片为例说明:soft MAC 和 full MAC 的调用过程。Cfg80211 通信接口1. struct cfg80211_ops :backend description for wireless configu

13、ration。通过 struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv)来注册。一般是通过 mac80211(soft MAC)或者是设备驱动直接调用来注册的函数接口。2. struct class ieee80211_class = .name = ieee80211,.dev_attrs = ieee80211_dev_attrs,.ns_type = &net_ns_type_operations,.namespace = wiphy_namespace,; Sysfs 文件系统,组织设备类的通用

14、接口函数。为用户空间提供接口。3. static struct genl_ops nl80211_ops :用与接收用户层的 netlink command,对应wpa_supplicant drivers_nl80211.c 中的函数接口。4. static int cfg80211_netdev_notifier_call(struct notifier_block *nb, unsigned long state, void *ndev):用于监听底层上报的 event5. struct notifier_block nl80211_netlink_notifier:接收底层6. int

15、 genlmsg_unicast(struct net *net, struct sk_buff *skb, u32 pid):发送 nlmsg 给上层应用int genlmsg_multicast_netns(struct net *net, struct sk_buff *skb, u32 pid, unsigned int group, gfp_t flags)7.数据帧的传输(这里包括控制帧,管理帧,数据帧)发送:probe request, probe response;authentication request, authentication response; associat

16、ion request, association response;实际发送的帧:deauthenticate;disassociate;authenticate;associate;数据帧接收的帧:Regulatory domain:参考:http:/wireless.kernel.org/en/developers/RegulatoryRegulatory.txt (documentationnetworking)目前支持两种方式:1. Keeping regulatory domains in userspaceusing the CRDA package provided with their distribution,Essentially the kernel will send a udev event when it knows it needs a new regulatory domain. A udev rule can b

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 行业资料 > 其它行业文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号