connectionMgr/inc/connectionMgr.h File Reference

#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <glib.h>
#include <liberregxml/erregapi.h>
#include "ecdc_err.h"
#include "commonData.h"
#include "connectScan.h"
#include "connectPing.h"
#include "connectScreen.h"
#include "editScreen.h"

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  screenPage_t

Defines

#define COMMAND_WIRED   "wired.sh"
#define COMMAND_IFUP_WIRED   "wired.sh start"
#define COMMAND_WIRELESS   "wireless.sh"
#define COMMAND_IFUP_WIRELESS   "wireless.sh start"
#define COMMAND_IFDOWN_ALL   "cifs.sh umount ; wireless.sh stop ; wired.sh stop ; dialup.sh stop"
#define COMMAND_SCAN_WIRELESS   "wireless.sh scan"
#define COMMAND_STATUS_WIRELESS   "wireless.sh status"
#define COMMAND_DIALUP   "dialup.sh"
#define COMMAND_STATUS_DIALUP   "dialup.sh status"
#define INTERFACE_WIRED   "eth0"
#define INTERFACE_WIRELESS   "wlan0"
#define INTERFACES_FILE_TMP   "/tmp/interfaces.tmp"
#define RESOLVE_CONF_FILE_TMP   "/tmp/resolv.conf.tmp"
#define HTTP_PROXY_FILE_TMP   "/tmp/http_proxy.tmp"
#define COMMAND_MOUNT_SAMBA   "cifs.sh"
#define DOWNLOADMGR_EXECUTABLE   "/usr/bin/downloadMgr"
#define PCSHAREMGR_EXECUTABLE   "/usr/bin/pcshareMgr"

Typedefs

typedef void(* on_tbsync_action_t )(void)

Enumerations

enum  cmgrScreen_t { cmgrScreenConnect_e = 0, cmgrScreenEdit_e, cmgrScreenUndef_e }

Functions

gboolean main_get_background (void)
cmgrConnectType_t main_get_connect_type (void)
gboolean main_get_edit_only (void)
gboolean main_get_use_last_connected (void)
gboolean main_get_connect_after_reboot (void)
gboolean main_get_wifi_disabled (void)
gboolean main_get_dialup_disabled (void)
char * main_get_screen_title (void)
void cmgr_set_screen_mode (cmgrScreen_t mode)
cmgrScreen_t cmgr_get_screen_mode (void)
GtkWidget * cmgr_screens_create (void)
void cmgr_set_pagebar ()
void cmgr_add_on_toolbar_sync_action (on_tbsync_action_t action)
guint on_cmgr_keypress (GtkWidget *widget, GdkEventKey *event, gpointer data)
void main_start_child_process (void)
void main_quit (void)
void show_keyboard (gboolean show)
void cmgr_get_back_page (const screenPage_t *curPage, screenPage_t *backPage)
void cmgr_up_page (void)
void cmgr_back_page (void)
gboolean cmgrInstallIpcServer (void)
gboolean cmgrStartIpcClientSetup (void)
void prepare_registry_write (void)
void do_registry_write (void)
void cmgr_scan_ctxt_init (void)
void cmgr_scan_ctxt_destory (void)
scanContext_tcmgr_get_scan_ctxt (void)
void cmgr_ping_ctxt_init (void)
void cmgr_ping_ctxt_destory (void)
pingContext_tcmgr_get_ping_ctxt (void)
void connect_disable_network (void)
ecd_err_t connect_enable_network (const regNetworkProfile_t *setting)
void connect_enable_network_abort (void)
void main_set_exit_value (int exitValue)
gboolean on_cmgr_quit (gpointer data)


Define Documentation

#define COMMAND_DIALUP   "dialup.sh"

Definition at line 55 of file connectionMgr.h.

#define COMMAND_IFDOWN_ALL   "cifs.sh umount ; wireless.sh stop ; wired.sh stop ; dialup.sh stop"

Definition at line 52 of file connectionMgr.h.

#define COMMAND_IFUP_WIRED   "wired.sh start"

Definition at line 48 of file connectionMgr.h.

#define COMMAND_IFUP_WIRELESS   "wireless.sh start"

Definition at line 51 of file connectionMgr.h.

#define COMMAND_MOUNT_SAMBA   "cifs.sh"

Definition at line 65 of file connectionMgr.h.

#define COMMAND_SCAN_WIRELESS   "wireless.sh scan"

