Mobile device Management (MDM) and OMA (OTA) DM Protocol Wizard (ii)--WAP Protocol (2)

Source: Internet
Author: User
Tags sessions

Up "mobile device Management (MDM) and OMA (OTA) DM Protocol Wizard (ii)--WAP Protocol (1)"

8.WAP Server and WAP gateway
WAP server can directly to the mobile terminal to provide WAP application services, many people think that only WAP server to provide WAP content, this is incorrect, WAP content can be provided by any ordinary Web server, but this server must contain a WAP gateway, So you can skip the Third-party gateways that are installed on the mobile operator, and the applications on the host have complete control over the encrypted data stream.

9.WAP data Transfer (WAP PUSH)
WAP data transmission using WAP Push,wap Push technology is a mechanism built on the client server, that is, the server's initiative to send information to the client's technology. The main difference from traditional pull (PULL) technology is that the push technology is driven by the server to send information to the client voluntarily, while the pull (PULL) technology is the client's unsolicited request for information. The advantage of push technology lies in the initiative and timeliness of information.
There are many reasons why push technology has failed to achieve great success in the Internet. The main reason is that fixed devices such as computers in the fixed network provide users with sufficient resources and capabilities to find information, so users often use it as a window to browse information, rather than passive information recipients. At the same time, fixed network users need more information accuracy than their timeliness requirements, so push technology has not been widely used.
In mobile network, due to the existence of network bandwidth, mobile terminals and the high cost of the standard and other restrictions, so that users find information has been limited, if the important information in a proactive and timely push to the user's mobile devices will undoubtedly greatly facilitate the user. The advantage of mobile communication is that the mobile device can receive information anytime, so push technology can be used in mobile network, and WAP push is the result of combination of push technology and mobile communication. WAP push is a push technology applied in mobile networks, which combines the characteristics of general push technology and mobile network. Its system framework, usage protocols, and service modes are very different from the push technology on fixed web.

10.WAP Data Transfer Framework
The whole WAP framework includes PI (push initiator, Internet server), PPG (push Proxy Gateway, General WAP Gateway), mobile Terminal three parts. Pi to PPG is an HTTP-based PAP (push Access Protocol) protocol (PPG and PI are HTTP servers), and PPG to mobile terminals is a push OTA (push over-the-air) protocol.
The basic process is the information content that the server of Internet will send, adopt the XML expression form, send to WAP gateway through the PAP protocol. There's a lot of detail going on here. After the process (billing, SP identification, access control, information content binary compression coding, terminal discovery, terminal capability feature check, terminal address resolution), the content is sent to the mobile phone via the Push OTA Protocol (2.0 of the following specifications are used OTA-WSP, More than 2.0 of the specifications used Ota-http).
This is an ideal goal, but in the current wireless network deployed by all operators worldwide, it is unrealistic to realize this. Second generation wireless network gsm/cdma95a is based on the signaling Circuit exchange communication technology, does not support the IP protocol, can carry on the WAP such data service, needs to borrow the modem dialing mechanism in the signaling protocol stack to encapsulate into the IP/PPP package first. It is impossible for a WAP gateway to find a mobile phone through a signaling network and establish a connection to a WSP session. The second-generation semi-transitional network technology gprs/cdma1.x theoretically allows the phone to be permanently online, with a fixed IP address, but this is not true. The limited capacity of the air channel, billing management, network capacity, etc. are immature, so mobile terminals like a server, to receive and process the WAP gateway at any time to initiate the active connection request, can only wait until the third generation of wireless network technology in full popularity of that day.
It is precisely because of these limitations that at present, all operators and all solution providers around the world use SMS (short message) to carry the OTA side of the push, so in the actual environment more through the short message (SMS) gateway and mobile terminal interaction. SMS is a signaling channel transmission, in the network coverage of the mobile phone through BTS, BSC, MSC and SMS Center can communicate with each other anywhere. Therefore, as this server to the terminal information transmission carrier, SMS is the most suitable.

