Message forwarding method and forwarding device

By analyzing the routing table and searching the source routing set and the destination routing set, automatic and rapid forwarding of message information is realized, solving the problem of low packet forwarding efficiency in the existing technology, and improving forwarding efficiency and user experience.

CN119583444BActive Publication Date: 2025-05-13CHONGQING SELIS PHOENIX INTELLIGENT INNOVATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510115550.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-24
Publication Date
2025-05-13
Estimated Expiration
2045-01-24

AI Technical Summary

Technical Problem

In the prior art, the message forwarding efficiency is low, the conversion process is cumbersome, and the degree of automation is low, resulting in a long development cycle.

Method used

By analyzing the routing table including at least one routing information, the source route set and the destination route set are obtained, and the source route set and the destination route set are searched based on the destination address bus and the destination address identification in the message information, and the corresponding address index information and the destination address bus and identification are obtained, thereby realizing automatic and rapid forwarding of the message information.

Benefits of technology

It realizes automatic and rapid search of destination address bus and destination address identification of message information, improves message forwarding efficiency and improves user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119583444B_ABST
    Figure CN119583444B_ABST
Patent Text Reader

Abstract

The present application relates to the field of communication technology, and provides a message forwarding method and forwarding device. The method parses a routing table including at least one routing information to obtain a source routing set and a destination routing set, and obtains message information, searches the source routing set according to a destination address bus and a destination address identifier in the message information, obtains corresponding address index information, searches the destination routing set according to the address index information, obtains a corresponding target destination address bus and a target destination address identifier, and then forwards the message information according to the target destination address bus and the target destination address identifier, thereby realizing automatic and rapid search of the destination address bus and the destination address identifier of the message information, improving the message forwarding efficiency, and enhancing the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a message forwarding method and forwarding device. Background Art

[0002] In the related technology, it is necessary to convert the overall routing requirement table for a specific application scenario provided by the developer into an executable routing function implementation file, and then use the executable routing function implementation file to forward messages. Usually, the routing requirement table is recorded in Excel format. When converting, it is first necessary to use the send-receive relationship recorded therein to generate a file in dbc (Database Definition and Creation) format, and then manually add and delete messages according to the routing relationship specified in the Excel routing table. Next, a hexadecimal routing table with a certain format is generated through the dbc file, and finally the hexadecimal routing table is parsed in the program through a preset format to extract various parameters.

[0003] The above conversion process is complicated to implement, has a low degree of automation, and a long development cycle, which in turn leads to low message forwarding efficiency. Summary of the invention

[0004] In view of this, an embodiment of the present application provides a message forwarding method and a forwarding device to solve the problem of low message forwarding efficiency in the prior art.

[0005] A first aspect of an embodiment of the present application provides a message forwarding method, the method comprising:

[0006] Obtaining a routing table; the routing table includes at least one routing information, each routing information includes at least a source address bus, a source address identifier, a destination address bus and a destination address identifier;

[0007] Parse the routing table to obtain a source routing set and a destination routing set; the source routing set includes address index information, and the address index information is obtained according to the source address bus and the source address identifier in the routing information; the destination routing set is obtained according to the destination address bus and the destination address identifier in the routing information;

[0008] Obtaining message information; the message information includes a target address bus and a target address identifier;

[0009] Search the source routing set according to the target address bus and the target address identifier to obtain the corresponding address index information;

[0010] Search the destination routing set according to the address index information to obtain the corresponding target destination address bus and target destination address identifier;

[0011] The message information is forwarded according to the target destination address bus and the target destination address identifier.

[0012] A second aspect of an embodiment of the present application provides a message forwarding device, including:

[0013] The obtaining module is configured to obtain a routing table by itself; the routing table includes at least one routing information, and each routing information includes at least a source address bus, a source address identifier, a destination address bus and a destination address identifier;

[0014] The parsing module is configured to parse the routing table to obtain a source routing set and a destination routing set; the source routing set includes address index information, the address index information is obtained according to the source address bus and the source address identifier in the routing information; the destination routing set is obtained according to the destination address bus and the destination address identifier in the routing information;

[0015] The acquisition module is further configured to obtain message information; the message information includes a target address bus and a target address identifier;

[0016] A search module is configured to search the source routing set according to the target address bus and the target address identifier to obtain the corresponding address index information; and search the destination routing set according to the address index information to obtain the corresponding target destination address bus and the target destination address identifier;

[0017] The forwarding module is configured to forward the message information according to the target destination address bus and the target destination address identifier.

[0018] Compared with the prior art, the embodiments of the present application have the following beneficial effects: the embodiments of the present application parse a routing table including at least one routing information to obtain a source routing set and a destination routing set, and obtain message information, search the source routing set according to the target address bus and the target address identifier in the message information to obtain the corresponding address index information, and search the destination routing set according to the address index information to obtain the corresponding target destination address bus and the target destination address identifier, and then forward the message information according to the target destination address bus and the target destination address identifier, thereby realizing automatic and rapid search of the destination address bus and the destination address identifier of the message information, improving the message forwarding efficiency, and enhancing the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0020] Figure 1 It is a flow chart of a message forwarding method provided in an embodiment of the present application.

