#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include "connectionMgrLog.h"
#include "connectionMgr.h"
#include "connectScreenData.h"
Go to the source code of this file.
Copyright (C) 2007 iRex Technologies BV.
Definition in file connectScreenData.c.
static int compare_wireless_profiles | ( | const void * | p1, | |
const void * | p2 | |||
) | [static] |
Definition at line 687 of file connectScreenData.c.
00688 { 00689 networkProfile_t *pNetwork1, * pNetwork2; 00690 int ret = 0; 00691 00692 pNetwork1 = (networkProfile_t*)p1; 00693 pNetwork2 = (networkProfile_t*)p2; 00694 00695 ret = (pNetwork1->nRegProfiles - pNetwork2->nRegProfiles); 00696 CN_LOGPRINTF("ret=%d", ret); 00697 // make the result of qsort to be descending 00698 ret = 0 - ret; 00699 return ret; 00700 }
static void connect_data_calc_last_network_type | ( | void | ) | [static] |
Definition at line 187 of file connectScreenData.c.
00188 { 00189 int index = -1; 00190 connection_t networkType = wireless_t;// default 00191 const regNetworkProfile_t* pRegNetwork; 00192 00193 // get it from the registry 00194 switch ( connect_data_get_connect_type() ) 00195 { 00196 case cmgrConnectIDS_e: 00197 index = g_last_connected_profile_ids; 00198 break; 00199 case cmgrConnectPCShare_e: 00200 index = g_last_connected_profile_pc; 00201 break; 00202 default: 00203 break; 00204 } 00205 00206 if (index != -1) 00207 { 00208 pRegNetwork = common_data_get_profiledata(index); 00209 if (pRegNetwork) 00210 { 00211 networkType = pRegNetwork->connection; 00212 } 00213 } 00214 00215 if (main_get_wifi_disabled() && networkType == wireless_t ) 00216 { 00217 // overrule default connection type when no wifi present 00218 networkType = wired_t; 00219 } 00220 00221 if (main_get_dialup_disabled() && networkType == dialup_t ) 00222 { 00223 // overrule default connection type when no dialup present 00224 networkType = wired_t; 00225 } 00226 00227 CN_LOGPRINTF("g_network_type[%d]", networkType); 00228 g_network_type = networkType; 00229 }
void connect_data_destroy | ( | void | ) |
void connect_data_destroy_network_profiles | ( | void | ) |
Definition at line 516 of file connectScreenData.c.
00517 { 00518 CN_LOGPRINTF("entry"); 00519 00520 common_data_destroy_network_profiles(g_network_profiles, 00521 g_n_network_profiles); 00522 g_network_profiles = NULL; 00523 g_n_network_profiles = 0; 00524 }
gboolean connect_data_get_ac_wlan | ( | void | ) |
Definition at line 399 of file connectScreenData.c.
00400 { 00401 CN_LOGPRINTF("ret=%d", g_ac_wlan); 00402 return g_ac_wlan; 00403 }
cmgrConnectType_t connect_data_get_connect_type | ( | void | ) |
Definition at line 349 of file connectScreenData.c.
00350 { 00351 CN_LOGPRINTF("entry"); 00352 00353 if ( main_get_background() ) 00354 { 00355 return g_background_connect_type; 00356 } 00357 else 00358 { 00359 return g_manual_connect_type; 00360 } 00361 }
gchar* connect_data_get_ecd_url | ( | void | ) |
Definition at line 472 of file connectScreenData.c.
00473 { 00474 CN_LOGPRINTF("entry"); 00475 00476 return g_strdup(REDIRECT_URL); 00477 }
char* connect_data_get_hidden_ssid_list | ( | void | ) |
Definition at line 801 of file connectScreenData.c.
00802 { 00803 char* ssidList; 00804 int len; 00805 gboolean first; 00806 int i, nRegNetworks; 00807 const regNetworkProfile_t* pRegNetwork; 00808 00809 // get how many profiles in the registry 00810 nRegNetworks = common_data_get_n_profiles(); 00811 00812 // get the len of ssidList 00813 len = 0; 00814 first = TRUE; 00815 for (i = 0; i < nRegNetworks; i++) 00816 { 00817 pRegNetwork = common_data_get_profiledata(i); 00818 if (pRegNetwork 00819 && pRegNetwork->connection == wireless_t 00820 && pRegNetwork->wirelessSettings 00821 && (pRegNetwork->wirelessSettings->broadcast == FALSE) 00822 && pRegNetwork->wirelessSettings->SSID) 00823 { 00824 if (!first) 00825 { 00826 // the number of spaces for the seperator 00827 len++; 00828 } 00829 // add the length of each ssid 00830 len += strlen(pRegNetwork->wirelessSettings->SSID); 00831 first = FALSE; 00832 } 00833 } 00834 // for the '\0' 00835 len += 1; 00836 00837 // malloc the memory 00838 ssidList = g_new0(char, len); 00839 g_return_val_if_fail(ssidList != NULL, 0); 00840 00841 first = TRUE; 00842 // set the value of ssidList 00843 for (i = 0; i < nRegNetworks; i++) 00844 { 00845 pRegNetwork = common_data_get_profiledata(i); 00846 if (pRegNetwork 00847 && pRegNetwork->connection == wireless_t 00848 && pRegNetwork->wirelessSettings 00849 && (pRegNetwork->wirelessSettings->broadcast == FALSE) 00850 && pRegNetwork->wirelessSettings->SSID) 00851 { 00852 if (!first) 00853 { 00854 // append the seperator 00855 strcat(ssidList, " "); 00856 } 00857 00858 // append each ssid 00859 strcat(ssidList, pRegNetwork->wirelessSettings->SSID); 00860 00861 first = FALSE; 00862 } 00863 } 00864 00865 CN_LOGPRINTF("return ssidList=%s", ssidList); 00866 return ssidList; 00867 }
gint connect_data_get_last_connected_profile | ( | void | ) |
Definition at line 279 of file connectScreenData.c.
00280 { 00281 CN_LOGPRINTF("entry"); 00282 00283 gint regIndex = -1; 00284 guint nRegNetworks; 00285 00286 nRegNetworks = common_data_get_n_profiles(); 00287 00288 switch ( connect_data_get_connect_type() ) 00289 { 00290 case cmgrConnectIDS_e: 00291 if ( g_last_connected_profile_ids >= 0 00292 && g_last_connected_profile_ids < nRegNetworks) 00293 { 00294 regIndex = g_last_connected_profile_ids; 00295 } 00296 break; 00297 00298 case cmgrConnectPCShare_e: 00299 if ( g_last_connected_profile_pc >= 0 00300 && g_last_connected_profile_pc < nRegNetworks) 00301 { 00302 regIndex = g_last_connected_profile_pc; 00303 } 00304 break; 00305 00306 default: 00307 ; // ignore 00308 } 00309 00310 CN_LOGPRINTF("Return [%d]", regIndex); 00311 return regIndex; 00312 }
int connect_data_get_n_network_profiles | ( | void | ) |
Definition at line 526 of file connectScreenData.c.
00527 { 00528 CN_LOGPRINTF("entry [%d]", g_n_network_profiles); 00529 00530 return g_n_network_profiles; 00531 }
const networkProfile_t* connect_data_get_network_profile | ( | int | profileIndex | ) |
Definition at line 533 of file connectScreenData.c.
00534 { 00535 CN_LOGPRINTF("entry profileIndex[%d]", profileIndex); 00536 00537 networkProfile_t* ret = NULL; 00538 00539 g_return_val_if_fail(g_network_profiles != NULL, NULL); 00540 g_return_val_if_fail(profileIndex < g_n_network_profiles, NULL); 00541 00542 ret = &g_network_profiles[profileIndex]; 00543 00544 CN_LOGPRINTF("ret=%p", ret); 00545 00546 return ret; 00547 }
connection_t connect_data_get_network_type | ( | void | ) |
Definition at line 381 of file connectScreenData.c.
00382 { 00383 CN_LOGPRINTF("ret=%d", g_network_type); 00384 return g_network_type; 00385 }
const regPCProfile_t* connect_data_get_pcsharedata | ( | void | ) |
Definition at line 459 of file connectScreenData.c.
00460 { 00461 CN_LOGPRINTF("entry"); 00462 00463 const regPCProfile_t* ret = common_data_get_pcsharedata(0); 00464 00465 CN_LOGPRINTF("return ret [%p]", ret); 00466 00467 return ret; 00468 }
int connect_data_get_profile_index | ( | int | regIndex | ) |
Definition at line 703 of file connectScreenData.c.
00704 { 00705 int profileIndex = -1; 00706 00707 profileIndex = common_data_get_profile_index(g_network_profiles, 00708 g_n_network_profiles, 00709 regIndex); 00710 00711 return profileIndex; 00712 }
int connect_data_get_reg_index | ( | int | profileIndex | ) |
Definition at line 714 of file connectScreenData.c.
00715 { 00716 CN_LOGPRINTF("entry profileIndex[%d]", profileIndex); 00717 00718 int regIndex = -1; 00719 00720 regIndex = common_data_get_reg_index(g_network_profiles, 00721 g_n_network_profiles, 00722 profileIndex); 00723 return regIndex; 00724 }
void connect_data_init | ( | void | ) |
Definition at line 66 of file connectScreenData.c.
00067 { 00068 CN_LOGPRINTF("entry"); 00069 00070 connect_data_read_last_connect(); 00071 connect_data_read_auto_connect(); 00072 connect_data_read_ac_wlan(); 00073 connect_data_calc_last_network_type(); 00074 }
void connect_data_init_network_profiles | ( | connection_t | networkType, | |
network_spec_t * | pScanNetworks, | |||
int | nScanNetworks | |||
) |
Definition at line 490 of file connectScreenData.c.
00493 { 00494 CN_LOGPRINTF("entry networkType[%d]pScanNetworks[%p]nScanNetworks[%d]", 00495 networkType, pScanNetworks, nScanNetworks); 00496 00497 // empty the old results 00498 connect_data_destroy_network_profiles(); 00499 00500 switch (networkType) 00501 { 00502 case wireless_t: 00503 get_wireless_profiles(pScanNetworks, nScanNetworks); 00504 break; 00505 case wired_t: 00506 case dialup_t: 00507 g_n_network_profiles = common_data_init_network_profiles(networkType, 00508 &g_network_profiles); 00509 break; 00510 default: 00511 CN_WARNPRINTF("unknown networkType[%d]", networkType); 00512 break; 00513 } 00514 }
gboolean connect_data_reach_max_profiles | ( | void | ) |
Definition at line 726 of file connectScreenData.c.
00727 { 00728 CN_LOGPRINTF("entry"); 00729 00730 connection_t networkType; 00731 gboolean reachMax = FALSE; 00732 00733 networkType = connect_data_get_network_type(); 00734 if ( ((networkType == wired_t) 00735 && common_data_reach_max_profiles(wired_t)) 00736 || ((networkType == wireless_t) 00737 && common_data_reach_max_profiles(wireless_t)) 00738 || ((networkType == dialup_t) 00739 && common_data_reach_max_profiles(dialup_t)) ) 00740 { 00741 reachMax = TRUE; 00742 } 00743 00744 CN_LOGPRINTF("return reachMax=%d", reachMax); 00745 return reachMax; 00746 }
static gboolean connect_data_read_ac_wlan | ( | void | ) | [static] |
Definition at line 125 of file connectScreenData.c.
00126 { 00127 CN_LOGPRINTF("entry"); 00128 00129 g_ac_wlan = erRegGetAutoConnectWlan(); 00130 00131 return TRUE; 00132 }
static gboolean connect_data_read_auto_connect | ( | void | ) | [static] |
Definition at line 102 of file connectScreenData.c.
00103 { 00104 CN_LOGPRINTF("entry"); 00105 00106 regAutoConnect_t* autoconnect; 00107 00108 // Read background connect mode 00109 if (main_get_background()) 00110 { 00111 autoconnect = erRegGetAutoConnect(); 00112 if (autoconnect) 00113 { 00114 if (autoconnect->backgroundConnectTo >= 1) 00115 { 00116 g_background_connect_type = cmgrConnectPCShare_e; 00117 } 00118 erRegFreeAutoConnect(autoconnect); 00119 } 00120 } 00121 00122 return TRUE; 00123 }
static gboolean connect_data_read_last_connect | ( | void | ) | [static] |
Definition at line 138 of file connectScreenData.c.
00139 { 00140 CN_LOGPRINTF("entry"); 00141 00142 regLastConnect_t* theLastConnect = NULL; 00143 gboolean ret = TRUE; 00144 00145 // get last connect from registry and 00146 // store the settings into global variables 00147 theLastConnect = erRegGetLastConnect(); 00148 if (theLastConnect) 00149 { 00150 // profile IDs 00151 g_last_connected_profile_ids = theLastConnect->profileConnectedIDS; 00152 g_last_connected_profile_pc = theLastConnect->profileConnectedPC; 00153 // connect type 00154 if (ids_t == theLastConnect->manualConnectType) 00155 { 00156 g_manual_connect_type = cmgrConnectIDS_e; 00157 } 00158 else if (pc_t == theLastConnect->manualConnectType) 00159 { 00160 g_manual_connect_type = cmgrConnectPCShare_e; 00161 } 00162 else 00163 { 00164 g_manual_connect_type = cmgrConnectUnknown_e; 00165 } 00166 00167 erRegFreeLastConnect(theLastConnect); 00168 } 00169 else 00170 { 00171 CN_LOGPRINTF("erRegGetLastConnect returns NULL"); 00172 g_last_connected_profile_ids = -1; 00173 g_last_connected_profile_pc = -1; 00174 g_manual_connect_type = cmgrConnectUnknown_e; 00175 g_network_type = connection_undefined_t; 00176 } 00177 00178 g_last_connected_profile_ids_stored = g_last_connected_profile_ids; 00179 g_last_connected_profile_pc_stored = g_last_connected_profile_pc; 00180 g_manual_connect_type_stored = g_manual_connect_type; 00181 00182 CN_LOGPRINTF("leave: return [%d]", ret); 00183 return ret; 00184 }
static gboolean connect_data_save_last_connect | ( | void | ) | [static] |
Definition at line 231 of file connectScreenData.c.
00232 { 00233 CN_LOGPRINTF("entry"); 00234 00235 gboolean ret = FALSE; 00236 regLastConnect_t theLastConnect; 00237 00238 if (g_last_connected_profile_ids != g_last_connected_profile_ids_stored 00239 || g_last_connected_profile_pc != g_last_connected_profile_pc_stored 00240 || g_manual_connect_type != g_manual_connect_type_stored) 00241 { 00242 prepare_registry_write(); 00243 00244 // write new settings to registry 00245 theLastConnect.profileConnectedIDS = g_last_connected_profile_ids; 00246 theLastConnect.profileConnectedPC = g_last_connected_profile_pc; 00247 if (g_manual_connect_type == cmgrConnectIDS_e) 00248 { 00249 theLastConnect.manualConnectType = ids_t; 00250 } 00251 else if (g_manual_connect_type == cmgrConnectPCShare_e) 00252 { 00253 theLastConnect.manualConnectType = pc_t; 00254 } 00255 else 00256 { 00257 theLastConnect.manualConnectType = ids_t; 00258 } 00259 00260 ret = erRegSetLastConnect(&theLastConnect); 00261 if (ret) 00262 { 00263 // update the global variables 00264 g_last_connected_profile_ids_stored = g_last_connected_profile_ids; 00265 g_last_connected_profile_pc_stored = g_last_connected_profile_pc; 00266 g_manual_connect_type_stored = g_manual_connect_type; 00267 } 00268 00269 do_registry_write(); 00270 } 00271 00272 return ret; 00273 }
gboolean connect_data_select_next_regprofile | ( | int | profileIndex | ) |
Definition at line 869 of file connectScreenData.c.
00870 { 00871 networkProfile_t *pNetwork; 00872 gboolean selected = FALSE; 00873 00874 pNetwork = (networkProfile_t*)connect_data_get_network_profile(profileIndex); 00875 if (pNetwork 00876 && pNetwork->nRegProfiles > 0 00877 && (pNetwork->nActiveIndex >= 0 00878 && pNetwork->nActiveIndex < pNetwork->nRegProfiles)) 00879 { 00880 if ((pNetwork->nActiveIndex+1) < pNetwork->nRegProfiles) 00881 { 00882 pNetwork->nActiveIndex += 1; 00883 selected = TRUE; 00884 } 00885 } 00886 00887 return selected; 00888 }
gboolean connect_data_set_connect_type | ( | cmgrConnectType_t | type | ) |
Definition at line 363 of file connectScreenData.c.
00364 { 00365 CN_LOGPRINTF("entry: type [%d]", type); 00366 00367 g_return_val_if_fail((type >= 0 && type < cmgrConnectUndef_e), 00368 FALSE); 00369 00370 if ( main_get_background() ) 00371 { 00372 g_background_connect_type = type; 00373 } 00374 else 00375 { 00376 g_manual_connect_type = type; 00377 } 00378 return TRUE; 00379 }
gboolean connect_data_set_last_connected_profile | ( | gint | regIndex | ) |
Definition at line 314 of file connectScreenData.c.
00315 { 00316 guint nRegNetworks; 00317 gboolean retVal = FALSE; 00318 00319 CN_LOGPRINTF("entry: regIndex [%d]", regIndex); 00320 00321 nRegNetworks = common_data_get_n_profiles(); 00322 00323 switch ( connect_data_get_connect_type() ) 00324 { 00325 case cmgrConnectIDS_e: 00326 if (regIndex >= 0 && regIndex < nRegNetworks) 00327 { 00328 g_last_connected_profile_ids = regIndex; 00329 retVal = TRUE; 00330 } 00331 break; 00332 00333 case cmgrConnectPCShare_e: 00334 if (regIndex >= 0 && regIndex < nRegNetworks) 00335 { 00336 g_last_connected_profile_pc = regIndex; 00337 retVal = TRUE; 00338 } 00339 break; 00340 00341 default: 00342 ; // ignore 00343 } 00344 00345 CN_LOGPRINTF("Return [%d]", retVal); 00346 return retVal; 00347 }
gboolean connect_data_set_network_type | ( | connection_t | type | ) |
Definition at line 387 of file connectScreenData.c.
00388 { 00389 CN_LOGPRINTF("entry type[%d]", type); 00390 00391 g_return_val_if_fail((type >= 0 && type < connection_undefined_t), 00392 FALSE); 00393 00394 g_network_type = type; 00395 00396 return TRUE; 00397 }
gboolean connect_data_store | ( | void | ) |
Definition at line 81 of file connectScreenData.c.
00082 { 00083 gboolean ret = TRUE; // TRUE = ok, so far 00084 00085 if (main_get_connect_type() == cmgrConnectUnknown_e) 00086 { 00087 // connect type NOT enforced by command line: save connect type 00088 ret = connect_data_save_last_connect(); 00089 } 00090 else 00091 { 00092 // connect type enforced by command line option: do NOT save 00093 } 00094 00095 CN_LOGPRINTF("ret=%d", ret); 00096 return ret; 00097 }
void connect_data_update_last_connected_profile_after_delete | ( | gint | delRegIndex | ) |
Definition at line 406 of file connectScreenData.c.
00407 { 00408 guint nRegNetworks; 00409 00410 CN_LOGPRINTF("entry: delRegIndex [%d]", delRegIndex); 00411 00412 nRegNetworks = common_data_get_n_profiles(); 00413 if (delRegIndex >= 0 && delRegIndex <= nRegNetworks) 00414 { 00415 CN_LOGPRINTF("before update: last_connected_profile_ids[%d]", 00416 g_last_connected_profile_ids); 00417 00418 CN_LOGPRINTF("before update: last_connected_profile_pc[%d]", 00419 g_last_connected_profile_pc); 00420 00421 // update the last connected profile to ids 00422 if (g_last_connected_profile_ids != -1) 00423 { 00424 if (delRegIndex < g_last_connected_profile_ids) 00425 { 00426 g_last_connected_profile_ids--; 00427 } 00428 else if (delRegIndex == g_last_connected_profile_ids) 00429 { 00430 g_last_connected_profile_ids = -1; 00431 } 00432 } 00433 00434 // update the last connected profile to pc 00435 if (g_last_connected_profile_pc != -1) 00436 { 00437 if (delRegIndex < g_last_connected_profile_pc) 00438 { 00439 g_last_connected_profile_pc--; 00440 } 00441 else if (delRegIndex == g_last_connected_profile_pc) 00442 { 00443 g_last_connected_profile_pc = -1; 00444 } 00445 } 00446 00447 CN_LOGPRINTF("after update: last_connected_profile_pc[%d]", 00448 g_last_connected_profile_pc); 00449 00450 CN_LOGPRINTF("after update: last_connected_profile_ids[%d]", 00451 g_last_connected_profile_ids); 00452 00453 } 00454 }
void connect_data_update_network_profile_with_last | ( | networkProfile_t * | pNetwork | ) |
Definition at line 749 of file connectScreenData.c.
00750 { 00751 CN_LOGPRINTF("entry pNetwork[%p]", pNetwork); 00752 00753 int nRegProfiles; 00754 const regNetworkProfile_t* pRegNetwork; 00755 00756 g_return_if_fail(pNetwork != NULL); 00757 00758 nRegProfiles = common_data_get_n_profiles(); 00759 g_return_if_fail(nRegProfiles > 0); 00760 00761 pRegNetwork = common_data_get_profiledata(nRegProfiles-1); 00762 g_return_if_fail(pRegNetwork != NULL); 00763 00764 pNetwork->nRegProfiles = 1; 00765 // regIndexList 00766 pNetwork->regIndexList = g_new0(int, 1); 00767 pNetwork->regIndexList[0] = nRegProfiles - 1; 00768 // regSettingsList 00769 pNetwork->regSettingsList = g_new0(regNetworkProfile_t*, 1); 00770 pNetwork->regSettingsList[0] = erRegDupNetworkProfile(pRegNetwork); 00771 // nActiveIndex 00772 pNetwork->nActiveIndex = 0; 00773 }
static int get_regindices_by_ssid | ( | const char * | ssid, | |
int ** | indexList | |||
) | [static] |
Definition at line 633 of file connectScreenData.c.
00634 { 00635 CN_LOGPRINTF("entry ssid=%s", ssid); 00636 00637 const regNetworkProfile_t* pRegNetwork; 00638 int nRegNetworks; 00639 int i; 00640 int counter = 0; // number if profiles found 00641 int *regIndices = NULL; // indexlist for profiles found 00642 00643 nRegNetworks = common_data_get_n_profiles(); 00644 // how many profiles have ssid 00645 for (i = 0; i < nRegNetworks; i++) 00646 { 00647 pRegNetwork = common_data_get_profiledata(i); 00648 if (pRegNetwork 00649 && pRegNetwork->wirelessSettings 00650 && pRegNetwork->wirelessSettings->SSID 00651 && ssid 00652 && !strcmp(pRegNetwork->wirelessSettings->SSID, ssid)) 00653 { 00654 counter++; 00655 } 00656 } 00657 00658 if (counter > 0) 00659 { 00660 // malloc the memory 00661 regIndices = g_new0(int, counter); 00662 g_return_val_if_fail(regIndices != NULL, 0); 00663 00664 // get the regIndices 00665 counter = 0; 00666 for (i = 0; i < nRegNetworks; i++) 00667 { 00668 pRegNetwork = common_data_get_profiledata(i); 00669 if (pRegNetwork 00670 && pRegNetwork->wirelessSettings 00671 && pRegNetwork->wirelessSettings->SSID 00672 && ssid 00673 && !strcmp(pRegNetwork->wirelessSettings->SSID, ssid)) 00674 { 00675 regIndices[counter] = i; 00676 counter++; 00677 } 00678 } 00679 } 00680 00681 CN_LOGPRINTF("leave: counter=%d, regIndices=%p", counter, regIndices); 00682 *indexList = regIndices; 00683 return counter; 00684 }
static void get_wireless_profiles | ( | network_spec_t * | pScanNetworks, | |
int | nScanNetworks | |||
) | [static] |
Definition at line 549 of file connectScreenData.c.
00551 { 00552 int i, j, regIndex; 00553 const regNetworkProfile_t* pRegNetwork; 00554 networkProfile_t* pNetwork; 00555 00556 CN_LOGPRINTF("pScanNetworks[%p], nScanNetworks[%d]", 00557 pScanNetworks, nScanNetworks); 00558 00559 // tweak them together 00560 if ((pScanNetworks == NULL) || (nScanNetworks == 0)) 00561 { 00562 CN_WARNPRINTF("No wireless network profiles scanned " 00563 "automatically. "); 00564 00565 // only show SSIDs in the air 00566 g_n_network_profiles = 0; 00567 g_network_profiles = NULL; 00568 } 00569 else if ((common_data_get_n_profiles() == 0)) 00570 { 00571 CN_WARNPRINTF("No any network profiles in the registry."); 00572 00573 g_n_network_profiles = nScanNetworks; 00574 g_network_profiles = g_new0(networkProfile_t, nScanNetworks); 00575 g_return_if_fail(g_network_profiles != NULL); 00576 00577 for (i = 0; i < nScanNetworks; i++) 00578 { 00579 pNetwork = &g_network_profiles[i]; 00580 pNetwork->scanSettings = dup_network_spec(&pScanNetworks[i]); 00581 pNetwork->regSettingsList = NULL; 00582 pNetwork->regIndexList = NULL; 00583 pNetwork->nRegProfiles = 0; 00584 pNetwork->nActiveIndex = -1; 00585 } 00586 } 00587 else 00588 { 00589 CN_LOGPRINTF("Found profiles in registry " 00590 "and profiles scanned automatically."); 00591 00592 g_n_network_profiles = nScanNetworks; 00593 g_network_profiles = g_new0(networkProfile_t, nScanNetworks); 00594 g_return_if_fail(g_network_profiles != NULL); 00595 00596 for (i = 0; i < nScanNetworks; i++) 00597 { 00598 pNetwork = &g_network_profiles[i]; 00599 pNetwork->scanSettings = dup_network_spec(&pScanNetworks[i]); 00600 pNetwork->nRegProfiles = get_regindices_by_ssid(pScanNetworks[i].ssid, 00601 &pNetwork->regIndexList); 00602 if (pNetwork->nRegProfiles > 0) 00603 { 00604 pNetwork->regSettingsList = g_new0(regNetworkProfile_t*, 00605 pNetwork->nRegProfiles); 00606 g_return_if_fail(pNetwork->regSettingsList != NULL); 00607 00608 for (j = 0; j < pNetwork->nRegProfiles; j++) 00609 { 00610 regIndex = pNetwork->regIndexList[j]; 00611 pRegNetwork = common_data_get_profiledata(regIndex); 00612 pNetwork->regSettingsList[j] = erRegDupNetworkProfile(pRegNetwork); 00613 } 00614 pNetwork->nActiveIndex = 0; 00615 } 00616 else 00617 { 00618 pNetwork->regSettingsList = NULL; 00619 pNetwork->regIndexList = NULL; 00620 pNetwork->nRegProfiles = 0; 00621 pNetwork->nActiveIndex = -1; 00622 } 00623 } 00624 00625 // sort them, profiles in registry are on the top 00626 qsort(g_network_profiles, g_n_network_profiles, 00627 sizeof(networkProfile_t), compare_wireless_profiles); 00628 } 00629 }
regNetworkProfile_t* network_spec_to_reg_network | ( | network_spec_t * | scanSettings | ) |
Definition at line 775 of file connectScreenData.c.
00776 { 00777 regNetworkProfile_t* regSettings = NULL; 00778 00779 if (scanSettings) 00780 { 00781 regSettings = g_new0(regNetworkProfile_t, 1); 00782 if (regSettings) 00783 { 00784 regSettings->name = g_strdup(scanSettings->ssid); 00785 regSettings->connection = wireless_t; 00786 regSettings->proxy = FALSE; 00787 regSettings->addressMode = dhcp_t; 00788 regSettings->wirelessSettings = g_new0(regWirelessSetting_t, 1); 00789 regSettings->wirelessSettings->SSID = g_strdup(scanSettings->ssid); 00790 regSettings->wirelessSettings->encrType = scanSettings->encryption; 00791 regSettings->wirelessSettings->encrKey = g_strdup(""); 00792 regSettings->dialupSettings = NULL; 00793 regSettings->proxySettings = NULL; 00794 regSettings->ipSettings = NULL; 00795 } 00796 } 00797 00798 return regSettings; 00799 }
gboolean g_ac_wlan = TRUE [static] |
Definition at line 44 of file connectScreenData.c.
cmgrConnectType_t g_background_connect_type = cmgrConnectIDS_e [static] |
Definition at line 39 of file connectScreenData.c.
gint g_last_connected_profile_ids = 0 [static] |
Definition at line 35 of file connectScreenData.c.
gint g_last_connected_profile_ids_stored = 0 [static] |
Definition at line 36 of file connectScreenData.c.
gint g_last_connected_profile_pc = 0 [static] |
Definition at line 37 of file connectScreenData.c.
gint g_last_connected_profile_pc_stored = 0 [static] |
Definition at line 38 of file connectScreenData.c.
cmgrConnectType_t g_manual_connect_type = cmgrConnectUnknown_e [static] |
Definition at line 40 of file connectScreenData.c.
cmgrConnectType_t g_manual_connect_type_stored = cmgrConnectUnknown_e [static] |
Definition at line 41 of file connectScreenData.c.
int g_n_network_profiles = 0 [static] |
Definition at line 48 of file connectScreenData.c.
networkProfile_t* g_network_profiles = NULL [static] |
Definition at line 47 of file connectScreenData.c.
connection_t g_network_type = connection_undefined_t [static] |
Definition at line 42 of file connectScreenData.c.