Linux makes WAP gateways
Abstract: This article briefly introduces WAP and WAP gateways, focusing on Kannel's gateway.
I. Introduction to WAP
1 WAP generation and development
In June 1997, Nokia, Ericsson, Motorola and Unwired Plancom jointly formed a WAP Forum, which is intended to introduce Internet's massive information and advanced services into wireless digital phones and terminals, and the goal is to generate a different wireless network. Technical Global Wireless Agreement Specifications for Industrial Standards Organization.
After the WAP Forum was established, the industry's positive response was obtained, and all walks of others gathered. At the beginning of 1998, the WAP specification was officially announced. The emergence of WAP has enabled the development of mobile communication in the telecommunications industry to completely join the computer network world. The maturity of the Internet standard.
WAP consists of a series of protocols to standardize wireless communication devices, such as cellular phones, radio transceivers, can also be used for Internet access, including e-mail, www, newsgroups, and IRC (Internet Relay chat). Briefly, the goal of WAP is to introduce the massive information and advanced services of the Internet to wireless terminals such as mobile phones. It optimizes the characteristics of the wireless network such as low bandwidth, high delay, and introduces a series of protocol specifications for the Internet into the wireless network. WAP is only required for mobile phones and WAP proxy servers, without requiring existing mobile communication network protocols to do any changes, thus applicable to different mobile communication systems such as CDMA, GSM, IMT-2000. In addition, WAP occupies hand-held equipment resources (such as ROM, RAM, CPU, etc.), which make up for the defects of the handheld equipment by strengthening the network function. Like the Web's role of the Internet, WAP hides the complexity of GSM on the application layer, and leaves the user-friendly intimate interface.
Telephone complies with WAP standards will be equipped with a browser that is comparable to the standard web browser. It uses a similar card set, and users can browse the operator's fixed web business through the card group. The end user first chooses a service, which downloads the card group to the mobile phone. The user can then browse, select and enter information between the cards, and perform the selected work. The information browsed can be cached. After later use, the card set can also cache and make a bookmark for quick retrieval. The format of electronic business cards, calendar events, and other types of content will be supported.
Internet, mobile communication is the most dynamic, most rapidly developed industry, WAP (Wireless Applications Wireless Application Protocol) combines mobile communications and Internet, which is a bridge between the world and the Internet. Mobile users can now access the Internet anytime, anywhere, can quickly safely obtain information and other communication services of the Internet and enterprise internal networks from their mobile terminals. WAP has a broad market prospect, which will will be rapidly developed and will change our lives to a large extent.
WAP's most attractive place is that whenever / where / whom can get the fastest speed, and the WAP terminal is relatively easy to carry and use. Wap the most applicable place is e-commerce, and now has been applied in securities, banks, etc., such as mobile phone stocks, mobile banking, etc.
2 WAP architecture
WAP Work Model Similar to the Work Model of Web, the mobile terminal issues a request and carries a variety of parameters (URLs, etc.), the gateway passes the corresponding request to the web server, and the server generates the corresponding result by retrieving parameters, returns to the proxy gateway The gateway is decoded, encoded, and sent the result back to the mobile terminal, and a session process is over. WAP defines a complete set of standard components to enable communication between clients and servers, including standard URLs, standard content formats, and standard transmission methods. WAP and WWW use the same URL to mark the contents of the server, because this standard does not change in consideration of the current Internet compatibility. Unlaw WWW is the standard of content expression format and file transmission mode, optimized for the characteristics of mobile terminals. WAP uses the technology of the gateway to connect the wireless network and the Internet data network. The gateway must be able to implement the conversion of the WAP protocol stack to the WWW protocol stack, and can implement the conversion of the content format, such as the WML language to HTML. This structure ensures that mobile users can use extensive Internet resources, while the developers of the network application do not need to consider the type of network and terminals, with maximum flexibility and scalability! In Wi-Fi, WAP phones communicate with two servers (WAP Proxy Server and WTA Server). WAP Proxy (ie WAP Gateway) converts the WAP protocol request from the WAP phone into WWW protocol request and submits the WWW request to Web Server. At the same time, WAP Proxy also encodes the information of the Web Server, encodes a compact binary format that can be identified by WAP phones, and then passed to the WAP phone.
This model uses existing WWW programming models that use developers to get many benefits from this model, including programming models that can continue to use their own programming models (such as web servers, XML tools), etc. In addition, the WAP programming model is also optimized and expanded for the original WWW programming model for the communication characteristics of the wireless environment.
WAP access involves wireless communication networks and Internet / Intranet, using WAP protocols and TCP / IP protocols, making the WAP gateway a key point of WAP access. According to the settings of the WAP gateway, the solution to constructing the WAP access platform can be roughly divided into two categories: one is the public WAP gateway directly using the telecommunications department (172, such as China Mobile); the other is The access unit has its own professional WAP gateway. It is the public WAP gateway using the telecommunications department or has a professional gateway mainly to consider access to timeliness and security. If the requirements are not too high, the public WAP gateway can be used, and it is necessary to set up a dedicated gateway.
All major mobile phone manufacturers have their own gateway products, using more domestic telecommunications departments to NOKIA, Motorola and Phone.com gateways, their features are relatively complete, strong technical support, but the price is extremely high, for ordinary companies come It is unbearable.
So some WAP enthusiasts began to develop WAP gateways on Linux, which is better than Kannel and 3UI gateways. Where the Kannel gateway is the first gateway for open source for WAP forum WAP1.1 compatibility certification. This article mainly introduces the WAP gateway of Kannel.
Second, KANNEL WAP Gateway
Kannel gateway runs under the Linux platform, open source, fully supports WAP1.1 protocol specification, using distributed and multi-threaded technology, fast gateway processing, reliable, easy maintenance, and easy to expand. A WAP standard protocol stack; implementation of WML and WML Script content encoding and decoding; support WBMP, graphical display; support secure connection, non-secure connection; support persistent connection, temporary connection mode. Load balancing between multiple hosts, high fault tolerance. Hundreds of concurrent users can be supported on ordinary PCs. 1 installation and configuration
You can download the source code from http://www.kannel.org, the latest stable version is 1.0.3, the development version is 1.1.3, with a 1.0.3 version as an example, download Gateway-1.0.2.gz download To the Linux machine, the Kannel gateway needs to install the XML library, you can download libXML2-2.2.8.tar.gz to http://www.xmlsoft.org, assume that the directory is / home / WAP, first install the libXML library first
CD / Home / WAP
TAR ZXVF LIBXML2-2.2.8.TAR.GZ
CD libxml2-2.2.8
./configure
Make
Make Install (this step needs root permissions)
Then install the gateway
CD / Home / WAP
Tar zxvf Gateway-1.0.3.tar.gz
CD Gateway-1.0.3
./configure
Make
The technical documentation in the DOC / Arch directory is a FIG format. If you don't have this program, compile will report an error, but there is no relationship, the binary executable we need is generated. If you have an error, you can modify your Makefile every time you compile, you can remove this part. Or go to download Fig2DEV (I didn't find it.).
Now go to the GW directory, we want the program Bearerbox and WAPBox program have generated, starting bearerbox (./ bearerbox &), ah, program error, unreadable file kannel.conf, what is going on, there is no GW directory This file, it doesn't matter, copy the wapkannel.conf file to kannel.conf (CP WAPKANnel.conf kannel.conf).
The format of the profile kannel.conf is as follows, and the specific meaning looks at the documentation of Kannel comes.
Group = CORE
Admin-port = 13000
WAPBOX-port = 13002
admin-password = bar
WDP-Interface-name = "*"
# Log-file = "/tmp/kannel.log"
# Log-level = 0
Box-deny-ip = "*. *. *. *"
Box-allow-ip = "127.0.0.1"
# admin-deny-ip = "" "
# admin- allow-ip = "" "
# access-log = "access.log"
Group = WAPBOX
Bearerbox-host = localhost
# Log-file = "/tmp/wapbox.log"
# log-level = 0syslog-level = none
After starting the gateway (./bearerbox & ;./wapbox ", you can access the WML page by it, hurry to download the simulator, you can test with the NOKIA Toolkit, Erission Wapide, Up.SDK, Motorola and other simulators. If you have a WAP phone, the Linux machine of the gateway is connected to the Internet, you can dial 172, set the gateway in your machine to your machine's IP address, you can go online. The main thing to set on your phone is
Gateway address: xxx.xxx.xxx.xxx (IP address of your gateway machine)
Port number: 9201 (general setting) 9200 (no connection method)
Connection Type: Ordinary Phone
Porture rate: 9600
Username: WAP
Password: WAP
Phone number: 172
Home: http://wap.china.com (URL you want to go)
2 program description
The gateway shares the processing load on multiple hosts and is divided into two modules. The gateway system consists of a bearerbox and a plurality of WAPBox. Bearerbox and WAPBox can run on a different machine.
(1) Bearer Box
The Bearerbox module is connected to the CSD Router, providing the WAPBOX interface for the WAP protocol stack. BEARERBOX records the currently running WAPBox, receives the UDP packet from the CSD Router, and the packets received from the same terminal to the same WAPBOX, and send the processing result of WAPBOX to the corresponding user terminal.
(2) WAPBOX
The WAPBox module implements the upper part of the WAP protocol stack, which belongs to the same transaction, and transaction is processed by a WAPBOX. Wapbox implements WTLS, WTP, and WSP layers. WAPBOX receives a request similar to HTTP from the phone, sending the actual HTTP request to the content server, compresses the response data, and returns to the terminal.
Between BEARERBOX and WAPBOX are connected via TCP. Bearerbox acts as a Server waits for WAPBOX to connect. In this way, Bearerbox does not need to retain static WAPBox list. It starts with an empty list, waiting for WAPBOX to register, this design makes dynamic adding new WAPBox very convenient: You only need to install one, configure it, connect to the corresponding Bearerbox.
If the TCP connection between Bearerbox and WAPBOX is disconnected, Bearerbox will get notifications to remove it from its own clients list. When the crash is removed from the BEARERBOX's Clients list, the packet received from the terminal that should be routed to this WAPBOX is considered to be received from a new terminal. This means that WAPBOX must be able to handle the package in a session.
It may also happen, WAPBOX is still survive, but no news is handled. In order to detect this, WAPBOX should send a heartbeat package to bearerbox, if Bearerbox fails to receive the HeartBeat message, it thinks there is a problem with WAPBOX crashed, but the TCP connection is not disconnected. BEARERBOX will disconnect and remove it from the clients list. When WAPBOX is recovered, the connection is reopened. The HeartBeat message also contains the load of WAPBOX, and BEARERBOX is load balance accordingly. 3 performance test
I have been tested in the following environments; testing a total of three PCs, which are CWAP gateway machines, web servers, analog clients, connected by 10M Ethernet, machine configuration as follows:
WAP Gateway: Operating System: Linux RedHat7.0
CPU: Intel Pentium III
Main frequency: 500MHz
Memory: 128M
Web server: operating system: Windows 2000
CPU: Intel Celeron
Main frequency: 500MHz
Memory: 64M
Simulated client: operating system: Linux redhat7.0
CPU: Intel Celeron
Main frequency: 500MHz
Memory: 128M
Start the gateway program (BEARERBOX and WAPBOX) on the WAP gateway machine, analog client to request the WML page on the Web server with the Test Program Fakewap (in Test Directory), and the statistical response time, the number of request numbers, etc.
The FAKEWAP program uses multi-threaded technology to simulate multiple user capacity, using 9201 ports (WSP / WTP / WTP / WDP) under default settings, using methods for fakewap [options] URL ..., all of these major options as follows:
-g Hostname gateway machine name or IP address (Default: localhost)
-P port gateway port (Default: 9201)
-m Max total sends a number of requests (Default: 1)
-i interval Sends the interval between 2 requests (Default: 1.0 Seconds)
-c threads concurrent users (Default: 1)
The test results are: In the case where the number of concurular users is 100, the response time of the gateway is within 1 second, and the number of requests per second is about 40, which is sufficient for most of the enterprise applications.
Third, refer to the website
http://www.kannel.org
http://www.wapforum.org