[0021] Figure 2 It is a flowchart of a method for obtaining address index information provided in an embodiment of the present application.

[0022] Figure 3 It is a flowchart diagram of a method provided in an embodiment of the present application for searching a source routing set according to a target address bus and a target address identifier to obtain corresponding address index information.

[0023] Figure 4 It is a flowchart diagram of a method provided in an embodiment of the present application for searching a destination routing set according to address index information to obtain a corresponding target destination address bus and a target destination address identifier.

[0024] Figure 5 It is a flow chart of another message forwarding method provided in an embodiment of the present application.

[0025] Figure 6 It is a flow chart of another message forwarding method provided in an embodiment of the present application.

[0026] Figure 7 It is a schematic diagram of a message forwarding device provided in an embodiment of the present application.

[0027] Figure 8 It is a schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0028] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0029] A message forwarding method and device according to an embodiment of the present application will be described in detail below with reference to the accompanying drawings.

[0030] As mentioned above, when the related technology converts the overall routing requirement table into an executable routing function implementation file, the conversion process is cumbersome, the degree of automation is low, and the development cycle is long, which leads to low message forwarding efficiency.

[0031] In view of this, an embodiment of the present application provides a message forwarding method, which parses a routing table including at least one routing information to obtain a source routing set and a destination routing set, and obtains message information, searches the source routing set according to a target address bus and a target address identifier in the message information to obtain corresponding address index information, and searches the destination routing set according to the address index information to obtain a corresponding target destination address bus and a target destination address identifier, and then forwards the message information according to the target destination address bus and the target destination address identifier, thereby realizing automatic and fast search of the destination address bus and the destination address identifier of the message information, improving the message forwarding efficiency, and enhancing the user experience.

[0032] Figure 1 FIG. 1 is a flow chart of a message forwarding method provided in an embodiment of the present application. Figure 1 As shown, the method comprises the following steps:

[0033] In step S101, a routing table is obtained.

[0034] The routing table includes at least one piece of routing information, and each piece of routing information includes at least a source address bus, a source address identifier, a destination address bus and a destination address identifier.

[0035] In step S102, the routing table is parsed to obtain a source routing set and a destination routing set.

[0036] The source routing set includes address index information, which is obtained according to the source address bus and source address identifier in the routing information; the destination routing set is obtained according to the destination address bus and destination address identifier in the routing information.

[0037] In step S103, message information is obtained.

[0038] The message information includes a target address bus and a target address identifier.

[0039] In step S104, the source routing set is searched according to the target address bus and the target address identifier to obtain corresponding address index information.

[0040] In step S105, the destination routing set is searched according to the address index information to obtain the corresponding target destination address bus and target destination address identifier.

[0041] In step S106, the message information is forwarded according to the target destination address bus and the target destination address identifier.

[0042] In some embodiments of the present application, the method can be executed by a terminal device to forward received message information.

[0043] In some implementations, the terminal device may obtain a routing table, which may include at least one routing information, each routing information including at least a source address bus, a source address identifier, a destination address bus, and a destination address identifier. In one example, the routing table may be an overall routing requirement table designed by a developer based on the networking requirements of a specific scenario. For example, when the specific application scenario is a vehicle, the routing table may be a vehicle routing requirement table provided by the developer.

[0044] In some other implementations, the acquired routing table can be parsed to obtain a source routing set and a destination routing set. The source routing set can include address index information, which can be obtained based on the source address bus and source address identifier in the routing information. On the other hand, the destination routing set can be obtained based on the destination address bus and destination address identifier in the routing information.

[0045] That is, the address index information can be determined according to the source address bus and source address identifier in the routing information, and the source routing set can be determined using the address index information. The destination routing set can also be determined according to the destination address bus and destination address identifier in the routing information.

[0046] In some embodiments of the present application, message information may be obtained, and the message information includes a target address bus and a target address identifier. That is, the message information may include a source address bus and a source address identifier of the message, and at the same time, the destination address bus and the destination address identifier of the message information may be determined based on the source route set and the destination route set obtained by parsing the routing table, so as to forward the message information.

[0047] After determining the destination address bus and destination address identifier of the message information, the source routing set can be searched according to the destination address bus and destination address identifier in the message information to obtain the corresponding address index information, and the destination routing set can be searched according to the obtained address index information to obtain the corresponding target destination address bus and target destination address identifier.

[0048] In some implementations, the message information may be forwarded according to the determined target destination address bus and target destination address identifier.

[0049] According to the technical solution provided by the embodiment of the present application, by parsing a routing table including at least one routing information, a source routing set and a destination routing set are obtained, and message information is obtained. The source routing set is searched according to the target address bus and the target address identifier in the message information to obtain the corresponding address index information, and the destination routing set is searched according to the address index information to obtain the corresponding target destination address bus and the target destination address identifier, and then the message information is forwarded according to the target destination address bus and the target destination address identifier, thereby realizing automatic and fast search of the destination address bus and the destination address identifier of the message information, improving the message forwarding efficiency, and enhancing the user experience.