Definition at line 53 of file connectionMgr.h.

#define COMMAND_STATUS_DIALUP   "dialup.sh status"

Definition at line 56 of file connectionMgr.h.

#define COMMAND_STATUS_WIRELESS   "wireless.sh status"

Definition at line 54 of file connectionMgr.h.

#define COMMAND_WIRED   "wired.sh"

Definition at line 47 of file connectionMgr.h.

#define COMMAND_WIRELESS   "wireless.sh"

Definition at line 50 of file connectionMgr.h.

#define DOWNLOADMGR_EXECUTABLE   "/usr/bin/downloadMgr"

Definition at line 68 of file connectionMgr.h.

#define HTTP_PROXY_FILE_TMP   "/tmp/http_proxy.tmp"

Definition at line 63 of file connectionMgr.h.

#define INTERFACE_WIRED   "eth0"

Definition at line 58 of file connectionMgr.h.

#define INTERFACE_WIRELESS   "wlan0"

Definition at line 59 of file connectionMgr.h.

#define INTERFACES_FILE_TMP   "/tmp/interfaces.tmp"

Definition at line 61 of file connectionMgr.h.

#define PCSHAREMGR_EXECUTABLE   "/usr/bin/pcshareMgr"

Definition at line 69 of file connectionMgr.h.

#define RESOLVE_CONF_FILE_TMP   "/tmp/resolv.conf.tmp"

Definition at line 62 of file connectionMgr.h.


Typedef Documentation

typedef void(* on_tbsync_action_t)(void)

Definition at line 85 of file connectionMgr.h.


Enumeration Type Documentation

Enumerator:
cmgrScreenConnect_e 
cmgrScreenEdit_e 
cmgrScreenUndef_e 

Definition at line 72 of file connectionMgr.h.

00073 {
00074     cmgrScreenConnect_e = 0,
00075     cmgrScreenEdit_e,
00076     cmgrScreenUndef_e
00077 } cmgrScreen_t;


Function Documentation

void cmgr_add_on_toolbar_sync_action ( on_tbsync_action_t  action  ) 

Definition at line 295 of file connectionMgr.c.

00296 {
00297     int elementSize, arraySize;
00298     int i, sz;
00299 
00300     CN_LOGPRINTF("entry");
00301     
00302     g_assert(action != NULL);
00303 
00304     elementSize = sizeof(on_toolbar_sync_actions[0]);
00305     arraySize = sizeof(on_toolbar_sync_actions);
00306     sz = arraySize / elementSize;
00307     
00308     for (i = 0; i < sz; i++)
00309     {
00310         if (on_toolbar_sync_actions[i] == NULL)
00311         {
00312             on_toolbar_sync_actions[i] = action;
00313             return;
00314         }
00315     }
00316 
00317     g_assert_not_reached();
00318 }

void cmgr_back_page ( void   ) 

Definition at line 1257 of file connectionMgr.c.

01258 {
01259     // wait for a while to show back icon active state
01260     g_timeout_add(500, on_delayed_cmgr_back_page, NULL);
01261 }

Here is the call graph for this function:

void cmgr_get_back_page ( const screenPage_t curPage,
screenPage_t backPage 
)

Definition at line 1030 of file connectionMgr.c.