11. Push Access Protocol (PAP) (Push access Protocol)
PAP is a communication protocol between PI (server) and PPG (Gateway), it uses XML as the description language of the message, and completes the data transmission through simple request response mechanism. PAP can be implemented on a variety of communication protocols, including HTTP,SMTP. The current WAP version only gives the specification of PAP using the HTTP mechanism.

12. Push Space Transfer Protocol (push OTA)
PUSH Ota is a relatively simple protocol layer running on the WSP, which is responsible for data transfer from PPG (Gateway) to mobile device. Push OTA uses two WSP layer services for connection-oriented sessions (confirmed push) and connectionless session (connectionless push), which requires a pre-existing active session between PPG and the client for push using a connection session. That is, a push that requires the caller to receive acknowledgment information, and for connectionless push, the communication is completed through the reserved port. That is, send out, whether received after the ignore.

13.WAP Gateway
PPG (push Proxy gateway, generally WAP Gateway) completes most of the work in the push architecture, including access from the Internet to the mobile network, and all of its related authentication, security, client control, and so on. The main services provided by PPG include:
1 The identification, authentication and access control of Pi;
2) to analyze the content of push and error correction according to data type definition (DTD);
3 customer addressing and information transmission;
4 the Protocol conversion between PAP and push Ota;
5 to improve the transmission efficiency of the wireless channel, the information compression, compilation and so on processing.
In addition, PPG can also through the alias mechanism to achieve multicast and broadcast, the specific address alias map to the multicast or broadcast operations, the specific scheme can be determined by the system implementation. Different clients, their capabilities are different, PPG is also responsible for responding to PI's customer capacity query request, so that pi for different clients to construct the appropriate content format.

14. Establish WAP Gateway
Commercial WAP Gateway is expensive, we can use open source software Kannel. Kannel is not only a WAP gateway, but also an SMS gateway, it realizes the WAP transmission protocol completely. Kannel WAP Transfer Protocol code in the WAP directory. WAP transport protocol is not equivalent, Kannel as a gateway, in fact, it only needs to implement the server code, but kannel that the implementation of the server Code also implemented the client code, so this part of the code can be fully used in the phone.
The implementation of the Kannel state Machine and Protocol data unit is ingenious. There are a lot of def files, these files are mainly used to implement the State Machine and Protocol Data unit PDU Package/unpack, the tricky thing about this approach is that the macros in the DEF file are defined by context, and different contexts extract different data from the Def file, minimizing repetitive (similar) code.
Kannel for each layer of protocol implementation is also very clever. At initialization time, each protocol layer typically requires two function pointers, which are used to connect up and down two adjacent protocol layers: one function receives packets from the top and puts them in the queue, and another function receives packets from the lower level and puts them in the queue. In this way, the upper and lower layers are completely independent and can be tested separately. Each layer has a worker thread that asynchronously processes packets from the top and bottom layers so that calls from each layer are not blocked.
(1) Kannel installation
The latest Kannel stable version is 1.4.3 and can be downloaded at http://www.kannel.org. To install after downloading:
After decompression, enter the directory of the source files such as: cd/usr/local/gateway-1.4.3, followed by the following command:
Apt-get Install LIBXML2 Libxml2-dev
./configure
Make
Make Bindir=/usr/local/bin Install
After compiling, you will see two executables in the GW directory in the source file: Bearerbox, Wapbox

(2) Bearerbox, Wapbox
1) Bearerbox
The Bearerbox module connects to the CSD router, provides the interface to the Wapbox, and realizes the WDP layer of the WAP protocol stack.
Bearerbox records the current running Wapbox, receives UDP packets from the CSD router, routes packets received from the same terminal to the same wapbox, and sends the Wapbox processing results to the corresponding
Household terminals.
2) Wapbox
The Wapbox module implements the upper part of the WAP protocol stack, and the sessions and transactions belonging to the same transaction are handled by the same wapbox. The Wapbox implements the WTLS, WTP, and WSP layers. Wapbox received it from the phone.
HTTP-like requests, the actual HTTP request sent to the content server, compressed response data, sent back to the terminal.

