Symbian3/SDK/Source/GUID-0DBB2379-6FCB-5D1D-AE5A-2DC7C498F479.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Fri, 13 Aug 2010 16:47:46 +0100
changeset 14 578be2adaf3e
parent 7 51a74ef9ed63
permissions -rw-r--r--
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="GUID-0DBB2379-6FCB-5D1D-AE5A-2DC7C498F479" xml:lang="en"><title>PAN-NAP
Role Guide</title><shortdesc>The Network Access Point (NAP) role of the PAN profile allows a
device to access networking resources such as a LAN or the internet over a
Bluetooth® wireless connection via a NAP enabled device.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
<section id="GUID-AA951759-6DBA-4E93-AE2F-FF41501EF825"><title>Purpose</title> <p>The
NAP enabled device acts as a bridge between networks, such as the Piconet
and the LAN or Internet, for routing Ethernet packets. </p> <p>This document
provides you with background details necessary to set up and configure a Symbian
device to act as a NAP. </p> </section>
<section id="GUID-A0BFF8D1-1F41-4F85-9831-85203DE13886"><title>Key concepts/terms</title> <ul>
<li id="GUID-243E6E5C-1370-577B-87D2-179F81F5B215"><p> <b>Network Address
and Port Translation (NAPT) Protocol</b>  </p> <p>NAPT is a variation of NAT
(Network Address Translation). It translates the IP address of network traffic
from an internal IP address to an external IP address. </p> </li>
<li id="GUID-63E00973-D04D-5304-A5A4-9D9DA0DA76FA"><p> <b>Dynamic Host Configuration
Protocol (DHCP) Client / Server</b>  </p> <p>The DHCP server on the PAN-NAP
device assigns the authorized internal IP address to the PANU device. The
DHCP Client makes a request to a DHCP Server on a device on an external network
for configuration and assignment of an authorized IP address. </p> </li>
<li id="GUID-45A513BF-1642-5017-AA3F-0CA96694B87D"><p> <b>Uplink</b>  </p> <p>This
is a reference to the external network uplink (via a GPRS or WIFI connection,
for example) from the NAP device. The UPLINK IAP will need to be configured.
If the uplink is provided over WIFI then DHCP is used, with a GPRS connection
DHCP is not used, GPRS provides its own addressing mechanism. </p> </li>
<li id="GUID-6404BDE8-08F7-517B-A43D-C0D0F1E443B1"><p> <b>Notifiers</b>  </p> <p>Standard
Symbian platorm notifiers. The Uplink Authorization notifiers allows a policy
for granting access to uplink connections based on user interaction or some
automated response determined by the device manufacturer. </p> </li>
<li id="GUID-BE043FDD-8AED-5E96-9196-218E1B82EC55"><p> <b>IP Hooks</b>  </p> <p>This
is a generic mechanism for adding functionality to the IP stack. Both <i>NAPT</i> and <i>PAN-NAP
IP hooks</i> are added to the IP stack using IP hooks. </p> </li>
<li id="GUID-9CAF4B98-B6BD-5357-B857-A4319B1C80EF"><p> <b>IP Forwarding</b>  </p> <p>The
ability to forward between two different interfaces on the IP stack. IP forwarding
must be enabled in order that NAPT can forward data between the internal and
external networks. </p> </li>
</ul> </section>
<section id="GUID-52E68E49-3BAC-415C-844F-84F16EC19182"><title>Typical uses</title> <p>The
PAN profile NAP role may be used as follows: </p> <ul>
<li id="GUID-5B254BF8-F3A4-51DB-9D3A-1EACD8A2F406"><p> <b>Bridging networks</b> -
for example, connecting a laptop to the Internet over a NAP enabled phone </p> </li>
<li id="GUID-2931BD9A-1C87-56D2-8D66-284B1AAFFEE8"><p> <b>Managing a small
network</b> - for example, playing networked games using a NAP enabled phone
as the network manager </p> </li>
<li id="GUID-19B8B1B7-118F-5E5C-8FA4-C1EBF4345E50"><p> <b>Some combination
of the above</b>  </p> </li>
</ul> <p><b>Configuring
the PAN-NAP Role</b> </p> <p><b> PAN-NAP
listening</b> </p> <p>As with other PAN roles plus an entry is required in
the PANServiceExtensions table for NAP services. </p> <codeblock id="GUID-9879973F-0BAC-5628-8167-EFCB6FF7075C" xml:space="preserve">NapServiceEnabled=TRUE</codeblock> <p>Setting this value to true advertises availability of PAN-NAP and PANU
on the device and allows DHCP to act as in its Server role, responding to
DHCP configuration requests as required. </p> <p><b>Additional NAP related configuration details</b> </p> <ul>
<li id="GUID-3D2F6BF8-DB07-5435-8341-D52C00936AD1"><p> <b> Listening IAP</b>  </p> <p>As
with other PAN profiles but for the NAP role to be used with the listening
IAP <codeph>NapServiceEnabled</codeph> must be set to <codeph>TRUE</codeph>. </p> </li>
<li id="GUID-8572CCA2-467A-5575-B92D-48004C6D2C84"><p> <b>Outgoing connection
IAP</b>  </p> <p>There are no special considerations for an outgoing connection. </p> </li>
<li id="GUID-141877C0-5954-580C-940E-522DE1F35BD0"><p> <b> Uplink IAP</b>  </p> <p>An
IAP for WIFI, GPRS or some other uplink mechanism. PAN notifiers will decide
if an uplink is required. The device may have a policy in place to automatically
deal with uplink requests in some way or it may have a policy to prompt the
user to decide how to proceed with uplink requests. </p> </li>
<li id="GUID-8E7D00EB-DEF8-597D-8EDA-F1158FED5A92"><p> <b>DHCP</b>  </p> <p>The
listener IAP contains an entry reference to a specific LANService table entry
which will contain the DHCP configuration details. </p> <codeblock id="GUID-6725C2BF-BD3A-53E2-9290-F3145C3BF073" xml:space="preserve">...
ConfigDaemonManagerName=NetCfgExtnDhcp
ConfigDaemonName=!DhcpServ
IpAddr=172.16.0.1
...</codeblock> <p>The DHCP server provides only a single IP address, meaning
only one device can have access to the uplink at a time. </p> <p>These configuration
details must be correctly set for each IAP. </p> </li>
</ul> <p><b>Default
PAN configuration</b> </p> <p>This configuration reverts the device to the
default setting whereby PANU and PAN-GN are supported roles and the device
may connect to a PAN-NAP device but can not accept a PAN-NAP connection request. </p> <p>The
following is used to set up a standard (Pre PAN-NAP) PAN listener. </p> <codeblock id="GUID-335CE017-8919-5718-818E-9C056D69ED4A" xml:space="preserve">NapServiceEnabled=FALSE</codeblock> <p>If <codeph>NapServiceEnabled</codeph> is
set to <codeph>FALSE</codeph> the device will advertise PANU and PAN-GN roles
only and DHCP will be configured in the Client role. </p> <p><b>Notifiers </b> </p> <p>A PAN agent notifier is used to decide how to deal
with a request for an uplink. Either the user will be prompted or an automated
policy will be used to to decide how to handle the uplink request. There are
three possible return values for an uplink request: </p> <ul>
<li id="GUID-436C3CEB-CF44-53EE-9A0C-909BD5FD6EE9"><p> <codeph>EDisallowNewConnection</codeph>  </p> <p>The
PAN connection is not allowed and the temporary connection is severed. </p> </li>
<li id="GUID-CD81D820-3023-5436-B3CF-C6CC1DBF06C5"><p> <codeph>EAcceptNapConnectionAllowUplinkAccess</codeph>  </p> <p>The
connection will be allowed and the access will be granted to the uplink. Any
other active connections will be automatically disconnected. </p> </li>
<li id="GUID-F0226C23-0FA9-5A36-A63E-F5107FFD39A7"><p> <codeph>EAcceptNapConnectionDisallowUplinkAccess</codeph>  </p> <p>The
connection will be allowed but no access will be given to the uplink. </p> </li>
</ul> <p><b> Managing
network communications </b> </p> <p>The PAN-NAP IP hook is used to ensure
the DHCP server is properly used and to enforce the requirement that only
approved clients are granted access to the uplink. Since the DHCP server only
supports assigning a single IP address the IP hook ensures that that address
is given to the correct device. Packets are tagged as having access to the
uplink. Attempts to send packets through the DHCP server that are not properly
tagged will be ignored. Please see the tutorial to learn how to load an IP
hook. </p> <p><b> Loading
the NAPT protocol </b> </p> <p>Create a standard socket as NAPT and configure
it at required providing: </p> <ul>
<li id="GUID-0EC5FF5C-FA9C-55A7-B5F5-7066E78AD800"><p>Internal IP address </p> </li>
<li id="GUID-EE7F0AE7-E2F0-54C3-B2F7-1DC6C1F3C348"><p>External IP address </p> </li>
<li id="GUID-7AF5F187-E509-5823-8018-37E854DA59CA"><p>Bluetooth IAP Id </p> </li>
<li id="GUID-7C5BB258-3180-5C42-A20D-3140EF63FC6B"><p>Uplink IAP ID </p> </li>
</ul> <p>For example: </p> <codeblock id="GUID-C02161C8-F87C-5EFC-B0AE-D0A7A4122D45" xml:space="preserve">...
RSocket iNaptSocket;
TBool iStartNapt;
TInt iIapsStarted;
...
TInt err = KErrNone;
if ((err = iNaptSocket.Open(iSockServ, _L("napt"))) == KErrNone)
    {
    iNaptInfo().iPublicIap = iUplinkIapHelper-&gt;IapId();
    iNaptInfo().iPublicIp.SetAddress(publicAddr);

    iNaptInfo().iPrivateIap = iPanIapHelper-&gt;IapId();
    iNaptInfo().iPrivateIp.SetAddress(privateAddr);
    
    iNaptInfo().iNetmaskLength = 16;
    
    iNaptSocket.SetOpt(KSoNaptSetup, KSolNapt, iNaptInfo);
    
    iStartNapt = EFalse;
    }