[0050] In some embodiments of the present application, taking the routing table as a whole vehicle demand routing table as an example, the demand routing table may include multiple message channels, such as EVCAN (electric vehicle whole vehicle controller local area network bus), CHACAN (chassis control controller local area network bus), ADSCAN (adaptive damping system controller local area network bus), BDCAN (body domain control controller local area network bus), INFOCAN (information system controller local area network bus), TBOXCAN (vehicle controller local area network bus) and Diag_CAN (diagnostic system controller local area network bus).

[0051] The demand routing table can be a table in Excel format, in which each message channel occupies a page (sheet) of Excel, and each page records information such as the source address bus, source address identifier, source routing cycle, source address name, destination address bus, destination address identifier, destination routing cycle and destination address name of all messages in the channel.

[0052] When parsing the routing table, the demand routing table can be traversed channel by channel to extract the source address bus, source address identifier, source routing cycle, destination address bus and destination address identifier information. The destination routing cycle is usually the same as the source routing cycle, so only the source routing cycle or the destination routing cycle can be extracted.

[0053] Figure 2 FIG. 1 is a flow chart of a method for obtaining address index information provided in an embodiment of the present application. Figure 2 As shown, the method comprises the following steps:

[0054] In step S201, all routing information in the routing table is sorted according to a first dimension.

[0055] The sorted routing information includes at least one piece of routing information in each item of the first dimension.

[0056] In step S202, each item of routing information in the first dimension is sorted according to the second dimension.

[0057] The sorted routing information includes at least one routing information in each item of the second dimension, and the first dimension and the second dimension are different and are respectively a source address bus or a source address identifier.

[0058] In step S203, the sorted routing information with the same first dimension and second dimension are combined to form at least one source routing set.

[0059] In step S204, address index information is obtained by summarizing the order of each source route set and the amount of route information.

[0060] In some embodiments of the present application, when parsing the routing table, all routing information in the routing table may be sorted according to a first dimension, wherein the first dimension may be a source address bus in the routing table or a source address identifier in the routing table.

[0061] That is, all the routing information in the routing table can be sorted according to the source address bus, and in the sorted routing table, the routing information of the same source address bus is adjacently configured, and the same source address bus can include one or at least one routing information. Alternatively, all the routing information in the routing table can be sorted according to the source address identifier, and in the sorted routing table, the routing information of the same source address identifier is adjacently configured, and the same source address bus can include one or at least one routing information.

[0062] That is to say, in the routing information sorted according to the first dimension, each item of the first dimension corresponds to one piece of routing information, and routing information with the same first dimension are arranged adjacently.

[0063] In some implementations, the routing information of each item in the first dimension may also be sorted according to the second dimension. The first dimension may be a source address identifier in the routing table or a source address bus in the routing table, and the first dimension is different from the second dimension. That is, if the source address bus is the first dimension, the second dimension is the source address identifier; or, if the source address identifier is the first dimension, the second dimension is the source address bus.

[0064] In some embodiments of the present application, the routing information with the same first dimension and second dimension after sorting can be combined to form at least one source routing set. That is, in each source routing set after the combination, the first dimension and second dimension of each routing information are the same. Moreover, in different source routing sets, at least one item of the first dimension and second dimension of each routing information is different.

[0065] In some embodiments of the present application, the address index information may be obtained by summarizing the order of each source route set and the amount of route information.

[0066] The address index information may be obtained by aggregating the order of each source route set and the amount of route information, and the corresponding address index information may be generated in sequence according to the source route sets.

[0067] In the generated address index information, each address index information includes a source address bus, a source address identifier, an index address, and a number of indexes, wherein the source address bus and the source address identifier in each address index information are the same as the source address bus and the source address identifier of the corresponding source routing set, and the number of indexes is the number of routing information in the corresponding source routing set. The index address of the first address index information is 0, and the index address of the next address index information is equal to the sum of the index address and the number of indexes in the previous address index information.

[0068] That is, a set of corresponding address index information may be generated for each source route set, and the address index information may include a source address bus and a source address identifier, which are determined by information corresponding to the first dimension and the second dimension in the source route set.

[0069] The index address information may also include the number of indexes and the index address, wherein the number of indexes is equal to the number of routing information in the source route set, and the index address is determined according to the arrangement order of each source route set. In one example, at least one source route set is arranged in order, the index address corresponding to the first source route set is 0, and the index address corresponding to the second source route set is the sum of the index address corresponding to the first source route set and the number of indexes corresponding to the first source route set. By analogy, except for the first source route set, the index address corresponding to any other source route set is the sum of the index address corresponding to the previous source route set and the number of indexes corresponding to the previous source route set.

[0070] In some implementations of the present application, the destination route set may be obtained by sequentially obtaining the destination address bus and the destination address identifier of the route information in each source route set, wherein sequentially may be in accordance with the determined arrangement order of each source route set.

[0071] The following takes the parsing of a routing table including N routing information as an example to illustrate the implementation process of obtaining the source routing set and the destination routing set.