Connections between Bearerbox and Wapbox are established via TCP. Bearerbox acts as a server waiting for Wapbox to connect. This way, Bearerbox does not need to keep a static Wapbox list. It starts with an empty list, waits for Wapbox to register, and this design makes it easy to add new Wapbox dynamically: Just install one, configure it, and connect to the corresponding Bearerbox.
If the TCP connection between Bearerbox and Wapbox is disconnected, Bearerbox will be notified to remove it from its own clients list. When the collapsed wapbox is removed from the Bearerbox clients list, packets received from terminals that should be routed to this wapbox are considered to be received from a new terminal. This means that Wapbox must be able to handle the packages in one session.
It may also be the case that Wapbox is still alive, but has been unable to deal with any news. To detect this, wapbox periodically sends a heartbeat (heartbeat) packet to Bearerbox, and if Bearerbox fails to receive the heartbeat message, it considers the wapbox of the problem to be a crash, but failed to disconnect the TCP connection. Bearerbox will disconnect and remove it from the list of clients. When the Wapbox is restored, the connection is reopened. The heartbeat message also contains the Wapbox load, Bearerbox load balancing accordingly.

(3) Configure the Gateway
You can also customize the gateway parameters after installation. Create personalized WAP gateway.
Observe one of the profiles and execute the command: VI gw/wapkannel.conf

# Kannle WAP Sample Configuration document
# Created by Nanu
# http://nanu.8866.org
# This is a must variable core
Group = Core
# The port number used to Bearerbox listening for HTTP management commands. Can be set to any port above 1023
Admin-port = 13333
# Specifies whether SSL is enabled
Admin-port-ssl = False
# Password for HTTP admin command
Admin-password = yourpasswd
# Request password for Kannel status. If there is no setting, no password is required.
Status-password = rose123
# Deny connections from this IP address
Admin-deny-ip = "123.123.123.123"
# allow these IP connections, you can use the wildcard character
Admin-allow-ip = "*.*.*.*"
# The port used for the Wapbox connection. If it is not set, Kannel cannot process the WAP transport
Wapbox-port = 13002
# Deny connections from this IP address
Box-deny-ip = "123.123.123.123"
# allow these IP to connect to the WAP unit, you can use the wildcard character
Box-allow-ip = "*.*.*.*"
# Reject UDP packets from this IP
Udp-deny-ip = "123.123.123.123"
# Allow UDP packets from this IP, you can use wildcard characters
Udp-allow-ip = "*.*.*.*"
# If this parameter is set, Kannel will listen for WAP UDP packets of 9200 to 9208 ports of the specified IP.
# If you don't need a specific qualification, you can use only one asterisk
Wdp-interface-name = "*"
# log file
Log-file = "Kannel.log"
# Log Level
# 0 Dispatch
# 1 Information
# 2 Warning
# 3 Error
# 4 Fatal problems
Log-level = 1
# Wapbox Group configuration information
# Required Variables
Group = Wapbox
# a computer running Bearerbox
Bearerbox-host = localhost
# The more frequency of the timer
Timer-freq = 1
# log file
Log-file = "Wap.log"
# Log Level
# 0 Dispatch
# 1 Information
# 2 Warning
# 3 Error
# 4 Fatal problems
Log-level = 1

(4) Start gateway
Bearerbox must be started before Wapbox is started. Since Bearerbox is a basic part of the gateway, it must be started first.
Go to the GW folder under the source code directory: CD gw/
Start Bearerbox:
./bearerbox-v 1 Pushkannel.conf &
Start Wapbox:
./wapbox-v 1 Pushkannel.conf &

Pushkannel.conf the configuration file that is brought by the package

(5) Management Gateway via HTTP
In the browser, enter:
Http://localhost:13000/shutdown?password=bar (Close Gateway)
Http://localhost:13000/status?password=bar (Get gateway status)
Http://localhost:13000/resume?password=bar (continue to run the gateway)

13000: Admin-port The specified port for the configuration file
Password: Admin-password The specified password for the configuration file

15.WAP Push Application Example
In order to observe the transmission process of WAP message, we do an application instance that sends WAP push message through WAP gateway.
Enter the test folder under the source code directory: CD test/
1 new file: iptestpap.txt, define PAP message, the contents of the file are as follows:

<?xml version= "1.0"?>
<! DOCTYPE pap public "-//wapforum//dtd pap//en"
"Http://www.wapforum.org/DTD/pap_1.0.dtd" >
<pap>
<push-message push-id= "9fjeo39jf084@pi.com"
deliver-after-timestamp= "2001-02-28t06:45:00z"
Progress-notes-requested= "false" >
<address address-value= "Wappush=127.0.0.1/type=ipv4" >
</address>
</push-message>
</pap>

where "wappush=127.0.0.1" defines the destination where the message is sent, defined here to be sent locally.

2 new file: Contentfile.txt, define the specific content of the message, the contents of the file are as follows:

<?xml version= "1.0"?>
<! DOCTYPE si public "-//wapforum//dtd si 1.0//en"
"Http://www.wapforum.org/DTD/si.dtd" >
<si>
<indication href= "http://wap.iobox.fi"
Si-id= "1@wiral.com"
action= "Signal-high"
Created= "1999-06-25t15:23:15z"
si-expires= "2006-06-30t00:00:00z" >
Want to test a fetch?
</indication>
</si>

3. Ready to grab the bag tool
Linux desktop environment can use "WIRESHARK", in the configuration window "Capture Options"
"Interface" option: Select "Pseudo-device that captures in all Interfaces:any"
"Capture Filter" option: Enter "host 127.0.0.1"
Click the "Start" button to start scratching the bag.

4) Send WAP push information
Go to the Test folder in the source file directory and execute the command:
./test_ppg "Http://127.0.0.1:8080/cgi-bin/wap-push.cgi?username=foo&password=bar" Contentfile.txt Iptestpap.txt
Where the arguments "username" and "password" are "Ppg-username=foo" and "Ppg-password=bar" defined in the configuration file "pushkannel.conf" that is used when starting Kannel


The results of the grab package are shown in Figure 1:

Figure 1


See Figure 1:
(a) The interaction of the previous two "HTTP" protocol packages is located on the PAP protocol side between the application server and the WAP gateway, the first packet is the PAP request sent by the server to the WAP gateway, the 2nd package "http/1.1 ACCE
Pted "indicates that the previously submitted request has been accepted by the WAP gateway and is being processed.
(B) The following two "SMPP", "WSP" protocols are located on the OTA protocol side of the Wap/sms Gateway and mobile terminal, and the UDP protocol is used for the 2nd packet (Figure 1) "WAP PUSH (0x06)" Transport layer.

16.OTA Side data Transfer (SMS Gateway and SMPP Protocol)
As described in the previous 10th chapter, "WAP Data transfer framework", at present all over the world, all operators and all solution providers use SMS (short message) to carry the OTA side of the push, SMS is transmitted on the signaling channel, Therefore, in the actual environment more through the short message (SMS) gateway and mobile terminal interaction, Kannel also implemented the SMS gateway function.
A short message Gateway (ISMG) is a device between a short message center (SMSC) and a business provider (SP) that provides a secure, fast channel for data exchange between the two entities. The SMS gateway uses the SMPP protocol (short messages PEER to PEER, SMS Point-to-Point Protocol), like the WAP gateway, which needs to complete the conversion, billing, routing, Security and network management of the Protocol. Specifically, the SMPP communication agent system mainly realizes the connection between the gateway and the GSM Network Short Message Center (SMSC), ensuring the accurate receiving and sending of the data, realizing the efficient and reliable transmission. In order to achieve the standard requirements of no more than 0.001% data packet loss rate, SMPP communication agent needs to support flow control.
SMPP is a basic agreement, in China there are mainly three derived from the agreement: China Mobile CMPP Agreement, China Unicom's SGIP (in CDMA is Etip), as well as PHS SMGP.
For example, through China Mobile WAP gateway to send WAP push has a long development cycle, debugging process more complex and so on, and the use of CMPP protocol that is based on SMS gateway for WAP Push delivery flexibility is relatively simple.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.