⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 p80211meta.c

📁 对于无线网卡采用prism芯片的linux的开源驱动.
💻 C
📖 第 1 页 / 共 2 页
字号:
/* src/shared/p80211meta.c** Defines the functions for handling mib and msg metadata** Copyright (C) 1999 AbsoluteValue Systems, Inc.  All Rights Reserved.* --------------------------------------------------------------------** linux-wlan**   The contents of this file are subject to the Mozilla Public*   License Version 1.1 (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.mozilla.org/MPL/**   Software distributed under the License is distributed on an "AS*   IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or*   implied. See the License for the specific language governing*   rights and limitations under the License.**   Alternatively, the contents of this file may be used under the*   terms of the GNU Public License version 2 (the "GPL"), in which*   case the provisions of the GPL are applicable instead of the*   above.  If you wish to allow the use of your version of this file*   only under the terms of the GPL and not to allow others to use*   your version of this file under the MPL, indicate your decision*   by deleting the provisions above and replace them with the notice*   and other provisions required by the GPL.  If you do not delete*   the provisions above, a recipient may use your version of this*   file under either the MPL or the GPL.** --------------------------------------------------------------------** Inquiries regarding the linux-wlan Open Source project can be* made directly to:** AbsoluteValue Systems Inc.* info@linux-wlan.com* http://www.linux-wlan.com** --------------------------------------------------------------------** Portions of the development of this software were funded by * Intersil Corporation as part of PRISM(R) chipset product development.** --------------------------------------------------------------------* This file defines the metadata for both mib and message contents and* argument metadata.** --------------------------------------------------------------------*//*================================================================*//* System Includes */#include <stdio.h>#include <stdlib.h>#include <string.h>/*================================================================*//* Project Includes */#include <wlan/wlan_compat.h>#include <wlan/p80211types.h>#include <wlan/p80211meta.h>/*================================================================*//* Local Constants *//*================================================================*//* Local Macros *//*================================================================*//* Local Types *//*================================================================*//* Local Static Definitions *//*================================================================*//* Local Function Declarations *//*================================================================*//* Function Definitions *//*----------------------------------------------------------------* p80211_text2did** Returns the numeric DID value for any textual metadata name.** Arguments:*	catlist		ptr to a category metadata list*	catname		string containing category name*	grpname		string containing group name*	iitemname	string containing item name** Returns: *	P80211DID_INVALID		no match on name(s)*	Valid DID		success, returns a valid DID----------------------------------------------------------------*/UINT32 p80211_text2did(catlistitem_t *catlist, char *catname, char *grpname, char *itemname){	UINT32		catdid = 0UL;	UINT32		grpdid = 0UL;	UINT32		itemdid = 0UL;	int		c;	int		cat;	int		g;	int		grp;	int		i;	int		catsize;	int		grpsize;	int		itemsize;	if ( (catname == NULL) && (grpname == NULL) && (itemname == NULL) ) {		return P80211DID_INVALID;	} else {		/* traverse category metadata list */		catsize = GETMETASIZE(catlist);		for ( c = 1; c < catsize; c++ ) {			cat = c;			if ( catname != NULL ){				if ( (catdid = p80211_text2catdid( catlist, catname)) != P80211DID_INVALID ) {					cat = P80211DID_SECTION(catdid);					/*					printf("category %s found, cat = %d\n", catname, cat );					*/					/* set loop counter to size of category list 					   to stop further execution of loop */					c = catsize;				} else {					return catdid;				}			}			/* traverse group metadata list */			grpsize = GETMETASIZE(catlist[cat].grplist);			for ( g = 1; g < grpsize; g++ ) {				grp = g;				if ( grpname != NULL ){					if ( (grpdid = p80211_text2grpdid( catlist[cat].grplist, grpname)) != P80211DID_INVALID ) {						if ( catdid == 0UL ) {							catdid = P80211DID_MKSECTION(cat);						}						grp = P80211DID_GROUP(grpdid);						/*						printf("group %s found, cat = %d, grp=%d\n", grpname, cat, grp );						*/						/* set category and group loop						   counters equal to list sizes 						   to stop further execution of loops */						g = grpsize;						c = catsize;					} else {						g = grpsize;						continue;					}				}				/* traverse item metadata list */				itemsize = GETMETASIZE(catlist[cat].grplist[grp].itemlist);				for ( i = 1; i < itemsize; i++ ) {					if ( itemname != NULL ){						if ( (itemdid = p80211_text2itemdid( catlist[cat].grplist[grp].itemlist, itemname)) != P80211DID_INVALID ) {							if ( catdid == 0UL ) {								catdid = P80211DID_MKSECTION(cat);							}							if ( grpdid == 0UL ) {								grpdid = P80211DID_MKGROUP(grp);							}							/*							printf("item %s found, cat = %d, grp=%d, item=%d\n",								itemname, cat, grp, P80211DID_ITEM(itemdid) );							*/							/* set category, group & items loop							   counters equal to list sizes 						   	   to stop further execution of loops */							i = itemsize;							g = grpsize;							c = catsize;						} else {							i = itemsize;						}					}				}			}		}	}	/*	printf("catdid = 0x%08x, grpdid=0x%08x, itemdid=0x%08x\n", catdid, grpdid, itemdid);	*/	/* check to make sure each non-NULL string was found and assigned a did */	if ( (catname != NULL) && ((catdid == 0UL) || (catdid == P80211DID_INVALID)) ) {		return P80211DID_INVALID;	}	if ( (grpname != NULL) && ((grpdid == 0UL) || (grpdid == P80211DID_INVALID)) ) {		return P80211DID_INVALID;	}	if ( (itemname != NULL) && ((itemdid == 0UL) || (itemdid == P80211DID_INVALID)) ) {		return P80211DID_INVALID;	}	return (catdid | grpdid | itemdid);}/*----------------------------------------------------------------* p80211_text2catdid** Returns the numeric DID value for a category metadata name.** Arguments:*	list		ptr to a category metadata list*	name		string containing category name** Returns: *	P80211DID_INVALID		no match on name*	Valid DID		success, returns a valid category DID----------------------------------------------------------------*/UINT32 p80211_text2catdid(catlistitem_t *list, char *name ){	UINT32		did;	int		i;	int		size;	did = P80211DID_INVALID;	size = GETMETASIZE(list);	if ( (list != NULL) && (name != NULL) ) {		for ( i = 1; i < size; i++ ) {			if ( strcmp(list[i].name, name ) == 0 ) {				did = P80211DID_MKSECTION(i);				break;			}		}	}	return did;}/*----------------------------------------------------------------* p80211_text2grpdid** Returns the numeric DID value for a group metadata name.** Arguments:*	list		ptr to a group metadata list*	name		string containing group name** Returns: *	P80211DID_INVALID		no match on name*	Valid DID		success, returns a valid group DID----------------------------------------------------------------*/UINT32 p80211_text2grpdid(grplistitem_t *list, char *name ){	UINT32		did;	int		i;	int		size;	did = P80211DID_INVALID;	size = GETMETASIZE(list);	if ( (list != NULL) && (name != NULL) ) {		for ( i = 1; i < size; i++ ) {			if ( strcmp(list[i].name, name ) == 0 ) {				did = P80211DID_MKGROUP(i);				break;			}		}	}	return did;}/*----------------------------------------------------------------* p80211_text2itemdid** Returns the numeric DID value for an item metadata name.** Arguments:*	list	ptr to an item metadata list*	name	string containing item name** Returns: *	P80211DID_INVALID		no match on name*	Valid DID		success, returns a valid item DID----------------------------------------------------------------*/UINT32 p80211_text2itemdid(p80211meta_t *list, char *name ){	UINT32		did;	int		i;	int		size;	did = P80211DID_INVALID;	size = GETMETASIZE(list);	if ( (list != NULL) && (name != NULL) ) {		for ( i = 1; i < size; i++ ) {			if ( strcmp(list[i].name, name ) == 0 ) {				did = list[i].did | P80211DID_MKITEM(i);				break;			}		}	}	return did;}/*----------------------------------------------------------------* p80211_isvalid_did** Verifies whether the category, group and item portions of a did* are valid.** Arguments:*	catlist		ptr to a category metadata list*	did		data id** Returns: *	P80211DID_INVALID	if DID is an invalid DID*	!P80211DID_INVALID	if DID is a valid DID----------------------------------------------------------------*/UINT32 p80211_isvalid_did( catlistitem_t *catlist, UINT32 did ){	int		result;	result = p80211_isvalid_itemdid( catlist, did );	return result;}/*----------------------------------------------------------------* p80211_isvalid_catdid** Verifies whether the category portion of a did is valid.** Arguments:*	catlist		ptr to a category metadata list*	did		data id** Returns: *	P80211DID_INVALID	if DID is an invalid DID*	!P80211DID_INVALID	if DID is a valid DID----------------------------------------------------------------*/UINT32 p80211_isvalid_catdid( catlistitem_t *catlist, UINT32 did ){	int		result;	int		cat;	int		size;	result = P80211DID_INVALID;	cat = P80211DID_SECTION(did);	size = GETMETASIZE(catlist);	if ( (cat > 0UL) && (cat < size) ) {		result = P80211DID_VALID; 	}	return result;}/*----------------------------------------------------------------* p80211_isvalid_grpdid** Verifies whether the group portion of a did is valid.** Arguments:*	catlist		ptr to a category metadata list*	did		data id** Returns: *	P80211DID_INVALID	if DID is an invalid DID*	!P80211DID_INVALID	if DID is a valid DID----------------------------------------------------------------*/UINT32 p80211_isvalid_grpdid( catlistitem_t *catlist, UINT32 did ){	int		result;	int		cat;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -