00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00026 #include <stdio.h>
00027 #include <stddef.h>
00028 #include <stdlib.h>
00029 #include <string.h>
00030
00031 #include <glib.h>
00032
00033 #include "erreglog.h"
00034 #include "erreg.h"
00035 #include "erregtypes_f.h"
00036 #include "erregxml.h"
00037 #include "erregbasis.h"
00038
00039 void regDumpVersion(const regVersion_t * theVersion)
00040 {
00041 if (theVersion)
00042 {
00043 ERREG_DUMPPRINTF("[%s]", EL_VERSION);
00044 ERREG_DUMPPRINTF("%s=%s", EL_REGISTRY, theVersion->registry);
00045 }
00046 }
00047
00048 void regDumpUserProfile(const regUserProfile_t * theUserProfile)
00049 {
00050 if (theUserProfile)
00051 {
00052 ERREG_DUMPPRINTF("[%s]", EL_USER_PROFILE);
00053 ERREG_DUMPPRINTF("%s=%s", EL_NAME, theUserProfile->name);
00054 ERREG_DUMPPRINTF("%s=%s", EL_EMAIL, theUserProfile->email);
00055 ERREG_DUMPPRINTF("%s=%s", EL_PASSWORD, theUserProfile->password);
00056 ERREG_DUMPPRINTF("%s=%s", EL_REDIRECT_URL, theUserProfile->redirectUrl);
00057 }
00058 }
00059
00060 void regDumpUserSetting(const regUserSetting_t * theUserSetting)
00061 {
00062 if (theUserSetting)
00063 {
00064 ERREG_DUMPPRINTF("[%s]", EL_USER_SETTING);
00065 ERREG_DUMPPRINTF("%s=%s", EL_LANGUAGE, theUserSetting->language);
00066 ERREG_DUMPPRINTF("%s=%d", EL_VOLUME, theUserSetting->volume);
00067 ERREG_DUMPPRINTF("%s=%d", EL_LONG_KP_TIMEOUT, theUserSetting->longkeypressTimeout);
00068 ERREG_DUMPPRINTF("%s=%d", EL_KEY_BUFFERING, theUserSetting->keyBuffering);
00069 ERREG_DUMPPRINTF("%s=%d", EL_FLIPBAR_DIRECTION, theUserSetting->flipbarLeftIsDown);
00070 }
00071 }
00072
00073 void regDumpPCConfig(const regPCConfig_t * thePCConfig)
00074 {
00075 if (thePCConfig)
00076 {
00077 int i;
00078 char szBuf[BUF_LEN + 1];
00079
00080 g_snprintf(szBuf, BUF_LEN, "%s=", EL_PC_PROFILES);
00081 for (i = 0; i < thePCConfig->size; i++)
00082 {
00083 strcat(szBuf, thePCConfig->pcList[i]);
00084 strcat(szBuf, ";");
00085 }
00086
00087 ERREG_DUMPPRINTF("[%s]", EL_PC_PROFILES);
00088 ERREG_DUMPPRINTF("%s", szBuf);
00089 }
00090 }
00091
00092 void regDumpPCProfile(const char *ID, const regPCProfile_t * thePCProfile)
00093 {
00094 if (thePCProfile)
00095 {
00096 ERREG_DUMPPRINTF("[%s]", ID);
00097 ERREG_DUMPPRINTF("%s=%s", EL_PROFILE_NAME, thePCProfile->name);
00098 ERREG_DUMPPRINTF("%s=%s", EL_PC_NAME, thePCProfile->pcname);
00099 ERREG_DUMPPRINTF("%s=%s", EL_SHARE_NAME, thePCProfile->sharename);
00100 ERREG_DUMPPRINTF("%s=%s", EL_WORKGROUP, thePCProfile->workgroup);
00101 ERREG_DUMPPRINTF("%s=%s", EL_USER_NAME, thePCProfile->username);
00102 ERREG_DUMPPRINTF("%s=%s", EL_PASSWORD, thePCProfile->password);
00103 }
00104 }
00105
00106 void regDumpAutoConnect(const regAutoConnect_t * theAutoConnect)
00107 {
00108 if (theAutoConnect)
00109 {
00110 ERREG_DUMPPRINTF("[%s]", EL_AUTO_CONNECT);
00111 ERREG_DUMPPRINTF("%s=%d", EL_ENABLE, theAutoConnect->backgroundEnable);
00112 ERREG_DUMPPRINTF("%s=%d", EL_SERVER_TYPE, theAutoConnect->backgroundConnectTo);
00113 ERREG_DUMPPRINTF("%s=%d", EL_INTERVAL, theAutoConnect->backgroundInterval);
00114 }
00115 }
00116
00117 void regDumpTimedIds(const regTimedIds_t *theTimedIds)
00118 {
00119 if (theTimedIds)
00120 {
00121 ERREG_DUMPPRINTF("[%s]", EL_TIMED_IDS);
00122 ERREG_DUMPPRINTF("%s=%d", EL_ENABLE_TIMEDIDS, theTimedIds->enable);
00123
00124 int i;
00125 for (i=0; i<theTimedIds->timeCnt; i++)
00126 {
00127 ERREG_DUMPPRINTF("%s[%d]=%d", EL_TIME, i, theTimedIds->timeSet[i]);
00128 }
00129
00130 ERREG_DUMPPRINTF("%s=%d", EL_ENABLE_SWUPDATE, theTimedIds->swUpdate);
00131 ERREG_DUMPPRINTF("%s=%d", EL_ENABLE_SWITCHOFF, theTimedIds->switchOff);
00132 }
00133 }
00134
00135 void regDumpContentCategory(const char *ID, const regContentCategory_t * theContentCategory)
00136 {
00137 if (ID && theContentCategory)
00138 {
00139 ERREG_DUMPPRINTF("[%s]", ID);
00140
00141 ERREG_DUMPPRINTF("%s=%s", EL_LOCATION, theContentCategory->location);
00142
00143 ERREG_DUMPPRINTF("%s=%d", EL_SORT_ASCENDING, theContentCategory->sortAscending);
00144 ERREG_DUMPPRINTF("%s=%s", EL_SORT_FIELD_TYPE, theContentCategory->sortFieldType);
00145 }
00146 }
00147
00148 void regDumpExportMemType(const regExportMemType_t *theExportMemType)
00149 {
00150 if (theExportMemType)
00151 {
00152 ERREG_DUMPPRINTF("%s=%s", EL_EXPORT_MEMORYTYPE, theExportMemType->location);
00153 }
00154 }
00155
00156 void regDumpLastRead(const char *ID, const regLastRead_t * theLastRead)
00157 {
00158 if (ID && theLastRead)
00159 {
00160 ERREG_DUMPPRINTF("[%s]", ID);
00161
00162 ERREG_DUMPPRINTF("%s=%s", EL_EXT_NAME, theLastRead->extension);
00163 ERREG_DUMPPRINTF("%s=%s", EL_DOCUMENT_PATH, theLastRead->documentPath);
00164 ERREG_DUMPPRINTF("%s=%s", EL_MANIFEST_PATH, theLastRead->manifestPath);
00165 ERREG_DUMPPRINTF("%s=%s", EL_POSITION, theLastRead->position);
00166 }
00167 }
00168
00169 void regDumpUserAppList(const regUserAppList_t * theUserAppList)
00170 {
00171 if (theUserAppList)
00172 {
00173 int i = 0;
00174 char szBuf[BUF_LEN + 1];
00175
00176 g_snprintf(szBuf, BUF_LEN, "%s=", EL_APPLICATIONS);
00177
00178 for (i = 0; i < theUserAppList->uaIDArraySize; i++)
00179 {
00180 strcat(szBuf, theUserAppList->uaIDArray[i]);
00181 strcat(szBuf, ";");
00182 }
00183
00184 ERREG_DUMPPRINTF("[%s]", EL_APPLICATIONS);
00185 ERREG_DUMPPRINTF("%s", szBuf);
00186 }
00187 }
00188
00189 void regDumpUserApp(const char *ID, const regUserApp_t * theUserApp)
00190 {
00191 if (ID && theUserApp)
00192 {
00193 int i = 0;
00194 char szBuf[BUF_LEN + 1];
00195
00196 ERREG_DUMPPRINTF("[%s]", ID);
00197 ERREG_DUMPPRINTF("%s=%s", EL_CATEGORY, theUserApp->szCategory);
00198 ERREG_DUMPPRINTF("%s=%s", EL_ARG_MASK, theUserApp->szArgMask);
00199 ERREG_DUMPPRINTF("%s=%s", EL_EXECUTE, theUserApp->szExec);
00200 ERREG_DUMPPRINTF("%s=%s", EL_X_RES_NAME, theUserApp->xResName);
00201 ERREG_DUMPPRINTF("%s=%d", EL_IPC_CHANNEL, theUserApp->ipcChannel);
00202
00203 g_snprintf(szBuf, BUF_LEN, "%s=", EL_SUPPORT_FORMAT);
00204 for (i = 0; i < theUserApp->extensionArraySize; i++)
00205 {
00206 strcat(szBuf, theUserApp->extensionArray[i]);
00207 strcat(szBuf, ";");
00208 }
00209
00210 ERREG_DUMPPRINTF("%s", szBuf);
00211 }
00212 }
00213
00214 void regDumpExtInfo(const regExtInfo_t * theExtInfo)
00215 {
00216 if (theExtInfo)
00217 {
00218 ERREG_DUMPPRINTF("[%s]", EL_EXTENSION_INFO);
00219 ERREG_DUMPPRINTF("%s=%s", EL_EXT_NAME, theExtInfo->extName);
00220 ERREG_DUMPPRINTF("%s=%s", EL_EXT_ICON, theExtInfo->iconLocation);
00221 ERREG_DUMPPRINTF("%s=%s", EL_ASSOCIATE_APP, theExtInfo->associateApp);
00222 ERREG_DUMPPRINTF("%s=%d", EL_ASSOCIATE_ORDER, theExtInfo->associateOrder);
00223 }
00224 }
00225
00226 void regDumpExtInfoList(const regExtInfoList_t * theExtInfoList)
00227 {
00228 if (theExtInfoList && theExtInfoList->extArraySize && theExtInfoList->extArray)
00229 {
00230 int i = 0;
00231 for(; i < theExtInfoList->extArraySize; ++i)
00232 {
00233 ERREG_DUMPPRINTF("[%s]", EL_EXTENSION_INFO);
00234 ERREG_DUMPPRINTF("%s=%s", EL_EXT_NAME, theExtInfoList->extArray[i].extName);
00235 ERREG_DUMPPRINTF("%s=%s", EL_EXT_ICON, theExtInfoList->extArray[i].iconLocation);
00236 ERREG_DUMPPRINTF("%s=%s", EL_ASSOCIATE_APP, theExtInfoList->extArray[i].associateApp);
00237 ERREG_DUMPPRINTF("%s=%d", EL_ASSOCIATE_ORDER, theExtInfoList->extArray[i].associateOrder);
00238 }
00239 }
00240 }
00241
00242
00243 void regDumpStartUp(const regStartUp_t * theStartUp)
00244 {
00245 if (theStartUp)
00246 {
00247 ERREG_DUMPPRINTF("[%s]", EL_START_UP);
00248 ERREG_DUMPPRINTF("%s=%d", EL_BEHAVIOUR, theStartUp->behaviour);
00249 ERREG_DUMPPRINTF("%s=%s", EL_DOCUMENT_PATH, theStartUp->documentPath);
00250 }
00251 }
00252
00253 void regDumpNetworkConfig(const regNetworkConfig_t * theNetworkConfig)
00254 {
00255 if (theNetworkConfig)
00256 {
00257 int i;
00258 char szBuf[BUF_LEN + 1];
00259
00260 g_snprintf(szBuf, BUF_LEN, "%s=", EL_NETWORK_PROFILES);
00261 for (i = 0; i < theNetworkConfig->size; i++)
00262 {
00263 strcat(szBuf, theNetworkConfig->networkList[i]);
00264 strcat(szBuf, ";");
00265 }
00266
00267 ERREG_DUMPPRINTF("[%s]", EL_NETWORK_PROFILES);
00268 ERREG_DUMPPRINTF("%s", szBuf);
00269 }
00270 }
00271
00272 void regDumpNetworkProfile(const char *ID, const regNetworkProfile_t * theNetworkProfile)
00273 {
00274 if (ID && theNetworkProfile)
00275 {
00276 ERREG_DUMPPRINTF("[%s]", ID);
00277 ERREG_DUMPPRINTF("%s=%s", EL_PROFILE_NAME, theNetworkProfile->name);
00278 ERREG_DUMPPRINTF("%s=%d", EL_NETWORK_TYPE, theNetworkProfile->connection);
00279 ERREG_DUMPPRINTF("%s=%s", EL_USE_PROXY, (theNetworkProfile->proxy == TRUE) ? "TRUE" : "FALSE");
00280 ERREG_DUMPPRINTF("%s=%d", EL_USE_DHCP, theNetworkProfile->addressMode);
00281 ERREG_DUMPPRINTF("%s=%d", EL_TIMESTAMP, theNetworkProfile->timestamp);
00282
00283 if (theNetworkProfile->wirelessSettings)
00284 {
00285 ERREG_DUMPPRINTF("%s=%s", EL_WLAN_SSID, theNetworkProfile->wirelessSettings->SSID);
00286 ERREG_DUMPPRINTF("%s=%d", EL_WLAN_ENCRYPTION_TYPE, theNetworkProfile->wirelessSettings->encrType);
00287 ERREG_DUMPPRINTF("%s=%s", EL_WLAN_ENCRYPTION_KEY, theNetworkProfile->wirelessSettings->encrKey);
00288 ERREG_DUMPPRINTF("%s=%d", EL_WLAN_BROADCAST, theNetworkProfile->wirelessSettings->broadcast);
00289 }
00290
00291 if (theNetworkProfile->dialupSettings)
00292 {
00293 ERREG_DUMPPRINTF("%s=%s", EL_DIALUP_PHONE, theNetworkProfile->dialupSettings->phone);
00294 ERREG_DUMPPRINTF("%s=%s", EL_DIALUP_USER, theNetworkProfile->dialupSettings->user);
00295 ERREG_DUMPPRINTF("%s=%s", EL_DIALUP_PASSWORD, theNetworkProfile->dialupSettings->password);
00296 }
00297
00298 if (theNetworkProfile->proxySettings)
00299 {
00300 ERREG_DUMPPRINTF("%s=%s", EL_PROXY_SERVER, theNetworkProfile->proxySettings->address);
00301 ERREG_DUMPPRINTF("%s=%s", EL_PROXY_PORT, theNetworkProfile->proxySettings->port);
00302 }
00303
00304 if (theNetworkProfile->ipSettings)
00305 {
00306 ERREG_DUMPPRINTF("%s=%s", EL_IP_ADDRESS, theNetworkProfile->ipSettings->address);
00307 ERREG_DUMPPRINTF("%s=%s", EL_IP_NETMASK, theNetworkProfile->ipSettings->netmask);
00308 ERREG_DUMPPRINTF("%s=%s", EL_IP_DNS, theNetworkProfile->ipSettings->dns);
00309 ERREG_DUMPPRINTF("%s=%s", EL_IP_GATEWAY, theNetworkProfile->ipSettings->gateway);
00310 }
00311 }
00312 }
00313
00314 void regDumpLastConnect(const regLastConnect_t * theLastConnect)
00315 {
00316 if (theLastConnect)
00317 {
00318 ERREG_DUMPPRINTF("[%s]", EL_LAST_CONNECT);
00319 ERREG_DUMPPRINTF("%s=%d", EL_PROFILE_CONNECTED_IDS, theLastConnect->profileConnectedIDS);
00320 ERREG_DUMPPRINTF("%s=%d", EL_PROFILE_CONNECTED_PC, theLastConnect->profileConnectedPC);
00321 ERREG_DUMPPRINTF("%s=%d", EL_MANUAL_CONNECT_TYPE, theLastConnect->manualConnectType);
00322 }
00323 }
00324
00325 void regDumpAutoConnectWlan(const gboolean enable)
00326 {
00327 ERREG_DUMPPRINTF("[%s]", EL_AUTO_CONNECT_WLAN);
00328 ERREG_DUMPPRINTF("%s=%d", EL_ENABLE, enable);
00329 }
00330
00331 void regDumpIconSet(const regIconSet_t * theIconSet)
00332 {
00333 if (theIconSet)
00334 {
00335 regIcon_t *theIcon = NULL;
00336 int i, j;
00337
00338 ERREG_DUMPPRINTF("[%s]", EL_TOOLBAR_ICONS);
00339
00340 for (i = 0; i < theIconSet->nIcons; i++)
00341 {
00342 theIcon = (theIconSet->iconArray) + i;
00343 if (theIcon)
00344 {
00345 char szBuf[BUF_LEN + 1];
00346
00347 if (theIcon->iconName)
00348 {
00349 g_snprintf(szBuf, BUF_LEN, "%s=", theIcon->iconName);
00350 for (j = 0; j < theIcon->iconPathsSize; j++)
00351 {
00352 strcat(szBuf, theIcon->iconPaths[j]);
00353 strcat(szBuf, ";");
00354 }
00355
00356 ERREG_DUMPPRINTF("%s", szBuf);
00357 }
00358 else
00359 {
00360 ERREG_LOGPRINTF("The %dth icon's name is NULL.", i);
00361 }
00362 }
00363 }
00364 }
00365 }
00366
00367 void regDumpDeviceDetails(const deviceDetails_t* theDeviceDetails)
00368 {
00369 if (theDeviceDetails)
00370 {
00371 ERREG_DUMPPRINTF("[%s]", EL_DEVICE_DETAILS);
00372
00373 if (theDeviceDetails->software)
00374 {
00375 ERREG_DUMPPRINTF("%s=%s", EL_BUILD_NAME, theDeviceDetails->software->szBuildName);
00376 ERREG_DUMPPRINTF("%s=%s", EL_BUILD_NUM, theDeviceDetails->software->szBuildNum);
00377 }
00378
00379 ERREG_DUMPPRINTF("%s=%s", EL_MAC_OF_WIRED, theDeviceDetails->szMacOfWired);
00380 ERREG_DUMPPRINTF("%s=%s", EL_MAC_OF_WIRELESS, theDeviceDetails->szMacOfWireless);
00381
00382 ERREG_DUMPPRINTF("%s=%s", EL_PUBLIC_KEY, theDeviceDetails->szPublicKey);
00383 }
00384 }
00385
00386 regPCProfile_t *regDupPCProfile(const regPCProfile_t * thePCProfile)
00387 {
00388 regPCProfile_t *ret = NULL;
00389
00390 ERREG_LOGPRINTF("entry");
00391
00392 if (thePCProfile)
00393 {
00394 ret = g_new0(regPCProfile_t, 1);
00395
00396 if (thePCProfile->name)
00397 {
00398 ret->name = strdup(thePCProfile->name);
00399 }
00400 if (thePCProfile->pcname)
00401 {
00402 ret->pcname = strdup(thePCProfile->pcname);
00403 }
00404 if (thePCProfile->sharename)
00405 {
00406 ret->sharename = strdup(thePCProfile->sharename);
00407 }
00408 if (thePCProfile->username)
00409 {
00410 ret->username = strdup(thePCProfile->username);
00411 }
00412 if (thePCProfile->workgroup)
00413 {
00414 ret->workgroup = strdup(thePCProfile->workgroup);
00415 }
00416 if (thePCProfile->password)
00417 {
00418 ret->password = strdup(thePCProfile->password);
00419 }
00420 }
00421 return ret;
00422 }
00423
00424 regStartUp_t *regDupStartUp(const regStartUp_t * theStartup)
00425 {
00426 ERREG_LOGPRINTF("entry");
00427
00428 regStartUp_t *ret = NULL;
00429
00430 if (theStartup)
00431 {
00432 ret = g_new0(regStartUp_t, 1);
00433 if (ret)
00434 {
00435 ret->behaviour = theStartup->behaviour;
00436 if (theStartup->documentPath)
00437 {
00438 ret->documentPath = g_strdup(theStartup->documentPath);
00439 }
00440 }
00441 }
00442
00443 return ret;
00444 }
00445
00446
00447 regNetworkProfile_t *regDupNetworkProfile(const regNetworkProfile_t * theNetworkProfile)
00448 {
00449 ERREG_LOGPRINTF("entry");
00450
00451 regNetworkProfile_t *ret = NULL;
00452
00453 if (theNetworkProfile)
00454 {
00455 ret = g_new0(regNetworkProfile_t, 1);
00456
00457 if (theNetworkProfile->name)
00458 {
00459 ret->name = g_strdup(theNetworkProfile->name);
00460 }
00461 ret->connection = theNetworkProfile->connection;
00462 ret->proxy = theNetworkProfile->proxy;
00463 ret->addressMode = theNetworkProfile->addressMode;
00464
00465 if (theNetworkProfile->wirelessSettings)
00466 {
00467 ret->wirelessSettings = g_new0(regWirelessSetting_t, 1);
00468
00469 if (theNetworkProfile->wirelessSettings->SSID)
00470 {
00471 ret->wirelessSettings->SSID = g_strdup(theNetworkProfile->wirelessSettings->SSID);
00472 }
00473 ret->wirelessSettings->encrType = theNetworkProfile->wirelessSettings->encrType;
00474
00475 if (theNetworkProfile->wirelessSettings->encrKey)
00476 {
00477 ret->wirelessSettings->encrKey = g_strdup(theNetworkProfile->wirelessSettings->encrKey);
00478 }
00479 }
00480
00481 if (theNetworkProfile->dialupSettings)
00482 {
00483 ret->dialupSettings = g_new0(regDialupSetting_t, 1);
00484
00485 if (theNetworkProfile->dialupSettings->phone)
00486 {
00487 ret->dialupSettings->phone = g_strdup(theNetworkProfile->dialupSettings->phone);
00488 }
00489 if (theNetworkProfile->dialupSettings->user)
00490 {
00491 ret->dialupSettings->user = g_strdup(theNetworkProfile->dialupSettings->user);
00492 }
00493 if (theNetworkProfile->dialupSettings->password)
00494 {
00495 ret->dialupSettings->password = g_strdup(theNetworkProfile->dialupSettings->password);
00496 }
00497 }
00498
00499 if (theNetworkProfile->proxySettings)
00500 {
00501 ret->proxySettings = g_new0(regProxySetting_t, 1);
00502
00503 if (theNetworkProfile->proxySettings->address)
00504 {
00505 ret->proxySettings->address = g_strdup(theNetworkProfile->proxySettings->address);
00506 }
00507
00508 if (theNetworkProfile->proxySettings->port)
00509 {
00510 ret->proxySettings->port = g_strdup(theNetworkProfile->proxySettings->port);
00511 }
00512 }
00513
00514 if (theNetworkProfile->ipSettings)
00515 {
00516 ret->ipSettings = g_new0(regIpSetting_t, 1);
00517
00518 if (theNetworkProfile->ipSettings->address)
00519 {
00520 ret->ipSettings->address = g_strdup(theNetworkProfile->ipSettings->address);
00521 }
00522
00523 if (theNetworkProfile->ipSettings->netmask)
00524 {
00525 ret->ipSettings->netmask = g_strdup(theNetworkProfile->ipSettings->netmask);
00526 }
00527
00528 if (theNetworkProfile->ipSettings->dns)
00529 {
00530 ret->ipSettings->dns = g_strdup(theNetworkProfile->ipSettings->dns);
00531 }
00532
00533 if (theNetworkProfile->ipSettings->gateway)
00534 {
00535 ret->ipSettings->gateway = g_strdup(theNetworkProfile->ipSettings->gateway);
00536 }
00537 }
00538 }
00539
00540 return ret;
00541 }
00542
00543 void regFreeVersion(regVersion_t * theVersion)
00544 {
00545 ERREG_LOGPRINTF("entry");
00546
00547 if (theVersion)
00548 {
00549 if (theVersion->registry)
00550 {
00551 g_free(theVersion->registry);
00552 theVersion->registry = NULL;
00553 }
00554 g_free(theVersion);
00555 }
00556 }
00557
00558 void regFreeUserProfile(regUserProfile_t * theUserProfile)
00559 {
00560 ERREG_LOGPRINTF("entry");
00561
00562 if (theUserProfile)
00563 {
00564 if (theUserProfile->name)
00565 {
00566 g_free(theUserProfile->name);
00567 theUserProfile->name = NULL;
00568 }
00569
00570 if (theUserProfile->email)
00571 {
00572 g_free(theUserProfile->email);
00573 theUserProfile->email = NULL;
00574 }
00575
00576 if (theUserProfile->email)
00577 {
00578 g_free(theUserProfile->password);
00579 theUserProfile->password = NULL;
00580 }
00581
00582 if (theUserProfile->redirectUrl)
00583 {
00584 g_free(theUserProfile->redirectUrl);
00585 theUserProfile->redirectUrl = NULL;
00586 }
00587
00588 g_free(theUserProfile);
00589 }
00590 }
00591
00592 void regFreeUserSetting(regUserSetting_t * theUserSetting)
00593 {
00594 ERREG_LOGPRINTF("entry");
00595
00596 if (theUserSetting)
00597 {
00598 if (theUserSetting->language)
00599 {
00600 g_free(theUserSetting->language);
00601 theUserSetting->language = NULL;
00602 }
00603
00604 g_free(theUserSetting);
00605 }
00606 }
00607
00608 void regFreePCConfig(regPCConfig_t * thePCConfig)
00609 {
00610 ERREG_LOGPRINTF("entry");
00611
00612 if (thePCConfig)
00613 {
00614 if (thePCConfig->pcList)
00615 {
00616 g_strfreev(thePCConfig->pcList);
00617 }
00618 g_free(thePCConfig);
00619 }
00620 }
00621
00622 void regFreePCProfile(regPCProfile_t * thePCProfile)
00623 {
00624 ERREG_LOGPRINTF("entry");
00625
00626 if (thePCProfile)
00627 {
00628 if (thePCProfile->name)
00629 {
00630 g_free(thePCProfile->name);
00631 thePCProfile->name = NULL;
00632 }
00633
00634 if (thePCProfile->pcname)
00635 {
00636 g_free(thePCProfile->pcname);
00637 thePCProfile->pcname = NULL;
00638 }
00639 if (thePCProfile->sharename)
00640 {
00641 g_free(thePCProfile->sharename);
00642 thePCProfile->sharename = NULL;
00643 }
00644 if (thePCProfile->username)
00645 {
00646 g_free(thePCProfile->username);
00647 thePCProfile->username = NULL;
00648 }
00649 if (thePCProfile->password)
00650 {
00651 g_free(thePCProfile->password);
00652 thePCProfile->password = NULL;
00653 }
00654 if (thePCProfile->workgroup)
00655 {
00656 g_free(thePCProfile->workgroup);
00657 thePCProfile->workgroup = NULL;
00658 }
00659 g_free(thePCProfile);
00660 }
00661 }
00662
00663 void regFreePCProfiles(regPCConfig_t * thePCConfig, regPCProfile_t ** thePCs)
00664 {
00665 ERREG_LOGPRINTF("entry");
00666
00667 if (thePCConfig != NULL && thePCs != NULL)
00668 {
00669 int i;
00670
00671 for (i = 0; i < thePCConfig->size; i++)
00672 {
00673 regFreePCProfile(thePCs[i]);
00674 }
00675 g_free(thePCs);
00676
00677
00678 regFreePCConfig(thePCConfig);
00679 }
00680 }
00681
00682 void regFreeAutoConnect(regAutoConnect_t * theAutoConnect)
00683 {
00684 ERREG_LOGPRINTF("entry");
00685
00686 if (theAutoConnect)
00687 {
00688 g_free(theAutoConnect);
00689 }
00690 }
00691
00692 void regFreeTimedIds(regTimedIds_t *theTimedIds)
00693 {
00694 ERREG_LOGPRINTF("entry");
00695
00696 if (theTimedIds)
00697 {
00698 g_free(theTimedIds);
00699 }
00700 }
00701
00702 void regFreeContentCategory(regContentCategory_t * theContentCategory)
00703 {
00704 ERREG_LOGPRINTF("entry");
00705
00706 if (theContentCategory)
00707 {
00708 if (theContentCategory->location)
00709 {
00710 g_free(theContentCategory->location);
00711 theContentCategory->location = NULL;
00712 }
00713
00714 if (theContentCategory->sortFieldType)
00715 {
00716 g_free(theContentCategory->sortFieldType);
00717 theContentCategory->sortFieldType = NULL;
00718 }
00719
00720 g_free(theContentCategory);
00721 }
00722 }
00723
00724 void regFreeExportMemType(regExportMemType_t *theExportMemType)
00725 {
00726 ERREG_LOGPRINTF("entry");
00727
00728 if (theExportMemType)
00729 {
00730 if (theExportMemType->location)
00731 {
00732 g_free(theExportMemType->location);
00733 theExportMemType->location = NULL;
00734 }
00735
00736 g_free(theExportMemType);
00737 }
00738 }
00739
00740 void regFreeLastRead(regLastRead_t * theLastRead)
00741 {
00742 ERREG_LOGPRINTF("entry");
00743
00744 if (theLastRead)
00745 {
00746 if (theLastRead->extension)
00747 {
00748 g_free(theLastRead->extension);
00749 theLastRead->extension = NULL;
00750 }
00751 if (theLastRead->documentPath)
00752 {
00753 g_free(theLastRead->documentPath);
00754 theLastRead->documentPath = NULL;
00755 }
00756 if (theLastRead->manifestPath)
00757 {
00758 g_free(theLastRead->manifestPath);
00759 theLastRead->manifestPath = NULL;
00760 }
00761 if (theLastRead->position)
00762 {
00763 g_free(theLastRead->position);
00764 theLastRead->position = NULL;
00765 }
00766 g_free(theLastRead);
00767 }
00768 }
00769
00770 void regFreeUserAppList(regUserAppList_t * theUserAppList)
00771 {
00772 ERREG_LOGPRINTF("entry");
00773
00774 if (theUserAppList)
00775 {
00776 g_strfreev(theUserAppList->uaIDArray);
00777 g_free(theUserAppList);
00778 }
00779 }
00780
00781 void regFreeUserApp(regUserApp_t * theUserApp)
00782 {
00783 ERREG_LOGPRINTF("entry");
00784
00785 if (theUserApp)
00786 {
00787 g_strfreev(theUserApp->extensionArray);
00788
00789 if (theUserApp->szCategory)
00790 {
00791 g_free(theUserApp->szCategory);
00792 theUserApp->szCategory = NULL;
00793 }
00794
00795 if (theUserApp->szArgMask)
00796 {
00797 g_free(theUserApp->szArgMask);
00798 theUserApp->szArgMask = NULL;
00799 }
00800 if (theUserApp->szExec)
00801 {
00802 g_free(theUserApp->szExec);
00803 theUserApp->szExec = NULL;
00804 }
00805 if (theUserApp->xResName)
00806 {
00807 g_free(theUserApp->xResName);
00808 theUserApp->xResName = NULL;
00809 }
00810 g_free(theUserApp);
00811 }
00812 }
00813
00814 void regFreeExtInfoList(regExtInfoList_t * theExtInfoList)
00815 {
00816 ERREG_LOGPRINTF("entry");
00817
00818 if (theExtInfoList)
00819 {
00820 int i = 0;
00821 for(; i < theExtInfoList->extArraySize; ++i)
00822 {
00823 g_free(theExtInfoList->extArray[i].extName);
00824 g_free(theExtInfoList->extArray[i].associateApp);
00825 g_free(theExtInfoList->extArray[i].iconLocation);
00826 }
00827 g_free(theExtInfoList->extArray);
00828 g_free(theExtInfoList);
00829 }
00830 }
00831
00832 void regFreeExtInfo(regExtInfo_t * theExtInfo)
00833 {
00834 ERREG_LOGPRINTF("entry");
00835
00836 if (theExtInfo)
00837 {
00838 if (theExtInfo->iconLocation)
00839 {
00840 g_free(theExtInfo->iconLocation);
00841 theExtInfo->iconLocation = NULL;
00842 }
00843
00844 g_free(theExtInfo);
00845 }
00846 }
00847
00848 void regFreeStartUp(regStartUp_t * theStartUp)
00849 {
00850 ERREG_LOGPRINTF("entry");
00851
00852 if (theStartUp)
00853 {
00854 if (theStartUp->documentPath)
00855 {
00856 g_free(theStartUp->documentPath);
00857 theStartUp->documentPath = NULL;
00858 }
00859
00860 g_free(theStartUp);
00861 }
00862 }
00863
00864 void regFreeWirelessSetting(regWirelessSetting_t * theWirelessSetting)
00865 {
00866 ERREG_LOGPRINTF("entry");
00867
00868 if (theWirelessSetting)
00869 {
00870 if (theWirelessSetting->SSID)
00871 {
00872 g_free(theWirelessSetting->SSID);
00873 theWirelessSetting->SSID = NULL;
00874 }
00875
00876 if (theWirelessSetting->encrKey)
00877 {
00878 g_free(theWirelessSetting->encrKey);
00879 theWirelessSetting->encrKey = NULL;
00880 }
00881
00882 g_free(theWirelessSetting);
00883 }
00884 }
00885
00886 void regFreeDialupSetting(regDialupSetting_t * theDialupSetting)
00887 {
00888 ERREG_LOGPRINTF("entry");
00889
00890 if (theDialupSetting)
00891 {
00892 if (theDialupSetting->phone)
00893 {
00894 g_free(theDialupSetting->phone);
00895 theDialupSetting->phone = NULL;
00896 }
00897
00898 if (theDialupSetting->user)
00899 {
00900 g_free(theDialupSetting->user);
00901 theDialupSetting->user = NULL;
00902 }
00903
00904 if (theDialupSetting->password)
00905 {
00906 g_free(theDialupSetting->password);
00907 theDialupSetting->password = NULL;
00908 }
00909
00910 g_free(theDialupSetting);
00911 }
00912 }
00913
00914 void regFreeProxySetting(regProxySetting_t * theProxySetting)
00915 {
00916 ERREG_LOGPRINTF("entry");
00917
00918 if (theProxySetting)
00919 {
00920 if (theProxySetting->address)
00921 {
00922 g_free(theProxySetting->address);
00923 theProxySetting->address = NULL;
00924 }
00925
00926 if (theProxySetting->port)
00927 {
00928 g_free(theProxySetting->port);
00929 theProxySetting->port = NULL;
00930 }
00931
00932 g_free(theProxySetting);
00933 }
00934 }
00935
00936 void regFreeIpSetting(regIpSetting_t * theIpSetting)
00937 {
00938 ERREG_LOGPRINTF("entry");
00939
00940 if (theIpSetting)
00941 {
00942 if (theIpSetting->address)
00943 {
00944 g_free(theIpSetting->address);
00945 theIpSetting->address = NULL;
00946 }
00947
00948 if (theIpSetting->netmask)
00949 {
00950 g_free(theIpSetting->netmask);
00951 theIpSetting->netmask = NULL;
00952 }
00953
00954 if (theIpSetting->dns)
00955 {
00956 g_free(theIpSetting->dns);
00957 theIpSetting->dns = NULL;
00958 }
00959
00960 if (theIpSetting->gateway)
00961 {
00962 g_free(theIpSetting->gateway);
00963 theIpSetting->gateway = NULL;
00964 }
00965
00966 g_free(theIpSetting);
00967 }
00968 }
00969
00970 void regFreeNetworkProfile(regNetworkProfile_t * theNetworkProfile)
00971 {
00972 ERREG_LOGPRINTF("entry");
00973
00974 if (theNetworkProfile)
00975 {
00976 if (theNetworkProfile->name)
00977 {
00978 g_free(theNetworkProfile->name);
00979 theNetworkProfile->name = NULL;
00980 }
00981
00982 if (theNetworkProfile->wirelessSettings)
00983 {
00984 regFreeWirelessSetting(theNetworkProfile->wirelessSettings);
00985 theNetworkProfile->wirelessSettings = NULL;
00986 }
00987
00988 if (theNetworkProfile->dialupSettings)
00989 {
00990 regFreeDialupSetting(theNetworkProfile->dialupSettings);
00991 theNetworkProfile->dialupSettings = NULL;
00992 }
00993
00994 if (theNetworkProfile->proxySettings)
00995 {
00996 regFreeProxySetting(theNetworkProfile->proxySettings);
00997 theNetworkProfile->proxySettings = NULL;
00998 }
00999
01000 if (theNetworkProfile->ipSettings)
01001 {
01002 regFreeIpSetting(theNetworkProfile->ipSettings);
01003 theNetworkProfile->ipSettings = NULL;
01004 }
01005 g_free(theNetworkProfile);
01006 }
01007 }
01008
01009 void regFreeNetworkConfig(regNetworkConfig_t * theNetworkConfig)
01010 {
01011 ERREG_LOGPRINTF("entry");
01012
01013 if (theNetworkConfig)
01014 {
01015 if (theNetworkConfig->networkList)
01016 {
01017 g_strfreev(theNetworkConfig->networkList);
01018 }
01019 g_free(theNetworkConfig);
01020 }
01021 }
01022
01023 void regFreeNetworkProfiles(regNetworkConfig_t * theNetworkConfig, regNetworkProfile_t ** theNetworks)
01024 {
01025 ERREG_LOGPRINTF("entry");
01026
01027 if (theNetworkConfig != NULL && theNetworks != NULL)
01028 {
01029 int i;
01030
01031 for (i = 0; i < theNetworkConfig->size; i++)
01032 {
01033 regFreeNetworkProfile(theNetworks[i]);
01034 }
01035 g_free(theNetworks);
01036
01037
01038 regFreeNetworkConfig(theNetworkConfig);
01039 }
01040 }
01041
01042 void regFreeLastConnect(regLastConnect_t * theLastConnect)
01043 {
01044 ERREG_LOGPRINTF("entry");
01045
01046 if (theLastConnect)
01047 {
01048 g_free(theLastConnect);
01049 }
01050 }
01051
01052 void regFreeIconSet(regIconSet_t * theIconSet)
01053 {
01054 ERREG_LOGPRINTF("entry");
01055
01056 if (theIconSet)
01057 {
01058 int i;
01059
01060 if (theIconSet->iconArray)
01061 {
01062 for (i = 0; i < theIconSet->nIcons; i++)
01063 {
01064 g_strfreev(theIconSet->iconArray[i].iconPaths);
01065 g_free(theIconSet->iconArray[i].iconName);
01066 }
01067 g_free(theIconSet->iconArray);
01068 }
01069 g_free(theIconSet);
01070 }
01071 }
01072
01073 void regFreeDeviceDetails(deviceDetails_t* theDeviceDetails)
01074 {
01075 ERREG_LOGPRINTF("entry");
01076
01077 if (theDeviceDetails)
01078 {
01079 if (theDeviceDetails->software)
01080 {
01081 g_free(theDeviceDetails->software->szBuildName);
01082 g_free(theDeviceDetails->software->szBuildNum);
01083 g_free(theDeviceDetails->software);
01084 }
01085
01086 g_free(theDeviceDetails->szMacOfWired);
01087 g_free(theDeviceDetails->szMacOfWireless);
01088 g_free(theDeviceDetails->szPublicKey);
01089
01090 g_free(theDeviceDetails);
01091 }
01092 }
01093
01094 connectTo_t regServerTypeToEnum(const char*string)
01095 {
01096 connectTo_t serverType = ids_t;
01097
01098 if (string)
01099 {
01100 if (strcmp(string, IDS) == 0)
01101 {
01102 serverType = ids_t;
01103 }
01104 else if (strcmp(string, PC) == 0)
01105 {
01106 serverType = pc_t;
01107 }
01108 else
01109 {
01110 serverType = ids_t;
01111 }
01112 }
01113 ERREG_LOGPRINTF("%s-->%d", string, serverType);
01114 return serverType;
01115 }
01116
01117 void regServerTypeToString(connectTo_t serverType, char* string, int len)
01118 {
01119 if (string && len > 0)
01120 {
01121 if (serverType == ids_t)
01122 {
01123 g_snprintf(string, len, "%s", IDS);
01124 }
01125 else if (serverType == pc_t)
01126 {
01127 g_snprintf(string, len, "%s", PC);
01128 }
01129 else
01130 {
01131 g_snprintf(string, len, "%s", IDS);
01132 }
01133 }
01134 ERREG_LOGPRINTF("%d-->%s", serverType, string);
01135 }
01136
01137 startup_behaviour_t regBehaviourToEnum(const char*string)
01138 {
01139 startup_behaviour_t behaviourType = DEFAULT_STARTUP_BEHAVIOUR;
01140
01141 if (string)
01142 {
01143 if (strcmp(string, SPECIFIC_DOCUMENT) == 0)
01144 {
01145 behaviourType = specificDocument_t;
01146 }
01147 else if (strcmp(string, REFERENCE_MATERIALS) == 0)
01148 {
01149 behaviourType = referenceMaterials_t;
01150 }
01151 else if (strcmp(string, LAST_READ_DOCUMENT) == 0)
01152 {
01153 behaviourType = lastReadDocument_t;
01154 }
01155 else if (strcmp(string, RECENT_DOCUMENTS) == 0)
01156 {
01157 behaviourType = recentDocuments_t;
01158 }
01159 else if (strcmp(string, DEVICE_MANAGER) == 0)
01160 {
01161 behaviourType = deviceManager_t;
01162 }
01163 else if (strcmp(string, NEWS_FOLDER) == 0)
01164 {
01165 behaviourType = newsFolder_t;
01166 }
01167 else if (strcmp(string, BOOKS_FOLDER) == 0)
01168 {
01169 behaviourType = booksFolder_t;
01170 }
01171 else if (strcmp(string, DOCS_FOLDER) == 0)
01172 {
01173 behaviourType = docsFolder_t;
01174 }
01175 else if (strcmp(string, NOTES_FOLDER) == 0)
01176 {
01177 behaviourType = notesFolder_t;
01178 }
01179 }
01180
01181 ERREG_LOGPRINTF("%s-->%d", string, behaviourType);
01182 return behaviourType;
01183 }
01184
01185 void regBehaviourToString(startup_behaviour_t behaviourType, char* string, int len)
01186 {
01187 if (string && len > 0)
01188 {
01189 if (behaviourType == specificDocument_t)
01190 {
01191 g_snprintf(string, len, "%s", SPECIFIC_DOCUMENT);
01192 }
01193 else if (behaviourType == referenceMaterials_t)
01194 {
01195 g_snprintf(string, len, "%s", REFERENCE_MATERIALS);
01196 }
01197 else if (behaviourType == lastReadDocument_t)
01198 {
01199 g_snprintf(string, len, "%s", LAST_READ_DOCUMENT);
01200 }
01201 else if (behaviourType == recentDocuments_t)
01202 {
01203 g_snprintf(string, len, "%s", RECENT_DOCUMENTS);
01204 }
01205 else if (behaviourType == deviceManager_t)
01206 {
01207 g_snprintf(string, len, "%s", DEVICE_MANAGER);
01208 }
01209 else if (behaviourType == newsFolder_t)
01210 {
01211 g_snprintf(string, len, "%s", NEWS_FOLDER);
01212 }
01213 else if (behaviourType == booksFolder_t)
01214 {
01215 g_snprintf(string, len, "%s", BOOKS_FOLDER);
01216 }
01217 else if (behaviourType == docsFolder_t)
01218 {
01219 g_snprintf(string, len, "%s", DOCS_FOLDER);
01220 }
01221 else if (behaviourType == notesFolder_t)
01222 {
01223 g_snprintf(string, len, "%s", NOTES_FOLDER);
01224 }
01225 else
01226 {
01227 regBehaviourToString(DEFAULT_STARTUP_BEHAVIOUR, string, len);
01228 }
01229 }
01230
01231 ERREG_LOGPRINTF("%s-->%d", string, behaviourType);
01232 }
01233
01234 connection_t regNetworkTypeToEnum(const char*string)
01235 {
01236 connection_t networkType = wired_t;
01237
01238 if (string)
01239 {
01240 if (strcmp(string, WIRELESS) == 0)
01241 {
01242 networkType = wireless_t;
01243 }
01244 else if (strcmp(string, WIRED) == 0)
01245 {
01246 networkType = wired_t;
01247 }
01248 else if (strcmp(string, DIALUP) == 0)
01249 {
01250 networkType = dialup_t;
01251 }
01252 else
01253 {
01254 networkType = wired_t;
01255 }
01256 }
01257
01258 ERREG_LOGPRINTF("%s-->%d", string, networkType);
01259 return networkType;
01260 }
01261
01262 void regNetworkTypeToString(connection_t networkType, char* string, int len)
01263 {
01264 if (string && len > 0)
01265 {
01266 if (networkType == wireless_t)
01267 {
01268 g_snprintf(string, len, "%s", WIRELESS);
01269 }
01270 else if (networkType == wired_t)
01271 {
01272 g_snprintf(string, len, "%s", WIRED);
01273 }
01274 else if (networkType == dialup_t)
01275 {
01276 g_snprintf(string, len, "%s", DIALUP);
01277 }
01278 else
01279 {
01280 g_snprintf(string, len, "%s", WIRED);
01281 }
01282 }
01283 ERREG_LOGPRINTF("%d-->%s", networkType, string);
01284 }
01285
01286 ip_address_mode_t regIpAddressToEnum(gboolean useDhcp)
01287 {
01288 ip_address_mode_t ipAddressType;
01289
01290 if (useDhcp)
01291 {
01292 ipAddressType = dhcp_t;
01293 }
01294 else
01295 {
01296 ipAddressType = static_t;
01297 }
01298
01299 ERREG_LOGPRINTF("%d-->%d", useDhcp, ipAddressType);
01300 return ipAddressType;
01301 }
01302
01303 gboolean regIpAddressToBool(ip_address_mode_t ipAddressType)
01304 {
01305 gboolean useDhcp;
01306
01307 if (ipAddressType == dhcp_t)
01308 {
01309 useDhcp = TRUE;
01310 }
01311 else if (ipAddressType == static_t)
01312 {
01313 useDhcp = FALSE;
01314 }
01315 else
01316 {
01317 useDhcp = TRUE;
01318 }
01319
01320 ERREG_LOGPRINTF("%d-->%d", ipAddressType, useDhcp);
01321 return useDhcp;
01322 }
01323
01324 wireless_encr_type_t regWlanEncrToEnum(const char*string)
01325 {
01326 wireless_encr_type_t encrType = encr_none_t;
01327
01328 if (string)
01329 {
01330 if (strcmp(string, ENCR_WEP) == 0)
01331 {
01332 encrType = encr_wep_t;
01333 }
01334 else if (strcmp(string, ENCR_WPA) == 0)
01335 {
01336 encrType = encr_wpa_t;
01337 }
01338 else if (strcmp(string, ENCR_NONE) == 0)
01339 {
01340 encrType = encr_none_t;
01341 }
01342 else
01343 {
01344 encrType = encr_none_t;
01345 }
01346 }
01347
01348 ERREG_LOGPRINTF("%s-->%d", string, encrType);
01349 return encrType;
01350 }
01351
01352 void regWlanEncrToString(wireless_encr_type_t encrType, char* string, int len)
01353 {
01354 if (string && len > 0)
01355 {
01356 if (encrType == encr_wep_t)
01357 {
01358 g_snprintf(string, len, "%s", ENCR_WEP);
01359 }
01360 else if (encrType == encr_wpa_t)
01361 {
01362 g_snprintf(string, len, "%s", ENCR_WPA);
01363 }
01364 else if (encrType == encr_none_t)
01365 {
01366 g_snprintf(string, len, "%s", ENCR_NONE);
01367 }
01368 else
01369 {
01370 g_snprintf(string, len, "%s", ENCR_NONE);
01371 }
01372 }
01373
01374 ERREG_LOGPRINTF("%d-->%s", encrType, string);
01375 }
01376