Symbian OS Communications (779884), страница 80
Текст из файла (страница 80)
However, if the WLAN chipset in your machine happens to beof the (rare) type that expects Ethernet II or 802.3 frames from the operating system andperforms the conversion to the 802.11 packet format internally, then this method will work.The best way to see if this works is to try it!398SETTING UP FOR DEVELOPMENTmore error prone. You’ll probablycccccc00.cre file first just in case.wanttobackupyourThe CommsDat repository is stored as a binary central repository file in\epoc32\winscw\c\private\10202be9\persists\ and is calledcccccc00.cre. The key tools to dealing with CommsDat are two Symbian OS executables that run under the emulator – the Comms databaseEDitor (CED) and the Comms database EDitor DUMPer (CEDDUMP).CED is used to convert a text-based, human readable CFG file, containing CommsDat information, into a binary CommsDat repository.
Itcan take a – i flag which allows you to specify the input file – notethat this is the effective Symbian OS path rather than the Windowsone, so to read a modified cedout.cfg file back in you should passa path of c:\cedout.cfg. If no input option is specified it tries toread from \epoc32\winscw\c\ced.cfg.
Running CED can take sometime, as the emulator has to start up first – on this machine it cantake up to a minute.2 At the end of the process CED leaves a log in\epoc32\winscw\c\ced.log.It is very important to check this log for errors. CED does not aborton failure – it tries to insert all information in the CFG file into therepository. Therefore the last line of the file might say ‘SUCCESS’ butindividual records may not have been inserted. Make sure you checkfor failures to insert particular records – the error itself can be hiddenamongst lots of other output, so errors such as ‘Field count mismatch!’are easy to miss.
The best way is often to check the number of recordsinserted into each table, and if it’s unexpectedly low then check thepreceding lines carefully for errors.CEDDUMP performs the opposite process – taking a binary cccccc00.cre file and producing a cedout.cfg file in \epoc32\winscw\c\.Dumping the original cccccc00.cre file is often a good point to startmodifying settings in CommsDat.2An unofficial, unsupported way of speeding this process up would be to add thestring ‘textshell’, on a line of its own, to \epoc32\data\epoc.ini. That reduces the timetaken to a few seconds. However, please be aware that this suggestion is both unofficialand unsupported, so it might change in the future – dependencies between CED and thecomponents it uses may change, changes to startup mechanisms might require the emulatorto boot fully, etc.
So try it, but be warned – it might stop working at any time!Don’t forget to remove the ‘textshell’ string afterwards – the S60 emulator has problemsdrawing the console, and obviously neither UIQ nor S60 emulators boot to the userinterface.NETWORK CONNECTIONS FOR IP399As we mentioned in Chapter 6, CommsDat is new for Symbian OSv9.1. Previously, information was stored in CommDB. The sametools are used to manipulate the data, but the binary file is different – in the case of CommDB it’s called cdbv3.dat and lives in\epoc32\winscw\c\system\data\.13.3.3 Setting up the Manual Way – Editing the Config FilesUsing WinPCap and a wired Ethernet cardUsing WinPCap and a virtual Ethernet adaptor allows you to share onephysical Ethernet interface between the emulator and your PC. It does thisby injecting packets through WinPCap into the bottom of the Windowsnetworking stack, specifically at the link-layer ie. underneath the IP stack,into the top of the Ethernet driver.
On the Symbian OS side, it appears asan Ethernet network interface.Make sure you’ve read the previous footnote about using WinPCap – specifically that it is very unlikely to work with WLAN adaptors.You may be lucky and have an adaptor with which it is compatible, butthe default recommendation is to use wired Ethernet adaptors only.The Symbian OS virtual network adaptor doesn’t show up as aseparate network interface in Windows due to the way it is implemented – however, it can be treated in the same way as a virtualEthernet interface, as it has its own properties – MAC address, and IPaddress – independent of the physical Ethernet interface that Windows isusing.This is the default IP connectivity option for the UIQ3 SDK. As aresult, a compatible version of WinPCap is installed during the SDKinstallation.
If you wish to use this method with S60 SDKs then you willneed to download and install WinPCap yourself from www.winpcap.org.Obviously if you have the UIQ3 SDK on your machine then WinPCapis already installed and there is no need to do it again.
At the time ofwriting, the compatible version of WinPCap is 3.0, although I’m using3.1 beta 4 which is working successfully.The configuration options for this virtual Ethernet adaptor are in theepoc.ini file, which is in \epoc32\data. The three lines of interest are:• ETHER_NIF – this specifies which network card to use on yourPC, and should be of the form ‘\Device\NPF_{<long string ofcharacters>}. The ‘netcards’ command from the SDK should listthe possible interfaces and ask you to choose one – however, we oftenfind it doesn’t work properly. The other method is to use the ‘Captureoptions’ dialog in Ethereal, which has a drop-down box listing all theinterfaces on your system. Pick the appropriate one, then copy the400SETTING UP FOR DEVELOPMENTcorrect part of the name (the part starting with ‘\Device’. .
. into yourepoc.ini.• ETHER_MAC – this is the MAC address of your virtual Ethernet adaptor.Most commonly it is the MAC address of the interface specified inETHER_NIF, but with the top byte changed from 00 to 02. Thismeans that it’s a ‘locally administered’ MAC address according to theIEEE, which also means that you’re responsible for making sure it’sunique! As long as you control the network card from which it isgenerated then this is a reasonable assumption, but be careful not toshare this MAC address around – if there’s more than one machineon the network with the same MAC address then you’ll see very oddbehavior from the IP networking components.• ETHER_SPEED – this parameter doesn’t actually do anything, so isnormally left set to ‘10 Mbps’.There is a script included with all SDKs called ‘configchange.pl’.Running this will attempt to set the configuration options above, thenbuild a new CommsDat repository suitable for use with the virtual Ethernetadaptor.One key point to note is that many business networks use someform of MAC address filtering.
This means that when you generate yourMAC address for the Symbian OS virtual network adaptor, you need tomake sure it is permitted on your network. Talk to your local networkadministrator to find out whether you need to register the MAC addressesyou use for the Symbian OS emulator with them. A typical symptom ofthis problem is that the emulator never gets an IP address over DHCP, orthat DNS lookups fail with -5120 errors.A great debugging tool for connection problems is Ethereal, availableat www.ethereal.com. This also uses WinPCap, and allows you to seeboth PC and emulator traffic.
You can also use a filter to display justthe emulator traffic – just enter eth.addr==<XX-XX-XX-XX-XX-XX>,where <XX-XX-XX-XX-XX-XX> is the MAC address of your emulator,in the ‘Filter’ field.Another potential issue you may encounter is the MTU of the virtualEthernet adaptor. It is hardcoded to 1500 bytes, the most common valuefor Ethernet networks. However, some networks, especially some broadband networks in the UK, require a lower MTU.
You’ll know if this isthe case if you have already had to alter the MTU on your PC to make itwork with your network connection. Typical symptoms of this problemwhen using a web browser are that small pages download correctly, suchas www.google.com, but the browser ‘hangs’ when downloading largerpages. Unfortunately, there is no way of altering the MTU without theEthernet NIF source code, so currently there is no workaround for thisproblem.
Keep an eye on the Symbian Developer website for updates onthis issue.NETWORK CONNECTIONS FOR IP401Using WinTAPInstructions for installing and using WinTAP are given as part of the download from Symbian’s developer website at http://developer.symbian.com/main/tools/devtools.The main point to make here is that WinTAP can solve many of theproblems encountered when using the WinPCap method of connectingthe emulator to a network, as it allows the use of Windows InternetConnection Sharing to connect the virtual network interface installedby WinTAP (this one is visible to Windows) to the PC’s main networkinterface. However, that’s also the drawback – the emulator does notappear on the main network, but instead has access through InternetConnection Sharing.