else
  {
  // some error
     }
// NAPT addressing configured and started.
...</codeblock> <p>loads NAPT as follows: </p> <ul>
<li id="GUID-0AAE7359-4198-5207-AE9C-410E7CB3324F"><p> <b>Internal IP address:</b>  </p> <codeblock id="GUID-971E2BA9-9C11-5165-9A3B-4E4A504607FE" xml:space="preserve">    iNaptInfo().iPrivateIp.SetAddress(privateAddr);</codeblock> </li>
<li id="GUID-D124FAB8-83FD-5BAB-839A-048CE63A6B80"><p> <b>External IP address:</b>  </p> <codeblock id="GUID-4F2AD3C7-BD69-5247-8199-719F3B887F71" xml:space="preserve">    iNaptInfo().iPublicIp.SetAddress(publicAddr);</codeblock> </li>
<li id="GUID-3E14F84A-5661-5A14-A7B8-B44EC9F31D9E"><p> <b>Bluetooth PAN IAP
Id:</b>  </p> <codeblock id="GUID-DEAC3C75-780A-51F6-B120-E3B9DC02861C" xml:space="preserve">    iNaptInfo().iPrivateIap = iPanIapHelper-&gt;IapId();</codeblock> </li>
<li id="GUID-9DB78C08-E851-5DCE-8286-C2A992DC9815"><p> <b>Uplink IAP ID:</b>  </p> <codeblock id="GUID-31FD8E51-CDEA-5F5D-984D-5C84498D2645" xml:space="preserve">    iNaptInfo().iPublicIap = iUplinkIapHelper-&gt;IapId();</codeblock> </li>
</ul> </section>
<section id="GUID-2EBF0D9A-1255-4322-A25A-55E840D1D992"><title>See also</title> <p>Please
refer to the following for more information: </p> <ul>
<li id="GUID-B6863B55-AACF-5CBF-B136-55A11752BCF5"><p> <xref href="GUID-DEB6E162-B2AA-5DF6-B750-E833C7DE4902.dita#GUID-DEB6E162-B2AA-5DF6-B750-E833C7DE4902/GUID-0066861F-2219-55ED-8BCA-9E7FDB7B3B68">PAN Profile Overview</xref>  </p> </li>
<li id="GUID-EE747EA0-ABC5-54D7-A181-4DF53D34C8C8"><p> <xref href="GUID-EA8038F6-8727-5ABE-805C-9FF095293EB7.dita#GUID-EA8038F6-8727-5ABE-805C-9FF095293EB7/GUID-D7338D15-E269-54A5-B4E1-D5F0AACA9F32">Bluetooth Profiles</xref>  </p> </li>
<li id="GUID-4B47955E-4E68-5B20-A2DF-BCCA1F26F0FA"><p> <xref href="GUID-7640F878-2D99-52C8-ACBE-8B77A714E081.dita">Bluetooth
Protocols</xref>  </p> </li>
<li id="GUID-3FE650D1-E2C5-5C21-8C46-76053074AC71"><p> <b>Bluetooth PAN Tutorial
series</b>  </p> <ul>
<li id="GUID-0D84E550-0404-57C4-AE7F-B4C430067CD3"><p> <xref href="GUID-91C4F00B-E241-57DC-8520-8C16A302C983.dita">Creating
a Personal Area Network</xref>  </p> </li>
<li id="GUID-B68DA623-F8A5-51ED-8FE0-92BF754C06FC"><p> <xref href="GUID-685AD682-10DC-553B-9C3A-04D0376138C4.dita">Adding
a device to the PAN</xref>  </p> </li>
<li id="GUID-39D73100-FC9A-5404-95E5-BDEF7B7D888D"><p> <xref href="GUID-197648C4-A42C-5769-82B7-F8BA510631D9.dita">Removing
a device from the PAN</xref>  </p> </li>
<li id="GUID-F1275679-1BFA-52BA-A332-09316BC3ADEC"><p> <xref href="GUID-50CDF6E0-C352-5771-8686-B551267C6BE6.dita">Closing
the PAN</xref>  </p> </li>
</ul> </li>
</ul> <p><b>Related
Items</b> </p>  </section>
</conbody></concept>