01032 {
01033     CN_LOGPRINTF("entry [%p][%p]", curPage, backPage);
01034     
01035     g_return_if_fail(curPage != NULL);
01036     g_return_if_fail(backPage != NULL);
01037 
01038     if ((curPage->screen == cmgrScreenConnect_e)
01039        && (curPage->page == connectScreenOptions_e))
01040     {
01041          backPage->screen = cmgrScreenUndef_e;
01042          backPage->page = -1;
01043     }
01044     else if ((curPage->screen == cmgrScreenConnect_e) 
01045             && (curPage->page == connectScreenProfiles_e))
01046     {
01047         backPage->screen = cmgrScreenConnect_e;
01048         backPage->page = connectScreenOptions_e;
01049     }
01050     else if ((curPage->screen == cmgrScreenEdit_e) 
01051             && (curPage->page == editScreenProfiles_e))
01052     { 
01053         backPage->screen = cmgrScreenUndef_e;
01054         backPage->page = -1; 
01055     }
01056     else if ((curPage->screen == cmgrScreenEdit_e) 
01057             && (curPage->page == editScreenSearch_e))
01058     { 
01059         backPage->screen = cmgrScreenUndef_e;
01060         backPage->page = -1;
01061     }
01062     else if ((curPage->screen == cmgrScreenEdit_e)
01063             && (curPage->page == editScreenWireless_e))
01064     {
01065         if (edit_get_back_overview())
01066         {
01067             backPage->screen = cmgrScreenEdit_e;
01068             backPage->page = editScreenOverview_e;
01069         }
01070         else 
01071         {
01072             if (edit_get_wizard_mode())
01073             {
01074                 backPage->screen = cmgrScreenEdit_e;
01075                 backPage->page = editScreenSearch_e;
01076             }
01077             else
01078             {
01079                 backPage->screen = cmgrScreenUndef_e;
01080                 backPage->page = -1; 
01081             }
01082         }
01083     }
01084     else if ((curPage->screen == cmgrScreenEdit_e) 
01085             && (curPage->page == editScreenOverview_e))
01086     {
01087         backPage->screen = cmgrScreenUndef_e;
01088         backPage->page = -1; 
01089     }
01090     else if ((curPage->screen == cmgrScreenEdit_e) 
01091             && (curPage->page == editScreenDialup_e))
01092     {
01093         if (edit_get_back_overview())
01094         {
01095             backPage->screen = cmgrScreenEdit_e;
01096             backPage->page = editScreenOverview_e;
01097         }
01098         else
01099         {
01100             backPage->screen = cmgrScreenUndef_e;
01101             backPage->page = -1; 
01102         }
01103     }
01104     else if ((curPage->screen == cmgrScreenEdit_e) 
01105             && (curPage->page == editScreenProxy_e))
01106     {
01107         backPage->screen = cmgrScreenEdit_e; 
01108         backPage->page = editScreenOverview_e;
01109     }
01110     else if ((curPage->screen == cmgrScreenEdit_e) 
01111             && (curPage->page == editScreenStatic_e))
01112     {
01113         backPage->screen = cmgrScreenEdit_e;
01114         backPage->page = editScreenOverview_e;
01115     }
01116     else if ((curPage->screen == cmgrScreenEdit_e) 
01117             && (curPage->page == editScreenWirelessExt_e))
01118     {
01119         if (edit_get_back_overview())
01120         {
01121             backPage->screen = cmgrScreenEdit_e;
01122             backPage->page = editScreenOverview_e;
01123         }
01124         else
01125         {
01126             backPage->screen = cmgrScreenUndef_e; 
01127             backPage->page = -1; 
01128         }
01129     }
01130     else
01131     {
01132         backPage->screen = cmgrScreenUndef_e;
01133         backPage->page = -1;
01134     }
01135     CN_LOGPRINTF("backPage[%d,%d]", backPage->screen, backPage->page);
01136 }

Here is the call graph for this function:

pingContext_t* cmgr_get_ping_ctxt ( void   ) 

Definition at line 673 of file connectionMgr.c.

00674 {
00675     CN_LOGPRINTF("return %p", g_ping_ctxt);
00676     return g_ping_ctxt;
00677 }

scanContext_t* cmgr_get_scan_ctxt ( void   ) 

Definition at line 651 of file connectionMgr.c.

00652 {
00653     CN_LOGPRINTF("return %p", g_scan_ctxt);
00654     return g_scan_ctxt;
00655 }

cmgrScreen_t cmgr_get_screen_mode ( void   ) 

Definition at line 197 of file connectionMgr.c.

00198 {
00199     CN_LOGPRINTF("entry: g_screen_mode [%d]", g_screen_mode);
00200     return g_screen_mode;
00201 }

void cmgr_ping_ctxt_destory ( void   ) 

Definition at line 665 of file connectionMgr.c.

00666 {
00667     CN_LOGPRINTF("entry");
00668 
00669     connect_ping_ctxt_destory(g_ping_ctxt);
00670     g_ping_ctxt = NULL;
00671 }

Here is the call graph for this function:

void cmgr_ping_ctxt_init ( void   ) 

Definition at line 657 of file connectionMgr.c.

00658 {
00659     CN_LOGPRINTF("entry");
00660 
00661     cmgr_ping_ctxt_destory();
00662     g_ping_ctxt = connect_ping_ctxt_new();
00663 }

Here is the call graph for this function:

void cmgr_scan_ctxt_destory ( void   ) 

Definition at line 643 of file connectionMgr.c.

