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.
The NAP enabled device acts as a bridge between networks, such as the Piconet and the LAN or Internet, for routing Ethernet packets.
This document provides you with background details necessary to set up and configure a Symbian device to act as a NAP.
Network Address and Port Translation (NAPT) Protocol
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.
Dynamic Host Configuration Protocol (DHCP) Client / Server
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.
Uplink
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.
Notifiers
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.
IP Hooks
This is a generic mechanism for adding functionality to the IP stack. Both NAPT and PAN-NAP IP hooks are added to the IP stack using IP hooks.
IP Forwarding
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.
The PAN profile NAP role may be used as follows:
Bridging networks - for example, connecting a laptop to the Internet over a NAP enabled phone
Managing a small network - for example, playing networked games using a NAP enabled phone as the network manager
Some combination of the above
Configuring the PAN-NAP Role
PAN-NAP listening
As with other PAN roles plus an entry is required in the PANServiceExtensions table for NAP services.
NapServiceEnabled=TRUE
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.
Additional NAP related configuration details
Listening IAP
As with other PAN profiles but for the NAP role to be used with the listening IAP NapServiceEnabled must be set to TRUE.
Outgoing connection IAP
There are no special considerations for an outgoing connection.
Uplink IAP
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.
DHCP
The listener IAP contains an entry reference to a specific LANService table entry which will contain the DHCP configuration details.
... ConfigDaemonManagerName=NetCfgExtnDhcp ConfigDaemonName=!DhcpServ IpAddr=172.16.0.1 ...
The DHCP server provides only a single IP address, meaning only one device can have access to the uplink at a time.
These configuration details must be correctly set for each IAP.
Default PAN configuration
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.
The following is used to set up a standard (Pre PAN-NAP) PAN listener.
NapServiceEnabled=FALSE
If NapServiceEnabled is set to FALSE the device will advertise PANU and PAN-GN roles only and DHCP will be configured in the Client role.
Notifiers
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:
EDisallowNewConnection
The PAN connection is not allowed and the temporary connection is severed.
EAcceptNapConnectionAllowUplinkAccess
The connection will be allowed and the access will be granted to the uplink. Any other active connections will be automatically disconnected.
EAcceptNapConnectionDisallowUplinkAccess
The connection will be allowed but no access will be given to the uplink.
Managing network communications
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.
Loading the NAPT protocol
Create a standard socket as NAPT and configure it at required providing:
For example:
... RSocket iNaptSocket; TBool iStartNapt; TInt iIapsStarted; ... TInt err = KErrNone; if ((err = iNaptSocket.Open(iSockServ, _L("napt"))) == KErrNone) { iNaptInfo().iPublicIap = iUplinkIapHelper->IapId(); iNaptInfo().iPublicIp.SetAddress(publicAddr); iNaptInfo().iPrivateIap = iPanIapHelper->IapId(); iNaptInfo().iPrivateIp.SetAddress(privateAddr); iNaptInfo().iNetmaskLength = 16; iNaptSocket.SetOpt(KSoNaptSetup, KSolNapt, iNaptInfo); iStartNapt = EFalse; } else { // some error } // NAPT addressing configured and started. ...
loads NAPT as follows: