made changes to replace msgoffset with just flags

This commit is contained in:
joellen 1999-08-31 18:52:49 +00:00
parent 1e9a95e88b
commit 5ae45c22d4
6 changed files with 471 additions and 327 deletions

View file

@ -34,31 +34,26 @@
/*----- Macros -------------------------------------------------------*/
/*--------------------------------------------------------------------*/
/* The following macros are used to manipulate the 'offset' field in */
/* The following macros are used to manipulate the 'flags' field in */
/* the metadata. These are only used when the metadata is for */
/* command arguments to determine if the data item is required, and */
/* whether the metadata item is for a request command, confirm */
/* command or both. Additionally, there's a macro to get the actual */
/* offset value of the field. */
/* command or both. */
/*--------------------------------------------------------------------*/
#define ISREQUIRED (0x80000000UL)
#define ISREQUEST (0x40000000UL)
#define ISCONFIRM (0x20000000UL)
#define P80211ITEM_ISREQUIRED(offset) (((UINT32)(offset & ISREQUIRED)) \
#define P80211ITEM_SETFLAGS(q, r, c) ( q | r | c )
#define P80211ITEM_ISREQUIRED(flags) (((UINT32)(flags & ISREQUIRED)) \
>> 31 )
#define P80211ITEM_ISREQUEST(offset) (((UINT32)(offset & ISREQUEST)) \
#define P80211ITEM_ISREQUEST(flags) (((UINT32)(flags & ISREQUEST)) \
>> 30 )
#define P80211ITEM_ISCONFIRM(offset) (((UINT32)(offset & ISCONFIRM)) \
#define P80211ITEM_ISCONFIRM(flags) (((UINT32)(flags & ISCONFIRM)) \
>> 29 )
#define P80211ITEM_GET_OFFSET(offset) ( ((UINT32)(offset)) & \
(~(ISREQUIRED | ISREQUEST | \
ISCONFIRM)) )
#define P80211ITEM_MKOFFSET(d, r, c, offset) ( (d|r|c) | ((UINT32)(offset)) )
/*====================================================================*/
/*----- Constants ----------------------------------------------------*/

View file

@ -101,7 +101,7 @@
/* mappings. */
/*--------------------------------------------------------------------*/
#define P80211ENUM_BAD 0xffffffffUL /* error code for lookups */
#define P80211ENUM_BADSTR "P80211ENUM_BAD"
#define P80211ENUM_BADSTR "\"P80211ENUM_BAD\""
#define P80211ENUM_truth_false 0
#define P80211ENUM_truth_true 1
#define P80211ENUM_powermgmt_active 1
@ -172,8 +172,8 @@
/* string constants */
/*--------------------------------------------------------------------*/
#define NOT_SET "NOT_SET"
#define NOT_SUPPORTED "NOT_SUPPORTED"
#define NOT_SET "\"NOT_SET\""
#define NOT_SUPPORTED "\"NOT_SUPPORTED\""
/*====================================================================*/
/*----- Macros -------------------------------------------------------*/
@ -510,7 +510,7 @@ typedef struct p80211meta
{
char *name; /* data item name */
UINT32 did; /* partial did */
UINT32 msgoffset; /* offset of this item in data item structure */
UINT32 flags; /* set of various flag bits */
UINT32 min; /* min value of a BOUNDEDINT */
UINT32 max; /* max value of a BOUNDEDINT */
UINT32 maxlen; /* maxlen of a OCTETSTR or DISPLAYSTR */

File diff suppressed because it is too large Load diff

View file

@ -155,7 +155,9 @@ UINT32 p80211item_maxdatalen( UINT32 did )
/* The following function definitions are for functions that convert */
/* MIB items binary represenations to/from their textual */
/* representations. */
/* Note: all of these functions assume a valid DID and pointers */
/* Note: all of these functions assume a valid DID as the first */
/* argument and valid pointers to buffers containing sufficient */
/* memory. */
/* All textual representations are "<itemname>=<itemvalue>" */
/* All itembufs are p80211item_t */
/* isvalid functions return: */
@ -179,6 +181,8 @@ void p80211_totext_displaystr( UINT32 did, UINT8 *itembuf, char *textbuf )
p80211pstrd_t *pstr;
UINT8 *cstr;
*textbuf = '\0';
if ( did != 0UL )
{
/* collect the C string stored in the data item */
@ -195,17 +199,13 @@ void p80211_totext_displaystr( UINT32 did, UINT8 *itembuf, char *textbuf )
{
cstr = pstr->data;
/* now, print to the textbuf */
sprintf( textbuf, "%s=%s", meta->name, cstr);
sprintf( textbuf, "%s=\"%s\"", meta->name, cstr);
}
else
{
sprintf( textbuf, "%s=%s", meta->name, NOT_SUPPORTED);
}
}
else
{
sprintf( textbuf, "Invalid displaystr DID of %lu\n", did);
}
return;
}
@ -317,6 +317,8 @@ void p80211_totext_octetstr( UINT32 did, UINT8 *itembuf, char *textbuf )
INT len;
INT n;
*textbuf = '\0';
if ( did != 0UL )
{
/* collect the C string stored in the data item */
@ -337,20 +339,16 @@ void p80211_totext_octetstr( UINT32 did, UINT8 *itembuf, char *textbuf )
for ( n=0; n < len; n++ )
{
sprintf( &textbuf[strlen(textbuf)], "%02xu:", (UINT)(cstr[n]) );
sprintf( &textbuf[strlen(textbuf)], "%02x:", (UINT)(cstr[n]) );
}
textbuf[strlen(textbuf)] = '\0'; /* get rid of trailing colon */
textbuf[strlen(textbuf) - 1] = '\0'; /* get rid of trailing colon */
}
else
{
sprintf( textbuf, "%s=%s", meta->name, NOT_SUPPORTED);
}
}
else
{
sprintf( textbuf, "Invalid octetstr DID of %lu\n", did);
}
return;
}
@ -445,6 +443,8 @@ void p80211_totext_boundedint( UINT32 did, UINT8 *itembuf, char *textbuf )
p80211itemd_t *item = (p80211itemd_t*)itembuf;
char *str;
*textbuf = '\0';
if ( did != 0UL )
{
/* collect the metadata item */
@ -543,6 +543,8 @@ void p80211_totext_int( UINT32 did, UINT8 *itembuf, char *textbuf )
p80211meta_t *meta = NULL;
p80211itemd_t *item = (p80211itemd_t*)itembuf;
*textbuf = '\0';
if ( did != 0UL )
{
/* collect the metadata item */
@ -628,6 +630,8 @@ void p80211_totext_enumint( UINT32 did, UINT8 *itembuf, char *textbuf )
INT n;
INT found;
*textbuf = '\0';
if ( did != 0UL )
{
/* collect the metadata item */
@ -645,7 +649,8 @@ void p80211_totext_enumint( UINT32 did, UINT8 *itembuf, char *textbuf )
{
if ( enumlist[n].val == (*((UINT32 *)(item->data))) )
{
strcpy( textbuf, enumlist[n].name );
/* now, print the data item name and enum text value into textbuf */
sprintf( textbuf, "%s=%s", meta->name, enumlist[n].name );
found = 1;
}
}
@ -660,10 +665,6 @@ void p80211_totext_enumint( UINT32 did, UINT8 *itembuf, char *textbuf )
sprintf( textbuf, "%s=%s", meta->name, NOT_SUPPORTED);
}
}
else
{
sprintf( textbuf, "Invalid enumint DID of %lu\n", did);
}
return;
}
@ -717,8 +718,6 @@ void p80211_fromtext_enumint( UINT32 did, UINT8 *itembuf, char *textbuf )
*((UINT32 *)(item->data)) = P80211ENUM_BAD;
}
printf("fromtext_enum: item->did=%x, item->len=%lu, item->data=%x\n",
item->did, item->len, *((UINT32 *)(item->data)) );
return;
}
@ -753,6 +752,8 @@ void p80211_totext_collection( UINT32 did, UINT8 *itembuf, char *textbuf )
UINT32 currdid;
char tmpstr[MAXLEN_PSTR255];
*textbuf = '\0';
if ( did != 0UL )
{
/* collect the metadata item */
@ -766,6 +767,8 @@ void p80211_totext_collection( UINT32 did, UINT8 *itembuf, char *textbuf )
sprintf( textbuf, "%s=", meta->name);
/* in the case of collections, some of the sub-items by not be set;
this doesn't mean the particular collection sub-item is invalid */
if (item->did == 0UL)
{
strcat(textbuf, NOT_SET);
@ -777,7 +780,7 @@ void p80211_totext_collection( UINT32 did, UINT8 *itembuf, char *textbuf )
for ( n=1UL; n < nitems; n++ )
{
currsubitem = (p80211itemd_t *)(((UINT8 *)(item->data)) + P80211ITEM_GET_OFFSET(collmeta[n].msgoffset));
currsubitem = (p80211itemd_t *)(((UINT8 *)(item->data)) + P80211ITEM_GET_OFFSET);
sprintf(&textbuf[strlen(textbuf)], "%s=", collmeta[n].name);
@ -794,10 +797,6 @@ void p80211_totext_collection( UINT32 did, UINT8 *itembuf, char *textbuf )
}
}
}
else
{
sprintf( textbuf, "Invalid collection DID of %lu\n", did);
}
return;
}