00644 {
00645     CN_LOGPRINTF("entry");
00646 
00647     connect_scan_ctxt_destory(g_scan_ctxt);
00648     g_scan_ctxt = NULL;
00649 }

Here is the call graph for this function:

void cmgr_scan_ctxt_init ( void   ) 

Definition at line 635 of file connectionMgr.c.

00636 {
00637     CN_LOGPRINTF("entry");
00638 
00639     cmgr_scan_ctxt_destory();
00640     g_scan_ctxt = connect_scan_ctxt_new();
00641 }

Here is the call graph for this function:

GtkWidget* cmgr_screens_create ( void   ) 

Definition at line 108 of file connectionMgr.c.

00109 {
00110     GtkWidget* screens;
00111     guint      signal_id;
00112 
00113     CN_LOGPRINTF("entry");
00114 
00115     // screens
00116     screens = gtk_vbox_new(FALSE, 0);
00117 
00118     // g_connectScreens
00119     g_connectScreens = connect_screen_create();
00120     connect_screen_set_text();
00121     gtk_box_pack_start(GTK_BOX(screens), g_connectScreens, 
00122                        FALSE, FALSE, 0);
00123     gtk_widget_hide(g_connectScreens);
00124 
00125     // g_editScreens
00126     g_editScreens = edit_screen_create();
00127     edit_screen_set_text();
00128     gtk_box_pack_start(GTK_BOX(screens), g_editScreens, FALSE, FALSE, 0);
00129     gtk_widget_hide(g_editScreens);
00130 
00131     // install class-specific screen update handlers
00132     //   erGtkEntry
00133     signal_id = g_signal_lookup("screen-refresh", ERGTK_ENTRY_TYPE);
00134     g_assert(signal_id > 0);
00135     g_signal_add_emission_hook(signal_id, 
00136                                0, 
00137                                hook_screen_refresh_typing, 
00138                                (gpointer)TEXT_ENTRY_CHANGED_LEVEL, 
00139                                NULL);
00140     //   erGtkToggleButton
00141     signal_id = g_signal_lookup("toggled", ERGTK_TOGGLE_BUTTON_TYPE);
00142     g_assert(signal_id > 0);
00143     g_signal_add_emission_hook(signal_id, 
00144                                 0, 
00145                                 hook_screen_refresh_typing, 
00146                                 (gpointer)SETTING_ITEM_CHANGE, 
00147                                 NULL);
00148 
00149     gtk_widget_show(screens);
00150     return screens;
00151 }

Here is the call graph for this function:

void cmgr_set_pagebar (  ) 

Definition at line 224 of file connectionMgr.c.

00225 {
00226     CN_LOGPRINTF("entry: g_screen_mode [%d]", g_screen_mode);
00227     
00228     switch (g_screen_mode)
00229     {
00230         case cmgrScreenConnect_e:
00231             connect_set_pagebar();
00232             break;
00233 
00234         case cmgrScreenEdit_e:
00235             edit_set_pagebar();
00236             break;
00237 
00238         default:
00239             CN_LOGPRINTF("Illegal screen g_screen_mode [%d]", 
00240                           g_screen_mode);
00241     }
00242 }

Here is the call graph for this function:

void cmgr_set_screen_mode ( cmgrScreen_t  mode  ) 

Definition at line 153 of file connectionMgr.c.

00154 {
00155     CN_LOGPRINTF("entry: mode [%d] g_screen_mode [%d]", 
00156                   mode, g_screen_mode);
00157 
00158     if (mode != g_screen_mode)
00159     {
00160         switch (mode)
00161         {
00162             case cmgrScreenConnect_e:
00163                 g_screen_mode = cmgrScreenConnect_e;
00164                 
00165                 bg_display_title();
00166 
00167                 gtk_widget_hide(g_editScreens);
00168                 gtk_widget_show(g_connectScreens);
00169 
00170                 connect_set_pagebar();
00171                 connect_set_toolbar();
00172                 
00173                 connect_screen_display();
00174                 break;
00175 
00176             case cmgrScreenEdit_e:
00177                 g_screen_mode = cmgrScreenEdit_e;
00178 
00179                 bg_display_title();
00180 
00181                 gtk_widget_hide(g_connectScreens);
00182                 gtk_widget_show(g_editScreens);
00183 
00184                 edit_set_toolbar();
00185                 edit_set_pagebar();
00186                 
00187                 edit_screen_display();
00188                 break;
00189 
00190             default:
00191                 CN_LOGPRINTF("Illegal screen mode [%d]", mode);
00192         }
00193     }
00194 }

