Embodiment
For making the object, technical solutions and advantages of the present invention clearer, below in conjunction with accompanying drawing, the technical scheme in the embodiment of the present invention is described in further detail, obviously, described embodiment is the present invention's part embodiment, rather than whole embodiment.Be understandable that; specific embodiment described herein is only for explaining the present invention; but not limitation of the invention; embodiment based in the present invention; those of ordinary skills, not making the every other embodiment obtaining under creative work prerequisite, belong to the scope of protection of the invention.It also should be noted that, for convenience of description, in accompanying drawing, only show part related to the present invention but not full content.
Embodiment mono-
Refer to Fig. 1, the flow chart of the screening technique of the equipment in a kind of local area network (LAN) providing for the embodiment of the present invention one.The method of the embodiment of the present invention is applicable to local area network (LAN), and in described local area network (LAN), equipment comprises: client node and at least two service nodes.The screening plant of the equipment in the local area network (LAN) that the method for the embodiment of the present invention can be realized by hardware and/or software is carried out, and this implement device is typically in the client node being disposed in local area network (LAN).
Described method comprises:
Step 110, described client node send mDNS query messages by local area network (LAN);
This step specifically sends mDNS query messages by the client node in local area network (LAN) to other service nodes except this client node in this local area network (LAN).
Service node and client node are all the node devices in local area network (LAN), and wherein service node refers to the provider of service, and client node refers to the recipient of service.Service can be for example print, duplicate, scan, shooting, phone and/or other services that can provide.For example service node can be the printer that print service can be provided, and client node can be the equipment that print service is used in request, as a certain computer in this local area network (LAN).
It should be noted that, the client node in this local area network (LAN) and the implementation of at least two service nodes are not unique.The equipment of take in local area network (LAN) comprises that first node equipment, Section Point equipment and the 3rd node device are example, and wherein first node equipment can provide first service, and Section Point equipment can provide second service, and the 3rd node device can provide the 3rd service.If current, by first node equipment, by local area network (LAN), send mDNS query messages, first node equipment is client node, and the Section Point equipment of second service can be provided and the 3rd node device of the 3rd service can be provided is service node; If current, by Section Point equipment, by local area network (LAN), send mDNS query messages, Section Point equipment is client node, and the first node equipment of first service can be provided and the 3rd node device of the 3rd service can be provided is service node.
Wherein, mDNS is multicast domain name system, be to provide be similar to DNS operation and without the technology of conventional dns server.
Wherein, mDNS query messages, for inquiring about the information of service node available in local area network (LAN), is the message that meets mDNS protocol specification.Header in mDNS query messages includes control information, for identifying the type of mDNS message, for example, inquiry or response.
Step 120, described client node receive at least two mDNS inquiry responses that service node returns;
In this step, mDNS inquiry response is can be in response to the message of mDNS query messages.The field that mDNS inquiry response generally comprises has: header field and answer field.Wherein, header field includes control information, for identifying the type of mDNS message, and for example inquiry or response.
In answer field, further comprise again resource record field, described resource record field comprises can be in response to the information of mDNS query messages, and in other words, described resource record field comprises the information of service node available in local area network (LAN).Text entry is wherein a type in resource record, so when resource record field store writing record, can be described as text entry field.
Step 130, described client node extract the unique identification in text entry field according to setting extracting rule respectively from described mDNS inquiry response, and described unique identification is for the described service node of unique identification;
This step specifically after client node receives the mDNS inquiry response that at least two service nodes return, is extracted respectively in text entry field the unique identification for unique identification service node from described mDNS inquiry response.Unique identification can be in local area network (LAN) unique identification service node, it can be both self-defining identification information, can be also that some information forms alone or in combination in mDNS inquiry response, as sign that can unique identification service node.
Wherein, described unique identification can comprise MAC (Medium Access Control, the medium access control) address of service node, or the IP address of service node.The unique identification that preferably can adopt the carrying of text entry field to embody with text formatting.
Step 140, described client node are according at least two service nodes described in described unique identification differentiation.
This step can be specifically that described client node is inquired about described unique identification in the ident value table of this locality storage, to determine corresponding service node.
The technical scheme of the present embodiment, client node sends mDNS query messages by local area network (LAN), and receives at least two mDNS inquiry responses that service node returns, and can make client node find can provide in local area network (LAN) a plurality of service nodes of service; Client node by extracting the unique identification that service node is corresponding respectively from described mDNS inquiry response, unique identification based on service node, can make client node distinguish the service node that different services can be provided, thereby according to the demand of client node self, filter out the service node satisfying the demands.Due to uniquely identified uniqueness corresponding to service node, therefore the unique identification based on service node can time client node in local area network (LAN), in numerous service node, filter out unique service node.
Further preferably, described in distinguishing according to described unique identification at described client node, before at least two service nodes, can also comprise:
Described client node, based on setting proof rule, is verified described unique identification.
In this step, can adopt conventional verification algorithm, verify described uniquely identified validity or verify described uniquely identified fail safe.Also can be in the local file of client node the identification list of pre-stored effective service node, or the identification list of the service node of safety, identification list by the described unique identification extracting from mDNS query messages with effective service node, or mate with the identification list of the service node of safety, thereby verify validity or the fail safe of described sign.Can also carry out by third-party authentication server the checking of validity or fail safe.
Embodiment bis-
Refer to Fig. 2, the flow chart of the screening technique of the equipment in a kind of local area network (LAN) providing for the embodiment of the present invention two.The present embodiment, on the basis of above-described embodiment, provides client node from described mDNS inquiry response, according to setting extracting rule, to extract the uniquely identified preferred version in text entry field respectively.
This method for optimizing comprises:
Step 210, client node filter resource record field according to the type of resource record field in answer field in described mDNS inquiry response, obtain the text entry field in described mDNS inquiry response;
Resource record field in the mDNS inquiry response that this step is specifically returned according to the service node in local area network (LAN) is filtered, and retains text entry field, and by non-text entry Field Sanitization.Wherein non-text entry field can comprise pointer resources field.
Step 220, client node, according to the value of the type field in text entry field, are determined the type of payload data in payload data field;
In described mDNS inquiry response, answer field specifically can comprise: the length field of name field, type field, life span field, payload data and payload data field.
Wherein, the value of described type field and payload data field are closely related.By the value of described type field, can specify the implication of payload data in payload data field, normally by LAN Administrator, carry out concrete implication assigned work.
If the type of the described payload data of step 230 is the unique identification implication of pre-configured service node, client node is using the value of the payload data field in text entry field as unique identification corresponding to service node.
This step can be specifically that client node detects the type of described payload data, if the value of type field is appointed as the unique identification of indication service node in advance, client node is determined payload data field in text record, and using the value of payload data field as unique identification corresponding to service node.In other words, the value of the type field in text entry can be pre-configured, to determine the function of payload data field.In this step, by specifying in advance the implication of payload data field, be the unique identification that represents service node, thereby by the value of payload data field, can obtain the unique identification of service node.
The technical scheme of the present embodiment, type by resource record field in answer field in mDNS inquiry response is filtered resource record, can access text entry, and by the value of the type field in specify text record field in advance, make payload data field for service node corresponding to unique identification mDNS inquiry response, therefore client node, according to the value of the value of the type field in text entry field and payload data field, can access the unique identification of the service node that mDNS inquiry response is corresponding.
Embodiment tri-
Refer to Fig. 3, the structural representation of the screening plant of the equipment in a kind of local area network (LAN) providing for the embodiment of the present invention three.In described local area network (LAN), equipment comprises client node and at least two service nodes, and described device is disposed in described client node.
Described device comprises: sending module 310, receiver module 320, unique identification extraction module 330 and discriminating module 340.
Wherein, sending module 310 is for sending mDNS query messages by local area network (LAN); The mDNS inquiry response that receiver module 320 returns for receiving at least two service nodes; Unique identification extraction module 330 is for extracting the unique identification text entry field from described mDNS inquiry response according to setting extracting rule respectively, and described unique identification is for the described service node of unique identification; Discriminating module 340 is at least two service nodes described in distinguishing according to described unique identification.
The technical scheme of the present embodiment, sends mDNS query messages by local area network (LAN), and receives at least two mDNS inquiry responses that service node returns, and can find can provide in local area network (LAN) a plurality of service nodes of service; By extracting the unique identification that service node is corresponding respectively from described mDNS inquiry response, unique identification based on service node, can distinguish the service node that different services can be provided, thereby according to the demand of client node self, filter out the service node satisfying the demands.Due to uniquely identified uniqueness corresponding to service node, therefore the unique identification based on service node can time client node in local area network (LAN), in numerous service node, filter out unique service node.
In such scheme, unique identification extraction module 330 specifically can be for:
According to the type of resource record field in answer field in described mDNS inquiry response, resource record is filtered, obtain the text entry in described mDNS inquiry response;
According to the value of the type field in text entry field, determine the type of payload data in payload data field;
If the type of described payload data is the unique identification implication of pre-configured service node, using the value of the payload data field in text entry field as unique identification corresponding to service node.
In such scheme, can also comprise: authentication module, for before at least two service nodes described in distinguishing according to described unique identification, based on setting proof rule, described unique identification is verified.
In such scheme, described discriminating module 340 specifically can be for inquiring about described unique identification in the ident value table in the local storage of client node, to determine corresponding service node.
The screening plant of the equipment in the local area network (LAN) that the embodiment of the present invention provides can be carried out the screening technique of the equipment in the local area network (LAN) that any embodiment of the present invention provides, and possesses the corresponding functional module of manner of execution and beneficial effect.
Finally it should be noted that: each embodiment is only for technical scheme of the present invention is described above, but not is limited; In embodiment, preferred embodiment, be not limited, to those skilled in the art, the present invention can have various changes and variation.All any modifications of doing, be equal to replacement, improvement etc., within protection scope of the present invention all should be included within spirit of the present invention and principle.