View file

@ -10,7 +10,7 @@
int main(int argc, char **argv)
{
int s, g, i, n, k;
UINT32 offset;
UINT32 flags;
UINT32 nenumargs;
UINT32 ncollargs;
@ -29,14 +29,13 @@ int main(int argc, char **argv)
{
for ( i=1; i < GETMETASIZE(p80211meta_slist[s][g]); i++)
{
offset = p80211meta_slist[s][g][i].msgoffset;
flags = p80211meta_slist[s][g][i].flags;
printf(" name=%s\n", p80211meta_slist[s][g][i].name);
printf(" did=0x%x\n", p80211meta_slist[s][g][i].did);
printf(" msgoffset value=0x%x\n", offset );
printf(" is required?=0x%x\n", P80211ITEM_ISREQUIRED(offset));
printf(" is request?=0x%x\n", P80211ITEM_ISREQUEST(offset));
printf(" is confirm?=0x%x\n", P80211ITEM_ISCONFIRM(offset));
printf(" actual offset=%lu\n", P80211ITEM_GET_OFFSET(offset));
printf(" flags value=0x%x\n", flags );
printf(" is required?=0x%x\n", P80211ITEM_ISREQUIRED(flags));
printf(" is request?=0x%x\n", P80211ITEM_ISREQUEST(flags));
printf(" is confirm?=0x%x\n", P80211ITEM_ISCONFIRM(flags));
printf(" min=%lu\n", p80211meta_slist[s][g][i].min);
printf(" max=%lu\n", p80211meta_slist[s][g][i].max);
printf(" maxlen=%lu\n", p80211meta_slist[s][g][i].maxlen);
@ -75,14 +74,13 @@ int main(int argc, char **argv)
for ( n = 1; n < ncollargs; n++)
{
offset = p80211meta_slist[s][g][i].collptr[n].msgoffset;
flags = p80211meta_slist[s][g][i].collptr[n].flags;
printf(" name: %s\n", p80211meta_slist[s][g][i].collptr[n].name);
printf(" did: 0x%x\n", p80211meta_slist[s][g][i].collptr[n].did);
printf(" msgoffset value=0x%x\n", offset );
printf(" is required?=0x%x\n", P80211ITEM_ISREQUIRED(offset));
printf(" is request?=0x%x\n", P80211ITEM_ISREQUEST(offset));
printf(" is confirm?=0x%x\n", P80211ITEM_ISCONFIRM(offset));
printf(" actual offset=%lu\n", P80211ITEM_GET_OFFSET(offset));
printf(" flags value=0x%x\n", flags );
printf(" is required?=0x%x\n", P80211ITEM_ISREQUIRED(flags));
printf(" is request?=0x%x\n", P80211ITEM_ISREQUEST(flags));
printf(" is confirm?=0x%x\n", P80211ITEM_ISCONFIRM(flags));
printf(" min=%lu\n", p80211meta_slist[s][g][i].collptr[n].min);
printf(" max=%lu\n", p80211meta_slist[s][g][i].collptr[n].max);
printf(" maxlen=%lu\n", p80211meta_slist[s][g][i].collptr[n].maxlen);

View file

@ -2,7 +2,7 @@
* wlanctl.c: user utility for the wlan card
*------------------------------------------------------------------------
*
* Written 1997-99 by Mark Mathews mark@absoval.com
* Written 1997-99 by Mark Mathews and Jo-Ellen Mathews
*
* Copyright (c) 1999 AbsoluteValue Software, Inc.
* http://www.absoval.com
@ -10,7 +10,7 @@
* This software may be used and distributed according to the terms
* of the GNU Public License, incoporated herein by reference.
*
* The author may be reached as mark@absoval.com, or C/O AbsoluteValue
* The authors may be reached at info@absoval.com, or C/O AbsoluteValue
* Software Inc., P.O. Box 941149, Maitland, FL, 32794-1149
*
* Description:
@ -20,154 +20,306 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <wlan/wlan_compat.h>
#include <wlan/p80211types.h>
#include <wlan/p80211msg.h>
INT BuildMessage( UINT8 *msg, UINT32 cmdcode, int argc, char **argv );
void PrintMessage( UINT8 *msg, UINT32 cmdcode );
void Simulate_ioctl( UINT8 *msg, UINT32 cmdcode );
int main ( int argc, char **argv )
{
p80211meta_t *alist = NULL;
INT found;
INT i;
INT j;
INT narg;
UINT32 cmdcode;
UINT32 tmpdid;
UINT8 *cmdlinelist;
UINT8 *msgptr;
UINT8 msg[4000];
UINT8 tmpitem[4000];
size_t itemlen;
size_t offset;
UINT8 message[4000];
UINT32 cmdcode;
INT result;
printf("\n============================================================\n");
/* returns P80211ENUM_BAD no match */
cmdcode = p80211enum_text2int(&MKENUMNAME(msgcode), argv[2]);
if (cmdcode != P80211ENUM_BAD)
{
/* Create an array of bytes where each byte represents a flag for
each command line argument. For each argument on the command line
following the msg code, the repsective byte will contain either
a 0 (for not found) or 1 (found) after an attempt to match the
command line argument to one of the metadata arguments for the
user entered 'valid' msg, such as 'scan' or 'powermgmt'. */
if ( (cmdlinelist = (UINT8 *)malloc(argc)) == NULL )
if ( !(result = BuildMessage( message, cmdcode, argc, argv )) )
{
printf("wlanctl: cmdlinelist memory allocation failed\n");
return 0;
printf("---- *** PrintMessage BEFORE call to Simulate_ioctl *** ---\n");
PrintMessage( message, cmdcode );
printf("---- *** Call to Simulate_ioctl *** ---\n");
Simulate_ioctl( message, cmdcode );
printf("---- *** PrintMessage AFTER call to Simulate_ioctl *** ---\n");
PrintMessage( message, cmdcode );
}
/* initialize all the bytes to 0 for not found */
memset( cmdlinelist, 0, argc);
memset( msg, 0, 4000);
memset( tmpitem, 0, 4000);
((p80211msg_t*)msg)->msgcode = cmdcode;
msgptr = msg + sizeof( ((p80211msg_t*)msg)->msgcode );
/* acquire the msg argument metadata list */
alist = p80211meta_slist[P80211SEC_MSG][cmdcode];
narg = GETMETASIZE(alist);
printf("The cmd %s is valid with a code of %lu\n", argv[2], cmdcode);
printf(" argc=%d, narg is %d\n", argc, narg);
/* Build message in the same order as the metadata argument list by
by looping through msg arg metadata, args always start at index 1 */
for ( i = 1; i < narg; i++)
else
{
found = 0;
/* loop through msg arguments on cmdline */
for ( j = 3; (j < argc) && (!found); j++)
printf("Message was unable to be created\n");
}
} /* if cmdcode is valid */
else
{
printf("The cmd \'%s\' is invalid\n", argv[2]);
} /* if cmdcode is not valid */
exit ( result );
}
INT BuildMessage( UINT8 *msg, UINT32 cmdcode, int argc, char **argv )
{
UINT8 *cmdlinelist;
UINT8 *msgptr;
UINT8 tmpitem[4000];
p80211meta_t *alist = NULL;
INT found;
INT i;
INT j;
INT32 narg;
UINT32 tmpdid;
size_t itemlen;
size_t offset;
/* Create an array of bytes where each byte represents a flag for
each command line argument. For each argument on the command line
following the msg code, the repsective byte will contain either
a 0 (for not found) or 1 (found) after an attempt to match the
command line argument to one of the metadata arguments for the
user entered 'valid' msg, such as 'scan' or 'powermgmt'. */
if ( (cmdlinelist = (UINT8 *)malloc(argc)) == NULL )
{
printf("wlanctl: cmdlinelist memory allocation failed\n");
return 1;
}
/* initialize all the bytes to 0 for not found */
memset( cmdlinelist, 0, argc);
memset( msg, 0, 4000);
memset( tmpitem, 0, 4000);
((p80211msg_t*)msg)->msgcode = cmdcode;
msgptr = msg + sizeof( ((p80211msg_t*)msg)->msgcode );
/* acquire the msg argument metadata list */
alist = p80211meta_slist[P80211SEC_MSG][cmdcode];
narg = GETMETASIZE(alist);
printf("The cmd %s is valid with a code of %lu\n", argv[2], cmdcode);
printf(" argc=%d, narg is %lu\n", argc, narg);
/* Build message in the same order as the metadata argument list by
by looping through msg arg metadata, args always start at index 1 */
for ( i = 1; i < narg; i++)
{
found = 0;
tmpdid = (P80211DID_MKID(P80211SEC_MSG,cmdcode,i,0,0,0,0))
| alist[i].did;
/* loop through msg arguments on cmdline */
for ( j = 3; (j < argc) && (!found); j++)
{
/* does meta match cmdline arg? */
if ( strncmp(alist[i].name,argv[j],strlen(alist[i].name)) == 0 )
{
/* does meta match cmdline arg? */
if ( strncmp(alist[i].name,argv[j],strlen(alist[i].name)) == 0 )
printf("found %s\n", argv[j]);
found = 1;
cmdlinelist[j] = (UINT8)1;
(*(alist[i].fromtextptr))(tmpdid, tmpitem, argv[j]);
if ( !(*(alist[i].validfunptr))(tmpdid, tmpitem) )
{
printf("found %s\n", argv[j]);
found = 1;
cmdlinelist[j] = (UINT8)1;
tmpdid = (P80211DID_MKID(P80211SEC_MSG,cmdcode,i,0,0,0,0))
| alist[i].did;
(*(alist[i].fromtextptr))(tmpdid, tmpitem, argv[j]);
offset = P80211ITEM_GET_OFFSET(alist[i].msgoffset);
itemlen = sizeof(p80211item_t)+p80211item_maxdatalen(tmpdid);
memcpy(msgptr, tmpitem, itemlen);
if ( !(*(alist[i].validfunptr))(tmpdid, tmpitem) )
{
printf("invalid value entered for %s\n", alist[i].name);
((p80211item_t *)msgptr)->did = 0UL;
}
msgptr += itemlen;
printf("%s: meta->msgoffset = %d, itemlen = %d\n",
alist[i].name, offset, itemlen );
} /* if cmdline match */
} /* for each cmdline arg */
if ( !found ) /* on the command line */
{
if ( (P80211ITEM_ISREQUIRED(alist[i].msgoffset)) &&
(P80211ITEM_ISREQUEST(alist[i].msgoffset)) )
{
printf("The required REQ argument \'%s\' was not found for cmd \'%s\'\n",
alist[i].name, argv[2]);
printf("invalid value entered for %s\n", alist[i].name);
free( cmdlinelist );
return 0;
return 1;
}
offset = P80211ITEM_GET_OFFSET(alist[i].flags);
itemlen = sizeof(p80211item_t)+p80211item_maxdatalen(tmpdid);
memcpy(msgptr, tmpitem, itemlen);
msgptr += itemlen;
printf("%s: meta->flags = %d, itemlen = %d\n",
alist[i].name, offset, itemlen );
} /* if cmdline match */
} /* for each cmdline arg */
if ( !found ) /* if metadata item isn't found on the command line */
{
if ( (P80211ITEM_ISREQUIRED(alist[i].flags)) &&
(P80211ITEM_ISREQUEST(alist[i].flags)) )
{
printf("The required REQ argument \'%s\' was not found for cmd \'%s\'\n",
alist[i].name, argv[2]);
free( cmdlinelist );
return 1;
}
} /* for each msg argument metadata */
/* check to see if there is data in the message for all the */
/* required message arguments */
offset = P80211ITEM_GET_OFFSET(alist[i].flags);
itemlen = sizeof(p80211item_t)+ p80211item_maxdatalen(tmpdid);
memset(msgptr, 0, itemlen);
((p80211item_t *)msgptr)->len = p80211item_maxdatalen(tmpdid);
msgptr += itemlen;
printf("%s: meta->flags = %d, itemlen = %d\n",
alist[i].name, offset, itemlen );
} /* for each cmdline arg */
} /* for each msg argument metadata */
msgptr = msg;
if ( p80211enum_int2text(&MKENUMNAME(msgcode), *((UINT32 *)(msgptr)),
tmpitem) == P80211ENUM_BAD )
/* check to see that each message argument on the command line was matched to an
argument metadata for the message */
for ( j = 3; j < argc; j++)
{
if ( !(cmdlinelist[j]) )
{
printf("msgcode %lu=%s\n", *((UINT32 *)(msgptr)), tmpitem);
printf("\'%s\' entered on the command line was either an invalid\n", argv[j]);
printf("argument to the cmd \'%s\' or an extra occurence of a valid argument.\n",
argv[2]);
free( cmdlinelist );
return 0;
return 1;
}
}
free( cmdlinelist );
return 0;
}
void PrintMessage( UINT8 *msg, UINT32 cmdcode )
{
UINT8 tmpitem[4000];
UINT8 *msgptr;
UINT8 *start;
INT i;
UINT32 narg;
UINT32 offset;
UINT32 tmpdid;
p80211meta_t *alist;
msgptr = msg;
/* acquire the msg argument metadata list */
alist = p80211meta_slist[P80211SEC_MSG][cmdcode];
narg = GETMETASIZE(alist);
/* print the message code */
if ( p80211enum_int2text(&MKENUMNAME(msgcode), *((UINT32 *)msgptr), tmpitem) != P80211ENUM_BAD )
{
printf("msgcode %lu=%s\n", *((UINT32 *)msgptr), tmpitem);
}
else
{
printf("msgcode %lu=%s: an invalid value.\n", *((UINT32 *)msgptr), tmpitem);
return;
}
msgptr += sizeof( ((p80211msg_t *)msgptr)->msgcode );
start = msg + sizeof( ((p80211msg_t *)msgptr)->msgcode );
msgptr = start;
for ( i = 1; i < narg; i++ )
for ( i = 1; i < narg; i++ )
{
/*
if ( (((p80211item_t *)msgptr)->did) != 0UL )
{
*tmpitem = 0;
*/
tmpdid = (P80211DID_MKID(P80211SEC_MSG,cmdcode,i,0,0,0,0));
(*(alist[i].totextptr))( tmpdid, msgptr, tmpitem);
printf(" argname=%s\n", alist[i].name);
printf(" data value=%s\n", tmpitem);
printf(" did=0x%04x, len=%lu\n", ((p80211item_t *)msgptr)->did,
((p80211item_t *)msgptr)->len);
printf(" %s\n", tmpitem);
/*
}
*/
offset = (sizeof(((p80211item_t *)msgptr)->did) +
sizeof(((p80211item_t *)msgptr)->len) +
((p80211item_t *)msgptr)->len);
offset = (sizeof(((p80211item_t *)msgptr)->did) +
sizeof(((p80211item_t *)msgptr)->len) +
((p80211item_t *)msgptr)->len);
printf(" advance %d bytes to next argument\n", offset );
printf(" advance %d bytes to next argument\n", offset );
msgptr += offset;
msgptr = start + offset;
} /* for each argument in the metadata */
} /* if cmdcode is valid */
else
{
printf("The cmd %s is invalid\n", argv[2]);
} /* if cmdcode is not valid */
printf("\n============================================================\n");
free( cmdlinelist );
return 0;
} /* for each argument in the metadata */
}
void Simulate_ioctl( UINT8 *msg, UINT32 cmdcode )
{
UINT8 j;
UINT8 nitems;
UINT8 *msgptr;
UINT8 *start;
UINT8 tmpitem[4000];
INT i;
INT k;
UINT32 narg;
UINT32 offset;
UINT32 tmpdid;
p80211meta_t *alist;
p80211pstrd_t *pstr;
start = msg + sizeof(UINT32);
msgptr = start;
/* acquire the msg argument metadata list */
alist = p80211meta_slist[P80211SEC_MSG][cmdcode];
narg = GETMETASIZE(alist);
for ( i = 1; i < narg; i++ )
{
if ( P80211ITEM_ISCONFIRM(alist[i].flags) )
{
tmpdid = (P80211DID_MKID(P80211SEC_MSG,cmdcode,i,0,0,0,0))
| alist[i].did;
((p80211item_t *)msgptr)->did = tmpdid;
((p80211item_t *)msgptr)->len = p80211item_maxdatalen(tmpdid);
switch (P80211DID_TYPE(tmpdid))
{
case P80211_TYPE_OCTETSTR:
pstr=(p80211pstrd_t *)(((p80211itemd_t *)msgptr)->data);
pstr->len = ((p80211item_t *)msgptr)->len - 1;
for ( j = 0, k = (UINT8)0xa0; j < pstr->len; j++, k+=(UINT8)0x0a )
{
pstr->data[j] = k;
}
break;
case P80211_TYPE_DISPLAYSTR:
pstr=(p80211pstrd_t *)(((p80211itemd_t *)msgptr)->data);
strcpy(pstr->data, "\"This is a display string\"");
pstr->len = strlen(pstr->data) + 1;
break;
case P80211_TYPE_BOUNDEDINT:
*((UINT32 *)(((p80211itemd_t *)msgptr)->data)) = 35UL;
break;
case P80211_TYPE_INT:
*((UINT32 *)(((p80211itemd_t *)msgptr)->data)) = 652201UL;
break;
case P80211_TYPE_ENUMINT:
*((UINT32 *)(((p80211itemd_t *)msgptr)->data)) = 2UL;
break;
case P80211_TYPE_COLLECTION:
case P80211_TYPE_MIBITEM:
break;
default: break;
}
printf("Simulate_ioctl: changing data value of %s\n", alist[i].name );
}
offset = (sizeof(((p80211item_t *)msgptr)->did) +
sizeof(((p80211item_t *)msgptr)->len) +
((p80211item_t *)msgptr)->len);
printf("Simulate_ioctl: advance %d bytes to next argument\n", offset );
msgptr = start + offset;
} /* for each argument in the metadata */
return;
}