Here is the call graph for this function:

void cmgr_up_page ( void   ) 

Definition at line 1190 of file connectionMgr.c.

01191 {
01192     screenPage_t curPage, upPage;
01193     editMode_t mode;
01194 
01195     CN_LOGPRINTF("entry");
01196  
01197     cmgr_get_cur_screen_page(&curPage);
01198     cmgr_get_up_page(&curPage, &upPage);
01199     
01200     if ((upPage.screen == cmgrScreenUndef_e)
01201         || (upPage.page == -1))
01202     {
01203         main_quit();
01204     }
01205     else
01206     {
01207         cmgr_goto_screen_page(&upPage);
01208 
01209         // The behaviour of up page to editScreenProfiles_e 
01210         // will lead to the profile editor is not only 
01211         // for filling in encryption key for access point.
01212         // So here, need to change the edit mode 
01213         // to be editModeConnectNormal_e
01214         if (upPage.screen == cmgrScreenEdit_e
01215             && upPage.page == editScreenProfiles_e)
01216         {
01217             mode = edit_get_mode();
01218             if ((mode == editModeConnectFillIn_e) 
01219                 || (mode == editModeConnectCreate_e))
01220             {
01221                 edit_set_mode(editModeConnectNormal_e);
01222             }
01223         }
01224     }
01225 }

Here is the call graph for this function:

gboolean cmgrInstallIpcServer ( void   ) 

Definition at line 530 of file connectionMgr.c.

00531 {
00532     int     ret;
00533     int     fd = -1;
00534     int     returnValue;
00535 
00536     CN_IPCPRINTF("entry");
00537 
00538     ret = erIpcOpenServerChannel(ER_CONNECT_CHANNEL, &theServerChannel);
00539 
00540     if (ret != (-1))
00541     {
00542         fd = erIpcGetServerFd(theServerChannel);
00543 
00544         CN_IPCPRINTF("erIpcGetServerFd returned %d\n", fd);
00545 
00546         // gtk specific mechanism to monitor input file descriptor.
00547         returnValue = gdk_input_add(fd, 
00548                                     GDK_INPUT_READ, 
00549                                     connectMessageReceived, 
00550                                     (gpointer) theServerChannel);
00551 
00552         CN_IPCPRINTF("gdk_input_add returned %d", returnValue);
00553         return TRUE;
00554     }
00555     else
00556     {
00557         CN_ERRORPRINTF("Could not open server channel");
00558         return FALSE;
00559     }
00560 }

Here is the call graph for this function:

gboolean cmgrStartIpcClientSetup ( void   ) 

void connect_disable_network ( void   ) 

Definition at line 679 of file connectionMgr.c.

00680 {
00681     // disable all interfaces
00682     system(COMMAND_IFDOWN_ALL);
00683 }

ecd_err_t connect_enable_network ( const regNetworkProfile_t setting  ) 

Definition at line 733 of file connectionMgr.c.

