Embodiment
The embodiment of the present invention provides a kind of alternative space method being applied to family, is below described in detail.
In this alternative space method, each from the owned priority of node, the MAC Address whole world is unique, and determine during production equipment, priority is according to type of service determination default value, and user can be arranged, and host node priority is fixed as 0.It should be noted that, in digital home network, host node is home gateway, is the various application terminal be connected with home gateway of household internal, such as: computer, telephone set, television set, game machine, security device, integrated reading device etc. of checking meter from node.
The mark (ID, IDentity) from node that this alternative space method can realize being controlled by home gateway divides; Realize the access of 6 kinds of business (maximum easily extensible is 16 kinds of business) and 64 home business terminals; Realize classification and the flow control of QoS.
Different types of service is mapped as different priority, and supporting 16 priority at most, is namely 16 kinds of business.In the present embodiment, 0 is that priority is the highest, 15 is that priority is minimum, six kinds of business of definition, corresponding priority registration is respectively: the priority that the priority that priority is 8, game service is corresponding that the priority that the priority that the priority that television services is corresponding is 2, telephone service is corresponding is 4, security protection business is corresponding is 6, business of checking meter is corresponding is 10, business of networking is corresponding is 15.
In the present embodiment, the frame format adopted is as shown in the table,
Frame head territory |
ID territory |
Type field |
Data field |
Verification territory |
1 byte |
1 byte |
1 byte |
Maximum 1496 bytes |
1 byte |
Wherein,
(1) 1 byte representation in frame head territory, is fixed as 0x7E.In intraframe data territory part, need to be converted to 0x7D0x5E if run into 0x7E during encapsulation, need to be converted to 0x7D0x5E if run into 0x7D; Reverse operating is carried out during decapsulation.
(2) 1 byte representation in ID territory, for identifying user address, design support 64 users at present.
(3) type field 1 byte representation, maximum definable 256 kinds of frame types.
Devise the frame of 6 types at present, its title and effect are respectively:
Node ID application frame: for from node to host node application from node ID;
Node ID distributes frame: for host node to from peer distribution from node ID;
Send Data Control frame: control to send data from node for host node;
Send Data Control acknowledgement frame: " send Data Control frame " for response;
Downlink data frame: for transmitting host node to the data from node;
Uplink data frames: for transmitting the data from node to host node.
(4) with regard to data field, this alternative space is carried on Ethernet, ethernet layer adopts the encapsulation format of RFC894 definition, payload data length is 1500 bytes to the maximum, in the present embodiment, payload data length maximum is designated as Lmax, Lmax=Ethernet payload data length maximum-frame head length of field-type field length-ID length of field-byte-1 byte-1 byte-1 byte-1 byte=1496, verification length of field=1500 byte, namely in the present embodiment, payload data length maximum is 1496 bytes.
When physical layer provides the bandwidth of 50Mbps, transmitting a frame length is 1518 byte ethernet frame times be designated as tmax, tmax=frame length/bandwidth=(1518 byte × 8)/50 Gigabits per second=243 × 10-6 seconds, namely transmit 1518 byte frames and only need 243 microseconds.
If host node is to from the inquiry cycle of node, only send a frame data frame from node at every turn, suppose that " uplink data frames " frame length is maximum 1500 byte, then poll one-period is consuming time maximum, " transmission Data Control frame " and " sending Data Control acknowledgement frame " frame length are all 5 bytes, now in 64 number of users situations, the time that the whole poll of all users is one time is designated as t, then t=number of users × (transmitting the longest frame time+transmission Data Control frame time+transmission Data Control acknowledgement frame time)=64 × [243 × 10-6 second+(5 byte × 8)/50 Gigabits per second+(5 byte × 8)/50 Gigabits per second]=15.65 milliseconds.
According to ETSI statistics, voice data maximum delay is 20 milliseconds, game maximum delay is 20 milliseconds, audio and video streams maximum delay is 100 milliseconds, and other business time delays are substantially at about 200 milliseconds.
First select frame length to be 500 bytes to reduce each service delay, time delay is 5.2ms.
(5) verify 1 byte representation in territory, adopt CRC8 School Affairs.
As previously mentioned, this alternative space method devises six kinds of frame types at present, is specially: node ID application frame, node ID are distributed frame, send Data Control, sent Data Control acknowledgement frame, downlink data frame and uplink data frames, specifically describe as follows:
(1) the frame type territory of node ID application frame is 0x02, and the frame format of node ID application frame is:
Frame head territory |
ID territory |
Type field |
Mac domain |
Priority field |
Verification territory |
1 byte |
1 byte |
1 byte |
6 bytes |
1 byte |
1 byte |
Wherein ID territory is used for filling in host node ID; MAC (MediaAccessControl) territory is used for filling in from node self MAC value; Priority field is used for filling in from node own priority value;
Node ID application frame is sent to host node by from node, needs host node to respond, for from node to host node application from node ID.
(2) node ID distributes the type field of frame is 0x03, and the frame format that node ID distributes frame is:
Frame head territory |
ID territory one |
Type field |
Mac domain |
ID territory two |
Verification territory |
1 byte |
1 byte |
1 byte |
6 bytes |
1 byte |
1 byte |
Wherein, ID territory one is for filling in host node ID; Mac domain is used for filling in target from node M AC value; ID territory two is for extending this as the ID value of target from peer distribution.Node ID is distributed frame and is sent to from node by host node, does not need from node response, for host node to from peer distribution from node ID.
(3) type field sending Data Control frame is 0x04, and the frame format sending Data Control frame is:
Frame head territory |
ID territory |
Type field |
Control command territory |
Verification territory |
1 byte |
1 byte |
1 byte |
1 byte |
1 byte |
Wherein, ID territory is used for filling in target from node ID; When being in the state the need of transmission data, 0x00 is filled in control command territory, and when being in the state stopping sending data, 0x01 is filled in control command territory.
Sending the effect of Data Control frame is sent to from node by host node, needs from node response, controls to send data from node for host node.
(4) type field sending Data Control acknowledgement frame is 0x05, and the frame format sending Data Control acknowledgement frame is:
Frame head territory |
ID territory |
Type field |
Control command territory |
Verification territory |
1 byte |
1 byte |
1 byte |
1 byte |
1 byte |
Wherein ID territory is used for filling in host node ID; When being in the state needing to send data, 0x00 is filled in control command territory, and when being in the state not needing to send data, 0x01 is filled in control command territory.
Send Data Control acknowledgement frame and be sent to host node by from node, do not need host node to respond.Send Data Control acknowledgement frame to be used for " sending Data Control frame " from node response.
(5) type field of downlink data frame is 0x06, and the frame format of downlink data frame is:
Frame head territory |
ID territory |
Type field |
Payload data territory |
Verification territory |
1 byte |
1 byte |
1 byte |
Maximum 1496 bytes |
1 byte |
Wherein, ID territory is used for filling in host node ID; Downlink data frame is sent to from node by host node, does not need to respond from node.Downlink data frame is used for host node and sends data to from node.
(6) type field of uplink data frames is 0x07, and the frame format of uplink data frames is;
Frame head territory |
ID territory |
Type field |
Data field |
Verification territory |
1 byte |
1 byte |
1 byte |
Maximum 1496 bytes |
1 byte |
Wherein, ID territory is used for filling in host node ID; Uplink data frames is sent to host node by from node, does not need host node to respond.Uplink data frames is used for sending data from node to host node.
See Fig. 1, below by with regard to host node to from the ID allocation flow of node, host node and from the downlink data handling process between node, host node be described in detail from the transmitting uplink data flow process between node.
1) host node is to the ID allocation flow from node
101, arbitrary from node power on backward host node sending node ID apply for frame.
102, after host node receives node ID application frame, host node distributes frame to this from node sending node ID, and this node ID distribution frame carries mac domain information and is this id information from peer distribution.
103, after the node ID distribution frame of host node transmission should being received from node, the mac domain information that this node ID distribution frame carries was obtained,
If the mac domain information that 104 these node ID distribution frames carry and the MAC information match from node self, should extract host node distribution frame from node from this node ID is the id information distributed from node N.
2) host node and from the downlink data handling process between node and upstream data handling process
Adopt the mode of broadcast to transmit for downlink data (host node to from the control frame of node and Frame), adopt the mode of clean culture to transmit for upstream data (control frame from node to host node and Frame).
In host node according to type of service (priority) by all queues being created as respective numbers from node, the signal of the queue structure of host node is as shown in Figure 2.Downlink data is stored in respective queue successively according to type of service.Host node according to priority scans individual queue in descending order successively, after high-priority queue process completes, then scans next priority query.After the queue of all priority has all scanned, new round scanning from highest-priority queue again.
Optionally, when scanning beginning, opening timing device, when timer t (the being defined as 20 milliseconds at present) time arrives, present scan terminates, and again scans from limit priority.This mechanism is used for ensureing when bandwidth is not enough, the implementation of high-priority service.
Queue processing process comprises: upstream data and downlink data process.
Downlink data in queue is directly sent, until no longer comprise valid data in queue; The node of the corresponding priority of inquiry, realizes transmitting uplink data successively.
The queue processing process flow of host node is as follows:
105, the queue of host node scanning limit priority;
106, in the queue that judgement is scanning, whether there are valid data, if so, perform step 107, if not, perform step 108;
107, in the queue scanned, there are valid data, host node to exist valid data from node send downlink data frame;
108, in the queue scanned, there are not valid data, host node carries out poll to what scanning from node, carries out transmitting uplink data;
109, after step 108, host node judges whether the queue of current scanline is lowest priority, if so, performs step 105, if not, performs step 110;
110, the queue of current scanline is not lowest priority, and host node scans next priority query again.After the queue of all priority has all scanned, new round scanning from highest-priority queue again.
In a step 102, it is id information from peer distribution that the node ID that host node the sends ID territory distributed in frame contains host node, and host node self first will be retrieved as the id information from peer distribution.See Fig. 3, host node is retrieved as from the process of the id information of peer distribution as follows:
The id information of host node is 0x00, safeguards id information table at host node, and id information table is that major key stores item of information from small to large with ID.Have 8bit from the ID of node, Gao Siwei determines by from node priority, and low four are distributed successively from 0.
201, after host node receives node ID application frame, from node ID application frame, priority value is extracted;
202, in id information table, search whether to there is high four of ID be the list item of this priority value, if there is not high four of ID in id information table is the list item of this priority value, perform step 203; If there is high four of ID in id information table is the list item of this priority value, perform step 204;
203, there is not high four of ID in id information table is the list item of this priority value, and host node increases ID list item in id information table, and high four of the ID list item newly increased is this priority value, and low four is 0;
204, there is high four of ID in id information table is the list item of this priority value, judges whether low four figures value the maximum of this list item equals 15, if be not equal to 15, performs step 205, if equal 15, performs step 206;
205, low four figures value the maximum of this list item is not equal to 15, and host node increases ID list item in id information table, the ID list item newly increased high four for this priority value, low four is low 4-digit number the maximum of this list item aforesaid;
206, low four figures value the maximum of this list item equals 15, and the priority value extracted in node ID application frame is updated to the value after adding;
207, after step 206, then judge whether the priority value after upgrading equals 15, if be not equal to 15, then re-executes step 202, and the step that step 202 is later; If equal 15, then perform step 208;
208, the priority value after upgrading equals 15, and host node carries out abnormality processing.
Concrete, suppose that the priority from node 1 that host node extracts from node ID application frame is 2, then from the ID of node 1 high four be 2.Host node retrieval id information table, finding high four of ID is the list item of 2, and this list item ID low four figures value the maximum is m.Host node judges whether m equals 15, if m equals 15, the priority value that host node extracts from node ID application frame is updated to the value after adding, obtain m1, m1=2+1=3, judge whether m1 equals 15 again, if m1 is not equal to 15, host node retrieval id information table, finding high four of ID is the list item of 3, and high four of this ID be ID low four figures value the maximum in the list item of 3 is m2, if m2 is not equal to 15, host node adds list item in id information table, and the Gao Siwei of the new list item added is m1, and low four is m2+1.
See Fig. 4, in step 108, when there are not valid data in the queue scanned, host node carries out poll to what scanning from node, realizes transmitting uplink data, is specially:
301, host node sends Data Control frame to what scanning from node, inquires from node the need of transmission data;
302, all from nodes listen circuit, arbitrary scanning receive send Data Control frame from node after, from transmission Data Control frame, obtain id information, this id information and the ID value of self matched.
If 303 couplings, then send Data Control acknowledgement frame to host node and respond;
304, after host node receives and sends Data Control acknowledgement frame, what respond with it sends uplink data frames from node.
Optionally, host node, at every turn to during from node polls, allows to send Data Control frame to sending multiframe from node.
Optionally, in transmitting uplink data process, once timer then, then host node is to sending from node " sending Data Control frame ", orders from node end data transmission immediately.
The embodiment of the present invention adopts host node to control to divide from the ID of node, the transmission of upstream data and downlink data is carried out according to the ID from node and the priority from node, thus the access of 6 kinds of business and 64 home business terminals can be realized, and realize classification and the flow control of QoS.
One of ordinary skill in the art will appreciate that all or part of step in the various methods of above-described embodiment is that the hardware that can carry out instruction relevant by program has come, this program can be stored in a computer-readable recording medium, and storage medium can comprise: ROM, RAM, disk or CD etc.
Above the alternative space method being applied to family that the embodiment of the present invention provides is described in detail, apply specific case herein to set forth principle of the present invention and execution mode, the explanation of above embodiment just understands method of the present invention and core concept thereof for helping; Meanwhile, for one of ordinary skill in the art, according to thought of the present invention, all will change in specific embodiments and applications, in sum, this description should not be construed as limitation of the present invention.