[0072] When sorting N pieces of routing information, the first sorting can be performed based on the source address bus of each piece of routing information to obtain a routing information sublist, the number of rows of the routing information sublist is the same as the total number of routing information, and each row corresponds to one piece of routing information. Wherein, each column in the routing information sublist includes at least a source address bus column, a source address identification column, and a source routing cycle column, and the routing information rows with the same source address bus are adjacently arranged in the routing information sublist.

[0073] It is understandable that a list is a way to summarize routing information. In actual implementation, routing information can be summarized in other ways such as arrays as needed, and there is no limitation here.

[0074] Table 1 shows a routing information sublist. As shown in Table 1, the routing information corresponding to the same source address bus ADSCAN is adjacently configured in the routing information sublist, which includes a source address bus column, a source address identification column, and a source routing cycle column, and may also include a sequence number column, a destination address bus column, and a destination address identification column.

[0075] Table 1 Routing information sublist

[0076]

[0077] When sorting, you can choose different methods according to different processing languages. For example, if you use Python, you can use the sort_values ​​function to sort.

[0078] In some implementations, the routing information sublist may be further classified using the source address identifier. When classifying, the rows corresponding to the same source message address may be arranged adjacently in the routing information sublist to obtain a sorted routing combination.

[0079] That is, the rows with the same source routing bus and source routing identifier can be grouped, and then the grouped rows can be connected. At the same time, the connected rows can be sorted according to the size of the source address identifier, so as to obtain a sorted routing information combination.

[0080] Table 2 shows a sorted routing information combination. As shown in Table 2, the routing information sublist shown in Table 1 can be sorted again according to the source address identifier. Since the destination address bus column and the destination address identifier column have been recorded in the original routing information sublist, it is only necessary to adjust the rows in the routing information sublist when sorting, and there is no need to add the destination address bus column and the destination address identifier column.

[0081] Table 2 Sorted routing information combination

[0082]

[0083] After the sorting is completed, at least one source route set may be obtained based on the sorted route information, and a destination route set may be generated based on the at least one source route set.

[0084] It is understandable that, in actual operation, the first sorting may be performed based on the source address identifier in the routing information, and then the second sorting may be performed based on the source address bus to obtain sorted routing information including at least one source routing set.

[0085] In some embodiments of the present application, generating a destination route set using at least one source route set in the sorted route information may be to traverse each source route set in the sorted route information, extract the destination address bus and the destination address identifier in each source route set; and generate the destination route set based on the extracted destination address identifier and the destination address bus. The destination route set may include N set elements, each of which includes a destination address identifier item and a destination address bus item of a route information in the sorted route information.

[0086] That is to say, each row of the sorted routing information can be traversed to extract the destination address bus and the destination address identifier into the destination routing set. An exemplary destination routing set can be, [{0x20A, 4}, {0x20B, 4}, {0x20B, 5}, {0x20B, 6}, {0x20C, 5}, {0x2AA, 5}, {0x2AB, 5}, {0x2AC, 5}, {0x2AD, 5}, {0x2AE, 5}, {0x2AF, 5}, {0x2B1, 5}, {0x2B2, 5}, {0x2B3, 5}, {0x3B1, 4}, {0x3B2, 4}, ...]. Wherein, the destination address bus can be represented by a number, for example, number 4 represents the destination address bus BDCAN, and number 5 represents the destination address bus INFOCAN. It can be understood that the corresponding relationship between the number and the destination address bus can be set according to actual needs, and is not limited here.

[0087] On the other hand, in some embodiments of the present application, the source route set is generated by using the sorted route information, and the number of route information with the same source address bus and source address identifier in the sorted route information is determined as the number of indexes of the source route set. The index address of the first source route set is determined to be 0, and the index addresses of the remaining source route sets are determined to be the sum of the index address and the number of indexes of the previous source route set.

[0088] The address index information of the source routing set is generated by using the source address bus, source address identifier, index address and index number corresponding to each source routing set.

[0089] That is, each row of the sorted routing information can be traversed to count the number of rows with the same source address bus and source address identifier, and recorded together with the source address identifier, source routing cycle and source address bus to the first destination routing set.

[0090] An exemplary destination routing set can be, [{0x20A, 20, 0, 1, 3}, {0x20B, 20, 1, 3, 3}, ...], where 0x20A and 0x20B are source address identifiers, 20 is the source routing cycle, 0 in the first set element and 1 in the second set element are index addresses, 1 in the first set element and the first 3 in the second set element are the number of indexes, i.e., the number of rows with the same source address bus and source address identifier, and 3 in the first set element and the second 3 in the second set element are the source address buses expressed in numbered form.

[0091] Figure 3 1 is a flow chart of a method for searching a source routing set according to a target address bus and a target address identifier to obtain corresponding address index information provided by an embodiment of the present application. Figure 3 As shown, the method comprises the following steps:

[0092] In step S301, the source routing set is traversed.

[0093] In step S302, it is determined that the address index information in which the source address identifier and the target address identifier in the source routing set are the same and the source address bus and the target address bus are the same is the corresponding address index information.

