erbrowser/src/ipcServer.cpp File Reference

browser - browser IPC communication More...

#include <pthread.h>
#include <liberipc/eripc.h>
#include <liberipc/eripctoolbar.h>
#include <liberipc/eripcicons.h>
#include <liberipc/eripcbusyd.h>
#include <liberipc/eripccontentlister.h>
#include <liberipc/eripcviewer.h>
#include "browserTypes.h"
#include "contentLister.h"
#include "browserLog.h"
#include "toolbar.h"
#include "ipcServer.h"
#include "pagebar.h"

Go to the source code of this file.

Functions

void ipcMessageReceived (gpointer data, gint source_fd, GdkInputCondition condition)
gboolean ipc_InstallIpcServer (Ereader *browser)

Variables

static erServerChannel_t theServerChannel


Detailed Description

browser - browser IPC communication

<File description>="">

Definition in file ipcServer.cpp.


Function Documentation

gboolean ipc_InstallIpcServer ( Ereader browser  ) 

Start listening to IPC requests

Parameters:
Ereader datastructure containing the "mozembed" reference
Returns:
-

Definition at line 51 of file ipcServer.cpp.

00052 {
00053     int     returnValue;
00054     int     channel;
00055     int     fd = -1;
00056 
00057     BR_IPCPRINTF("entry");
00058 
00059     returnValue = erIpcOpenServerChannel(ER_XHTML_VIEWER_CHANNEL, &theServerChannel);
00060 
00061     if (returnValue != (-1))
00062     {
00063         fd = erIpcGetServerFd(theServerChannel);
00064 
00065         BR_IPCPRINTF("erIpcGetServerFd returned %d\n", fd);
00066 
00067         // gtk specific mechanism to monitor input file descriptor.
00068         returnValue = gdk_input_add(fd, GDK_INPUT_READ, ipcMessageReceived, (gpointer) browser);
00069 
00070         BR_IPCPRINTF("gdk_input_add returned %d", returnValue);
00071         return TRUE;
00072     }
00073     else
00074     {
00075         BR_ERRORPRINTF("Could not open server channel");
00076         return FALSE;
00077     }
00078 }

Here is the call graph for this function:

void ipcMessageReceived ( gpointer  data,
gint  source_fd,
GdkInputCondition  condition 
)

Definition at line 84 of file ipcServer.cpp.

00085 {
00086     Ereader *browser;
00087     char       szBuffer[SERVER_BUFFER_SIZE];
00088     int        nBuf = SERVER_BUFFER_SIZE;
00089     erIpcCmd_t command;
00090     int        page;
00091     int        iconID;
00092     int        iconState;
00093 
00094     browser = (Ereader *) data;
00095     erIpcGetMessage(theServerChannel, szBuffer, &nBuf);
00096 
00097     BR_IPCPRINTF("Received %s\n", szBuffer);
00098 
00099     if (vwrParseCommand(szBuffer, &command) >= 0)
00100     {
00101         switch (command.cc)
00102         {
00103             case ccVwrToolbar:
00104                 iconID    = atoi(command.arg[0]);
00105                 iconState = atoi(command.arg[1]);
00106                 BR_IPCPRINTF("Toolbar iconID [%d] iconState [%d]", iconID, iconState);
00107                 gdk_threads_enter();
00108                 toolbar_key_selected(iconID, iconState, browser);
00109                 gdk_threads_leave();
00110                 break;
00111             case ccVwrStore:
00112                 // no widget related requests => gdk_threads_enter() not needed
00113                 contentlister_request(command, browser);
00114                 break;
00115             case ccVwrJumpToPage:
00116                 page = atoi(command.arg[1]);
00117                 BR_IPCPRINTF("PageBar JumpToPage: %d", page);
00118                 gdk_threads_enter();
00119                 browser_pagebar_page_selected(page, browser);
00120                 gdk_threads_leave();
00121             default:
00122                 BR_IPCPRINTF("UNHANDLED COMMAND %d", command.cc);
00123                 break;
00124         }
00125     }
00126     else
00127     {
00128         BR_WARNPRINTF("vwrParseCommand returned < 0\n");
00129     }
00130 }

Here is the call graph for this function:


Variable Documentation

Definition at line 45 of file ipcServer.cpp.


Generated on Sun Dec 14 17:14:50 2008 by  doxygen 1.5.6