00734 {
00735     ecd_err_t err = ECD_FAILURE;
00736     char *command[128];
00737     int arg = 0;
00738     char *freelist[128];
00739     int free_arg = 0;
00740     int rc;
00741     struct in_addr address;
00742     struct in_addr netmask;
00743     struct in_addr broadcast;
00744     char *encrkey;
00745 
00746     CN_LOGPRINTF("entry");
00747     g_return_val_if_fail((regNetworkProfile != NULL), err);
00748 
00749     if (regNetworkProfile->connection != dialup_t)
00750     {
00751         FILE* fd_iface  = NULL;
00752         FILE* fd_resolv = NULL;
00753         FILE* fd_proxy  = NULL;
00754 
00755         // Create temporary files
00756         fd_iface  = fopen(INTERFACES_FILE_TMP,   "w");
00757         fd_resolv = fopen(RESOLVE_CONF_FILE_TMP, "w");
00758         fd_proxy  = fopen(HTTP_PROXY_FILE_TMP,   "w");
00759         g_return_val_if_fail((   fd_iface  != NULL
00760                               && fd_resolv != NULL
00761                               && fd_proxy  != NULL), err);
00762 
00763         // interface name
00764         fputs("iface ", fd_iface);
00765     
00766         switch (regNetworkProfile->connection)
00767         {
00768             case wired_t:
00769                 fputs(INTERFACE_WIRED, fd_iface);
00770                 break;
00771             case wireless_t:
00772                 fputs(INTERFACE_WIRELESS, fd_iface);
00773                 break;
00774             default:
00775                 CN_ERRORPRINTF("Illegal setting->connection [%d]", 
00776                                (int)regNetworkProfile->connection);
00777                 return err;
00778         }
00779 
00780         fputs(" inet ", fd_iface);  //type TCP/IP
00781 
00782         // static or dynamic IP address
00783         switch (regNetworkProfile->addressMode)
00784         {
00785             case dhcp_t:
00786                 fputs("dhcp ", fd_iface);
00787                 break;
00788 
00789             case static_t:
00790                 // static IP address etc.
00791                 fputs(  "static ", fd_iface);
00792                 fputs("\n  address ", fd_iface); 
00793                 fputs(regNetworkProfile->ipSettings->address, fd_iface);
00794                 fputs("\n  netmask ", fd_iface); 
00795                 fputs(regNetworkProfile->ipSettings->netmask, fd_iface);
00796                 fputs("\n  gateway ", fd_iface); 
00797                 fputs(regNetworkProfile->ipSettings->gateway, fd_iface);
00798 
00799                 // static DNS server address
00800                 fputs("nameserver ", fd_resolv);
00801                 fputs(regNetworkProfile->ipSettings->dns, fd_resolv);
00802                 break;
00803 
00804             default:
00805                 CN_ERRORPRINTF("Illegal setting->addresMode [%d]", 
00806                                 (int)regNetworkProfile->addressMode);
00807                 return err;
00808         }
00809 
00810         // Put proxy setting in environment
00811         if (regNetworkProfile->proxySettings == NULL)
00812         {
00813             CN_WARNPRINTF("No proxy needs to be specified");
00814             g_unsetenv("http_proxy");
00815             g_unsetenv("https_proxy");
00816         }
00817         else
00818         {
00819             char proxyString[256];
00820 
00821             snprintf(proxyString, sizeof(proxyString), 
00822                     "http://%s:%s", 
00823                     regNetworkProfile->proxySettings->address, 
00824                     regNetworkProfile->proxySettings->port);
00825             fputs(proxyString, fd_proxy);
00826             CN_WARNPRINTF("Setting proxy to %s", proxyString);
00827 
00828             g_setenv("http_proxy", proxyString, 1);
00829             g_setenv("https_proxy", proxyString, 1);
00830         }
00831 
00832         // close temporary files
00833         fputc('\n', fd_iface);   fclose(fd_iface);
00834         fputc('\n', fd_resolv);  fclose(fd_resolv);
00835         fputc('\n', fd_proxy);   fclose(fd_proxy);
00836     }
00837 
00838     // command-line to start network interface
00839     switch (regNetworkProfile->connection)
00840     {
00841         case wired_t:
00842             err = ECD_WIRED_ERROR;
00843             arg = 0;
00844             command[arg++] = COMMAND_WIRED;
00845             command[arg++] = "start";
00846             if (regNetworkProfile->addressMode == static_t)
00847             {
00848                 //inet_aton(regNetworkProfile->ipSettings->address, &address);
00849                 //inet_aton(regNetworkProfile->ipSettings->netmask, &netmask);
00850                 address.s_addr = inet_addr(regNetworkProfile->ipSettings->address);
00851                 netmask.s_addr = inet_addr(regNetworkProfile->ipSettings->netmask);
00852                 broadcast.s_addr = address.s_addr | ~netmask.s_addr;
00853 
00854                 command[arg++] = "static";
00855                 command[arg++] = regNetworkProfile->ipSettings->address;
00856                 command[arg++] = regNetworkProfile->ipSettings->netmask;
00857                 command[arg++] = freelist[free_arg++] = strdup(inet_ntoa(broadcast));
00858                 command[arg++] = regNetworkProfile->ipSettings->gateway;
00859                 command[arg++] = regNetworkProfile->ipSettings->dns;
00860             }
00861             else
00862             {
00863                 command[arg++] = "dhcp";
00864             }
00865             break;
00866 
00867         case wireless_t:
00868             err = ECD_WIRELESS_ERROR;
00869             arg = 0;
00870             command[arg++] = COMMAND_WIRELESS;
00871             command[arg++] = "start";
00872             command[arg++] = regNetworkProfile->wirelessSettings->SSID;
00873 
00874             switch (regNetworkProfile->wirelessSettings->encrType)
00875             {
00876                 case encr_none_t:
00877                     /* ignore */ ;
00878                     break;
00879                 case encr_wep_t:
00880                     command[arg++] = "enc";
00881                     encrkey = regNetworkProfile->wirelessSettings->encrKey;
00882                     add_key_prefix(encrkey, &freelist[free_arg]);
00883                     command[arg++] = freelist[free_arg];
00884                     free_arg++;
00885                    break;
00886                 case encr_wpa_t:
00887                     command[arg++] = "wpa";
00888                     encrkey = regNetworkProfile->wirelessSettings->encrKey;
00889                     command[arg++] = encrkey;
00890                     break;
00891                 default:
00892                     // TODO: support these settings
00893                     CN_ERRORPRINTF("Support the ascii settings");
00894                     break;
00895             }
00896             break; // end wireless_t
00897 
00898         case dialup_t:
00899             err = ECD_DIALUP_ERROR;
00900             arg = 0;
00901             command[arg++] = COMMAND_DIALUP;
00902             command[arg++] = "start";
00903             command[arg++] = regNetworkProfile->dialupSettings->phone;
00904             command[arg++] = regNetworkProfile->dialupSettings->user;
00905             command[arg++] = regNetworkProfile->dialupSettings->password;
00906             break; // end dialup_t
00907 
00908         default:
00909             /* ignore, has been tested before */ ;
00910     }
00911   
00912     // now execute the command, at last
00913     command[arg] = NULL;
00914     if ((enable_pid = fork()) == 0)
00915     {
00916         printf("Execvp returned %d\n", execvp(command[0], command));
00917         printf("execvp error: %d %s", errno, strerror(errno));
00918         exit(1);
00919     }
00920     waitpid(enable_pid, &rc, 0);
00921     if (WIFEXITED(rc) && WEXITSTATUS(rc) == 0)
00922     {
00923         err = ECD_NO_ERROR;
00924     }
00925     enable_pid = 0;
00926 
00927     for (free_arg--; free_arg >= 0; free(freelist[free_arg--]));
00928 
00929     FILE *fd = fopen("/tmp/profile_name.tmp", "w");
00930     fputs(regNetworkProfile->name, fd);
00931     fputs("\n", fd);
00932     fclose(fd);
00933     
00934     CN_LOGPRINTF("done: err [%d]", err);
00935     return err;
00936 }