[0094] In some embodiments of the present application, the source routing set can be traversed according to the target address bus and the target address identifier in the message information. If it is determined during the traversal that the source routing set includes an address index information whose source address identifier is the same as the target address identifier and whose source address bus is the same as the target address bus, then it can be determined that the address index information is the address index information corresponding to the message information.

[0095] Figure 4 1 is a flow chart of a method for searching a destination routing set according to address index information to obtain a corresponding target destination address bus and target destination address identifier provided by an embodiment of the present application. Figure 4 As shown, the method comprises the following steps:

[0096] In step S401, the index address and the number of indexes in the corresponding address index information are obtained.

[0097] In step S402, a target set element is determined in the destination route set.

[0098] The ranking of the target set element in the destination routing set is greater than the index address and less than or equal to the sum of the index address and the number of indexes.

[0099] In step S403, the destination address bus and the destination address identifier of the target set element are determined as the target destination address bus and the target destination address identifier.

[0100] In some embodiments of the present application, after determining the address index information corresponding to the message information, the index address and the number of indexes in the address index information can be obtained, and then the target set element is determined in the destination routing set according to the index address and the number of indexes. Among them, the ranking of the target set element in the destination routing set is greater than or equal to the index address and less than or equal to the sum of the index address and the number of indexes, and the target set element can be one or more. That is, the determined target destination address bus and target destination address identifier can be one group or multiple groups.

[0101] For example, if the determined address index information is 0 and the number of indexes is 1, the first set element in the destination route set can be determined as the target set element. For another example, if the determined address index information is 10 and the number of indexes is 3, the 11th to 13th set elements in the destination route set can be determined as the target set elements.

[0102] The destination address bus and the destination address identifier in the determined target set element are used as the target destination address bus and the target destination address identifier of the message information, and the message information can be automatically forwarded in sequence.

[0103] In some embodiments of the present application, after the source route set and the destination route set are generated, an execution file may be generated according to the source route set and the destination route set. The execution file may include a first execution file and a second execution file, the first execution file may be an execution file with a file suffix of .c, and the second execution file may be an execution file with a file suffix of .h.

[0104] The execution file may be determined by obtaining a header file of the execution file; and generating the execution file based on at least the header file, the source route set, and the destination route set.

[0105] The header file may include AppRouting.h file, stdint.h file, string.h file and postbuild_cfg.h file. Among them, AppRouting.h file is the header file for implementing the routing forwarding function, and postbuild_cfg.h file is the configuration file for the routing forwarding function. Both AppRouting.h file and postbuild_cfg.h file can be obtained from the preset directory, and the preset directory can store the AppRouting.h file and postbuild_cfg.h file pre-written based on the routing requirement table. The stdint.h file is used to define the variable type in the execution file, and the string.h file is used to define the reference method of the string in the execution file. Both stdint.h and string.h can be obtained from the standard function library.

[0106] In some implementations, when generating an execution file, a source route set and a destination route set can be created in a routing automatic configuration system; the value in the source route set and the number of route information items in the sorted route information are written into a newly created source route set, and the value in the destination route set and the number of route information items in the sorted route information are written into a newly created destination route set. On the other hand, the number of route information items in the sorted route information and the header file of the routing function implementation file can also be obtained; and the first execution file and the second execution file are generated based at least on the header file, the newly created source route set and the newly created destination route set.

[0107] Next, a first designated path of a first execution file may be obtained; a header file, the newly created source route set, and the newly created destination route set are written into the first designated path to obtain a first execution file. Also, in response to determining that a defined header file does not exist in the routing automatic configuration system, a header file is defined; a second designated path of a second execution file is obtained; and a header file, the newly created source route set, and the newly created destination route set are written into the second designated path to obtain a second execution file.

[0108] That is to say, a new source route set may be firstly created in the route automatic configuration system, and the value of the source route set obtained by parsing the routing table may be filled into the newly created source route set.

[0109] Next, a first execution file and a second execution file may be generated. The first execution file, ie, the execution file with a file suffix of .c, may be implemented by writing a header file, a newly created source route set, and a newly created destination route set into a first designated path.

[0110] On the other hand, when generating the second execution file, that is, the execution file with the file suffix .h, it can be first determined whether there is a defined header file. If so, the defined header file is directly called as the second execution file. Otherwise, if there is no defined header file, the second execution file can be obtained by defining the header file. The format of the defined header file is the same as the header file format described above, and will not be repeated here.

[0111] Next, the header file, the newly created source route set and the newly created destination route set are written into the second designated path, and the second execution file can be obtained.

[0112] Figure 5 FIG. 1 is a flow chart of another message forwarding method provided in an embodiment of the present application. Figure 5As shown, the preset gateway message routing table can be first traversed according to the specified channel mapping, and then each sub-table can be traversed according to the row in each channel to extract the source address bus, source address identifier, source routing cycle, destination address bus, destination address identifier and destination routing cycle of each sub-table. Next, the extracted sub-table information is filled into a routing sub-table, and the routing information in the routing sub-table is sorted according to the source address bus and source address identifier. When sorting, the source address bus and source address identifier can be first grouped, and the rows of the same combination can be connected. Then traverse each row separately, extract the destination address bus and destination address identifier into the destination routing set, and count the number of the same source address bus and source address identifier, and record them in the source routing set until the last row is traversed.

