Hello, I would like to get some ideas on writing a stack library using C language, that will as generic as possible It should support different data types - (handle strings, ints, chars, doubles, and other misc data types), different stack sizes, etc... I am open to hear about any ideas that may come, (See prototypes, and get some code if anybody happen to have it already) and/or will be happy if anyone can referee me to places with this issue already solved. Thanks.
amitalonm
Posts
-
Generic stack library in c -
Active scan on a WiFi NIC, including flush of old scan results - how ? PinHi Fibers, here are my understandings about this issue: 1. The fastest promised "response time" for updated information that you can get using NDIS API will be around 6 seconds. 2. If you need faster response time then this - you need to work wuth wireless NIC's drivers. 3. In order to check yourself, you may do some tests and from time to time switch the power of the transmitting AP on/off. when you switch it off - you will know exactly when the reading of the relevant AP should vanish from the list. according to my tests, I could not make them disappear fast, i.e. the reading of the AP that is no longer on air, kept reporting as if it was on air, sometimes for about 1-2 minutes (!!!) after the AP was turned off. the rx database was not flushed and held old information. This, of course, is not what I wanted. The scan command, which should have flush the RXed AP's database, surely did not work. I think that this problem is due to incompatibility of the Wireless card's vendors with NDIS requirements. If you find any wireless card (NIC) that the NDIS SCAN command actually cleans the old data from the database, using NDIS interface, please inform me with the exact model of the wireless NIC. If you find any wireless NIC that you can access it's Firmware and control it using your code (bypass the NDIS level), and that can do it with no cost (no need to pay for information on how to do this), please update me as well with the wireless card's model and brand, and with relevant sample code. As a matter of fact, I think that in order to achieve fast response, this is that direction that you should focus on. Any help will be very much appreciated ! In second thought, please update us anyway :-) Thanks a lot and good luck. -- Amit.
-
DeviceIoControl & OID_802_11_BSSID_LIST_SCAN ?Hi, please have a look here: WLAN Scan with NDIS Miniport and Much More[^] I hope that it will help you. in case that you already overcame your problem and in case that you can contribute to the questions that I asked under the responses of the article that I just gave you - I will appreciate your help as well. Thanks, -- Amit.
-
Active scan on a WiFi NIC, including flush of old scan results - how ? PinI don't think that it will help. According to the documentation the Wireless card will return it's most up to date database, without flushing old information. The data may have been collected using passive scan or any other action that the card's driver was doing to collect, before the _LIST query (command) was issued.
-
Active scan on a WiFi NIC, including flush of old scan results - how ? PinHi David, Thanks for your answer. it answered my first question, but the second question, that bothers me much more is still left unanswered. My problem is that the Wireless Card returns old scanned data, that is no longer relevant, of APs that are no longer on air. According to the text in here: http://msdn.microsoft.com/en-us/library/ms799400.aspx[^] it says that
"...The miniport driver must manage its cached BSSID scan list in the following ways: * The driver must clear its BSSID scan list when set by OID_802_11_BSSID_LIST_SCAN before it starts the explicit network scan. ...
" I tried my code, which uses the OID_802_11_BSSID_LIST_SCAN command, on 2 different Wireless NICs (DELL, and Intel) and both Wireless NICs did not clear the history and kept returning the result of old scanned APs that are no longer on air. Can you maybe help me here as well ? Thanks, -- Amit. -
Active scan on a WiFi NIC, including flush of old scan results - how ?Hi, I wrote a program using VC++ that should scan for available wireless networks in the area. In my SW I use the commands OID_802_11_BSSID_LIST_SCAN and OID_802_11_BSSID_LIST. My questions are: 1. How can I Force the Wireless NIC to do ACTIVE SCAN (as contrary to PASSIVE scan) ? 2. According to tests that I did, the card does not flush the list between scans, i.e. I get for several scan a result of an AP that was on air during an old scan, but is no longer there, and new scans return's it's data as if it is still there. A code part that I used is attached - in order to illustrate which functions I am using.
NDIS_802_11_BSSID_LIST* m_pBSSIDList;
m_pBSSIDList = (NDIS_802_11_BSSID_LIST *) VirtualAlloc (NULL,
sizeof (NDIS_802_11_BSSID_LIST) * NUMBEROF_BSSIDS,
MEM_RESERVE | MEM_COMMIT,
PAGE_READWRITE) ;memset (m_pBSSIDList, 0, sizeof (NDIS_802_11_BSSID_LIST) * NUMBEROF_BSSIDS);
// Do Scan
oidcode = OID_802_11_BSSID_LIST_SCAN;
DeviceIoControl (m_handle,
IOCTL_NDIS_QUERY_GLOBAL_STATS,
&oidcode,
sizeof(oidcode),
(ULONG *) NULL,
0,
&bytesreturned,
NULL);Sleep (6100); // According to the documentation the result of the scan should be valid after 6 seconds.
// The original line was delay of 2000 mSec. find out why...
//Sleep (2000);// Read scan results
oidcode = OID_802_11_BSSID_LIST;
if (DeviceIoControl( m_handle,
IOCTL_NDIS_QUERY_GLOBAL_STATS,
&oidcode,
sizeof(oidcode),
(ULONG *) m_pBSSIDList,
sizeof(NDIS_802_11_BSSID_LIST) * NUMBEROF_BSSIDS,
&bytesreturned,
NULL) == 0)
{
// List failed
return NULL;
}
else
{
return m_pBSSIDList;
}If you have any idea of how can I solve my problems, or if you see that I forgot any important line- please let me know. I am open to hear about completely new ways to do this. only requirement is that I will use VC++. Thanks a lot, --Amit.
-
Active scan on a WiFi NIC, including flush of old scan results - how ? PinHi, I wrote a program using VC++ that should scan for available wireless networks in the area. In my SW I use the commands OID_802_11_BSSID_LIST_SCAN and OID_802_11_BSSID_LIST. My questions are: 1. How can I Force the Wireless NIC to do ACTIVE SCAN (as contrary to PASSIVE scan) ? 2. According to tests that I did, the card does not flush the list between scans, i.e. I get for several scan a result of an AP that was on air during an old scan, but is no longer there, and new scans return's it's data as if it is still there. A code part that I used is attached - in order to illustrate which functions I am using.
NDIS_802_11_BSSID_LIST* m_pBSSIDList;
m_pBSSIDList = (NDIS_802_11_BSSID_LIST *) VirtualAlloc (NULL,
sizeof (NDIS_802_11_BSSID_LIST) * NUMBEROF_BSSIDS,
MEM_RESERVE | MEM_COMMIT,
PAGE_READWRITE) ;memset (m_pBSSIDList, 0, sizeof (NDIS_802_11_BSSID_LIST) * NUMBEROF_BSSIDS);
// Do Scan
oidcode = OID_802_11_BSSID_LIST_SCAN;
DeviceIoControl (m_handle,
IOCTL_NDIS_QUERY_GLOBAL_STATS,
&oidcode,
sizeof(oidcode),
(ULONG *) NULL,
0,
&bytesreturned,
NULL);Sleep (6100); // According to the documentation the result of the scan should be valid after 6 seconds.
// The original line was delay of 2000 mSec. find out why...
//Sleep (2000);// Read scan results
oidcode = OID_802_11_BSSID_LIST;
if (DeviceIoControl( m_handle,
IOCTL_NDIS_QUERY_GLOBAL_STATS,
&oidcode,
sizeof(oidcode),
(ULONG *) m_pBSSIDList,
sizeof(NDIS_802_11_BSSID_LIST) * NUMBEROF_BSSIDS,
&bytesreturned,
NULL) == 0)
{
// List failed
return NULL;
}
else
{
return m_pBSSIDList;
}If you have any idea of how can I solve my problems, or if you see that I forgot any important line- please let me know. I am open to hear about completely new ways to do this. only requirement is that I will use VC++. Thanks a lot, --Amit.
-
Active scan on a WiFi NIC, including flush of old scan results - how ?Hi, I wrote a program using VC++ that should scan for available wireless networks in the area. In my SW I use the commands OID_802_11_BSSID_LIST_SCAN and OID_802_11_BSSID_LIST. My questions are: 1. How can I Force the Wireless NIC to do ACTIVE SCAN (as contrary to PASSIVE scan) ? 2. According to tests that I did, the card does not flush the list between scans, i.e. I get for several scan a result of an AP that was on air during an old scan, but is no longer there, and new scans return's it's data as if it is still there. A code part that I used is attached - in order to illustrate which functions I am using.
NDIS_802_11_BSSID_LIST* m_pBSSIDList;
m_pBSSIDList = (NDIS_802_11_BSSID_LIST *) VirtualAlloc (NULL,
sizeof (NDIS_802_11_BSSID_LIST) * NUMBEROF_BSSIDS,
MEM_RESERVE | MEM_COMMIT,
PAGE_READWRITE) ;memset (m_pBSSIDList, 0, sizeof (NDIS_802_11_BSSID_LIST) * NUMBEROF_BSSIDS);
// Do Scan
oidcode = OID_802_11_BSSID_LIST_SCAN;
DeviceIoControl (m_handle,
IOCTL_NDIS_QUERY_GLOBAL_STATS,
&oidcode,
sizeof(oidcode),
(ULONG *) NULL,
0,
&bytesreturned,
NULL);Sleep (6100); // According to the documentation the result of the scan should be valid after 6 seconds.
// The original line was delay of 2000 mSec. find out why...
//Sleep (2000);// Read scan results
oidcode = OID_802_11_BSSID_LIST;
if (DeviceIoControl( m_handle,
IOCTL_NDIS_QUERY_GLOBAL_STATS,
&oidcode,
sizeof(oidcode),
(ULONG *) m_pBSSIDList,
sizeof(NDIS_802_11_BSSID_LIST) * NUMBEROF_BSSIDS,
&bytesreturned,
NULL) == 0)
{
// List failed
return NULL;
}
else
{
return m_pBSSIDList;
}If you have any idea of how can I solve my problems, or if you see that I forgot any important line- please let me know. I am open to hear about completely new ways to do this. only requirement is that I will use VC++. Thanks a lot, --Amit.
-
Performing Active scan with flush of old scanned data from the Wireless NIC - how ?NDIS_802_11_BSSID_LIST* m_pBSSIDList;
m_pBSSIDList = (NDIS_802_11_BSSID_LIST *) VirtualAlloc (NULL,
sizeof (NDIS_802_11_BSSID_LIST) * NUMBEROF_BSSIDS,
MEM_RESERVE | MEM_COMMIT,
PAGE_READWRITE) ;memset (m_pBSSIDList, 0, sizeof (NDIS_802_11_BSSID_LIST) * NUMBEROF_BSSIDS);
oidcode = OID_802_11_BSSID_LIST_SCAN;
DeviceIoControl (m_handle,
IOCTL_NDIS_QUERY_GLOBAL_STATS,
&oidcode,
sizeof(oidcode),
(ULONG *) NULL,
0,
&bytesreturned,
NULL);Sleep (6100); // According to the documentation the result of the scan should be valid after 6 seconds.
// The original line was delay of 2000 mSec. find out why...
//Sleep (2000);memset (m_pBSSIDList, 0, sizeof (NDIS_802_11_BSSID_LIST) * NUMBEROF_BSSIDS); // @@@ why is this required ???
oidcode = OID_802_11_BSSID_LIST;
if (DeviceIoControl( m_handle,
IOCTL_NDIS_QUERY_GLOBAL_STATS,
&oidcode,
sizeof( oidcode),
( ULONG *) m_pBSSIDList,
sizeof( NDIS_802_11_BSSID_LIST) * NUMBEROF_BSSIDS,
&bytesreturned,
NULL) == 0)
{
// List failed
return NULL;
}
else
{
return m_pBSSIDList;
} -
Create icon in Helloworld ApplicationNow you can tell us... :)
-
Performing Active scan with flush of old scanned data from the Wireless NIC - how ?The missing link of data source that I used is attached again http://msdn.microsoft.com/en-us/library/aa504190.aspx[^]
-
Performing Active scan with flush of old scanned data from the Wireless NIC - how ?Hi, I wrote a program using VC++ that should scan for available wireless networks in the area. In my SW I use the commands OID_802_11_BSSID_LIST_SCAN and OID_802_11_BSSID_LIST. My questions are: 1. How can I Force the Wireless NIC to do ACTIVE SCAN ? 2. According to tests that I did, the card does not flush the list between scans, i.e. I get for several scan a results of an AP that was on air during an old scan, but is no longer there and new scans return's it's data as if it is still there. I am using Intel PRO 2200BG Wireless NIC, with driver version 8.1.0.28 (dated 24/8/2004). Relevant information That I used is here: Some relevant info from the above link: --------------------------------------- " The device must do the following when performing an explicit scan in response to a setting of OID_802_11_BSSID_LIST_SCAN: * The device must flush the current contents of its cached BSSID scan list before initiating the explicit scan request. * The device must scan both infrastructure and ad hoc networks, regardless of the current setting of its network mode. * The device can use either the active or passive scanning methods, or a combination of both scanning methods. Note Active scanning is preferred whenever appropriate. * When performing an active scan, the device sets the BSSID to the broadcast MAC address in the 802.11 probe request that it sends. The device also sets the SSID to the zero-length broadcast SSID in the probe request. * The device must perform the scan across all the frequency channels and bands that it supports. * The miniport driver must minimize its response time for this OID. It is recommended that the driver just initiate the scan and return NDIS_STATUS_SUCCESS in response to the setting of OID_802_11_BSSID_LIST_SCAN. The driver must not return NDIS_STATUS_PENDING or wait for the scan to complete before returning NDIS_STATUS_SUCCESS. " ------- Any help will be appreciated. -- Amit.
-
Activating the PC's speaker using C++ for until I will need to stop - how ? (Beep, thread, and more)...Hi, Can anyone help me here ? I would really appreciate getting ideas for my problem. -- Amit.
-
Activating the PC's speaker using C++ for until I will need to stop - how ? (Beep, thread, and more)...Thanks for your comment. As I wrote before, I did so, but the problem is that this caused a short noise every time interval. In the case of your suggestion, the noise will come out every 5 seconds. The noise is an outcome of the beep being stopped and immediately started again, so the tone is not continuously. This noise is a problem, as the tone that I produce should come out clean. Any other suggestions ? Thanks.
-
Activating the PC's speaker using C++ for until I will need to stop - how ? (Beep, thread, and more)...Hi, I am trying to write a small application, using Visual C++. In the application's GUI, among other things, there will be 2 buttons: First button should turn the PC's internal speaker ON. Second button should turn the PC's internal speaker OFF. The GUI will have to be functional during all times. I see that in order to use the PC's internal speaker I need to use the Beep(int tone, int duration) function. (or is there any other way ???) The problem is that Beep function will play sound and stop the code's execution until duration mSec will be over. This is not good to me, as I will need the program to continue do other things in the background and I will need it to response to the OFF button as well. Using a flag to repeat the short Beeps again and again in a loop produces a glitch in the sound, every time that the Beep is executed (looped) again, so this is not elegant solution that I wold like to use. The solution that I came to is: ON button will start a thread, that will Beep endlessly. OFF button will Beep for 1 mSec, and this way will terminate sound that the Beep from the BeepThread started. Note that the Beep's thread called from ON button will never finish execution as it will be stack in it's Beep() line that has endless time as parameter. The problem in my solution is that even if the sound stops, the BeepThread that was started will never end, and pressing several times on the on/off buttons will produce several BeepThreads. Killing a thread from the outside is not recommended as well. Any ideas on how to deal with this issue ? I am open to change the whole way of my solution. Thanks.