Here is the call graph for this function:

void connect_enable_network_abort ( void   ) 

Definition at line 685 of file connectionMgr.c.

00686 {
00687     // stop network enable, when needed
00688     if (enable_pid > 0)
00689     {
00690         CN_WARNPRINTF("Sending SIGTERM to enable_pid [%d]", enable_pid);
00691         kill(enable_pid, SIGTERM);
00692     }
00693 }

void do_registry_write ( void   ) 

Definition at line 303 of file main.c.

00304 {
00305     gboolean       b;
00306     
00307     // verify write lock
00308     g_assert(lock_write == erRegGetLockState());
00309     
00310     // save registry
00311     b = erRegStore();
00312     if (b == FALSE)
00313     {
00314         CN_ERRORPRINTF("erRegStore fails with return code [%d]", b);
00315     }
00316 
00317     // release lock
00318     erRegUnlock();
00319 }

Here is the call graph for this function:

gboolean main_get_background ( void   ) 

Definition at line 595 of file main.c.

00596 {
00597     CN_LOGPRINTF("entry");
00598     return g_background;
00599 }

gboolean main_get_connect_after_reboot ( void   ) 

Definition at line 619 of file main.c.

00620 {
00621     CN_LOGPRINTF("return [%d]", g_connect_after_reboot);
00622     return g_connect_after_reboot;
00623 }

cmgrConnectType_t main_get_connect_type ( void   ) 

Definition at line 601 of file main.c.

00602 {
00603     CN_LOGPRINTF("return [%d]", g_connect_type);
00604     return g_connect_type;
00605 }

gboolean main_get_dialup_disabled ( void   ) 

Definition at line 631 of file main.c.

00632 {
00633     CN_LOGPRINTF("return [%d]", g_dialup_disabled);
00634     return g_dialup_disabled;
00635 }

gboolean main_get_edit_only ( void   ) 

Definition at line 607 of file main.c.

