Detailed description of the invention
Being described below in detail embodiments of the invention, the example of described embodiment is shown in the drawings, and wherein same or similar label represents same or similar element or has the element of same or like function from start to finish。The embodiment described below with reference to accompanying drawing is illustrative of, and is only used for explaining the present invention, and is not construed as limiting the claims。
Those skilled in the art of the present technique are appreciated that unless expressly stated, and singulative used herein " ", " one ", " described " and " being somebody's turn to do " may also comprise plural form。Should be further understood that, the wording " including " used in the description of the present invention refers to there is described feature, integer, step, operation, element and/or assembly, but it is not excluded that existence or adds other features one or more, integer, step, operation, element, assembly and/or their group。It should be understood that when we claim element to be " connected " or during " coupled " to another element, it can be directly connected or coupled to other elements, or can also there is intermediary element。Additionally, " connection " used herein or " coupling " can include wireless connections or wireless couple。Wording "and/or" used herein includes one or more list the whole of item or any cell being associated and combines with whole。
Those skilled in the art of the present technique are appreciated that unless otherwise defined, and all terms used herein (include technical term and scientific terminology), have with the those of ordinary skill in art of the present invention be commonly understood by identical meaning。It should also be understood that, those terms of definition in such as general dictionary, should be understood that there is the meaning consistent with the meaning in the context of prior art, and unless by specific definitions as here, otherwise will not explain by idealization or excessively formal implication。
Those skilled in the art of the present technique are appreciated that, " terminal " used herein above, " terminal unit " had both included the equipment of wireless signal receiver, it only possesses the equipment of wireless signal receiver of non-emissive ability, include again the equipment receiving and launching hardware, it has the reception that on bidirectional communication link, can carry out two-way communication and launches the equipment of hardware。This equipment may include that honeycomb or other communication equipments, and it has single line display or multi-line display or does not have honeycomb or other communication equipments of multi-line display;PCS (PersonalCommunicationsService, PCS Personal Communications System), its can combine voice, data process, fax and/or its communication ability;PDA (PersonalDigitalAssistant, personal digital assistant), it can include radio frequency receiver, pager, the Internet/intranet access, web browser, notepad, calendar and/or GPS (GlobalPositioningSystem, global positioning system) receptor;Conventional laptop and/or palmtop computer or other equipment, it has and/or includes the conventional laptop of radio frequency receiver and/or palmtop computer or other equipment。" terminal " used herein above, " terminal unit " can be portable, can transport, be arranged in the vehicles (aviation, sea-freight and/or land), or it is suitable for and/or is configured at local runtime, and/or with distribution form, any other position operating in the earth and/or space is run。" terminal " used herein above, " terminal unit " can also is that communication terminal, access terminals, music/video playback terminal, can be such as PDA, MID (MobileInternetDevice, mobile internet device) and/or there is the mobile phone of music/video playing function, it is also possible to it is the equipment such as intelligent television, Set Top Box。
The realization of the present invention, being suitable for Android provides and installs an application program, it start, and when obtaining system highest weight limit or open system highest weight limit, and provides interactive function to system, it is achieved the control needed for this method。
As it is shown in figure 1, a kind of intelligent terminal network collocation method of the present invention, comprise the steps S11-S13:
Step S11, set up and meet the network group of WiFiP2P specification to complete the startup of the hotspot pattern of this intelligent terminal so that it is with the station mode of this intelligent terminal deposit work。
Described hotspot pattern can be set up in theory by the focus process Hostapd of android system, but, in actual measurement, during hostapd process initiation, website process can be automatically switched off, cause that intelligent terminal cannot simultaneously work under hotspot pattern and station mode, thus, then adopt the mode setting up network group voluntarily, it is possible to it is prevented effectively from the generation of this fault。
Specification according to WiFiP2P agreement, it is possible to make multiple intelligent terminal's group a network group, in this network group, has and only one of which service end role, the rest is client role。Described service end and two kinds of roles of client, in the present invention, mainly with respect to two intelligent terminal with WiFiP2P agreement institute specification, wherein, work in as the chip module of the intelligent terminal of client under the P2P-Client pattern of this agreement institute specification, namely show as client role;The intelligent terminal of the present invention on the other side then works under P2P-GroupOwner (P2PGO) pattern of this agreement institute specification, namely shows as service end role。
In android system, encapsulate point-to-point connection management class, i.e. a WiFiP2pManager, as the term suggests, such is namely for managing the point-to-point connection between Android terminal according to the specification of WiFiP2P agreement。Such constructs a method function for setting up described network group, concrete reform is WiFiP2pManager.createGroup (wifip2pmanger.chanenl, wifip2pmanager.ActionListener), call the method, a focus can be created, making intelligent terminal start hotspot pattern, and self is set to service end, the focus thus created can also supply not support that traditional WiFi equipment of WiFiP2P agreement is attached thereto。The network group being consequently formed, it is possible to use such other method function: requestConnectionInfo (wifip2pmanger.chanenl, wifip2pmanager.ActionListener) goes to obtain detailed link information。This wifip2pInfo link information contain the address groupOwnerAddress having group person namely service end and one go to illustrate that whether current device is the mark isGroupOwer of the owner of this p2p group, therefore the client of a p2p can be communicated by a socket connection with p2p group owner。
Under Android operation system default situations, the WiFi chip module not allowing for same intelligent terminal simultaneously works under client and service end both of which, but, but this problem can be solved by creating described network group voluntarily, wherein createGroup () function call the effect playing key, it completes the startup of hotspot pattern of this intelligent terminal。
Due to the present invention it is important that hope solves the netconfig problem of the WiFi function access outer net of the smart machine allowing client pass through service end place。Under the premise being left out client and connecting outer net voluntarily, this intelligent terminal is able to access that outer net, is the premise of the client-access outer net accessing present networks group。It is therefore advantageous to mode in, be make this intelligent terminal before completing the startup of above-mentioned hotspot pattern, just had been turned on station mode。
It is intended to start the station mode of android system, it is possible to by user, manually opened on page or by system website process is set in system and sets up。Described website process, refer in particular to the wpa_supplicant process that android system self provides, wpa_supplicant is originally open source projects source code, android mobile platform is added after being revised by Google, it is primarily used to support WEP, WPA/WPA2 and WAPI wireless protocols and encryption certification, and actual job content be by socket (no matter being that wpa_supplicant adopts socket communication with upper strata or wpa_supplicant with driving) with the mutual reported data of driving to user, user can send commands to wpa_supplicant transfer driving by socket and WiFi chip is operated。Briefly, wpa_supplicant is exactly that WiFi drives the additional support to agreement and encryption certification with the terminal of user。Wpa_supplicant source program after compiling it can be seen that two main can executing means: wpa_supplicant and wpa_cli。Wpa_supplicant is kernel program, and the relation of it and wpa_cli is exactly the relation of service and client: running background wpa_supplicant, uses wpa_cli to search for, arrange and connect network。
One presented below utilizes the wpa_cli example connected to complete network to understand the present invention for those skilled in the art's reference, but should not be construed as the restriction of the realization to the present invention。
Realize network connecting function, it is necessary first to run wpa_supplicant program to load basic function;
Perform :/system/bin/wpa_supplicant-d-Dwext-iwlan0-c/data/misc/wif i/wpa_supplicant.conf
Wherein:
-d: increase Debugging message
-Dwext:wext, drives title
-iwlan0:wlan0, network interface title
/ system/bin/wpa_supplicant:wpa_supplicant, executable program path
The Profile Path of/data/misc/wifi/wpa_supplicant.conf:wpa_supplicant
Then, command-line tool wpa_cli is run;
Perform: wpa_cli-iwlan0-p/data/system/wpa_supplicant
Noting, the wpa_supplicant in-p/data/system/wpa_supplicant is not executable program, but individual control socket。
Now can enter interactive mode。The wherein order of interactive mode such as following table:
Fullcommand
Shortcommand
Description
status
stat
displaysthecurrentconnectionstatus
disconnect
disc
preventswpa_supplicantfromconnectingtoanyaccesspoint
quit
q
exitswpa_cli
terminate
term
killswpa_supplicant
reconfigure
recon
reloadswpa_supplicantwiththeconfigurationfilesupplied(-cparameter)
scan
scan
scansforavailableaccesspoints(onlyscansit,doesn'tdisplayanything)
scan_result
scan_r
displaystheresultsofthelastscan
list_networks
list_n
displaysalistofconfigurednetworksandtheirstatus(activeornot,enabledordisabled)
select_network
select_n
selectanetworkamongthosedefinedtoinitiateaconnection(ieselect_network0)
enable_network
enable_n
makesaconfigurednetworkavailableforselection(ieenable_network0)
disable_network
disable_n
makesaconfigurednetworkunavailableforselection(iedisable_network0)
remove_network
remove_n
removesanetworkanditsconfigurationfromthelist(ieremove_network0)
add_network
add_n
addsanewnetworktothelist.Itsidwillbecreatedautomatically
set_network
set_n
showsaveryshortlistofavailableoptionstoconfigureanetworkwhensuppliedwithnoparameters.
Seenextsectionforalistofextremelyusefulparameterstobeusedwithset_networkandget_network.
get_network
get_n
displaystherequiredparameterforthespecifiednetwork.Seenextsectionforalistofparameters
save_config
save_c
savestheconfiguration
Above command entry can be checked from the public technology document of Android, only for reference herein。
The instruction of the basic format arranging network is: set_network<networkid><key><parameter>[<parameter>]
The instruction of the basic format of display networks is: get_network<networkid><key>
Corresponding parameter such as following table:
Key
Description
Parameters
ssid
Accesspointname
string
id_str
Stringidentifyingthenetwork
string
priority
ConnectionpriorityoverotherAPs
number(0beingthedefaultlowpriority)
bssid
Macaddressoftheaccesspoint
macaddress
scan_ssid
Enable/disbalessidscan
0,1,2
key_mgmt
Typeofkeymanagement
WPA-PSK,WPA_EAP,None
pairwise
PairwiseciphersforWPA
CCMP,TKIP
Group=TKIP
GroupciphersforWPA
CCMP,TKIP,WEP104,WEP40
psk
Pre-SharedKey(clearorencrypted)
string
wep_key0
WEPkey(upto4:wep_key[0123])
string
eap
ExtensibleAuthenticationProtocol
MD5,MSCHAPV2,OTP,GTC,TLS,PEAP,TTLS
identity
EAPidentitystring
string
password
EAPpassword
string
ca_cert
PathnametoCAcertificatefile
/full/path/to/certificate
client_cert
Pathnametoclientcertificate
/full/path/to/certificate(PEM/DER)
private_key
Pathnametoaclientprivatekeyfile
/full/path/to/private_key(PEM/DER/PFX)
In like manner, above parameter list obtains from Android official also by public approach, only for reference, pardons and does not repeat。Illustrate how that realizing network connects following with one for connecting the instantiation without the AP encrypted:
> add_network (network ID will be shown, it is assumed that return value is 0)
>set_network0ssid"666"
>set_network0key_mgmtNONE
>enable_network0
>quit
Recycling one is illustrated for the instantiation connecting the AP of WEP encryption:
> add_network (assuming that network ID returns 1)
>set_network1ssid"666"
>set_network1key_mgmtNONE
>set_network1wep_key0"yourappassword"
>enable_network1
Example as the AP connecting WPA-PSK/WPA2-PSK encryption is as follows:
> add_network (assuming that network ID returns 2)
>set_network2ssid"666"
>set_network2psk"yourpre-sharedkey"
>enable_network2
Arriving this, wifi module just can connect AP。
It is above being realized the connection of wifi network by command-line tool wpa_cli。It is of course also possible to realize connecting by the configuration file of wpa_supplicant。
The order performed when above running wpa_supplicant might as well be looked back again:
/system/bin/wpa_supplicant-d-Dwext-iwlan0-c/data/misc/wifi/wpa_supplicant.conf
We add-c/data/misc/wifi/wpa_supplicant.conf upon execution, so the AP's that can connect is arranged with in certain form write wpa_supplicant.conf configuration file。Such as:
Ctrl_interface=DIR=/data/system/wpa_supplicantGROUP=syst emupdate_config=1
Network={
Ssid=" myaccesspoint "
Proto=WPA
Key_mgmt=WPA-PSK
Psk=" youpasswords "
}
Visible, even the station mode of call site process initiation intelligent terminal's WiFi chip module, also by using instruction above, using two kinds of different modes of configuration file, realize being controlled voluntarily the unlatching of described website process by program process, so that intelligent terminal works under station mode。
As can be known from the above analysis, the present invention can activate the station mode of intelligent terminal by various ways, and the hotspot pattern of intelligent terminal is activated by calling the createGroup method of point-to-point connection management class, both patterns can and be stored in Android intelligent terminal。So that intelligent terminal can utilize its station mode accessing external network, utilize one mininet of hotspot pattern construction simultaneously。
For making above-mentioned concurrent state be physically easier to perform, embodying Consumer's Experience more preferably, the program process of the present invention can be in addition perfect by user interface being designed to this。
User interface refers to and is implemented for man-machine interaction and is able to receive that the display interface of user's control instruction, such as, it can be arrange in the page option (or button of android system, added wherein by described application program, lower same), can also be an option from the informing or interaction page of desktop exhalation, it is also possible to be an option in the page that constructs of a moving component of described application program。
The present invention is preferably as follows two ways, for receiving described control instruction:
One, by providing single control button in user interface, receives described control instruction for one-touch, and this mode is easy to user and is realized operating in a key。
Its two, by providing control button respectively at user interface correspondence hotspot pattern and station mode, produce the corresponding control instruction starting corresponding pattern with corresponding different key respectively。
According to the control button that above mode provides, generally these buttons can be preferably provided at system desktop informing list place, or provide in the way of desktop suspended window, both it had been easy to user's touch-control control, do not affect again user's visual effect, activate when certainly can open WiFi button as the default feature of system with user yet。It is also preferred that the left described application program can set itself to self-starting item so that during system start-up, it is possible to load described button voluntarily, consequently facilitating user operation。
When user is by described user interface, after the control button described in touch-control, just producing corresponding control instruction, this control instruction will be received by the process of described application program, thus the control hotspot pattern of correspondence and/or station mode are opened。
Specifically, user both can open hotspot pattern and station mode by single control button simultaneously, it is also possible to is opened by two buttons corresponding with both of which, essentially provides multiple operation change case。These changes corresponding, illustrate further below。
If user interface provides single control button, user triggers its user instruction by this single control button, just can first call createGroup () herein and create focus。Then, the program process of the present invention starts this website process more voluntarily, thus just can realize both of which and deposit。Otherwise, it is also possible to leading initiating station point process, after it completes to open, then row opens hotspot pattern with reference to above-mentioned example。It is to say, the control instruction caused corresponding to single control button, it is possible to the boot sequence of hotspot pattern described in different embodiment flexible arrangement and station mode。
And correspondence user interface provides different control buttons, characterizing the example opening different patterns respectively, then can click the order of different control button by user and open corresponding pattern according to the order of sequence, this measure has no effect on the enforcement of the present invention。
In preferred scheme, it is recommended that preferentially allow station mode open prior to hotspot pattern, when guaranteeing that this intelligent terminal can connect outer net, provide access function to other intelligent terminal, it is possible to exempt some idle works, more energy-conservation。
As can be seen here, after station mode and hotspot pattern being sequentially activated, coexisting of both of which can just be realized。On this basis, the program process of the present invention can export some object informations to user interface, to inform the concurrent state that this intelligent terminal of user currently coexists already at hotspot pattern and station mode。Expression-form as described object information, both can be through system message and be shown in informing, can also pop-up show on the table, more excellent mode can be call default third party's icon, for characterizing the concurrent state that this intelligent terminal is in hotspot pattern and station mode coexists, this third party's icon is shown in the system mode hurdle of user interface so that user is easier to know corresponding object information。
Step S12, with system highest weight limit call network guard process amendment network configuration sharing information make the network between connection hotspot pattern and station mode be connected。
Relate to the operation that network guard process is directly invoked, specification according to Android, the highest weight needing acquisition system is limit, thus, under the premise obtaining android system highest weight limit or android system open highest weight limit, can by described network guard process be called, amendment relates to the configuration information that network is shared whereby, i.e. network configuration sharing information, so that the network connected between hotspot pattern with station mode is connected, allow client can access outer net by service end。
Described network guard process, the i.e. abbreviation of Netd, NetworkDaemon。Netd is responsible for the functional realiey being correlated with some network operations relating to physical port, such as bandwidth controls (Bandwidth), network address translation (NAT), PAN (Personal Area Network) (pan), PPP links, soft-ap, shared verification (Tether) involved by the hotspot pattern of this intelligent terminal etc.. be all organized under netd file directory according to module (.cpp+.h)。
Four major parts of the basic framework that AndroidNetd is relevant:
(1) all events relevant for detecting network for LinuxKernel。
(2) Netd is as the bridge communicated between Kernel (inner nuclear layer) and Framework (ccf layer)。
(3) ccf layer operation Netd, sends operational order to Netd。
(4) application layer is mutual with ccf layer, carries out the manipulation of network for user。
Android is that Netd provides testing tool, i.e. a ndc, and its major function has:
Monitor event in Netd。
Support that sending commands to Netd by order line goes to perform。Ndc realizes principle, is that " netd " being arranged in netd process on connecting monitors socket, then receives information from Netd or send commands to Netd。
As can be seen here, it is possible to drive network guard process to perform dependent instruction by ndc, in the present invention, it is achieved the function to the amendment of network configuration sharing information, just available ndc order is implemented。
Please also refer to the following observation process that android system is implemented:
First, by analyzing, it has been found that after createGroup () creates focus, although can be connected by client, but it is for as follows to the parameter of the configuration process DNSmasq of user feedback DHCP configuration information:
/ system/bin/dnsmasq--keep-in-foreground--no-resolv--no-po ll--dhcp-authoritative--dhcp-option-force=43, ANDROID_METERED--pid-file--dhcp-range=192.168.42.2, 192.168.42.254, 1h--dhcp-range=192.168.43.2, 192.168.43.254, 1h--dhcp-range=192.168.44.2, 192.168.44.254, 1h--dhcp-range=192.168.45.2, 192.168.45.254, 1h--dhcp-range=192.168.46.2, 192.168.46.254, 1h--dhcp-range=192.168.47.2, 192.168.47.254, 1h--dhcp-range=192.168.48.2, 192.168.48.254, 1h--dhcp-range=192.168.49.2, 192.168.49.254, 1h
It can be seen that, with addition of the control option and the dhcp-option-force=43 that force configuration sequence to be 43, ANDROID_METERED, official's lexical or textual analysis of sequence number 43 is manufacturer's specified option, for representing that being currently connected as charging connects, in this case, the outer net that can not utilize service end is connected by client, in order to avoid producing enormous expenditure。But, this design logic is to provide, by being connected by the charging of operator, the outer net service that accesses with service end, but service end exists the situation that the free outer net set up with WiFi station mode connects, not by Android compatibility。
Then, by analyzing in Android official document for the source code of TetherController (shared control unit) it can be seen that in this case, ANDROID_METERED has been carried out specification by this place, but, but have no the setting of default gateway。
And to client is analyzed, from core.java.android.net.DhcpInfoInternal i.e. dhcp client over there, utilize following code implementation to detect:
Above analysis shows, as made client connect outer net by service end, it is necessary to avoid the above-mentioned impact controlling option。
And then, by analyze this intelligent terminal hotspot pattern open before and open after packet forward switch and Packet Filtering table and iptables, it has been found that affect client surf the Net the factor。
Specifically, switch is forwarded for packet, it appeared that, the result of cat/proc/sys/net/ipv4/ip_forward is 1 rather than 0, thus in theory can by echo " 1 " >/proc/sys/net/ipv4/ip_forwardenable change this one switch arrange so that it is open packet forwarding capability。But, in this case, due to the impact by iptables, even if making above-mentioned change, client carries out extranet access and still fails to unimpeded。Packet is received when the p2p0 under the hotspot pattern of intelligent terminal identifies corresponding interface, though route can be searched, and the interface being dealt under its station mode corresponding to wlan0 mark, but can be abandoned by the filtering rule of iptables。
For iptables, it has been found that it deposits impact both ways, the first wherein includes the rule of the data packet discarding by interface p2p0, and it two is the NAT rule that intelligent terminal is mapped to public network by shortcoming。For the former, it is possible to by with the process that gives an order: iptables-DFORWARD4, namely delete the 4th rule in forward namely natctrl_FORWARD rule。At this time when p2p0 receives bag, can send from wlan0。But the source ip of this bag is an Intranet ip。Accordingly, it would be desirable to the latter is processed as follows: iptables-tnat-APOSTROUTING-owlan0-jMASQUERADE, namely increase a nat rule to iptables filter table, after interpolation, on another mobile phone, just can the logical outer net ip of ping。By the connection of client to outer net, thus just unimpeded。Naturally, and in conjunction with practice analysis, gateway is also correctly configured。
By above-mentioned process, the problem that only address only IP layer, for the function of dns resolution, then still unrealized。Further by analyzing the configuration parameter of DNSmasq, it has been found that this carry--no-resolv option, this option causes that affecting client obtains the reason of correct dns resolution just。Thus, it is possible to be modified startTethering method or increase startTetheringWithDns () method, remove--no-resolv parameter。Completing these operations, client is through service end to outer net, specific to the access of the WWW based on domain name, just unblocked。
Above, generally, the present invention realizes client by service end access outer net by the amendment relating to network configuration sharing information that ndc tool drives network guard process is made, is mainly concerned with following aspect:
One, the packet forwarding capability that is connected of network opened between connection hotspot pattern and station mode: being embodied in and can arranging its parameter by echo instruction is 1 open。
That two, revises the Packet Filtering table for the network connection between unimpeded hotspot pattern and station mode arranges content: be embodied in and iptables form is removed corresponding filtering items and interpolation NAT map record。
Three, remove the restriction of client shared verification and resolve the option of DNS: be embodied in and can be removed by the method for shared control unit (TetherController)--no-resolv option。
As can be seen here, by above-mentioned method, just can make the intelligent terminal of the present invention realize connecting its hotspot pattern with under its station mode between network be connected, the service of accessing external network is provided for client。
Above by the analysis process disclosing the system principle to Android, what disclose the present invention realizes principle, and provide a kind of embodiment how revising network configuration sharing information, in addition, revise network configuration sharing information also by following mode:
This mode specifically, namely by system highest weight limit call ndc instrument realized by network guard process amendment in the way of, refer to following code and explanation thereof:
ndcipfwdenable
ndctetherdnsset0114.114.114.114
// if it fails, generally mean that and above have manual operations not cancel completely。Perform ps | grepdnsmasq elder generation positive closing configuration process。If also having and remaining process, for instance:
shellCP8681_A01:/#ps|grepdnsmasq
dhcp355732510272740001a0338b66f61acS/system/bin/dnsmasq
// execution kill3557 kills, then
Ndctetherstop, // stop sharing
Ndctetherstart192.168.49.2192.168.49.254//startup is shared, and configures the network segment
Ndctetherdnsset0114.114.114.114//DNS is set
Ndcnatenablep2p0wlan00//interpolation NAT rule
After tested, the effect that above code is risen is consistent with the manual modification process that top is disclosed, and through thus section code effect, packet forwarding capability is opened, and iptables filter table obtains correct configuration, and dns resolution function also obtains correct maintenance。Therefore, the application program of the present invention under system highest weight limit state, after starting hotspot pattern, can perform this section of code, just achieves the correct amendment to network configuration sharing information, and client just can be surfed the Net by service end。
Most android system intelligent terminal, due to the restriction of manufacturer, not open its system highest weight limit, or unsuccessful by ROOT, for this situation, the operation of the above amendment directly driving network guard to be carried out network configuration sharing information with NDC instruction can not be successful。Accordingly, it would be desirable to look for another way。
The mode of a kind of improvement is to become a method function (configuration interface) by above with the NDC code wrap expressed, Open Source Code file and WifiP2pServiceImpl.java to WiFiP2pManager class are modified, owing to WifiP2pServiceImpl.java can realize those ndc orders either directly through the mNwService function derived, cause exists, can inside increase the method function, and derive and use to WiFiP2pManager class, so, the application program of the present invention only need to call this configuration interface either directly through WiFiP2pManager class, the amendment to network configuration sharing information can be implemented, acquisition without Help of System highest weight limit。
As can be seen here, control described network guard process by ndc order is also diversified in the way of revising network configuration sharing parameter。
By implementing above-mentioned multiple control modes, the network between the hotspot pattern of service end and station mode all can being made to connect and interconnect, the problem of route has solution therewith。
Step S13, access after described network group in client, set up the connection of this client and the outer net maintained by described station mode。
After the network group that client access service end provides, sending DHCP request to service end, the configuration process of service end reads the correct network configuration sharing information after above-mentioned amendment, feeds back to client。After client completes the network settings of self accordingly, just can through accessing outer net as the focus interface of service end intelligent terminal of the present invention, site interface。For this intelligent terminal, when it receives the packet of client-access outer net, this packet is forwarded through the path transmission of described station mode to described outer net;When its receive extranet access client packet time, be forwarded through described hotspot pattern path transmission give this client。
Further, for improving the function of the program process of the present invention, it is possible to increase subsequent step: this step, in response to the user instruction exiting shared verification, recovers described network configuration sharing information。
Specifically, the application program of the present invention is referred to aforesaid mode, provides the control button of a shared verification to user interface, also may be used as continued to use the above-mentioned final election control operation controlling button providing user interface。When this control button is triggered, just producing described user instruction, by the effect of this user instruction, the present invention just can implement to disconnect described hotspot pattern, thus just automatically disconnects external connection。
Further, it is possible to adopt mode more thoroughly, the network configuration sharing information in advance aforementioned processing process produced is cleared up, for instance, consult following ndc instruction:
Ndcipfwddisable//closedown packet forwarding capability
Ndctetherstop//stopping online sharing functionality
Ndcnatdisablep2p0wlan00//closedown NAT mapping function
Perform above-mentioned order by the program process of the present invention, just can pass through SOCKET port controlling network guard process and perform corresponding function, thus avoiding the aforesaid potential impact that the machine use is brought by network configuration sharing information。Could be aware that, the premise directly invoking the described network guard process of above-mentioned order control in the program process of the present invention is the highest weight limit having obtained system。
In like manner, according to above-mentioned building method function and be implanted into the example in WiFiP2pManager, thrashing code herein can be configured to method function (interface of clearing up and discharging) completely in the same way, add in the code file of WiFiP2pManager class, export as such corresponding member function, follow-up directly called this interface of clearing up and discharging by the program process of the present invention and can perform, without considering currently whether obtained system ROOT authority。
In sum, the method for the present invention solves Android intelligent terminal and opens the technical barrier of hotspot pattern and station mode simultaneously, and allows the client accessing the network group under its hotspot pattern via the corresponding outer net interface accessing outer net of its station mode。
Modularized thoughts according to computer software, the present invention also provides for a kind of intelligent terminal, and this intelligent terminal includes setting up unit 11, dispensing unit 12 and communication unit 13, the concrete function that unit introduced below realizes:
Described sets up unit 11, for setting up the network group meeting WiFiP2P specification to complete the startup of the hotspot pattern of this intelligent terminal so that it is with the station mode of this intelligent terminal deposit work。
Described hotspot pattern can be set up in theory by the focus process Hostapd of android system, but, in actual measurement, during hostapd process initiation, website process can be automatically switched off, cause that intelligent terminal cannot simultaneously work under hotspot pattern and station mode, thus, then adopt the mode setting up network group voluntarily, it is possible to it is prevented effectively from the generation of this fault。
Specification according to WiFiP2P agreement, it is possible to make multiple intelligent terminal's group a network group, in this network group, has and only one of which service end role, the rest is client role。Described service end and two kinds of roles of client, in the present invention, mainly with respect to two intelligent terminal with WiFiP2P agreement institute specification, wherein, work in as the chip module of the intelligent terminal of client under the P2P-Client pattern of this agreement institute specification, namely show as client role;The intelligent terminal of the present invention on the other side then works under P2P-GroupOwner (P2PGO) pattern of this agreement institute specification, namely shows as service end role。
In android system, encapsulate point-to-point connection management class, i.e. a WiFiP2pManager, as the term suggests, such is namely for managing the point-to-point connection between Android terminal according to the specification of WiFiP2P agreement。Such constructs a method function for setting up described network group, concrete reform is WiFiP2pManager.createGroup (wifip2pmanger.chanenl, wifip2pmanager.ActionListener), call the method, a focus can be created, making intelligent terminal start hotspot pattern, and self is set to service end, the focus thus created can also supply not support that traditional WiFi equipment of WiFiP2P agreement is attached thereto。The network group being consequently formed, it is possible to use such other method function: requestConnectionInfo (wifip2pmanger.chanenl, wifip2pmanager.ActionListener) goes to obtain detailed link information。This wifip2pInfo link information contain the address groupOwnerAddress having group person namely service end and one go to illustrate that whether current device is the mark isGroupOwer of the owner of this p2p group, therefore the client of a p2p can be communicated by a socket connection with p2p group owner。
Under Android operation system default situations, the WiFi chip module not allowing for same intelligent terminal simultaneously works under client and service end both of which, but, but this problem can be solved by creating described network group voluntarily, wherein createGroup () function call the effect playing key, it completes the startup of hotspot pattern of this intelligent terminal。
Due to the present invention it is important that hope solves the netconfig problem of the WiFi function access outer net of the smart machine allowing client pass through service end place。Under the premise being left out client and connecting outer net voluntarily, this intelligent terminal is able to access that outer net, is the premise of the client-access outer net accessing present networks group。It is therefore advantageous to mode in, be make this intelligent terminal before completing the startup of above-mentioned hotspot pattern, just had been turned on station mode。
It is intended to start the station mode of android system, it is possible to by user, manually opened on page or by system website process is set in system and sets up。Described website process, refer in particular to the wpa_supplicant process that android system self provides, wpa_supplicant is originally open source projects source code, android mobile platform is added after being revised by Google, it is primarily used to support WEP, WPA/WPA2 and WAPI wireless protocols and encryption certification, and actual job content be by socket (no matter being that wpa_supplicant adopts socket communication with upper strata or wpa_supplicant with driving) with the mutual reported data of driving to user, user can send commands to wpa_supplicant transfer driving by socket and WiFi chip is operated。Briefly, wpa_supplicant is exactly that WiFi drives the additional support to agreement and encryption certification with the terminal of user。Wpa_supplicant source program after compiling it can be seen that two main can executing means: wpa_supplicant and wpa_cli。Wpa_supplicant is kernel program, and the relation of it and wpa_cli is exactly the relation of service and client: running background wpa_supplicant, uses wpa_cli to search for, arrange and connect network。
One presented below utilizes the wpa_cli example connected to complete network to understand the present invention for those skilled in the art's reference, but should not be construed as the restriction of the realization to the present invention。
Realize network connecting function, it is necessary first to run wpa_supplicant program to load basic function;
Perform :/system/bin/wpa_supplicant-d-Dwext-iwlan0-c/data/misc/wif i/wpa_supplicant.conf
Wherein:
-d: increase Debugging message
-Dwext:wext, drives title
-iwlan0:wlan0, network interface title
/ system/bin/wpa_supplicant:wpa_supplicant, executable program path
The Profile Path of/data/misc/wifi/wpa_supplicant.conf:wpa_supplicant
Then, command-line tool wpa_cli is run;
Perform: wpa_cli-iwlan0-p/data/system/wpa_supplicant
Noting, the wpa_supplicant in-p/data/system/wpa_supplicant is not executable program, but individual control socket。
Now can enter interactive mode。The wherein order of interactive mode such as following table:
Fullcommand
Shortcommand
Description
status
stat
displaysthecurrentconnectionstatus
disconnect
disc
preventswpa_supplicantfromconnectingtoanyaccesspoint
quit
q
exitswpa_cli
terminate
term
killswpa_supplicant
reconfigure
recon
reloadswpa_supplicantwiththeconfigurationfilesupplied(-cparameter)
scan
scan
scansforavailableaccesspoints(onlyscansit,doesn'tdisplayanything)
scan_result
scan_r
displaystheresultsofthelastscan
list_networks
list_n
displaysalistofconfigurednetworksandtheirstatus(activeornot,enabledordisabled)
select_network
select_n
selectanetworkamongthosedefinedtoinitiateaconnection(ieselect_network0)
enable_network
enable_n
makesaconfigurednetworkavailableforselection(ieenable_network0)
disable_network
disable_n
makesaconfigurednetworkunavailableforselection(iedisable_network0)
remove_network
remove_n
removesanetworkanditsconfigurationfromthelist(ieremove_network0)
add_network
add_n
addsanewnetworktothelist.Itsidwillbecreatedautomatically
set_network
set_n
showsaveryshortlistofavailableoptionstoconfigureanetworkwhensuppliedwithnoparameters.
Seenextsectionforalistofextremelyusefulparameterstobeusedwithset_networkandget_network.
get_network
get_n
displaystherequiredparameterforthespecifiednetwork.Seenextsectionforalistofparameters
save_config
save_c
savestheconfiguration
Above command entry can be checked from the public technology document of Android, only for reference herein。
The instruction of the basic format arranging network is: set_network<networkid><key><parameter>[<parameter>]
The instruction of the basic format of display networks is: get_network<networkid><key>
Corresponding parameter such as following table:
Key
Description
Parameters
ssid
Accesspointname
string
id_str
Stringidentifyingthenetwork
string
priority
ConnectionpriorityoverotherAPs
number(0beingthedefaultlowpriority)
bssid
Macaddressoftheaccesspoint
macaddress
scan_ssid
Enable/disbalessidscan
0,1,2
key_mgmt
Typeofkeymanagement
WPA-PSK,WPA_EAP,None
pairwise
PairwiseciphersforWPA
CCMP,TKIP
Group=TKIP
GroupciphersforWPA
CCMP,TKIP,WEP104,WEP40
psk
Pre-SharedKey(clearorencrypted)
string
wep_key0
WEPkey(upto4:wep_key[0123])
string
eap
ExtensibleAuthenticationProtocol
MD5,MSCHAPV2,OTP,GTC,TLS,PEAP,TTLS
identity
EAPidentitystring
string
password
EAPpassword
string
ca_cert
PathnametoCAcertificatefile
/full/path/to/certificate
client_cert
Pathnametoclientcertificate
/full/path/to/certificate(PEM/DER)
private_key
Pathnametoaclientprivatekeyfile
/full/path/to/private_key(PEM/DER/PFX)
In like manner, above parameter list obtains from Android official also by public approach, only for reference, pardons and does not repeat。Illustrate how that realizing network connects following with one for connecting the instantiation without the AP encrypted:
> add_network (network ID will be shown, it is assumed that return value is 0)
>set_network0ssid"666"
>set_network0key_mgmtNONE
>enable_network0
>quit
Recycling one is illustrated for the instantiation connecting the AP of WEP encryption:
> add_network (assuming that network ID returns 1)
>set_network1ssid"666"
>set_network1key_mgmtNONE
>set_network1wep_key0"yourappassword"
>enable_network1
Example as the AP connecting WPA-PSK/WPA2-PSK encryption is as follows:
> add_network (assuming that network ID returns 2)
>set_network2ssid"666"
>set_network2psk"yourpre-sharedkey"
>enable_network2
Arriving this, wifi module just can connect AP。
It is above being realized the connection of wifi network by command-line tool wpa_cli。It is of course also possible to realize connecting by the configuration file of wpa_supplicant。
The order performed when above running wpa_supplicant might as well be looked back again:
/system/bin/wpa_supplicant-d-Dwext-iwlan0-c/data/misc/wifi/wpa_supplicant.conf
We add-c/data/misc/wifi/wpa_supplicant.conf upon execution, so the AP's that can connect is arranged with in certain form write wpa_supplicant.conf configuration file。Such as:
Ctrl_interface=DIR=/data/system/wpa_supplicantGROUP=syst emupdate_config=1
Network={
Ssid=" myaccesspoint "
Proto=WPA
Key_mgmt=WPA-PSK
Psk=" youpasswords "
}
Visible, even the station mode of call site process initiation intelligent terminal's WiFi chip module, also by using instruction above, using two kinds of different modes of configuration file, realize being controlled voluntarily the unlatching of described website process by program process, so that intelligent terminal works under station mode。
As can be known from the above analysis, the present invention can activate the station mode of intelligent terminal by various ways, and the hotspot pattern of intelligent terminal is activated by calling the createGroup method of point-to-point connection management class, both patterns can and be stored in Android intelligent terminal。So that intelligent terminal can utilize its station mode accessing external network, utilize one mininet of hotspot pattern construction simultaneously。
For making above-mentioned concurrent state be physically easier to perform, embodying Consumer's Experience more preferably, the program process of the present invention can be in addition perfect by user interface being designed to this。
User interface refers to and is implemented for man-machine interaction and is able to receive that the display interface of user's control instruction, such as, it can be arrange in the page option (or button of android system, added wherein by described application program, lower same), can also be an option from the informing or interaction page of desktop exhalation, it is also possible to be an option in the page that constructs of a moving component of described application program。
The present invention is preferably as follows two ways, for receiving described control instruction:
One, by providing single control button in user interface, receives described control instruction for one-touch, and this mode is easy to user and is realized operating in a key。
Its two, by providing control button respectively at user interface correspondence hotspot pattern and station mode, produce the corresponding control instruction starting corresponding pattern with corresponding different key respectively。
According to the control button that above mode provides, generally these buttons can be preferably provided at system desktop informing list place, or provide in the way of desktop suspended window, both it had been easy to user's touch-control control, do not affect again user's visual effect, activate when certainly can open WiFi button as the default feature of system with user yet。It is also preferred that the left described application program can set itself to self-starting item so that during system start-up, it is possible to load described button voluntarily, consequently facilitating user operation。
When user is by described user interface, after the control button described in touch-control, just producing corresponding control instruction, this control instruction will be received by the process of described application program, controls hotspot pattern and/or station mode unlatching thus corresponding。
Specifically, user both can wish to open hotspot pattern and station mode by single control button simultaneously, it is also possible to is opened by two buttons corresponding with both of which, essentially provides multiple operation change case。These changes corresponding, illustrate further below。
If user interface provides single control button, user triggers its user instruction by this single control button, just can first call createGroup () herein and create focus。Then, the program process of the present invention starts this website process more voluntarily, thus just can realize both of which and deposit。Otherwise, it is also possible to leading initiating station point process, after it completes to open, then row opens hotspot pattern with reference to above-mentioned example。It is to say, the control instruction caused corresponding to single control button, it is possible to the boot sequence of hotspot pattern described in different embodiment flexible arrangement and station mode。
And correspondence user interface provides different control buttons, characterizing the example opening different patterns respectively, then can click the order of different control button by user and open corresponding pattern according to the order of sequence, this measure has no effect on the enforcement of the present invention。
In preferred scheme, it is recommended that preferentially allow station mode open prior to hotspot pattern, when guaranteeing that this intelligent terminal can connect outer net, provide access function to other intelligent terminal, it is possible to exempt some idle works, more energy-conservation。
As can be seen here, after station mode and hotspot pattern being sequentially activated, coexisting of both of which can just be realized。On this basis, the program process of the present invention can export some object informations to user interface, to inform the concurrent state that this intelligent terminal of user currently coexists already at hotspot pattern and station mode。Expression-form as described object information, both can be through system message and be shown in informing, can also pop-up show on the table, more excellent mode can be call default third party's icon, for characterizing the concurrent state that this intelligent terminal is in hotspot pattern and station mode coexists, this third party's icon is shown in the system mode hurdle of user interface so that user is easier to know corresponding object information。
Described dispensing unit 12, is configured to call network guard process amendment network configuration sharing information with system highest weight limit and makes the network between connection hotspot pattern and station mode be connected。
Relate to the operation that network guard process is directly invoked, specification according to Android, the highest weight needing acquisition system is limit, thus, under the premise obtaining android system highest weight limit or android system open highest weight limit, can by described network guard process be called, amendment relates to the configuration information that network is shared whereby, i.e. network configuration sharing information, so that the network connected between hotspot pattern with station mode is connected, allow client can access outer net by service end。
Described network guard process, the i.e. abbreviation of Netd, NetworkDaemon。Netd is responsible for the functional realiey being correlated with some network operations relating to physical port, such as bandwidth controls (Bandwidth), network address translation (NAT), PAN (Personal Area Network) (pan), PPP links, soft-ap, shared verification (Tether) involved by the hotspot pattern of this intelligent terminal etc.. be all organized under netd file directory according to module (.cpp+.h)。
Four major parts of the basic framework that AndroidNetd is relevant:
(1) all events relevant for detecting network for LinuxKernel。
(2) Netd is as the bridge communicated between Kernel (inner nuclear layer) and Framework (ccf layer)。
(3) ccf layer operation Netd, sends operational order to Netd。
(4) application layer is mutual with ccf layer, carries out the manipulation of network for user。
Android is that Netd provides testing tool, i.e. a ndc, and its major function has:
Monitor event in Netd。
Support that sending commands to Netd by order line goes to perform。Ndc realizes principle, is that " netd " being arranged in netd process on connecting monitors socket, then receives information from Netd or send commands to Netd。
As can be seen here, it is possible to drive network guard process to perform dependent instruction by ndc, in the present invention, it is achieved the function to the amendment of network configuration sharing information, just available ndc order is implemented。
Please also refer to the following observation process that android system is implemented:
First, by analyzing, it has been found that after createGroup () creates focus, although produce to be connected by client, but it is for as follows to the parameter of the configuration process DNSmasq of user feedback DHCP configuration information:
/ system/bin/dnsmasq--keep-in-foreground--no-resolv--no-po ll--dhcp-authoritative--dhcp-option-force=43, ANDROID_METERED--pid-file--dhcp-range=192.168.42.2, 192.168.42.254, 1h--dhcp-range=192.168.43.2, 192.168.43.254, 1h--dhcp-range=192.168.44.2, 192.168.44.254, 1h--dhcp-range=192.168.45.2, 192.168.45.254, 1h--dhcp-range=192.168.46.2, 192.168.46.254, 1h--dhcp-range=192.168.47.2, 192.168.47.254, 1h--dhcp-range=192.168.48.2, 192.168.48.254, 1h--dhcp-range=192.168.49.2, 192.168.49.254, 1h
It can be seen that, with addition of the control option and the dhcp-option-force=43 that force configuration sequence to be 43, ANDROID_METERED, official's lexical or textual analysis of sequence number 43 is manufacturer's specified option, for representing that being currently connected as charging connects, in this case, the outer net that can not utilize service end is connected by client, in order to avoid producing enormous expenditure。But, this design logic is to provide, by being connected by the charging of operator, the outer net service that accesses with service end, but service end exists the situation that the free outer net set up with WiFi station mode connects, not by Android compatibility。
Then, by analyzing in Android official document for the source code of TetherController (shared control unit) it can be seen that in this case, ANDROID_METERED has been carried out specification by this place, but, but have no the setting of default gateway。
And to client is analyzed, from core.java.android.net.DhcpInfoInternal i.e. dhcp client over there, utilize following code implementation to detect:
Above analysis shows, as made client connect outer net by service end, it is necessary to avoid the above-mentioned impact controlling option。
And then, by analyze this intelligent terminal hotspot pattern open before and open after packet forward switch and Packet Filtering table and iptables, it has been found that affect client surf the Net the factor。
Specifically, switch is forwarded for packet, it appeared that, the result of cat/proc/sys/net/ipv4/ip_forward is 1 rather than 0, thus in theory can by echo " 1 " >/proc/sys/net/ipv4/ip_forwardenable change this one switch arrange so that it is open packet forwarding capability。But, in this case, due to the impact by iptables, even if making above-mentioned change, client carries out extranet access and still fails to unimpeded。Packet is received when the p2p0 under the hotspot pattern of intelligent terminal identifies corresponding interface, though route can be searched, and the interface being dealt under its station mode corresponding to wlan0 mark, but can be abandoned by the filtering rule of iptables。
For iptables, it has been found that it deposits impact both ways, the first wherein includes the rule of the data packet discarding by interface p2p0, and it two is the NAT rule that intelligent terminal is mapped to public network by shortcoming。For the former, it is possible to by with the process that gives an order: iptables-DFORWARD4, namely delete the 4th rule in forward namely natctrl_FORWARD rule。At this time when p2p0 receives bag, can send from wlan0。But the source ip of this bag is an Intranet ip。Accordingly, it would be desirable to the latter is processed as follows: iptables-tnat-APOSTROUTING-owlan0-jMASQUERADE, namely increase a nat rule to iptables filter table, after interpolation, on another mobile phone, just can the logical outer net ip of ping。By the connection of client to outer net, thus just unimpeded。Naturally, and in conjunction with practice analysis, gateway is also correctly configured。
By above-mentioned process, the problem that only address only IP layer, for the function of dns resolution, then still unrealized。Further by analyzing the configuration parameter of DNSmasq, it has been found that this carry--no-resolv option, this option causes that affecting client obtains the reason of correct dns resolution just。Thus, it is possible to be modified startTethering method or increase startTetheringWithDns () method, remove--no-resolv parameter。Completing these operations, client is through service end to outer net, specific to the access of the WWW based on domain name, just unblocked。
Above, generally, the present invention realizes client by service end access outer net by the amendment relating to network configuration sharing information that ndc tool drives network guard process is made, is mainly concerned with following aspect:
One, the packet forwarding capability that is connected of network opened between connection hotspot pattern and station mode: being embodied in and can arranging its parameter by echo instruction is 1 open。
That two, revises the Packet Filtering table for the network connection between unimpeded hotspot pattern and station mode arranges content: be embodied in and iptables form is removed corresponding filtering items and interpolation NAT map record。
Three, remove the restriction of client shared verification and resolve the option of DNS: be embodied in and can be removed by the method for shared control unit (TetherController)--no-resolv option。
As can be seen here, by above-mentioned method, just can make the intelligent terminal of the present invention realize connecting its hotspot pattern with under its station mode between network be connected, the service of accessing external network is provided for client。
Above by the analysis process disclosing the system principle to Android, what disclose the present invention realizes principle, and provide a kind of embodiment how revising network configuration sharing information, in addition, revise network configuration sharing information also by following mode:
This mode specifically, namely by system highest weight limit call ndc instrument realized by network guard process amendment in the way of, refer to following code and explanation thereof:
ndcipfwdenable
ndctetherdnsset0114.114.114.114
// if it fails, generally mean that and above have manual operations not cancel completely。Perform ps | grepdnsmasq elder generation positive closing configuration process。If also having and remaining process, for instance:
shellCP8681_A01:/#ps|grepdnsmasq
dhcp355732510272740001a0338b66f61acS/system/bin/dnsmasq
// execution kill3557 kills, then
Ndctetherstop, // stop sharing
Ndctetherstart192.168.49.2192.168.49.254//startup is shared, and configures the network segment
Ndctetherdnsset0114.114.114.114//DNS is set
Ndcnatenablep2p0wlan00//interpolation NAT rule
After tested, the effect that above code is risen is consistent with the manual modification process that top is disclosed, and through thus section code effect, packet forwarding capability is opened, and iptables filter table obtains correct configuration, and dns resolution function also obtains correct maintenance。Therefore, the application program of the present invention under system highest weight limit state, after starting hotspot pattern, can perform this section of code, just achieves the correct amendment to network configuration sharing information, and client just can be surfed the Net by service end。
Most android system intelligent terminal, due to the restriction of manufacturer, not open its system highest weight limit, or unsuccessful by ROOT, for this situation, the operation of the above amendment directly driving network guard to be carried out network configuration sharing information with NDC instruction can not be successful。Accordingly, it would be desirable to look for another way。
The mode of a kind of improvement is to become a method function (configuration interface) by above with the NDC code wrap expressed, Open Source Code file and WifiP2pServiceImpl.java to WiFiP2pManager class are modified, owing to WifiP2pServiceImpl.java can realize those ndc orders either directly through the mNwService function derived, cause exists, can inside increase the method function, and derive and use to WiFiP2pManager class, so, the application program of the present invention only need to call this configuration interface either directly through WiFiP2pManager class, the amendment to network configuration sharing information can be implemented, acquisition without Help of System highest weight limit。
As can be seen here, control described network guard process by ndc order is also diversified in the way of revising network configuration sharing parameter。
By implementing above-mentioned multiple control modes, the network between the hotspot pattern of service end and station mode all can being made to connect and interconnect, the problem of route has solution therewith。
Described communication unit 13, for, after client accesses described network group, setting up the connection of this client and the outer net maintained by described station mode。
After the network group that client access service end provides, sending DHCP request to service end, the configuration process of service end reads the correct network configuration sharing information after above-mentioned amendment, feeds back to client。After client completes the network settings of self accordingly, just can through accessing outer net as the focus interface of service end intelligent terminal of the present invention, site interface。For this intelligent terminal, when it receives the packet of client-access outer net, this packet is forwarded through the path transmission of described station mode to described outer net;When its receive extranet access client packet time, be forwarded through described hotspot pattern path transmission give this client。
Further, for improving the function of the program process of the present invention, it is possible to increase recovery unit, this recovery unit is configured to respond to exit the user instruction of shared verification, recovers described network configuration sharing information。
Specifically, the application program of the present invention is referred to aforesaid mode, provides the control button of a shared verification to user interface, also may be used as continued to use the above-mentioned final election control operation controlling button providing user interface。When this control button is triggered, just producing described user instruction, by the effect of this user instruction, the present invention just can implement to disconnect described hotspot pattern, thus just automatically disconnects external connection。
Further, it is possible to adopt mode more thoroughly, the network configuration sharing information in advance aforementioned processing process produced is cleared up, for instance, consult following ndc instruction:
Ndcipfwddisable//closedown packet forwarding capability
Ndctetherstop//stopping online sharing functionality
Ndcnatdisablep2p0wlan00//closedown NAT mapping function
Perform above-mentioned order by the program process of the present invention, just can pass through SOCKET port controlling network guard process and perform corresponding function, thus avoiding the aforesaid potential impact that the machine use is brought by network configuration sharing information。Could be aware that, the premise directly invoking the described network guard process of above-mentioned order control in the program process of the present invention is the highest weight limit having obtained system。
In like manner, according to above-mentioned building method function and be implanted into the example in WiFiP2pManager, thrashing code herein can be configured to method function (interface of clearing up and discharging) completely in the same way, add in the code file of WiFiP2pManager class, export as such corresponding member function, follow-up directly called this interface of clearing up and discharging by the program process of the present invention and can perform, without considering currently whether obtained system ROOT authority。
In sum, the method for the present invention solves Android intelligent terminal and opens the technical barrier of hotspot pattern and station mode simultaneously, and allows the client accessing the network group under its hotspot pattern via the corresponding outer net interface accessing outer net of its station mode。
In brief, by the process of the present invention, the intelligent terminal of android system has just possessed dual mode capability, namely both may act as focus for the access of other equipment simultaneously, also act as website and access external network access point, and the effect of router can be played, it is allowed to the client device accessing this intelligent terminal accesses outer net by this intelligent terminal。
Those skilled in the art of the present technique are appreciated that the present invention includes the one or more equipment relating to perform in operation described herein。These equipment can specialized designs and manufacture for required purpose, or the known device in general purpose computer can also be included。These equipment have storage computer program within it, and these computer programs optionally activate or reconstruct。Such computer program can be stored in equipment (such as, computer) in computer-readable recording medium or be stored in and be suitable to storage e-command and be coupled to any kind of medium of bus respectively, described computer-readable medium includes but not limited to that any kind of dish (includes floppy disk, hard disk, CD, CD-ROM, and magneto-optic disk), ROM (Read-OnlyMemory, read only memory), RAM (RandomAccessMemory, memorizer immediately), EPROM (ErasableProgrammableRead-OnlyMemory, Erarable Programmable Read only Memory), EEPROM (ElectricallyErasableProgrammableRead-OnlyMemory, EEPROM), flash memory, magnetic card or light card。It is, computer-readable recording medium include by equipment (such as, computer) with can read form storage or transmission information any medium。
Those skilled in the art of the present technique are appreciated that, it is possible to the calculation machine programmed instruction combination to the frame in each frame realizing in these structure charts and/or block diagram and/or flow graph and these structure charts and/or block diagram and/or flow graph of using tricks。Those skilled in the art of the present technique are appreciated that, the processor that these computer program instructions can be supplied to general purpose computer, special purpose computer or other programmable data processing methods realizes, and performs the scheme specified in the frame of structure chart disclosed by the invention and/or block diagram and/or flow graph or multiple frame thereby through the processor of computer or other programmable data processing methods。
Those skilled in the art of the present technique are appreciated that the step in the various operations discussed in the present invention, method, flow process, measure, scheme can be replaced, change, combine or delete。Further, have the various operations discussed in the present invention, method, other steps in flow process, measure, scheme can also be replaced, changed, reset, decomposed, combined or deleted。Further, of the prior art have with the present invention disclosed in various operations, method, the step in flow process, measure, scheme can also be replaced, changed, reset, decomposed, combined or deleted。
The above is only the some embodiments of the present invention; it should be pointed out that, for those skilled in the art, under the premise without departing from the principles of the invention; can also making some improvements and modifications, these improvements and modifications also should be regarded as protection scope of the present invention。