#135607 - yellowstar - Tue Jul 24, 2007 11:32 pm
I have some questions and problems.
These questions and problems
have to do with wireless and a Download Play Client.
NOTE:
I have moved this problem,
from my "Help! Wireless, bootloader, icon and Download Play Client",
to here,
since the total size of that starting post was very long.
1.
I am trying to make a DS Download Play Client,
for Juglak's WMB Host.
All these problems are in this client.
My client is based on Juglak's WMB Host,
for local wireless.
Like Juglak's WMB Host,
my program's graphics is an console.
The following is a problem with the wireless communication
part of the client.(The downloading and etc.)
My client never makes it past the Authication step.
According to the CFTP version of DSFTP,
in the Packet Capture tool,
it says it(my client) never sends out the Authication requests.
The only thing it detected was the host's Download Play ad/beacon.
Here's the things I have tried:
I tried typecasting the framehead struct to
a pointer, whichs points to an unsigned char array,
then sending that.
That failed.
I tried allocating a dynamic unsigned char array.
I then copied the contents of the framehead struct
into that array.
Then I would have it sent.
That failed.
Here's my code:
This only has the code for the ARM9.
Since this app is based on Juglak's WMB Host,
this app has the same ARM7 code as the WMB Host.
After initializing,
my app goes into a loop.
A timer,(gets triggered evey second)
handles detecting the Download Play ads/beacons.
If one was detected at least once,
in a 5 second time frame,
it displays information about the ad/beacon.
Other wise,
it clears that info,
and stops displaying it.
When a ad is detected,
to start downloading,
you press A.
It will then ask if you are sure
you want to download.
With A for yes, B for no.
After that,
it will go into another infinite loop.
In this loop,
a function which handles the actual downloading and ect. ,
is called.
Here is that function:
(Note: I cut out the rest of the steps which handles
the steps after Authication, since I didn't get to those
steps, and beacuse it never makes it past Authication.)
Here is the GetACK function.
Basicly, it waits for an ACK with the specified mac.
It goes into a for loop,
and if it doesn't find it,
it returns 0.
Otherwise,
it returns 1.
These questions and problems
have to do with wireless and a Download Play Client.
NOTE:
I have moved this problem,
from my "Help! Wireless, bootloader, icon and Download Play Client",
to here,
since the total size of that starting post was very long.
1.
I am trying to make a DS Download Play Client,
for Juglak's WMB Host.
All these problems are in this client.
My client is based on Juglak's WMB Host,
for local wireless.
Like Juglak's WMB Host,
my program's graphics is an console.
The following is a problem with the wireless communication
part of the client.(The downloading and etc.)
My client never makes it past the Authication step.
According to the CFTP version of DSFTP,
in the Packet Capture tool,
it says it(my client) never sends out the Authication requests.
The only thing it detected was the host's Download Play ad/beacon.
Here's the things I have tried:
I tried typecasting the framehead struct to
a pointer, whichs points to an unsigned char array,
then sending that.
That failed.
I tried allocating a dynamic unsigned char array.
I then copied the contents of the framehead struct
into that array.
Then I would have it sent.
That failed.
Here's my code:
This only has the code for the ARM9.
Since this app is based on Juglak's WMB Host,
this app has the same ARM7 code as the WMB Host.
After initializing,
my app goes into a loop.
A timer,(gets triggered evey second)
handles detecting the Download Play ads/beacons.
If one was detected at least once,
in a 5 second time frame,
it displays information about the ad/beacon.
Other wise,
it clears that info,
and stops displaying it.
When a ad is detected,
to start downloading,
you press A.
It will then ask if you are sure
you want to download.
With A for yes, B for no.
After that,
it will go into another infinite loop.
In this loop,
a function which handles the actual downloading and ect. ,
is called.
Here is that function:
(Note: I cut out the rest of the steps which handles
the steps after Authication, since I didn't get to those
steps, and beacuse it never makes it past Authication.)
Code: |
void downloadMain() { int i, ds, j=0, k; unsigned char *datapkt; struct nds_rsaframe *rsa; unsigned char *nds_data; tNDSHeader *nds_head; tNDSBanner *banner; unsigned char *d,*dr; struct iee80211_framehead FH; struct iee80211_framehead *fh = &FH; bool gotrsa=0; int mode = 1; unsigned short curdata=0; unsigned char *dataacked; consoleClear(); if (mode == 1) { //Wifi_SetRetry(4); //dr = RXNextFrame(&ds); //if (dr != NULL) { //for(int i=0;i<10;i++) //{ //fh = (struct iee80211_framehead *) malloc(66);//(unsigned int) dr; memset(fh,sizeof(fh),0); // check against macs later to see if its really to us //Right here, in WMB Host, //fh->frame_control always = 4272 fh->frame_control = 4272;//4272,3,15 for(int i = 0; i < 6; i++) fh->mac3[i] = the_ad.host_mac[i]; for(int i = 0; i < 6; i++) fh->mac2[i] = mymac[i]; //if (((FH_FC_TYPE(fh->frame_control) == 0) && (FH_FC_SUBTYPE(fh->frame_control) == 11)) && //CompareMAC(my_mac, fh->mac3)) { for(int i=0;i<10;i++) { unsigned char *buff = (unsigned char*)malloc(sizeof(fh)); memset(buff,sizeof(buff),0); memcpy((unsigned char*)fh,buff,sizeof(buff)); SendFrame(buff,sizeof(buff)); //free(fh); free(buff); } //} iprintf("\x1b[18;0H "); iprintf("\x1b[18;0H* Sent Authentication request\n"); //return; //iprintf("\x1b[19;0HMAC1: "); for(i=0;i<6;i++) iprintf("%2.2X ",fh->mac1[i]); //iprintf("\x1b[20;0HMAC2: "); for(i=0;i<6;i++) iprintf("%2.2X ",fh->mac2[i]); //iprintf("\x1b[21;0HMAC3: "); for(i=0;i<6;i++) iprintf("%2.2X ",fh->mac3[i]); //iprintf("\x1b[21;0HMAC3: "); for(i=0;i<6;i++) iprintf("%2.2X ",fh->mac3[i]); // ack it if(!GetACK(mymac)) return; iprintf("\x1b[18;0H* ACKED!\n"); //mac2 is the MAC of the client. That is, //the DS that is running this app. /*copy_mac(&authres[4], &fh->mac2[0]); copy_mac(&authres[10], &mymac[0]); copy_mac(&authres[16], &mymac[0]); fh = (struct iee80211_framehead *) (unsigned int) &authres[0]; fh->sequence_control = bec_seq<<4; */ bec_seq++; //SendFrame(authres,30); while(1) { fh = (struct iee80211_framehead *)RXNextFrame(&sz); if(sz==30 && fh!=NULL) { if(((unsigned char*)fh)[4]==mymac[0] && ((unsigned char*)fh)[10]==the_ad.host_mac[0] && ((unsigned char*)fh)[16]==the_ad.host_mac[0]) { break; } else { return; } } else { return; } iprintf("\x1b[18;0H* Authenicated!\n"); } } |
Here is the GetACK function.
Basicly, it waits for an ACK with the specified mac.
It goes into a for loop,
and if it doesn't find it,
it returns 0.
Otherwise,
it returns 1.
Code: |
bool GetACK(unsigned char *wanted_mac) { unsigned char *dat = NULL; for(int i=0; i<10; i++) { dat = RXNextFrame(&sz); if(sz==6) { if(CompareMAC(wanted_mac,dat)) { return 1; } } return 0; } } |