Method and device for multi-hop resource discovery
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method and an apparatus for discovering resources through multiple hops.
Background
The machine-to-machine communication refers to data communication between machines without human participation, and is suitable for scenes such as traffic control management, remote meter reading, remote monitoring, medical monitoring, intelligent home control and the like. To provide a standardized interface between machines and devices of a machine communication system, the OneM2M standard organization defines a standard specification of the machine communication system.
In this specification, an initiator may initiate a resource discovery process, searching for resources on its registered platform. The resource discovery request may carry a filter to limit the range of the discovered result, and may also carry a result upper limit value to limit the size of the discovered result.
However, in the prior art, the initiator can only search and discover the resources on the platform which is registered or registered, and can not discover other platforms. This greatly limits the scope of search findings, affecting the comprehensiveness of the search findings.
Disclosure of Invention
The invention provides a method and a device for multi-hop resource discovery, which are used for solving the problem that a resource discovery initiator in the prior art can only search and discover resources on a platform registered or registered by the initiator and can not discover other platforms.
According to an aspect of the present invention, there is provided a method for multi-hop discovery of resources, including:
a platform receives a resource discovery request carrying multi-hop discovery constraint condition information;
the platform discovers the resources on the platform according to the multi-hop discovery constraint condition information, or forwards the resource discovery request to the next platform;
when the resource discovery is carried out on the platform, if a discovery result is obtained or the discovery result is not obtained but the platform finds the last hop, feeding back discovery result information of the hop to the resource discovery initiating platform; otherwise, the multi-hop discovery constraint condition information is updated and then a resource discovery request is sent to the next platform.
Optionally, in the method of the present invention, the multi-hop discovery constraint information includes: discovery hop count restriction information and duplicate discovery indication information.
Optionally, in the method of the present invention, the duplicate discovery indication information includes: current completed hop count information and/or discovery identification information.
Optionally, in the method of the present invention:
when the repeated discovery indication information comprises the discovery identification information, the platform judges whether the discovery identification information in the multi-hop discovery constraint condition information is stored locally or not after receiving a resource discovery request, and if so, forwards the resource discovery request to the next platform; otherwise, storing the discovery identification information, and performing resource discovery on the platform;
when the repeated discovery indication information does not include the discovery identification information, the platform judges whether the current hop count is less than or equal to the current completed hop count in the multi-hop discovery constraint condition information after receiving a resource discovery request, and if so, forwards the resource discovery request to a next platform; otherwise, the resource discovery is carried out on the platform.
Optionally, in the method of the present invention:
when the repeated discovery indication information includes information of currently completed hops, the updating the information of the multi-hop discovery constraint condition includes: adding 1 to the current completed hop count in the received multi-hop discovery constraint condition information;
when the repeated discovery indication information does not include information of currently completed hops, the updating the information of the multi-hop discovery constraint condition includes: and subtracting 1 from the discovery hop count limit information in the received multi-hop discovery constraint condition information.
Optionally, in the method of the present invention, the feeding back the discovery result information of the current hop to the resource discovery initiating platform specifically includes:
and the platform feeds back the discovery result of the platform and the discovery hop count information corresponding to the platform to the resource discovery initiating platform according to the resource discovery request transmission path.
According to another aspect of the present invention, there is also provided a method for multi-hop discovery of resources, comprising:
a resource discovery initiating platform initiates a resource discovery request to a first hop platform; the resource discovery request carries multi-hop discovery constraint condition information so that a platform receiving the request can perform platform discovery or forward the request to the next platform for judgment;
and the resource discovery initiating platform acquires a discovery result of a certain platform, and when the discovery result and the corresponding hop count do not meet a set termination condition, the resource discovery initiating platform continues to initiate a resource discovery request for a next platform of the certain platform along an original path from the first hop platform to the certain platform.
According to a third aspect of the present invention, there is provided a resource discovery platform, comprising:
a request receiving unit, configured to receive a resource discovery request carrying multi-hop discovery constraint condition information;
a discovery unit, configured to perform resource discovery on the present platform according to the multi-hop discovery constraint condition information, or forward the resource discovery request to a next platform; when the resource discovery is carried out on the platform, if a discovery result is obtained or the discovery result is not obtained but the platform finds the last hop, feeding back discovery result information of the hop to the resource discovery initiating platform; otherwise, the multi-hop discovery constraint condition information is updated and then a resource discovery request is sent to the next platform.
According to a fourth aspect of the present invention, there is provided a resource discovery initiation platform, comprising:
a request initiating unit, configured to initiate a resource discovery request to a first hop platform; the resource discovery request carries multi-hop discovery constraint condition information so that a platform receiving the request can perform platform discovery or forward the request to the next platform for judgment;
and the multi-hop discovery management unit is used for acquiring a discovery result of a certain platform and continuously initiating a resource discovery request for a next platform of the certain platform along an original path from the first hop platform to the certain platform when the discovery result and the corresponding hop count do not meet a set termination condition.
The invention has the following beneficial effects:
the invention provides a solution for searching and discovering resources on a plurality of platforms by carrying a multi-hop discovery constraint condition in a resource discovery request, and an initiator can acquire more and more complete resource information through multi-hop.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart of a method for multi-hop discovery of resources according to an embodiment of the present invention;
fig. 2 is a flowchart of a method for multi-hop discovery of resources according to a second embodiment of the present invention;
fig. 3 is a flowchart of a method for multi-hop discovery of resources according to a third embodiment of the present invention;
fig. 4 is a flowchart of a method for multi-hop discovery of resources according to a fourth embodiment of the present invention;
fig. 5 is a flowchart of a method for multi-hop discovery of resources according to a fifth embodiment of the present invention;
fig. 6 is a block diagram of a resource discovery platform according to a sixth embodiment of the present invention;
fig. 7 is a block diagram of a resource discovery initiation platform according to a seventh embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Example one
An embodiment of the present invention provides a method for discovering resources in multiple hops, where the method is applied to a resource discovery platform side, and as shown in fig. 1, the method specifically includes:
step S101, a platform receives a resource discovery request carrying multi-hop discovery constraint condition information;
step S102, the platform discovers the resource on the platform according to the multi-hop discovery constraint condition information, or forwards the resource discovery request to the next platform;
when the resource discovery is carried out on the platform, if a discovery result is obtained or the discovery result is not obtained but the platform finds the last hop, feeding back discovery result information of the hop to the resource discovery initiating platform; otherwise, the multi-hop discovery constraint condition information is updated and then a resource discovery request is sent to the next platform.
Based on the above principle, several specific and preferred embodiments are given below to refine and optimize the functions of the method described in the embodiments of the present invention, so as to make the implementation of the scheme of the present invention more convenient and accurate. It should be noted that the following features may be arbitrarily combined with each other without conflict.
In the embodiment of the present invention, the multi-hop discovery constraint condition information includes, but is not limited to: discovery hop count restriction information and duplicate discovery indication information.
Wherein the duplicate discovery indication information includes: current completed hop count information and/or discovery identification information.
Further, in the embodiment of the present invention:
when the repeated discovery indication information comprises discovery identification information, the platform judges whether discovery identification information in multi-hop discovery constraint condition information is stored locally or not after receiving a resource discovery request, and if so, forwards the resource discovery request to the next platform; otherwise, storing the discovery identification information, and performing resource discovery on the platform;
when the repeated discovery indication information does not include discovery identification information, the platform judges whether the current hop count is less than or equal to the current completed hop count in the multi-hop discovery constraint condition information after receiving the resource discovery request, and if so, forwards the resource discovery request to the next platform; otherwise, the resource discovery is carried out on the platform.
Further, in the embodiment of the present invention, based on the principle of eliminating the hop of the platform, the multi-hop discovery constraint condition information is updated, specifically:
when the repeated discovery indication information includes information of currently completed hops, the updating the information of the multi-hop discovery constraint condition includes: adding 1 to the current completed hop count in the received multi-hop discovery constraint condition information;
when the repeated discovery indication information does not include the information of the current completed hop count, the updating the information of the multi-hop discovery constraint condition includes: and subtracting 1 from the discovery hop count limit information in the received multi-hop discovery constraint condition information.
Further, in this embodiment of the present invention, the feeding back, to the resource discovery initiating platform, discovery result information of the current hop specifically includes:
and the platform feeds back the discovery result of the platform and the discovery hop count information corresponding to the platform to the resource discovery initiating platform according to the resource discovery request transmission path.
Example two
The embodiment of the present invention provides a method for discovering resources in multiple hops, which is applied to a resource discovery initiation platform side, and the method is matched with the method described in the first embodiment to perform multiple hop resource discovery, as shown in fig. 2, and specifically includes the following steps:
step S201, a resource discovery initiating platform initiates a resource discovery request to a first hop platform; the resource discovery request carries multi-hop discovery constraint condition information so that a platform receiving the request can perform platform discovery or forward the request to the next platform for judgment;
step S202, the resource discovery initiating platform obtains the discovery result of a certain platform, and when the discovery result and the corresponding hop count do not meet the set termination condition, the resource discovery initiating platform continues to initiate a resource discovery request for a next platform of the certain platform along the original path from the first hop platform to the certain platform.
As can be seen from the explanation of the first and second embodiments, the present invention provides a solution that can search for discovery resources on multiple platforms by using a multi-hop discovery constraint condition carried in a resource discovery request, and through multi-hop, an initiator can obtain more and more complete resource information.
EXAMPLE III
The embodiment of the invention provides a method for multi-hop resource discovery, and the embodiment explains the implementation process of the method by disclosing a specific application example.
As shown in fig. 3, the method of this embodiment includes the following steps:
step S301, the resource discovery initiating platform (hereinafter referred to as "initiator") sends a discovery request to the CSE1, where the discovery request carries a search discovery hop count limit, that is, the limit is limited to discovery on several platforms at most, and if the hop count is 5, discovery is performed on 5 platforms at most.
Step S302, after receiving the request, the CSE1 detects whether the request carries the hop count limit, and if the request does not carry the hop count limit or the hop count limit is 1, it indicates that the resource required for discovery is only searched on the current platform, and if the hop count limit is carried and is greater than 1, it indicates that the resource is searched and discovered on the current platform. If no result is found, forwarding the request to the next hop, carrying the current hop count and the hop count limit, and then turning to step S307; and if the result is found, returning the result to the initiator and carrying the current hop count.
In step S303, the initiator obtains the result of the discovery.
Step S304, the initiator is satisfied with the result or returns that the hop count reaches the hop count upper limit, and then the discovery process is ended; if the result is not satisfactory, the discovery request is continuously sent, and the last hop count (for example, the hop count carried in the message returned in step S302 is 1, and the hop count carried this time is also 1), the hop count limit, and the next hop indication (used for indicating that the search discovery is performed on the next hop CSE of the platform returning the hop count, that is, the request is forwarded without repeated discovery on the platform from the first hop to the platform returning the hop count).
Step S305, the initiator sends a discovery request to the CSE that received the last returned result, and carries the last returned hop count, hop count limit, and next hop indication.
Step S306, the CSE returning the result receives the request and then forwards the request to the next hop CSE (such as CSE 2);
in step S307, the next hop CSE repeats the operation of S302, and so on.
Example four
The embodiment of the invention provides a method for multi-hop resource discovery, and discloses another specific application example to explain the implementation process of the method.
As shown in fig. 4, the method of this embodiment includes the following steps:
in step S401, the initiator sends a discovery request to the CSE1, which carries a search discovery hop count limit (which limits the discovery to at most several platforms, i.e. if the hop count is 5, the discovery is performed on at most 5 platforms) and a discovery identifier (which is used to uniquely identify the discovery request).
Step S402, after receiving the request, the CSE1 detects whether the discovery identifier exists: if not, storing the discovery identifier, and simultaneously detecting whether the request carries hop limit or not: if the resource is not carried, or the hop count is limited to 1, the resource is searched and found only on the current platform; if the hop limit is carried and is more than 1, the search discovery is carried out on the platform; if the found identifier exists or the required result is not found, forwarding the request to the next hop, and carrying the current hop count, the hop count limit and the found identifier, and then turning to step S407; and if the result is found, returning the result to the initiator and carrying the current hop count.
In step S403, the initiator obtains the result of the discovery.
Step S404, the initiator is satisfied with the result or returns that the hop count reaches the hop count upper limit, and then the discovery process is ended; if the result is not satisfactory, the discovery request is continuously sent, and the last hop count (for example, the hop count carried in the message returned in the step 2 is 1, and the hop count carried this time is also 1), the hop count limit and the discovery identifier are carried.
Step S405, the initiator sends a discovery request to the CSE which receives the last returned result and carries the last returned hop count, hop count limit and discovery identification.
Step S406, the CSE returning the result last time forwards to the next hop CSE because the corresponding discovery identifier is stored;
in step S407, the next hop CSE repeats the operation of S402, and so on.
EXAMPLE five
The embodiment of the invention provides a method for multi-hop resource discovery, and discloses another specific application example to explain the implementation process of the method.
As shown in fig. 5, the method of this embodiment includes the following steps:
in step S501, the initiator sends a discovery request to the CSE1, where the discovery request carries a search discovery hop count limit N (which limits discovery on several platforms at most, if the hop count is 5, i.e. discovery on 5 platforms at most) and a discovery identifier (for uniquely identifying the discovery request).
Step S502, after receiving the request, the CSE1 detects whether the discovery identifier exists: if not, storing the discovery identifier, and simultaneously detecting whether the request carries hop limit or not: if the resource is not carried, or the hop count is limited to 1, the resource is searched and found only on the current platform; if the hop limit is carried and is more than 1, the search discovery is carried out on the platform; if the discovery mark exists or the required result is not found, the request is forwarded to the next hop, and the modified discovery hop number limit and the discovery mark are carried; and if the result is found, returning the result to the initiator and carrying the current hop count. Wherein, the modified discovery hop count limit is-1 of the discovery hop count limit carried in the request.
In step S503, the initiator obtains the result of the discovery.
Step S504, the initiator is satisfied with the result or returns the hop count to reach the hop count upper limit, and then the discovery process is ended; if the result is not satisfactory, the discovery request is continuously sent, the hop count upper limit is modified (namely, the original hop count upper limit is subtracted by the returned hop count), and the modified hop count limit, the discovery identifier and the hop count returned last time are carried.
Step S505, the initiator sends a discovery request to the CSE that received the last returned result, and carries the last returned hop count, hop count limit, and discovery identifier.
Step S506, the CSE returning the result last time forwards to the next hop CSE because the corresponding discovery identifier is stored;
in step S507, the next-hop CSE repeats the operation of S502, and so on.
EXAMPLE six
An embodiment of the present invention provides a resource discovery platform, as shown in fig. 6, including:
a request receiving unit 610, configured to receive a resource discovery request carrying multi-hop discovery constraint condition information;
a discovering unit 620, configured to perform resource discovery on the present platform according to the multi-hop discovery constraint condition information, or forward the resource discovery request to a next platform; when the resource discovery is carried out on the platform, if a discovery result is obtained or the discovery result is not obtained but the platform finds the last hop, feeding back discovery result information of the hop to the resource discovery initiating platform; otherwise, the multi-hop discovery constraint condition information is updated and then a resource discovery request is sent to the next platform.
Based on the structural framework and the implementation principle, a few specific and preferred embodiments under the structure are given below to refine and optimize the functions of the resource discovery platform of the invention, so that the implementation of the scheme of the invention is more convenient and accurate. The method specifically comprises the following steps:
in the embodiment of the present invention, the multi-hop discovery constraint condition information includes, but is not limited to: discovery hop count restriction information and duplicate discovery indication information.
Wherein the duplicate discovery indication information includes: current completed hop count information and/or discovery identification information.
Further, in the embodiment of the present invention:
when the repeated discovery indication information includes discovery identification information, the discovery unit 620 determines whether discovery identification information in the multi-hop discovery constraint condition information is stored locally after receiving the resource discovery request, and forwards the resource discovery request to the next platform if the discovery identification information in the multi-hop discovery constraint condition information is stored locally; otherwise, storing the discovery identification information, and performing resource discovery on the platform;
when the repeated discovery indication information does not include discovery identification information, the discovery unit 620 determines whether the current hop count is less than or equal to the current completed hop count in the multi-hop discovery constraint condition information after receiving the resource discovery request, and forwards the resource discovery request to the next platform if the current hop count is less than or equal to the current completed hop count in the multi-hop discovery constraint condition information; otherwise, the resource discovery is carried out on the platform.
Further, in the embodiment of the present invention:
when the repeated discovery indication information includes information of currently completed hops, the updating the information of the multi-hop discovery constraint condition includes: adding 1 to the current completed hop count in the received multi-hop discovery constraint condition information;
when the repeated discovery indication information does not include the information of the current completed hop count, the updating the information of the multi-hop discovery constraint condition includes: and subtracting 1 from the discovery hop count limit information in the received multi-hop discovery constraint condition information.
Further, in this embodiment of the present invention, the discovery unit 620 feeds back the discovery result of the platform and the discovery hop count information corresponding to the platform to the resource discovery initiation platform according to the resource discovery request transmission path.
EXAMPLE seven
An embodiment of the present invention provides a resource discovery initiation platform, as shown in fig. 7, including:
a request initiating unit 710, configured to initiate a resource discovery request to a first hop platform; the resource discovery request carries multi-hop discovery constraint condition information so that a platform receiving the request can perform platform discovery or forward the request to the next platform for judgment;
and the multi-hop discovery management unit 720 is configured to obtain a discovery result of a certain platform, and when the discovery result and the number of hops corresponding to the discovery result do not satisfy a set termination condition, continue to initiate a resource discovery request for a platform next to the certain platform along an original path from the first hop platform to the certain platform.
Further, when the multi-hop discovery management unit 720 determines that one of the discovery result and the corresponding hop count satisfies the set termination condition, the discovery process is ended.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.