00608 {
00609     CN_LOGPRINTF("return [%d]", g_edit_only);
00610     return g_edit_only;
00611 }

char* main_get_screen_title ( void   ) 

Definition at line 637 of file main.c.

00638 {
00639     CN_LOGPRINTF("return [%s]", g_screen_title);
00640     return g_screen_title;
00641 }

gboolean main_get_use_last_connected ( void   ) 

Definition at line 613 of file main.c.

00614 {
00615     CN_LOGPRINTF("return [%d]", g_use_last_connected);
00616     return g_use_last_connected;
00617 }

gboolean main_get_wifi_disabled ( void   ) 

Definition at line 625 of file main.c.

00626 {
00627     CN_LOGPRINTF("return [%d]", g_wifi_disabled);
00628     return g_wifi_disabled;
00629 }

void main_quit ( void   ) 

Definition at line 485 of file main.c.

00486 {
00487     CN_LOGPRINTF("entry");
00488 
00489     if (g_exec_pid > 0)
00490     {
00491         // stop child process
00492         CN_WARNPRINTF("stop child process [%d]", g_exec_pid);
00493         kill(g_exec_pid, SIGTERM);
00494     }
00495     else if (gtk_main_level() > 0)
00496     {
00497         // no child process: stop gtk engine
00498         CN_WARNPRINTF("stop GTK main");
00499         gtk_main_quit();
00500     }
00501     else
00502     {
00503         // no child process, no in gtk_main, 
00504         // probably in initialisation phase: just quit
00505         CN_WARNPRINTF("_exit(1)");
00506         _exit(1);
00507     }
00508 }

void main_set_exit_value ( int  exitValue  ) 

void main_start_child_process ( void   ) 

Definition at line 514 of file main.c.

00515 {
00516     if (!g_background)
00517     {
00518        // no more screen updates from connection manager
00519        display_update_increase_level(NO_DISPLAY_UPDATE_LEVEL);
00520        // show_keyboard(FALSE);
00521        toolbar_setIconState(iconID_keyboard, iconState_grey);
00522     }
00523 
00524     g_idle_add(delayed_start_child_process, NULL);
00525 }

Here is the call graph for this function:

guint on_cmgr_keypress ( GtkWidget *  widget,
GdkEventKey *  event,
gpointer  data 
)

Definition at line 245 of file connectionMgr.c.

00248 {
00249     guint   returnValue = 0;    // return FALSE => default gtk handling
00250 
00251     CN_LOGPRINTF("entry");
00252 
00253     switch (cmgr_get_screen_mode())
00254     {
00255         case cmgrScreenConnect_e:
00256             returnValue = on_connect_keypress(event);
00257             break;
00258         case cmgrScreenEdit_e:
00259             returnValue = on_edit_keypress(event);
00260             break;
00261         default:
00262             /* ignore */ ;
00263     }
00264     
00265     return returnValue;
00266 }

Here is the call graph for this function:

gboolean on_cmgr_quit ( gpointer  data  ) 

void prepare_registry_write ( void   ) 

Definition at line 277 of file main.c.

00278 {
00279     gboolean       b;
00280     regLoad_t      regLoad;
00281     
00282     // acquire write lock
00283     b = erRegWriteLock();
00284     if (b == FALSE)
00285     {
00286         CN_ERRORPRINTF("erRegWriteLock fails with return code [%d]", b);
00287         g_assert_not_reached();
00288     }
00289     
00290     // reload section(s) that may be written
00291     erRegUnload(regNWProfiles_t);
00292     regLoad = erRegLoad(regNWProfiles_t);
00293     if (regLoad == loadError_t)
00294     {
00295         CN_ERRORPRINTF("erRegLoad(regNWProfiles_t) fails "
00296                        "with return code [%d]", 
00297                        regLoad);
00298         g_assert_not_reached();
00299     }
00300 }

Here is the call graph for this function:

void show_keyboard ( gboolean  show  ) 

Definition at line 511 of file connectionMgr.c.

00512 {
00513     CN_LOGPRINTF("entry: show [%d]", show);
00514 
00515     if (show)
00516     {
00517         // keyboard requested
00518         do_show_keyboard();
00519     }
00520     else
00521     {
00522         // keyboard not requested
00523         do_hide_keyboard(iconState_grey);
00524     }
00525 }

Here is the call graph for this function:


Generated on Sun Dec 14 17:15:26 2008 by  doxygen 1.5.6