[0113] When the routing information recorded in the preset gateway message routing table changes, the first execution file and the second execution file can be updated by updating the source routing set and the destination routing set, and the message can be forwarded using the updated message information.

[0114] Figure 6 FIG. 1 is a flow chart of another message forwarding method provided in an embodiment of the present application. Figure 6 As shown, after receiving the route request message, the route forwarding module can obtain the source address identifier and source address bus of the route request message, and traverse the source route set in the execution file according to the source address identifier. During the traversal, it can be determined whether the source address identifier of the route request message exists in the source route set. If it exists, it is further determined whether the source address bus of the route request message is the same as the source address bus in the routing information corresponding to the source address identifier obtained by querying the source route set. If they are the same, the index address and the number of indexes are obtained. Subsequently, the set elements in the destination route set whose ranking is greater than the index address and less than or equal to the sum of the index address and the number of indexes are traversed, and then the destination address bus and the destination address identifier are obtained. The message forwarding function can be called to forward the route request message to the destination address corresponding to the destination address bus and the destination address identifier.

[0115] When traversing, it can start from the index address, and determine whether the number of traversals is greater than the number of indexes each time it is traversed. If not, the set element in the next destination route set is obtained in sequence. If yes, the forwarding process is exited. In addition, if the source address identifier of the route request message is not found in the source route set, or it is determined that the source address bus of the route request message is different from the source address bus in the route information corresponding to the source address identifier obtained by querying the source route set, the message forwarding process exit operation is also executed.

[0116] In the related art, when traversing the routing table, a whole table traversal method is usually adopted, which has a high time cost.

[0117] In view of this, the embodiment of the present application adopts a binary search when traversing the routing table, which improves the search efficiency and reduces the time cost.

[0118] In some embodiments of the present application, traversing the source route set may be to traverse the source route set using a binary search method to search for corresponding address index information.

[0119] That is to say, since the message meets the following conditions: the message data volume is huge, and the time complexity of processing needs to be optimized; the source route set is arranged according to the source address identification order; the target is usually a certain value or a position. Therefore, the binary search method can be used to search in the routing table.

[0120] In one example, you can first take a data element at a middle position in the source routing set or the destination routing set, such as (mid=(left+right) / 2), and compare it with the given value. If they are equal, the search is successful; otherwise, if the given value is smaller (or larger) than the value of the data element, the given value must be in the first half of the set [left, mid-1] (or the second half [mid+1, right]). Then perform the same search in the new search range. Repeat this process until an element with a set element value equal to the given value is found or it is determined that there is no data to be searched in the set. Therefore, each time a binary search is searched, it is either successful or the number of elements in the search set is reduced by half. When there are no more data elements in the search set, the search fails.

[0121] Binary search is a very efficient search method. The main principle is that each time you search, you can discard half of the values ​​to narrow the range. Its time complexity is O(log 2 n), generally used to optimize common search methods.

[0122] By adopting the technical solution provided in the embodiment of the present application, it is possible to directly parse the script of the .c and .h files compiled by the code generation of the routing table in the preset Excel format, that is, the executable routing function implementation file. In this way, when adapting to different routing tables, the script can be directly run without manually configuring the code, which greatly improves the development efficiency and shortens the development cycle. At the same time, the binary search method is used to further improve the efficiency of the table lookup.

[0123] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present application, which will not be described one by one here.

[0124] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.

[0125] Figure 7Schematic diagram of a message forwarding device provided in an embodiment of the present application. Figure 7 As shown, the device comprises:

[0126] The acquisition module 701 is configured to self-acquire a routing table; the routing table includes at least one piece of routing information, and each piece of routing information includes at least a source address bus, a source address identifier, a destination address bus and a destination address identifier.

[0127] The parsing module 702 is configured to parse the routing table to obtain a source routing set and a destination routing set; the source routing set includes address index information, which is obtained based on the source address bus and source address identifier in the routing information; the destination routing set is obtained based on the destination address bus and destination address identifier in the routing information.

[0128] The obtaining module 701 is further configured to obtain message information; the message information includes a target address bus and a target address identifier.

[0129] The search module 703 is configured to search the source routing set according to the target address bus and the target address identifier to obtain the corresponding address index information; and search the destination routing set according to the address index information to obtain the corresponding target destination address bus and the target destination address identifier.

[0130] The forwarding module 704 is configured to forward the message information according to the target destination address bus and the target destination address identifier.

[0131] According to the technical solution provided by the embodiment of the present application, by parsing a routing table including at least one routing information, a source routing set and a destination routing set are obtained, and message information is obtained. The source routing set is searched according to the target address bus and the target address identifier in the message information to obtain the corresponding address index information, and the destination routing set is searched according to the address index information to obtain the corresponding target destination address bus and the target destination address identifier, and then the message information is forwarded according to the target destination address bus and the target destination address identifier, thereby realizing automatic and fast search of the destination address bus and the destination address identifier of the message information, improving the message forwarding efficiency, and enhancing the user experience.

