Content of the invention
A kind of in view of above-mentioned the deficiencies in the prior art, it is an object of the invention to provide method of smart machine access network
And system is it is intended to solve the problems, such as that the setup time length of existing smart machine access network, network connection speed are slow.
Technical scheme is as follows:
A kind of method of smart machine access network, wherein, including step:
A, smart machine open promiscuous mode, and multiple channels are monitored in turn, when listening to intelligent terminal, locking intelligence
Terminal place channel;
B, described intelligent terminal is by the configuration information composition data bag of target AP, and described packet segmentation is become multiple units,
Sent in batches by UDP multicast mode;
C, described smart machine, after intelligent terminal place channel receives described packet, solve to described packet
Analysis, carries out WIFI connection according to analysis result.
It is preferred that the method for described smart machine access network, wherein, before described step A, described smart machine connects
Enter network also to include:
A0, described intelligent terminal are by the Header compression of described packet to a UDP multicast frame, and are persistently sent out with scheduled duration
Send described UDP multicast frame.
It is preferred that the method for described smart machine access network, wherein, described step A specifically includes:
A1, described smart machine open promiscuous mode, and multiple channels are monitored in turn;
A2, when described smart machine receives described UDP multicast frame, packet header judgement is carried out to described UDP multicast frame, works as judgement
During for packet header, then lock described intelligent terminal place channel.
It is preferred that the method for described smart machine access network, wherein, described step B specifically includes:
B1, described intelligent terminal by the configuration information composition data bag of target AP, and by described packet in units of 23bits
It is divided into multiple units with different numberings;
B2, by UDP multicast mode, described unit is sent in batches.
It is preferred that the method for described smart machine access network, wherein, described step C specifically includes:
C1, described smart machine carry out minute wheel time by number and receive to all units in packet, and by current round with front
The same numbered cell that each round in face receives carries out content and compares, if each is with the content all same of numbered cell, terminates to receive
And enter step C2;If it is different, then continue the reception of next one, and the same volume that next one is received with above each round
Number unit carries out content and compares, until the content of each numbered cell two rounds are identical wherein;
C2, all units to composition data bag carry out completeness check;
After C3, verification are passed through, described packet is carried out parse SSID, the password obtaining target AP -- and cipher mode, root
Carry out WIFI connection according to the SSID of described target AP, password and cipher mode.
It is preferred that the method for described smart machine access network is it is characterised in that described step C1 also includes:
C11, inquire-receive to each unit send side mac address whether mate with the MAC Address of described intelligent terminal,
If coupling, retaining described unit, if mismatching, abandoning described unit;
C12, inquire-receive to each unit send side mac address whether mate with the MAC Address of described target AP, if
Coupling, then retain described unit, if mismatching, abandons described unit.
A kind of system of smart machine access network, wherein, including:Smart machine and intelligent terminal;
Described smart machine is used for opening promiscuous mode, and multiple channels are monitored in turn, when listening to intelligent terminal, lock
Determine intelligent terminal place channel;
Described intelligent terminal is used for the configuration information composition data bag of target AP, and described packet segmentation is become multiple lists
Unit, is sent in batches by UDP multicast mode;
Described smart machine is additionally operable to, after intelligent terminal place channel receives described packet, described packet be carried out
Parsing, carries out WIFI connection according to analysis result.
It is preferred that described smart machine also includes:
Open promiscuous mode, multiple channels are monitored in turn;
When described smart machine receives described UDP multicast frame, packet header judgement is carried out to described UDP multicast frame, when being judged to
During packet header, then locking intelligent terminal place channel.
It is preferred that described intelligent terminal specifically for:
By the configuration information composition data bag of target AP, and by described packet be divided in units of 23bits multiple with not
Unit with numbering;
By UDP multicast mode, described unit is sent in batches.
It is preferred that described smart machine is additionally operable to:
Described smart machine is carried out by number to all units in packet with minute wheel time receive, and by current round with above
The same numbered cell that each round receives carries out content and compares, if each is with the content all same of numbered cell, terminates to receive simultaneously
Enter step C2;If it is different, then continue the reception of next one, and the same numbering that next one is received with above each round
Unit carries out content and compares, until the content of each numbered cell two rounds are identical wherein;
Completeness check is carried out to all units of composition data bag;
After verification is passed through, described packet is carried out parse SSID, password and the cipher mode obtaining target AP, according to described
The SSID of target AP, password and cipher mode carry out WIFI connection.
The method and system of the smart machine access network that various embodiments of the present invention are provided, it is mixed that described smart machine passes through unlatching
Parasitic mode formula is monitored to multiple channels in turn to lock intelligent terminal place channel, and intelligent terminal is with UDP multicast mode in batches
Secondary send the packet being made up of the configuration information of target AP, described smart machine pass through Header compression, redundancy reception, sender
The quick and stable described packet of reception of mode of checking and two-way seizure, and the packet of described reception is solved
Analysis, realizes equipment quickly and stably access network finally according to analysis result.
Specific embodiment
The present invention provides a kind of method and system of smart machine access network, for making the purpose of the present invention, technical scheme
And effect is clearer, clear and definite, the present invention is described in more detail below.It should be appreciated that described herein be embodied as
Example, only in order to explain the present invention, is not intended to limit the present invention.
Before linking objective AP, although smart machine can be grabbed to the wireless signal of in the air by promiscuous mode
Bag, but the packet commuting between intelligent terminal and AP caught is all MAC layer encryption, as shown in figure 1, now intelligence sets
Standby is that an information island obtains surrounding " sound " although can " listen ", but does not understand implication therein.
For this reason, the present invention proposes a kind of fixing mapping relations using UDP multicast ip address to MAC Address transmits letter
Breath, that is, IPv4 multicast address is identical with latter 23 of MAC Address, and the such as corresponding MAC Address of multicast address 239.1.2.3 is fixed
For 01:00:5E:01:02:03, Fig. 2 is 802.11 MAC layer frame format, and encryption is only limitted to MAC payload(Frame
Body), frame head and verification be all unencrypted.Based on this principle, the present invention arrives MAC Address using UDP multicast ip address
Fixing mapping relations carry out transmission information, can transmit 23bits data every time, and 802.11 frame lengths only have 60bytes, effect
Improve much than the mode of udp broadcast in rate.
Refer to Fig. 3, Fig. 3 is a kind of method preferred embodiment flow chart of present invention smart machine access network, such as schemes
Shown, it includes step:
S100, smart machine open promiscuous mode, and multiple channels are monitored in turn, when listening to intelligent terminal, locking
Intelligent terminal place channel;
S200, described intelligent terminal is by the configuration information composition data bag of target AP, and described packet segmentation is become multiple lists
Unit, is sent in batches by UDP multicast mode;
S300, described smart machine, after intelligent terminal place channel receives described packet, are carried out to described packet
Parsing, carries out WIFI connection according to analysis result.
In the present invention, described intelligent terminal refers to the equipment that can automatically network with screen and input equipment, such as
Smart mobile phone, Intelligent flat etc.;Described smart machine refers to that some do not have screen and keyboard it is impossible to select WIFI access point and defeated
Enter corresponding password, thus the equipment of wireless network cannot be directly accessed, such as the equipment such as intelligent refrigerator, intelligent microwave oven.
Network can be connected to realize smart machine, in the present invention, first, smart machine is opened mixed fast and stable
Multiple channels are monitored by parasitic mode formula in turn, when listening to intelligent terminal, lock intelligent terminal place channel, intelligence afterwards
Terminal the information such as the SSID of target AP, password, cipher mode can be formed a packet according to certain format, enter as needed
Row encryption and completeness check;
Further, ready configuration information packet is split for unit by intelligent terminal according to most 23bits, passes through
UDP multicast mode sends in batches;Smart machine completes after packet receives, it to be decrypted and completeness check, school
Test by after parse SSID, password and the cipher mode of target AP, and the SSID according to described target AP, password and encryption side
The information such as formula connect network.
Further, in the present embodiment, described step S100 specifically includes:
S101, described intelligent terminal will be in the Header compression of described packet to a UDP multicast frame and lasting with scheduled duration
Send described UDP multicast frame;
Specifically, the present invention to realize faster channel locks by way of Header compression, and described packet header is with respect to joining
For putting information packet, the size in packet header is less than 23bits, and it can be sent by a UDP multicast frame, described bag
Head includes the information such as packet header identifier, configuration information protocol version, configuration mode, configuration information bag size and verification, such as
Shown in table 1:
Table 1 is the IPv4 multicast address of a 32bits nybble:
As shown in table 1, low 23bits will appear in Address1 or Address3 of 802.11 mac frames, first character section value
For 239, because 239.0.0.0 ~ 239.255.255.255 is local management multicast address;Second byte value is 116, i.e. word
The ASCII character of symbol ' t ', as packet header identifier;3rd byte is the main body in packet header, its BIT [7:6] represent configuration information association
View version number, BIT5 represents configuration mode, and being worth for 0 is batch configuration pattern, and being worth for 1 is single-point configuration mode(General use
Carry out under the test environment of WiFi configuration in there being many intelligent terminal of multiple AP simultaneously), BIT [2:0] it is used for representing configuration information
Bag size, unit is block, and each block comprises 16 bytes(AES encryption block size is 128bits), most 8*16=
128bytes, enough for configuration information, because the longest 32 characters of SSID, Password Length scope is 8 ~ 63 characters;The
Four bytes are used for the verification in packet header.
Further, so-called Header compression is exactly by as far as possible less and important information is filled in 23bits, so only need one
Individual UDP multicast frame just can carry;If packet header is more than 23bits, need to receive multiple UDP multicast frames, easily because packet loss causes
It is invalid that whole packet header receives.
S102, described smart machine open promiscuous mode, and multiple channels are monitored in turn;
Specifically, 802.11 have 13 channels in 2.4GHz frequency range, and smart machine promiscuous mode similarly hereinafter can only monitor by the time
One channel is it is desirable to receive configuration information firstly the need of determination target AP(Or intelligent terminal)Place channel, so need 13
Individual channels in turn is monitored it is also possible to the inactive channel excluded some in advance by scanning and do not have AP improves monitoring efficiency.
S103, when described smart machine receives described UDP multicast frame, packet header judgement is carried out to described UDP multicast frame,
When being judged to packet header, then lock described intelligent terminal place channel.
Specifically, as previously described, packet header, except comprising the key property of configuration information bag below, is additionally operable to channel
Locking, reducing, in Header compression to a UDP multicast frame, the probability being disturbed by other WiFi communication, also simplify intelligence
The reception operation at the transmission of terminal and smart machine end, transmitting terminal only needs constantly to send one UDP multicast frame of identical and hold
Continuous a period of time, such as 2 seconds, receiving terminal was periodically(As 100ms)Monitor each channel in turn, often receive a frame and can carry out packet header
Judge, if packet header can carry out channel locks, no longer monitor other channels;
Preferably, to be on the safe side, the condition of channel locks can be set to repeatedly receive identical packet header by receiving terminal, than
The channel that the channel being located as when continuing 3 times and receiving identical packet header, then locked described packet header is located for intelligent terminal is logical
Cross this channel configuration information bag afterwards is received.
Further, the present invention effectively increases configuration speed and reliability by way of Header compression, with respect to common
The packet header of " configuration information bag " needs multiple 802.11 transmissions, and Header compression is reduced the several of error to once transmission by the present invention
Rate, improves stability, also improves channel locks speed.
Further, described step S200 specifically includes:
S201, described intelligent terminal by the configuration information composition data bag of target AP, and by described packet with 23bits as list
Position is divided into multiple units with different numberings;
S202, by UDP multicast mode, described unit is sent in batches.
Specifically, because each UDP multicast frame once at most can transmit 23bits data, intelligent terminal therefore of the present invention
Unit segmentation is carried out in units of 23bits by the packet forming target AP configuration information, and passes through UDP multicast mode
Described packet unit is sent in batches, can achieve by the way and packet is quickly sent, and prevent
Packet loss phenomenon occurs.
Further, in the present embodiment, described step S300 specifically includes:
S301, described smart machine carry out minute wheel time by number and receive to all units in packet, and by current round with
The same numbered cell that above each round receives carries out content and compares, if each, with the content all same of numbered cell, terminates to connect
Receive and enter step C2;If it is different, then continue the reception of next one, and next one is same with what above each round received
Numbered cell carries out content and compares, until the content of each numbered cell two rounds are identical wherein;
Specifically, described packet includes configuration information bag and packet header, and the present invention determines reception by way of redundancy reception
To packet be complete, stable.Due to there may be other UDP multicast transmission in LAN, this is to configuration information
The reception in bag and packet header all may produce interference and cause configuration failure.
Configuration information bag and packet header are different, are typically made up of multiple UDP multicast frames.Table 2 is a UDP multicast frame number
According to:
Byte |
B1 |
B2 |
B3 |
B4 |
Value |
239 |
7+n |
XX |
XX |
Description |
Multicast |
Packet number |
Byte(2n) |
Byte(2n+1) |
As shown in table 2, each UDP multicast frame can transmit 23bits data, and high 7bits therein is set to packet number, because
Only 7bits, so representing that scope is 0 ~ 127, because 239.0.xx.xx and 239.1.xx.xx is typically easier to be used for certainly
The local area network multicast transmission of definition, can avoid multicast address end above, the present embodiment, from the beginning of 7, further needs exist for avoiding
For representing the 116 of packet header(Character ' t '), so every frame UDP multicast can also transmit 16bits data, i.e. two bytes, such as
Front described, because the longest 32 characters of SSID, Password Length scope is 8 ~ 63 characters, packet number scope 7 ~ 127(Exclusion
116)Use enough.
Specifically, such as whole configuration information(Packet)Need to be divided into 20 transmissions, smart machine only need to connect in theory
Receive this 20 units just, but as it is possible that there is interference, wherein a certain unit is probably mistake, leads to below
Completeness check failure, and because not can determine that it is which unit in 20 units is wrong, so can only from the beginning carry out take turns more
The whole units of secondary reception, until the content of each numbered cell two rounds are identical wherein, then terminate to receive.The present invention passes through superfluous
The mode of remaining reception receives twice to each unit(Or more times), contrast the unit receiving twice whether identical, if identical
Then think that described unit receives correct, if difference, lose described unit and again repeatedly receive described unit, connect by redundancy
The mode received effectively reduces disturbed probability during packet transmission.
S302, all units to composition data bag carry out completeness check;
After S302, verification are passed through, described packet is carried out parse SSID, password and the cipher mode obtaining target AP, root
Carry out WIFI connection according to the SSID of described target AP, password and cipher mode.
Packet is carried out with completeness check and parsing belongs to prior art, here does not do excessive explanation.
Further, affiliated step S301 specifically also includes:
S31, inquire-receive to each unit send side mac address whether mate with the MAC Address of described intelligent terminal,
If coupling, retaining described unit, if mismatching, abandoning described unit;
Specifically, because configuration information bag is by multiple units(UDP multicast frame)Composition is although reduce data by redundancy reception
The bag disturbed probability of transmission, but, when there are many people or multiple intelligent terminal configure simultaneously a WIFI equipment or many people with
When configure multiple WIFI equipments and some malice disturbed condition when, still it cannot be guaranteed that the multicast frame of a certain sequence number and other sequences
Number multicast frame be from same intelligent terminal.
For solving the above problems, in the present embodiment, when smart machine is when receiving packet, need to UDP multicast
The transmission side mac address of bag is verified, if the MAC Address being described intelligent terminal with sender during lock channel before is not
Coupling, then abandon this unit, thus avoiding disturbed;If coupling, retain described unit.
Each unit that S32, inquire-receive arrive send the MAC Address of side mac address and described target AP whether
Joining, if coupling, retain described unit, if mismatching, abandoning described unit.
Specifically, after described smart machine locks described intelligent terminal place channel, described intelligent terminal is mixing
Continue the reception of packet, in most cases, what smart machine received is the multicast that intelligent terminal is sent to AP under pattern
Frame, but because the performance parameters of smart machine are different, what some smart machines received is that AP is transmitted in LAN other ends
End although the valid data that AP forwards and intelligent terminal sends are identicals, but the frame head of its MAC layer is different, especially
It is three MAC Address(Source MAC, the MAC of purpose MAC, AP)Position in frame head is different.And it is of the present invention mixed
Parasitic mode formula is exactly to capture radio data bag in atmosphere, for the WiFi equipment in packet capturing, is to be hard to tell which bag is
The intelligent terminal of configuration sends out, and which is that AP forwards, and the MAC Address structure in the packet of both types is different
, and the information source of the present invention " UDP multicast mode " is by chance the MAC Address in packet, so WiFi equipment is to packet capturing
If to Frame filtered when simultaneously consider both types, take wherein a certain type efficiency to improve much than only.
The present invention passes through for the UDP multicast frame in both direction to include range of receiving, can be effectively increased smart machine network configuration
Success rate and stability.
Further, also include after described step S300:
S400, smart machine send the termination packet of set form in the way of udp broadcast or multicast to described intelligent terminal,
Intelligent terminal is notified to stop sending packet.
Specifically, after smart machine is successfully connected network, the mode that will pass through udp broadcast or multicast is to intelligent terminal
Send the termination packet of set form, notify intelligent terminal to stop send configuration information, i.e. packet, so far entirely configured
Journey terminates.
In sum, the present invention provides a kind of method of smart machine access network, and specifically, smart machine passes through to open
Promiscuous mode is monitored to multiple channels in turn to lock intelligent terminal place channel, when smart machine receives intelligent terminal
After the packet of configuration information composition of target AP being sent with UDP multicast mode, described packet is parsed, enters one
Step, realizes smart machine by modes such as Header compression, redundancy reception, sender authentication, two-way seizure more quick and stable
Ground access network.
Based on said method, the present invention also provides a kind of system of intelligent terminal's access network, in a preferred embodiment,
As shown in Figure 4, the system of described smart machine 100 access network includes:Smart machine 100 and intelligent terminal 200;
Described smart machine 100 is used for opening promiscuous mode, and multiple channels are monitored in turn, when listening to intelligent terminal
When, lock intelligent terminal place channel;
Described intelligent terminal 200 is used for the configuration information composition data bag of target AP, and described packet segmentation is become multiple
Unit, is sent in batches by UDP multicast mode;
Described smart machine 100 is additionally operable to after intelligent terminal place channel receives described packet, to described packet
Parsed, WIFI connection is carried out according to analysis result.
It is preferred that the system of described smart machine access network, wherein, described intelligent terminal 200 is additionally operable to will be described
The Header compression of packet is in a UDP multicast frame, and persistently sends described UDP multicast frame with scheduled duration.
It is preferred that the system of described smart machine access network, wherein, described smart machine 100 includes:
Open promiscuous mode, multiple channels are monitored in turn;
When described smart machine 100 receives described UDP multicast frame, packet header judgement is carried out to described UDP multicast frame, works as judgement
During for packet header, then locking intelligent terminal place channel, terminates to monitor.
Preferably, the system of described smart machine access network, wherein, described intelligent terminal 200 specifically for:
By the configuration information composition data bag of target AP, and described packet is divided into multiple units in units of 23bits;
By UDP multicast mode, described unit is sent in batches.
It is preferred that the system of described smart machine access network, wherein, described smart machine 100 is additionally operable to:
First unit in packet is repeatedly received, and first unit of relatively described multiple reception whether phase
With, if identical, carry out the multiple reception of second unit, and whether second unit of relatively described multiple reception be identical,
The rest may be inferred, until described smart machine receives complete packet;
Completeness check is carried out to described packet;
After verification is passed through, described packet is carried out parse SSID, password and the cipher mode obtaining target AP, according to described
The SSID of target AP, password and cipher mode carry out WIFI connection.
It is preferred that the system of described smart machine access network, wherein, described smart machine 100 is additionally operable to:
Inquire-receive to each unit send side mac address whether mate with the MAC Address of described intelligent terminal, if
Joining, then retain described unit, if mismatching, abandoning described unit;
Inquire-receive to each unit send side mac address whether mate with the MAC Address of described target AP, if
Joining, then retain described unit, if mismatching, abandoning described unit.
It is preferred that the system of described smart machine access network, wherein, described smart machine 100 is additionally operable to wide with UDP
Broadcast or multicast mode to described intelligent terminal send set form termination packet, notify intelligent terminal stop send data
Bag.
It should be noted that said system provided in an embodiment of the present invention, due to being based on together with the inventive method embodiment
One design, the technique effect that it brings is identical with the inventive method embodiment, and particular content can be found in the inventive method embodiment
In narration, here is omitted.
It should be appreciated that the application of the present invention is not limited to above-mentioned citing, for those of ordinary skills, can
To be improved according to the above description or to convert, all these modifications and variations all should belong to the guarantor of claims of the present invention
Shield scope.