iw_handler.h

来自「Linux Kernel 2.6.9 for OMAP1710」· C头文件 代码 · 共 517 行 · 第 1/2 页

H
517
字号
				/* SET : Omit payload from generated iwevent *//* Driver level flags */#define IW_DESCR_FLAG_WAIT	0x0100	/* Wait for driver event *//****************************** TYPES ******************************//* ----------------------- WIRELESS HANDLER ----------------------- *//* * A wireless handler is just a standard function, that looks like the * ioctl handler. * We also define there how a handler list look like... As the Wireless * Extension space is quite dense, we use a simple array, which is faster * (that's the perfect hash table ;-). *//* * Meta data about the request passed to the iw_handler. * Most handlers can safely ignore what's in there. * The 'cmd' field might come handy if you want to use the same handler * for multiple command... * This struct is also my long term insurance. I can add new fields here * without breaking the prototype of iw_handler... */struct iw_request_info{	__u16		cmd;		/* Wireless Extension command */	__u16		flags;		/* More to come ;-) */};/* * This is how a function handling a Wireless Extension should look * like (both get and set, standard and private). */typedef int (*iw_handler)(struct net_device *dev, struct iw_request_info *info,			  union iwreq_data *wrqu, char *extra);/* * This define all the handler that the driver export. * As you need only one per driver type, please use a static const * shared by all driver instances... Same for the members... * This will be linked from net_device in <linux/netdevice.h> */struct iw_handler_def{	/* Number of handlers defined (more precisely, index of the	 * last defined handler + 1) */	__u16			num_standard;	__u16			num_private;	/* Number of private arg description */	__u16			num_private_args;	/* Array of handlers for standard ioctls	 * We will call dev->wireless_handlers->standard[ioctl - SIOCSIWNAME]	 */	iw_handler *		standard;	/* Array of handlers for private ioctls	 * Will call dev->wireless_handlers->private[ioctl - SIOCIWFIRSTPRIV]	 */	iw_handler *		private;	/* Arguments of private handler. This one is just a list, so you	 * can put it in any order you want and should not leave holes...	 * We will automatically export that to user space... */	struct iw_priv_args *	private_args;	/* Driver enhanced spy support */	long			spy_offset;	/* Spy data offset */	/* In the long term, get_wireless_stats will move from	 * 'struct net_device' to here, to minimise bloat. */};/* ---------------------- IOCTL DESCRIPTION ---------------------- *//* * One of the main goal of the new interface is to deal entirely with * user space/kernel space memory move. * For that, we need to know : *	o if iwreq is a pointer or contain the full data *	o what is the size of the data to copy * * For private IOCTLs, we use the same rules as used by iwpriv and * defined in struct iw_priv_args. * * For standard IOCTLs, things are quite different and we need to * use the stuctures below. Actually, this struct is also more * efficient, but that's another story... *//* * Describe how a standard IOCTL looks like. */struct iw_ioctl_description{	__u8	header_type;		/* NULL, iw_point or other */	__u8	token_type;		/* Future */	__u16	token_size;		/* Granularity of payload */	__u16	min_tokens;		/* Min acceptable token number */	__u16	max_tokens;		/* Max acceptable token number */	__u32	flags;			/* Special handling of the request */};/* Need to think of short header translation table. Later. *//* --------------------- ENHANCED SPY SUPPORT --------------------- *//* * In the old days, the driver was handling spy support all by itself. * Now, the driver can delegate this task to Wireless Extensions. * It needs to include this struct in its private part and use the * standard spy iw_handler. *//* * Instance specific spy data, i.e. addresses spied and quality for them. */struct iw_spy_data{#ifdef IW_WIRELESS_SPY	/* --- Standard spy support --- */	int			spy_number;	u_char			spy_address[IW_MAX_SPY][ETH_ALEN];	struct iw_quality	spy_stat[IW_MAX_SPY];#ifdef IW_WIRELESS_THRSPY	/* --- Enhanced spy support (event) */	struct iw_quality	spy_thr_low;	/* Low threshold */	struct iw_quality	spy_thr_high;	/* High threshold */	u_char			spy_thr_under[IW_MAX_SPY];#endif /* IW_WIRELESS_THRSPY */#endif /* IW_WIRELESS_SPY */};/**************************** PROTOTYPES ****************************//* * Functions part of the Wireless Extensions (defined in net/core/wireless.c). * Those may be called only within the kernel. *//* First : function strictly used inside the kernel *//* Handle /proc/net/wireless, called in net/code/dev.c */extern int dev_get_wireless_info(char * buffer, char **start, off_t offset,				 int length);/* Handle IOCTLs, called in net/code/dev.c */extern int wireless_process_ioctl(struct ifreq *ifr, unsigned int cmd);/* Second : functions that may be called by driver modules *//* Send a single event to user space */extern void wireless_send_event(struct net_device *	dev,				unsigned int		cmd,				union iwreq_data *	wrqu,				char *			extra);/* We may need a function to send a stream of events to user space. * More on that later... *//* Standard handler for SIOCSIWSPY */extern int iw_handler_set_spy(struct net_device *	dev,			      struct iw_request_info *	info,			      union iwreq_data *	wrqu,			      char *			extra);/* Standard handler for SIOCGIWSPY */extern int iw_handler_get_spy(struct net_device *	dev,			      struct iw_request_info *	info,			      union iwreq_data *	wrqu,			      char *			extra);/* Standard handler for SIOCSIWTHRSPY */extern int iw_handler_set_thrspy(struct net_device *	dev,				 struct iw_request_info *info,				 union iwreq_data *	wrqu,				 char *			extra);/* Standard handler for SIOCGIWTHRSPY */extern int iw_handler_get_thrspy(struct net_device *	dev,				 struct iw_request_info *info,				 union iwreq_data *	wrqu,				 char *			extra);/* Driver call to update spy records */extern void wireless_spy_update(struct net_device *	dev,				unsigned char *		address,				struct iw_quality *	wstats);/************************* INLINE FUNTIONS *************************//* * Function that are so simple that it's more efficient inlining them *//*------------------------------------------------------------------*//* * Wrapper to add an Wireless Event to a stream of events. */static inline char *iwe_stream_add_event(char *	stream,		/* Stream of events */		     char *	ends,		/* End of stream */		     struct iw_event *iwe,	/* Payload */		     int	event_len)	/* Real size of payload */{	/* Check if it's possible */	if((stream + event_len) < ends) {		iwe->len = event_len;		memcpy(stream, (char *) iwe, event_len);		stream += event_len;	}	return stream;}/*------------------------------------------------------------------*//* * Wrapper to add an short Wireless Event containing a pointer to a * stream of events. */static inline char *iwe_stream_add_point(char *	stream,		/* Stream of events */		     char *	ends,		/* End of stream */		     struct iw_event *iwe,	/* Payload */		     char *	extra){	int	event_len = IW_EV_POINT_LEN + iwe->u.data.length;	/* Check if it's possible */	if((stream + event_len) < ends) {		iwe->len = event_len;		memcpy(stream, (char *) iwe, IW_EV_POINT_LEN);		memcpy(stream + IW_EV_POINT_LEN, extra, iwe->u.data.length);		stream += event_len;	}	return stream;}/*------------------------------------------------------------------*//* * Wrapper to add a value to a Wireless Event in a stream of events. * Be careful, this one is tricky to use properly : * At the first run, you need to have (value = event + IW_EV_LCP_LEN). */static inline char *iwe_stream_add_value(char *	event,		/* Event in the stream */		     char *	value,		/* Value in event */		     char *	ends,		/* End of stream */		     struct iw_event *iwe,	/* Payload */		     int	event_len)	/* Real size of payload */{	/* Don't duplicate LCP */	event_len -= IW_EV_LCP_LEN;	/* Check if it's possible */	if((value + event_len) < ends) {		/* Add new value */		memcpy(value, (char *) iwe + IW_EV_LCP_LEN, event_len);		value += event_len;		/* Patch LCP */		iwe->len = value - event;		memcpy(event, (char *) iwe, IW_EV_LCP_LEN);	}	return value;}#endif	/* _IW_HANDLER_H */

⌨️ 快捷键说明

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