[0132] In some embodiments, a method for obtaining address index information includes: sorting all routing information in a routing table according to a first dimension, wherein the sorted routing information includes at least one routing information in each item of the first dimension; sorting the routing information of each item in the first dimension according to a second dimension, wherein the sorted routing information includes at least one routing information in each item of the second dimension; wherein the first dimension and the second dimension are different and are respectively a source address bus or a source address identifier; combining the routing information that is the same in both the first dimension and the second dimension after sorting to form at least one source routing set; and obtaining the address index information by summarizing the order of each source routing set and the amount of routing information.

[0133] In some implementations, address index information is obtained by summarizing the order of each source route set and the number of route information, including: generating corresponding address index information in sequence according to the source route set; each address index information includes a source address bus, a source address identifier, an index address, and a number of indexes, wherein the source address bus and source address identifier in each address index information are the same as the source address bus and source address identifier of the corresponding source route set, the number of indexes is the number of route information in the corresponding source route set, the index address of the first address index information is 0, and the index address of the next address index information is equal to the sum of the index address and the number of indexes in the previous address index information.

[0134] In some implementations, the method for obtaining the destination route set includes: sequentially obtaining the destination address bus and the destination address identifier of the route information in each source route set to obtain the destination route set.

[0135] In some implementations, searching a source routing set according to a target address bus and a target address identifier to obtain corresponding address index information includes: traversing the source routing set; determining that the address index information in the source routing set in which the source address identifier is the same as the target address identifier and the source address bus is the same as the target address bus is the corresponding address index information; searching a destination routing set according to the address index information to obtain a corresponding target destination address bus and a target destination address identifier, includes: obtaining an index address and a number of indexes in the corresponding address index information; determining a target set element in the destination routing set, wherein the ranking of the target set element in the destination routing set is greater than the index address and less than or equal to the sum of the index address and the number of indexes; and determining the destination address bus and the destination address identifier of the target set element as the target destination address bus and the target destination address identifier.

[0136] In some implementations, the source route set and the destination route set are configured in an execution file; the method for determining the execution file includes: obtaining a header file of the execution file; and generating the execution file based at least on the header file, the source route set and the destination route set.

[0137] In some implementations, the execution file includes at least a first execution file; generating the first execution file based on a header file, a source route set, and a destination route set includes: obtaining a first designated path of the first execution file; writing the header file, the source route set, and the destination route set into the first designated path to obtain the first execution file.

[0138] In some implementations, the execution file includes at least a second execution file;

[0139] A second execution file is generated based on a header file, a source route set, and a destination route set, including: in response to determining that obtaining the header file of the execution file fails, defining a header file; obtaining a second specified path of the second execution file; and writing the defined header file, source route set, and destination route set into the second specified path to obtain the second execution file.

[0140] In some implementations, traversing the source route set includes: traversing the source route set using a binary search method to search for corresponding address index information.

[0141] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0142] Figure 8 Schematic diagram of an electronic device provided in an embodiment of the present application. Figure 8 As shown, the electronic device 8 of this embodiment includes: a processor 801, a memory 802, and a computer program 803 stored in the memory 802 and executable on the processor 801. When the processor 801 executes the computer program 803, the steps in the above-mentioned method embodiments are implemented. Alternatively, when the processor 801 executes the computer program 803, the functions of the modules / units in the above-mentioned device embodiments are implemented.

[0143] The electronic device 8 may be a desktop computer, a notebook, a PDA, a cloud server, or other electronic device. The electronic device 8 may include, but is not limited to, a processor 801 and a memory 802. Those skilled in the art will appreciate that Figure 8 The electronic device 8 is merely an example and does not limit the electronic device 8 . The electronic device 8 may include more or fewer components than those shown in the figure, or different components.

[0144] The processor 801 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.

[0145] The memory 802 may be an internal storage unit of the electronic device 8, for example, a hard disk or memory of the electronic device 8. The memory 802 may also be an external storage device of the electronic device 8, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 8. The memory 802 may also include both an internal storage unit of the electronic device 8 and an external storage device. The memory 802 is used to store computer programs and other programs and data required by the electronic device.

[0146] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units.

[0147] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. The computer program may include computer program code, which may be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc.

[0148] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A message forwarding method, characterized in that: include: Get the routing table; The routing table includes at least one piece of routing information, each piece of routing information includes at least a source address bus, a source address identifier, a destination address bus and a destination address identifier; Parse the routing table to obtain the source routing set and the destination routing set; The source routing set includes address index information, and the address index information is obtained according to the source address bus and the source address identifier in the routing information; The destination routing set is obtained according to the destination address bus and the destination address identifier in the routing information; Obtain message information; The message information includes a target address bus and a target address identifier; Search the source routing set according to the target address bus and the target address identifier to obtain corresponding address index information; Search the destination routing set according to the address index information to obtain the corresponding target destination address bus and target destination address identifier; forwarding the message information according to the target destination address bus and the target destination address identifier; The method for obtaining the address index information includes: Sorting all the routing information in the routing table according to the first dimension, wherein the sorted routing information includes at least one routing information in each item of the first dimension; Sorting the routing information of each item in the first dimension according to the second dimension, wherein the sorted routing information includes at least one routing information in each item of the second dimension; wherein the first dimension and the second dimension are different and are source address buses or source address identifiers, respectively; Combining the sorted routing information having the same first dimension and second dimension to form at least one source routing set; Generate corresponding address index information in sequence according to the source routing set; Each address index information includes a source address bus, a source address identifier, an index address, and the number of indexes, wherein the source address bus and the source address identifier in each address index information are the same as the source address bus and the source address identifier of the corresponding source routing set, and the number of indexes is the number of routing information in the corresponding source routing set. The index address of the first address index information is 0, and the index address of the next address index information is equal to the sum of the index address and the number of indexes in the previous address index information; Searching the destination routing set according to the address index information to obtain a corresponding target destination address bus and a target destination address identifier includes: Obtaining the index address and the number of indexes in the corresponding address index information; Determine a target set element in the target route set, wherein the ranking of the target set element in the target route set is greater than the index address and less than or equal to the sum of the index address and the number of indexes; The destination address bus and the destination address identifier of the target set element are determined as the target destination address bus and the target destination address identifier.

2. The method according to claim 1, characterized in that Methods for obtaining the destination route set include: The destination address bus and the destination address identifier of the routing information in each source routing set are obtained in order to obtain the destination routing set.

3. The method according to claim 1, characterized in that Searching the source routing set according to the target address bus and the target address identifier to obtain corresponding address index information includes: Traversing the source routing set; Determine that the source address identifier in the source routing set is the same as the target address identifier, and the address index information in which the source address bus is the same as the target address bus is the corresponding address index information.

4. The method according to claim 1, characterized in that The source route set and the destination route set are configured in an execution file; Methods for determining execution files include: Get the header file of the executable file; The execution file is generated based on at least the header file, the source route set, and the destination route set.

5. The method according to claim 4, characterized in that The execution file at least includes a first execution file; Generating a first execution file based on the header file, the source route set, and the destination route set includes: Obtaining a first specified path of the first execution file; The header file, the source route set, and the destination route set are written into the first designated path to obtain the first execution file.

6. The method according to claim 4, characterized in that The execution file at least includes a second execution file; Generating a second execution file based on the header file, the source route set, and the destination route set includes: In response to determining that obtaining the header file of the execution file fails, defining the header file; Obtaining a second specified path of the second execution file; The defined header file, the source route set and the destination route set are written into the second designated path to obtain the second execution file.

7. The method according to claim 3, characterized in that Traversing the source routing set includes: Use the binary search method to traverse the source routing set and search whether there is corresponding address index information.

8. A message forwarding device, characterized in that: include: The obtaining module is configured to obtain a routing table by itself; the routing table includes at least one routing information, each routing information includes at least a source address bus, a source address identifier, a destination address bus and a destination address identifier; A parsing module is configured to parse the routing table to obtain a source routing set and a destination routing set; The source routing set includes address index information, and the address index information is obtained according to the source address bus and the source address identifier in the routing information; The destination routing set is obtained according to the destination address bus and the destination address identifier in the routing information; The obtaining module is further configured to obtain message information; The message information includes a target address bus and a target address identifier; A search module is configured to search the source routing set according to the target address bus and the target address identifier to obtain corresponding address index information; and searching the destination routing set according to the address index information to obtain a corresponding target destination address bus and a target destination address identifier; A forwarding module, configured to forward the message information according to a target destination address bus and a target destination address identifier; The method for obtaining the address index information includes: Sorting all the routing information in the routing table according to the first dimension, wherein the sorted routing information includes at least one routing information in each item of the first dimension; Sorting the routing information of each item in the first dimension according to the second dimension, wherein the sorted routing information includes at least one routing information in each item of the second dimension; wherein the first dimension and the second dimension are different and are source address buses or source address identifiers, respectively; Combining the sorted routing information having the same first dimension and second dimension to form at least one source routing set; Generate corresponding address index information in sequence according to the source routing set; Each address index information includes a source address bus, a source address identifier, an index address, and the number of indexes, wherein the source address bus and the source address identifier in each address index information are the same as the source address bus and the source address identifier of the corresponding source routing set, and the number of indexes is the number of routing information in the corresponding source routing set. The index address of the first address index information is 0, and the index address of the next address index information is equal to the sum of the index address and the number of indexes in the previous address index information; Searching the destination routing set according to the address index information to obtain a corresponding target destination address bus and a target destination address identifier includes: Obtaining the index address and the number of indexes in the corresponding address index information; Determine a target set element in the target route set, wherein the ranking of the target set element in the target route set is greater than the index address and less than or equal to the sum of the index address and the number of indexes; The destination address bus and the destination address identifier of the target set element are determined as the target destination address bus and the target destination address identifier.

Citation Information

Patent Citations

  • Vehicle-mounted gateway test method and system and computer readable storage medium

    CN115242689A

  • PCI express switch and method for multi-port non-transparent switching

    US8429325B1