Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments of the present application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
The technical scheme of the application obtains, stores, uses, processes and the like the data, which all meet the relevant regulations of national laws and regulations.
In consideration of the problems in the prior art, the application provides a communication method and a communication device based on graphic modeling, which are used for analyzing historical protocol characteristics and generating a protocol template data set through a deep learning model, so that the intellectualization of protocol design is realized. The graphical protocol design interface is innovatively designed, the communication protocol universal block and the logic block are integrated, and the compatibility parameter matrix is introduced to realize intelligent connection correction. The system automatically generates a protocol analyzer, processes the network data flow through a serialization function library and an algorithm function library, and ensures the accuracy and reliability of data transmission. The method breaks through the limitation of the traditional manual coding and provides an efficient and visual visualization solution for the development of the communication protocol.
In order to break through the limitation of the traditional manual coding and provide an efficient and visual visualization solution for the development of a communication protocol, the application provides an embodiment of a communication method based on graphic modeling, and referring to fig. 1, the communication method based on graphic modeling specifically comprises the following contents:
Step S101, a protocol feature vector is built by acquiring historical protocol definition data, the protocol feature vector is transmitted into a deep learning model to generate a protocol template data set, a communication protocol general block and a logic block are extracted from the protocol template data set, a graphical protocol design interface is established to load the communication protocol general block and the logic block, drag operation of the communication protocol general block and the logic block is monitored to generate assembly connection data, a compatibility parameter matrix is calculated according to the assembly connection data, the compatibility parameter matrix is compared with a preset threshold value to generate a connection correction instruction, the assembly connection data is adjusted according to the connection correction instruction to form a protocol hierarchical structure, field attributes of the communication protocol general block and logic attributes of the logic block are read, and the field attributes, the logic attributes and the protocol hierarchical structure are written into a protocol definition file;
Optionally, the embodiment provides an intelligent protocol modeling method based on deep learning, which is mainly applied to a visual design scene of a communication protocol. Historical protocol definition data is first systematically collected and consolidated, with sources of data including standard communication protocol libraries, enterprise custom protocols, and open source protocol frameworks. The original data is cleaned by a data preprocessing engine, including duplicate definition removal, format error correction, missing field replenishment, etc. The preprocessed data is stored according to a unified JSON format, so that the subsequent processing is facilitated.
The construction of the protocol feature vector adopts a multi-level feature extraction strategy. Extracting the characteristics of inheritance relation, nesting depth, branch structure and the like of the fields at the structure level, analyzing field naming rules through natural language processing technology at the semantic level, extracting the business meaning and use scene of the fields, and extracting the characteristics of data types, value ranges, validity rules and the like at the constraint level. The features are converted into numerical vectors through feature mapping functions, and sparse matrix storage is adopted to improve the calculation efficiency.
The deep learning model adopts an improved transducer architecture, and performs specific optimization for a protocol modeling scene. The encoder comprises a multi-layer self-attention module, and the attention head number of each layer is adaptively adjusted according to the characteristic dimension. Attention computation employs an improved scaling dot product attention mechanism, introducing position coding to preserve field order information. The decoder adopts a cross attention mechanism, and simultaneously considers the input characteristics and the generated output, so that the consistency of template generation is improved.
Model training employs a multi-stage strategy. The first stage uses a large amount of standard protocol data to pretrain and learn general protocol structure characteristics, and the second stage uses domain-specific protocol data to fine tune and adapt to the requirements of specific application scenes. Dynamic batch size and learning rate adjustment strategies are used in the training process to prevent overfitting. The loss function comprehensively considers the structural similarity and the semantic similarity, and ensures the accuracy of the generated template.
The generation process of the protocol template data set realizes intelligent template clustering and optimization. The model is clustered based on the functional characteristics of the protocol, and protocol templates with similar functions are classified and stored. And then carrying out structural optimization on each type of template, including field combination optimization, logic structure simplification and the like. The optimization process considers the performance requirements in practical application, such as the size of a data packet, the analysis efficiency and other factors.
The extraction of the communication protocol general blocks and the logic blocks adopts a mixed method based on rules and statistics. The identification of the generic block is based on the frequency of field usage and the degree of cross-protocol multiplexing, and the optimal combination of fields is determined by similarity calculation. The extraction of the logic block focuses on operation modes such as condition judgment, cyclic processing, data conversion and the like, and the common logic structure is identified through a pattern matching algorithm.
The implementation of the graphical protocol design interface adopts a componentized architecture. The interface frame uses a responsive design to ensure presentation effects on different devices. The component library comprises a basic control and a compound control, and supports drag operation and real-time preview. The interface layout adopts a grid system, so that the accurate positioning and alignment of the components are realized.
The monitoring of the component drag operation adopts an event driven mode. The mouse event and the touch event are captured by the event monitor, and the component position and the overlapping state are calculated in real time. Visual feedback such as alignment lines, adsorption effects and the like is provided in the dragging process, and the operation precision is improved. The generation of the component connection data is based on the position relation and the connection rule, and supports various connection modes.
The compatibility parameter matrix is calculated taking into account constraints of the multiple dimensions. Including data type compatibility, field dependencies, business rule restrictions, etc. And the matrix calculation adopts a parallel processing strategy, so that the efficiency of large-scale component analysis is improved. The calculation result is conveniently compared with a preset threshold value through normalization processing.
The generation and execution of the connection correction instruction enables intelligent error correction. When an incompatible connection is detected, the system analyzes possible corrective actions such as adjusting the connection order, adding conversion components, etc. The modification process considers the minimum modification principle, and maintains the original design intention as much as possible.
The formation of the protocol hierarchy is represented by a tree model. Relationships between nodes include various types of inclusion, inheritance, referencing, and the like. The change history is maintained in the structure adjustment process, and operation rollback is supported. The finally generated protocol definition file adopts a standard format, and ensures the compatibility with the existing tool chain.
The embodiment realizes the intellectualization and automation of protocol design through the deep learning technology, and obviously improves the protocol development efficiency. The protocol template generated by the model has higher accuracy and practicability, and can effectively reduce the complexity of protocol design. The graphical interface and the intelligent correction mechanism enable the protocol design process to be more visual and reliable. In practical applications, the scheme has successfully supported protocol development work in multiple fields, and is particularly excellent in a scene requiring rapid customization of protocols.
Step S102, calling a packing function and an unpacking function from a preset protocol serialization function library, writing the packing function and the unpacking function into the protocol definition file, reading a dynamic reference keyword table to generate a keyword mapping set, writing the keyword mapping set into the protocol definition file, calling a byte length calculation function and a check value calculation function from an algorithm function library, writing the byte length calculation function and the check value calculation function into the protocol definition file, and generating a protocol parser according to the protocol definition file;
Optionally, in this embodiment, in the protocol serialization function library, a packing function and a unpacking function of the hierarchical design are implemented according to characteristics of a protocol hierarchy. The basic layer realizes the serialization operation of the atomic type data, including the processing of basic types such as integers, floating point numbers, character strings and the like, the composite layer is responsible for the combination processing of complex data types such as structural bodies, arrays and the like, and the expansion layer supports the serialization requirement of user-defined data types. The functions of each level are subjected to strict performance test and optimization, so that various data can be efficiently processed in practical application.
The calling of the packing function adopts a dynamic dispatch mechanism, and the most suitable serialization method is automatically selected by analyzing the type characteristics of the data to be processed. For fixed-length data, the memory copy operation is directly used to increase the processing speed, for variable-length data, the length information is written first and then the actual data content is written, and for nested data, each field is processed in a recursion mode. In order to improve the performance, the serialization path cache is realized, and the frequently used serialization operation is optimized.
The unpacking function is implemented based on a state machine mode, and processes the data stream through a predefined state transition rule. And the parser dynamically adjusts the parsing state according to the type mark and the length information in the data stream, and supports the fragmentation processing and stream parsing of the data packet. For complex protocol structures, a recursive descent algorithm is adopted to ensure that the multi-layer nested data structure is correctly analyzed, and meanwhile, analysis context information is maintained to ensure the integrity of data.
The design of dynamic reference key tables enables a flexible field referencing mechanism. And constructing a complete reference link network by analyzing the dependency relationship among fields in the protocol definition. The type, scope, and lifecycle information for each reference is recorded in the reference table, supporting forward and backward references. And for the condition of cyclic reference, the resource leakage is prevented by a reference counting mechanism, and the safety of the use of the memory is ensured.
The byte length calculation function adopts a recursive strategy, firstly processes the fixed length field, accumulates the number of bytes occupied by the fixed length field, and then calculates the space requirement of the variable length field. For conditional branch structures, the maximum possible length value is calculated by analyzing all possible execution paths. The processing logic of stuff bytes is added in the computation process in view of alignment requirements of different processor architectures.
The check value calculation module integrates various check algorithms, including basic CRC32 check, MD5 and SHA series algorithms with higher security. The verification process supports data blocking processing, and is suitable for processing a scene of large-scale data transmission. For particularly important data fields, a double checking mechanism is realized, and the reliability of data integrity verification is improved through the combination of different algorithms.
In the process of generating the protocol parser, a template engine technology is adopted to process the protocol definition file. The parser firstly loads structure definition, function statement and keyword mapping information in the definition file, and then generates corresponding parsing codes according to a preset code template. The generated codes support conditional compiling, can be optimized according to the characteristics of the target platform, and improve the running efficiency.
In the actual running process, the parser realizes efficient state tracking by maintaining detailed parsing context. The context information contains key information such as a protocol level, a field position and the like of the current processing, and meanwhile, a field value table is dynamically maintained to support complex data dependent processing. Aiming at possible abnormal conditions, a perfect error recovery mechanism is realized, and the stability of the system is improved.
The memory management adopts a pooling design, a plurality of memory pools with different specifications are pre-allocated, and proper memory blocks are dynamically selected according to the size of the data packet. Through an intelligent memory recycling mechanism, performance loss caused by frequent memory allocation and release operations is avoided. For the oversized data packet, a fragmentation processing mechanism is realized, and the memory use peak value is effectively controlled.
This complete set of serialization and parsing mechanisms is excellent in practical applications, especially in the context of handling complex protocol structures and large-scale data transmission. The optimized function calling mechanism and the memory management strategy remarkably improve the data processing performance, the dynamic reference support enhances the expansibility of the protocol, and the perfect checking mechanism ensures the reliability of data transmission.
Step S103, receiving a network data stream, extracting field data from the network data stream by the protocol analyzer according to the protocol hierarchical structure, transmitting the field data into the packing function to generate a serialized data packet, extracting a target field from the serialized data packet, transmitting the target field into the check value calculation function to generate a check code, judging the check code according to a preset check rule to generate a verification mark, and writing the serialized data packet and the verification mark into a network transmission buffer area.
Optionally, in this embodiment, the network interface monitoring module captures the network data flow in real time, and triggers the processing flow immediately when the data arrives. The network interface adopts an asynchronous IO mechanism, supports multiplexing and ensures that a large number of data streams can be efficiently processed in a high concurrency scene. When data is received, firstly, the data stream is segmented according to a preset frame format, and each data frame comprises a head identifier, load data, verification information and the like.
In order to accurately extract field data, a protocol parser first parses the header identification of the data frame, and quickly locates the protocol version and data type by bitmap matching. According to the field boundary rule defined in the protocol hierarchy, the parser scans the data frames step by using a sliding window mechanism, and accurately locates the start position and length of each field. In the field extraction process, format conversion is carried out on the original data through a type conversion module, and meanwhile data boundary checking is carried out, so that the extracted field data is ensured to accord with protocol specifications.
The problem of byte order is particularly noted in the data type conversion process, and a byte order self-adaption mechanism is realized aiming at different platforms. For example, for integer data transmitted across platforms, necessary conversion is performed according to the byte order specified by the protocol, so that the consistency of the data is ensured. Meanwhile, for special types such as floating point numbers, a precision control mechanism is realized, and precision loss of data in the conversion process is prevented.
The field data is processed and then is transmitted into a packing function for serialization, and the packing process strictly follows the data format defined by the protocol specification. In the serialization process, a stream processing mode is adopted, and the memory use is optimized through a buffer area management mechanism. For the variable length field, the length information is written first, and then the actual data is written in accordance with the designated encoding format. And in the serialization process, a field index table is maintained at the same time, and the offset positions of each field in the data packet are recorded, so that the subsequent extraction of the target field is facilitated.
When extracting a target field from a serialized data packet, a parser first analyzes the structure information of the data packet, and obtains the offset of the field. And the target field position is directly positioned through efficient memory operation, so that repeated analysis of the whole data packet is avoided. For the fields crossing the boundary, a data reorganization mechanism is realized, and the integrity of field data is ensured.
The check value calculation adopts a configurable multi-stage check mechanism. Firstly, the data length and the content of a target field are obtained and used as input parameters of a check function. The checking algorithm supports a plurality of modes such as CRC, hash and the like, and can be dynamically selected according to security requirements. For key service data, a segmentation checking mechanism is realized, and the reliability of data integrity verification is improved. In the verification process, a table lookup method is adopted to optimize the calculation efficiency, and meanwhile, hardware acceleration instructions are supported to improve the verification speed.
After the check code is generated, validity judgment is carried out according to a preset check rule. The validation rules contain multiple dimensions, such as numerical ranges, format requirements, business constraints, and the like. The decision tree structure is adopted in the decision process, so that quick rule matching is realized. For the verification failure conditions of different types, the system generates corresponding error codes, so that the problem is convenient to locate and process. The verification result is recorded in the form of an identification bit for subsequent data processing flow.
The network transmission buffer zone adopts a ring buffer design, and supports efficient data access operation. The buffer management module realizes an intelligent memory allocation strategy and dynamically adjusts the size of the buffer according to the size of the data packet. And in the writing process, the thread safety is ensured by adopting an atomic operation, and meanwhile, the data consistency is ensured by a memory barrier mechanism.
The serialized data packets are written to the buffer and organized in accordance with a predefined storage format. Including header information, payload data, authentication identification, etc. Byte alignment requirements are considered in the data organization process, and data access efficiency is ensured. Meanwhile, a data packet index is established, and specific data packets are supported to be positioned and retrieved quickly.
The embodiment shows excellent performance and reliability in practical application. The real-time processing requirement of large-scale data is effectively supported through the streaming processing and the multi-level buffer mechanism. The perfect checking mechanism ensures the accuracy of data transmission, and the flexible configuration options meet the performance and safety requirements in different scenes. Particularly in a network communication scene requiring quick response, the scheme can effectively reduce processing delay and improve system throughput.
From the above description, it can be known that the communication method based on graphic modeling provided by the embodiment of the application can analyze the historical protocol characteristics and generate the protocol template data set through the deep learning model, thereby realizing the intellectualization of the protocol design. The graphical protocol design interface is innovatively designed, the communication protocol universal block and the logic block are integrated, and the compatibility parameter matrix is introduced to realize intelligent connection correction. The system automatically generates a protocol analyzer, processes the network data flow through a serialization function library and an algorithm function library, and ensures the accuracy and reliability of data transmission. The method breaks through the limitation of the traditional manual coding and provides an efficient and visual visualization solution for the development of the communication protocol.
In an embodiment of the communication method based on graphic modeling of the present application, referring to fig. 2, the following may be further specifically included:
Step S201, screening a communication protocol general block and a logic block from the protocol template data set according to a preset component classification rule, performing field feature analysis on the communication protocol general block to generate a field attribute table, performing logic feature analysis on the logic block to generate a logic attribute table, loading the communication protocol general block and the logic block into a component cache area, calling a display template from a component display template library to construct a graphical protocol design interface, and reading data of the component cache area to generate a visual component on the graphical protocol design interface;
Step S202, monitoring a mouse event of the graphical protocol design interface to acquire a component drag coordinate, judging a component placement position according to the component drag coordinate to generate position information, reading the field attribute table and the logic attribute table to acquire component connection constraint, establishing a component association matrix based on the position information and the component connection constraint, and converting the component association matrix into component connection data.
Optionally, in this embodiment, components in the protocol template dataset are divided into different functional levels according to functional requirements in the protocol design process. The protocol functions comprise a basic communication layer, a service processing layer, a security control layer and the like, and each layer is subdivided according to the use frequency, the multiplexing property and the functional independence to construct a systematic classification system. The layering classification mode enables the protocol design process to be more orderly and clear, and is convenient for subsequent feature analysis and processing.
The field feature analysis adopts a multidimensional feature extraction method to extract the feature information such as a numerical range, a precision requirement, a unit attribute and the like from the numeric type field, and analyzes the attributes such as a length limit, a coding format, a special character processing rule and the like from the character string type field. By establishing a feature vector space for quantization description, the features of each field can be accurately recorded and expressed. The extracted characteristic information is finally integrated into a structured field attribute table, which provides basis for subsequent component management and connection constraint.
In the logic feature analysis process, the present embodiment focuses on control flows and data processing rules in the protocol. By constructing a logic flow diagram, input conditions, execution rules and output results of typical logic modules such as condition judgment, loop structure, data conversion and the like are analyzed. Meanwhile, the dependency relationship and the execution sequence between the logic modules are considered, and the analysis results are organized into a logic attribute table, so that logic support is provided for the design of complex protocols.
The component cache area adopts a layered storage structure, and comprises a quick access layer and a persistence layer. The quick access layer uses a memory mapping technology to realize quick loading and updating of the component data, and the persistence layer is responsible for reliable storage and version management of the data. The caching mechanism implements an intelligent preloading strategy that predicts components that may be needed by analyzing the frequency and relevance of component usage and loads them into the quick access layer in advance.
In the process of constructing the graphical protocol design interface, the embodiment calls the adapted display template from the component display template library. The template library contains rich visual components, such as connection lines, node frames, labels, etc., each supporting style customization and interactive responses. The interface layout adopts a grid system to realize accurate component positioning and alignment functions, and flexible design space is provided through view operations such as zooming, translation and the like.
In the generation process of the visual component, the embodiment uses visual elements such as different graphic shapes, colors, connection styles and the like to intuitively display the characteristics and constraint relation of the component by performing visual mapping on field attributes and logic attributes. For complex logic structures, a hierarchical display mechanism is realized, and a designer can view detail information of different levels through unfolding or folding operations.
The mouse event monitoring adopts an event delegation mechanism, and captures user interaction operation through a unified event processor. The event processing process realizes anti-shake and throttling optimization, and ensures that the system can keep stable response in frequent operation. The calculation of the drag coordinates considers the scaling and rolling offset of the view, and ensures the accuracy of coordinate positioning.
When the component placement position is judged, the embodiment realizes intelligent space management by constructing a space occupation map. In the placing process, the automatic alignment and adsorption functions are realized, and the accurate positioning of the assembly by a designer is assisted. And meanwhile, the hierarchical relation of the components is maintained, the correct display sequence of the overlapped components is ensured, and powerful support is provided for the visual design of the complex protocol.
Component connection constraints are based on rule engine implementations, supporting a combination of multiple constraint types. Constraint rules include data type compatibility, direction restrictions, number of connections restrictions, etc. And flexible connection control is realized through rule combination and priority management. For connection requirements in special scenarios, the present embodiment supports dynamic addition of custom constraint rules.
The component association matrix is expressed by adopting an adjacency matrix, and the connection relation and the connection attribute between the components are recorded. Each element of the matrix contains information of connection type, direction, weight and the like, and the validity and the integrity of the connection can be rapidly verified through matrix operation. The conversion process from the matrix to the connection data realizes data compression and optimization, and effectively reduces the storage cost.
The embodiment obviously improves the efficiency and the reliability of protocol design in practical application. The accuracy of the design process is ensured by intelligent constraint inspection and space management, and the complexity of the design is reduced by visual expression. In particular, the scheme shows obvious advantages in the development stage requiring frequent modification and optimization, and provides powerful support for protocol design work.
In an embodiment of the communication method based on graphic modeling of the present application, referring to fig. 3, the following may be further specifically included:
Step 301, a component compatibility rule set is read from a compatibility rule base, the component connection data is substituted into the component compatibility rule set to calculate the association degree among components, a compatibility parameter matrix is constructed based on the association degree, parameter values in the compatibility parameter matrix are compared with a preset threshold value to generate a difference mark, a component position offset is calculated according to the difference mark to form a connection correction instruction, and the connection correction instruction is applied to the component connection data to generate a protocol hierarchical structure;
Step S302, obtaining a field name, a data type, a default value of the communication protocol universal block and a conditional statement, an operation symbol and an execution sequence of the logic block from a property analysis module, and writing the field name, the data type, the default value, the conditional statement, the operation symbol, the execution sequence and the protocol hierarchy into a protocol definition file according to a preset format.
Optionally, the present embodiment addresses the problem of component compatibility in protocol design. The rule set read from the compatibility rule base comprises rules of multiple dimensions such as field type matching, numerical range constraint, business logic association and the like. Each rule is provided with a corresponding weight coefficient for reflecting the importance degree of different rules in the association degree calculation.
And when the component association degree calculation is carried out, a multi-level evaluation mechanism is adopted. Firstly, analyzing the component connection data, and extracting attribute characteristics of both connected parties. These features are then matched with compatibility rules, and the satisfaction of each rule is calculated. For matching of numerical value types, normalization processing is adopted to ensure that parameters of different dimensions can be uniformly compared. And for the matching of the logic types, evaluating the satisfaction degree of the rule through a semantic similarity algorithm.
The compatibility parameter matrix is constructed by adopting a weighted accumulation mode, and the evaluation results of all the rules are integrated. Each element in the matrix represents an integrated compatibility score between a corresponding component pair. In order to improve the calculation efficiency, a sparse matrix storage mode is adopted, and only parameter values of component pairs with connection relations are recorded. Meanwhile, an incremental computing mechanism for matrix updating is realized, and the estimated component pairs are prevented from being repeatedly computed.
When comparing the parameter value with a preset threshold, the embodiment adopts a segmentation threshold strategy. Different types of component connections may have different compatibility requirements, and thus multiple threshold intervals are set. The difference mark generated through the comparison result not only contains information about whether the threshold value is exceeded or not, but also contains a quantization index of the exceeding degree, and a basis is provided for subsequent correction.
The calculation of the positional offset fully considers the spatial relationship between the components. First a space occupation map of the assembly is constructed, analyzing the possible directions of movement. And then determining the component pair to be adjusted according to the difference identification, and calculating the optimal moving path. In the calculation process, a heuristic algorithm is adopted to avoid a local optimal solution and ensure the rationality of the overall layout.
In the process of generating the connection correction instruction, the embodiment not only considers the position adjustment, but also includes the optimization of the connection line. For the connection to be adjusted, the system will recalculate the path of the connection line, avoiding interference with other components. The correction instructions are stored in a serialized form, supporting batch execution and rollback operations.
In the process of attribute analysis, the embodiment realizes a fine-grained attribute extraction mechanism. For the general block of the communication protocol, besides the basic field name and data type, the characteristics of the field such as value constraint, unit attribute, precision requirement and the like are analyzed. For the logic block, the semantic structure of the conditional statement is deeply analyzed, and key judgment conditions and operators are identified.
The determination of the execution sequence adopts a topological sorting algorithm, so that the dependency relationship among the logic blocks is ensured to be processed correctly. In the sorting process, abnormal conditions such as cyclic dependence and the like are detected in real time by maintaining a dependence graph data structure. And meanwhile, the logic block identification which supports parallel execution provides possibility for subsequent optimization.
The protocol definition file is generated by adopting a hierarchical structural design. The file format contains clear hierarchical divisions, facilitating subsequent parsing and maintenance. In the writing process, the automatic formatting and annotation generating functions are realized, and the readability of the file is improved. Meanwhile, by a version control mechanism, a history record of protocol evolution is saved.
The embodiment shows excellent adaptability and reliability in the protocol design process. The workload of manual adjustment is obviously reduced through intelligent compatibility analysis and an automatic correction mechanism. Accurate attribute extraction and canonical file generation ensure the accuracy and integrity of protocol definition. Particularly, in the design process of a complex protocol, the scheme can effectively identify and solve the potential compatibility problem, and improves the design efficiency.
In an embodiment of the communication method based on graphic modeling of the present application, referring to fig. 4, the following may be further specifically included:
Step S401, reading a function statement of a packing function and a unpacking function from a protocol serialization function library, analyzing the function statement to extract a function name, a parameter list and a return value type, combining the function name, the parameter list and the return value type to form a function definition code, writing the function definition code into a function definition area of the protocol definition file, and establishing a mapping relation between the packing function, the unpacking function and a protocol component;
Step S402, extracting a keyword identifier and a reference type from a dynamic reference keyword table, combining the keyword identifier and the reference type to construct a keyword mapping object, generating a keyword mapping set based on the keyword mapping object, writing the keyword mapping set in a keyword definition area of the protocol definition file, and establishing a reference link between the keyword mapping set and the function definition code.
Optionally, the embodiment maintains a rich set of packing and unpacking functions in the protocol serialization function library, and the functions are specially optimized for different data types and processing scenes. The analysis process of the function statement adopts a grammar analyzer to accurately identify key information such as function names, parameter types, parameter sequences, return value types and the like, and lays a foundation for subsequent code generation.
When analyzing function declarations, the embodiment realizes a parameter dependent analysis mechanism. By constructing the parameter dependency graph, the association relation between the parameters is ensured to be correctly processed. For example, when the value of a certain parameter depends on the calculation result of other parameters, the system can automatically adjust the processing sequence of the parameters to ensure the correctness of the data stream. For the processing of selectable parameters and default values, a conditional compiling mode is adopted, so that flexible parameter configuration options are provided.
In the process of generating the function definition code, the embodiment adopts a templated code assembly mode. Firstly, filling function information obtained through analysis into a predefined code template, and then carrying out customized adjustment according to a specific application scene. To improve maintainability of the code, the system automatically generates detailed function annotations, including information such as parameter descriptions, usage examples, and notes.
The mapping relationship between the protocol components and the functions is maintained by a mapping table. The mapping table adopts a multi-level index structure and supports function matching according to multiple dimensions such as component types, data characteristics, processing requirements and the like. When a certain protocol assembly needs to be serialized, the system can be rapidly positioned to the most suitable processing function, and the operation efficiency is improved.
This embodiment employs a flexible identifier management mechanism in handling dynamic reference keys. The design of the key identifiers allows for isolation of namespaces, avoiding naming conflicts between different modules. The definition of the reference type supports various reference modes, including direct reference, indirect reference, conditional reference and the like, and meets the reference requirements in different scenes.
When constructing the keyword mapping object, the present embodiment implements an intelligent type derivation mechanism. The system can automatically deduce the proper data type according to the use context of the keywords, and reduces the workload of manual type declaration. For complex reference relationships, the management is carried out by adopting a reference chain mode, and the tracking and analysis of multi-level references are supported.
The generation of the keyword mapping set adopts a recursive processing mode. First, simple direct mapping relationships are processed, and then complex combined mappings are developed step by step. In the process, the system can perform cycle reference detection to prevent the occurrence of dead cycle. Meanwhile, the processing efficiency of repeated reference is optimized through a caching mechanism.
When the keyword mapping set is written in the protocol definition file, the embodiment adopts a structured storage format. Each mapping entry contains complete context information, facilitating subsequent parsing and maintenance. Meanwhile, an incremental updating mechanism is realized, and when a certain mapping relation is modified, only relevant parts are required to be updated, so that the cost of full-volume rewriting is avoided.
In the process of establishing the reference link, the embodiment realizes a bidirectional tracking mechanism. The related function definition can be found from the keyword mapping, and the related function definition can be traced to the used keywords, so that the maintainability and the debuggeability of the code are greatly improved through the bidirectional association.
The embodiment remarkably improves the standardization and maintainability of protocol realization through the systematic function definition and the keyword mapping mechanism. The intelligent type deduction and reference management mechanism reduces the workload of the developer, and the perfect document generation function provides clear use guidelines. Particularly, when complex protocols are processed, the scheme can effectively manage a large number of function definitions and keyword mappings, and ensure the accuracy and efficiency of protocol implementation.
In an embodiment of the communication method based on graphic modeling of the present application, referring to fig. 5, the following may be further specifically included:
Step S501, retrieving a source code of a byte length calculation function and a check value calculation function from an algorithm function library, extracting algorithm parameters and calculation logic in the source code, packaging the algorithm parameters and the calculation logic into a function module, writing the function module into an algorithm area of the protocol definition file, and establishing a call entry of the byte length calculation function and the check value calculation function;
step S502, reading a protocol hierarchical structure, a function definition code and a keyword mapping set in the protocol definition file, generating a data analysis code according to a preset analysis rule, performing association binding on the function module and the data analysis code, and compiling the data analysis code and the function module to generate an executable file of a protocol analyzer.
Optionally, in the process of protocol data parsing, the embodiment extracts a high-efficiency algorithm specially used for byte length calculation and check value calculation from the algorithm function library. For byte length calculation, a dynamic calculation mechanism adapting to different character codes is realized, and data blocks containing complex conditions such as variable length fields, nested structures and the like can be accurately processed. For example, when processing UTF-8 encoded strings, the actual length of the multi-byte character is accurately calculated by identifying the characteristic bits of the first byte.
When algorithm parameters and calculation logic are extracted, the embodiment adopts a static analysis technology to convert source codes into abstract syntax trees for deep analysis. And extracting the core parameters and the dependency relationship of the algorithm by identifying key computing nodes and data flow directions. These parameters include key information such as data type identification, length cardinality, alignment requirements, etc.
In the packaging process of the check value calculation function, a unified interface of various check algorithms is realized. According to different application scenes and security requirements, different checking algorithms such as CRC, MD5, SHA and the like can be flexibly selected. The selection process of the algorithm takes into account a number of factors such as data integrity requirements, computational overhead, and hardware support.
The encapsulation of the function module adopts a combined design mode, and related algorithm parameters and calculation logic are organized into independent functional units. Each module is provided with a complete parameter verification and exception handling mechanism to ensure stable operation under various boundary conditions. The modules communicate through standardized interfaces, and flexible combination and expansion are supported.
The call entry is established in proxy mode, and a proxy interface is added between the original function and the caller. This design allows the addition of functions such as parameter preprocessing, result caching, performance monitoring, etc. without modifying the original code. The proxy behavior can be flexibly adjusted through the configuration file, and the method is suitable for different running environments.
When the protocol hierarchy is parsed, the present embodiment implements a recursive hierarchical traversal algorithm. From the top-level protocol structure, the relationships and properties of the various components are parsed layer by layer. For the cyclic reference and the complex dependency relationship, analysis and optimization are carried out by constructing a dependency graph, so that the accuracy of the analysis process is ensured.
The generation of the data analysis code adopts a template engine technology, and the protocol structure is converted into the high-efficiency analysis code according to a preset analysis rule. The parsing rules include aspects such as type conversion, boundary checking, exception handling, etc., ensuring that the generated code is both efficient and reliable. For example, for the processing of network byte sequence, byte sequence conversion codes are automatically generated, and the correctness of cross-platform data exchange is ensured.
In the process of association binding of the function module and the analysis code, the embodiment realizes an intelligent code injection mechanism. The system analyzes the data processing flow and injects codes for length calculation and verification value verification at proper positions. This injection process allows for performance optimization, minimizing unnecessary computation and memory operations.
In the compiling stage, the embodiment adopts a hierarchical compiling strategy. The method comprises the steps of firstly, independently compiling each module to generate an intermediate code, and then, performing global optimization including inline expansion, dead code elimination, cyclic optimization and the like to generate an efficient machine code. Debug information is added in the compiling process, so that subsequent problem positioning and performance analysis are facilitated.
The embodiment shows excellent expansibility and maintainability in the realization of the protocol parser. Through the modular design and standardized interface, the rapid integration of new algorithms and new protocols is supported. The automatically generated analytic code reduces the workload of manual coding and ensures the code quality. Particularly, when complex protocols are processed, the scheme can effectively manage various calculation and verification logics and provide stable and reliable analysis functions.
The finally generated executable file has good running efficiency and resource utilization rate, and can meet the requirements of various practical application scenes. Through reasonable memory management and caching strategies, stable performance can be maintained when a large amount of data is processed. At the same time, the perfect error handling mechanism ensures that failure recovery can be gracefully performed in the event of an anomaly.
In an embodiment of the communication method based on graphic modeling of the present application, referring to fig. 6, the following may be further specifically included:
step S601, a monitoring network interface acquires a network data stream, the network data stream is segmented according to a preset data frame format, the protocol analyzer analyzes the head identification of a data frame according to the protocol hierarchical structure, field data is extracted from a positioning field boundary in the data frame, and the field data is subjected to data type conversion and boundary verification to generate processed field data;
Step S602, transmitting the processed field data into the packing function according to a protocol specification to carry out serialization processing, generating a serialization data packet based on a serialization rule of the packing function, analyzing a data structure of the serialization data packet to obtain a field offset, and intercepting a target field from the serialization data packet according to the field offset.
Optionally, the embodiment adopts an efficient data capturing mechanism in the network interface monitoring process. By setting the promiscuous mode of the network adapter, it is ensured that all data packets passing through the interface can be captured. Meanwhile, a buffer area management strategy is realized, and the data loss under the condition of high load is effectively avoided by adjusting the size and the processing period of the receiving buffer area.
The data frame segmentation process adopts a sliding window mechanism, and the window size is dynamically adjusted to adapt to different network environments and data characteristics. In the processing process, a frame synchronization detection algorithm is realized, and the starting position of each data frame is accurately positioned by analyzing the frame header characteristic sequence. For the case of broken frames or damage, the system can automatically perform frame reorganization and error recovery.
In the process of header identification analysis, the embodiment realizes a multi-layer protocol identification mechanism. And analyzing the protocol type and version information of the data frame layer by analyzing the identification characteristics defined in the protocol hierarchical structure. The hierarchical analysis mode enables the system to flexibly process various protocol combinations and supports dynamic expansion and updating of the protocol.
The field boundary positioning adopts an accurate offset calculation method. And calculating the starting position and the ending position of each field according to the field length information and the alignment requirement in the protocol definition. For variable length fields, the field boundaries are dynamically determined by parsing information such as length identifiers or terminators. The method can accurately process complex data structures and avoid the problem of field dislocation.
In the data type conversion process, the embodiment realizes an intelligent type deduction and conversion mechanism. The system can automatically select a proper conversion method according to the definition attribute of the field, and process various data types including integers, floating point numbers, character strings and the like. For special data formats, such as time stamps, enumerated values, etc., special conversion functions are provided to ensure accurate interpretation of the data.
The boundary check adopts multiple verification strategies including range check, format verification, consistency check and the like. And verifying the validity of the value of each field through a preset verification rule, and timely finding and processing abnormal data. For constraint relations among the associated fields, a cross-validation mechanism is realized, and the overall consistency of the data is ensured.
In the serialization process, the embodiment adopts an efficient data organization mode. The packing function converts the field data into a standard binary format according to predefined serialization rules. In the process, data compression and alignment optimization are realized, the size of the serialized data packet is reduced, and the transmission efficiency is improved.
The design of the serialization rules considers cross-platform compatibility and adopts unified byte order and coding format. For different types of data, clear conversion rules are defined, so that correct analysis among different systems can be ensured. At the same time, forward compatibility of the protocol is supported by the version control mechanism, allowing new data fields to be added while maintaining existing functionality.
When analyzing the structure of the serialized data packet, the embodiment realizes an efficient indexing mechanism. By establishing a field position index table, the offset position of any field is quickly positioned. The index structure supports dynamic update, can adapt to the change of the data packet structure, and improves the efficiency of data access.
The intercepting process of the target field adopts an optimized memory operation mode. According to the field offset, the system directly operates on the original data buffer, avoiding unnecessary data copying. And for the data to be stored, the memory pool management is adopted, so that the cost of memory allocation and release is reduced.
The present embodiment exhibits excellent performance and reliability in network data processing. Through an efficient data capturing and processing mechanism, data flows in a high-speed network environment can be stably processed. The intelligent type conversion and verification mechanism ensures the accuracy of data processing, and the optimized serialization processing improves the efficiency of data transmission. Particularly, when complex protocols and large amounts of data are processed, the scheme can maintain stable performance and provide reliable data processing support for network applications.
In an embodiment of the communication method based on graphic modeling of the present application, referring to fig. 7, the following may be further specifically included:
Step S701, acquiring the data length and the data content of the target field, taking the data length and the data content as input parameters and transmitting the data length and the data content into the check value calculation function, generating a check code based on a check algorithm of the check value calculation function, reading a preset check rule from a check rule configuration table, carrying out matching judgment on the check code and the check rule, and generating a verification mark according to a judgment result;
step S702, available buffer space is obtained from a network transmission buffer, the serialized data packet is written in the buffer space according to a preset data storage format, the verification identification is added to a verification field of the serialized data packet, and index mapping of the serialized data packet in the network transmission buffer is established.
Optionally, in this embodiment, when the data of the target field is checked, the data length is first calculated accurately. The calculation process considers the alignment requirements of different data types, and adopts a dynamic length calculation method for variable-length data to ensure the accuracy of the length information. When special character codes are processed, a code length recognition mechanism is realized, and a multi-byte character sequence is correctly processed.
The verification value calculation function is realized by adopting a configurable multi-stage verification mechanism. According to the importance degree and the safety requirement of the data, checking algorithms with different intensities can be selected. For key business data, a composite verification algorithm comprising data integrity and security verification is adopted, and for common data, a lightweight verification method is used to improve processing efficiency.
In the process of generating the check code, the embodiment realizes a data block processing mechanism. The large data is divided into the data blocks with proper sizes for verification calculation, so that the accuracy of calculation is ensured, and the processing efficiency is improved. For each data block, the system stores an intermediate check result and supports check recovery in a breakpoint continuous transmission scene.
The check rule configuration table adopts a hierarchical rule organization structure and supports multi-dimensional check rule definition. The rule comprises a plurality of aspects such as a numerical range, a format requirement, a dependency relationship and the like, and a flexible verification strategy is realized through rule combination. Priority management of rules ensures that multiple rule conflicts can be handled as intended.
The verification mark is generated by adopting a state coding technology, so that the verification mark not only contains a verification result, but also records detailed verification process information. By analyzing the information, the specific position and reason of the data abnormality can be accurately positioned. The design of the verification mark considers forward compatibility and supports the subsequent addition of new verification rules.
The management of the network transmission buffer adopts an efficient memory allocation strategy. By implementing a memory pool mechanism, frequent memory allocation and release operations are avoided. The size of the buffer zone is dynamically adjusted according to the network transmission characteristics, so that the memory use is optimized while the data integrity is ensured.
The design of the data storage format takes the characteristics of the network transmission into account. The use of aligned data structures reduces access overhead, ensuring data boundary alignment by stuffing bytes. For data exchange among different platforms, automatic byte order conversion is realized, and correct interpretation of data is ensured.
The present embodiment implements a data compression mechanism when writing serialized data packets. And a proper compression algorithm is selected according to the data characteristics, so that a higher compression rate is realized while the decompression speed is ensured. For repeated data patterns, a reference counting mode is adopted to avoid repeated storage.
The addition of the check field employs a flexible location management strategy. The verification information may be inserted into different locations of the data packet according to the protocol definition. For large data packets transmitted in fragments, corresponding check information is added in each fragment, so that the data integrity in the transmission process is ensured.
The index map is established by adopting a multi-level index structure. By establishing the mapping relation between the data packet identifier and the buffer area position, quick data positioning and access are realized. The index structure supports concurrent access, and ensures data consistency in a multithreading environment through a lock mechanism.
The present embodiment exhibits excellent performance and reliability in handling network data transmission. Through efficient checking mechanism and buffer management, accuracy and efficiency of data transmission are ensured. The flexible rule configuration and verification policy enables the system to adapt to different application scenarios, while the optimized storage structure and indexing mechanism provide excellent data access performance. Particularly, when processing high concurrency and large data volume transmission tasks, the scheme can keep stable processing capacity and provide reliable data transmission guarantee for network communication.
In order to break through the limitation of the conventional manual coding and provide an efficient and intuitive visual solution for the development of communication protocols, the present application provides an embodiment of a communication device based on graphic modeling for implementing all or part of the content of the communication method based on graphic modeling, referring to fig. 8, the communication device based on graphic modeling specifically includes the following contents:
The graphic operation module 10 is configured to acquire historical protocol definition data, construct a protocol feature vector, transfer the protocol feature vector into a deep learning model to generate a protocol template data set, extract a communication protocol general block and a logic block from the protocol template data set, build a graphic protocol design interface to load the communication protocol general block and the logic block, monitor a drag operation of the communication protocol general block and the logic block to generate component connection data, calculate a compatibility parameter matrix according to the component connection data, compare the compatibility parameter matrix with a preset threshold value to generate a connection correction instruction, adjust the component connection data according to the connection correction instruction to form a protocol hierarchy, read field attributes of the communication protocol general block and logic attributes of the logic block, and write the field attributes, the logic attributes and the protocol hierarchy into a protocol definition file;
The protocol parsing module 20 is configured to call a packing function and an unpacking function from a preset protocol serialization function library, write the packing function and the unpacking function into the protocol definition file, read a dynamic reference keyword table to generate a keyword mapping set, write the keyword mapping set into the protocol definition file, call a byte length calculation function and a check value calculation function from an algorithm function library, write the byte length calculation function and the check value calculation function into the protocol definition file, and generate a protocol parser according to the protocol definition file;
The data flow converting module 30 is configured to receive a network data flow, the protocol parser extracts field data from the network data flow according to the protocol hierarchy, the field data is transmitted to the packing function to generate a serialized data packet, a target field is extracted from the serialized data packet, the target field is transmitted to the check value calculating function to generate a check code, the check code is determined according to a preset check rule to generate a verification identifier, and the serialized data packet and the verification identifier are written into a network transmission buffer.
From the above description, it can be seen that the communication device based on graphic modeling provided by the embodiment of the application can analyze the historical protocol characteristics and generate the protocol template data set through the deep learning model, thereby realizing the intellectualization of the protocol design. The graphical protocol design interface is innovatively designed, the communication protocol universal block and the logic block are integrated, and the compatibility parameter matrix is introduced to realize intelligent connection correction. The system automatically generates a protocol analyzer, processes the network data flow through a serialization function library and an algorithm function library, and ensures the accuracy and reliability of data transmission. The method breaks through the limitation of the traditional manual coding and provides an efficient and visual visualization solution for the development of the communication protocol.
In order to break through the limitation of traditional manual coding and provide an efficient and visual visualization solution for the development of communication protocols from the hardware level, the application provides an embodiment of an electronic device for realizing all or part of contents in the communication method based on graphic modeling, wherein the electronic device specifically comprises the following contents:
The system comprises a processor (processor), a memory (memory), a communication interface (Communications Interface) and a bus, wherein the processor, the memory and the communication interface are used for completing communication among the processors, the memory and the communication interface through the bus, the communication interface is used for realizing information transmission between a communication device based on graphic modeling and related equipment such as a core service system, a user terminal and a related database, and the logic controller can be a desktop computer, a tablet computer, a mobile terminal and the like. In this embodiment, the logic controller may refer to an embodiment of the communication method based on graphic modeling in the embodiment and an embodiment of the communication device based on graphic modeling, and the contents thereof are incorporated herein, and are not repeated here.
It is understood that the user terminal may include a smart phone, a tablet electronic device, a network set top box, a portable computer, a desktop computer, a Personal Digital Assistant (PDA), a vehicle-mounted device, a smart wearable device, etc. Wherein, intelligent wearing equipment can include intelligent glasses, intelligent wrist-watch, intelligent bracelet etc..
In practical applications, part of the communication method based on graphic modeling may be performed on the electronic device side as described above, or all operations may be performed in the client device. Specifically, the selection may be made according to the processing capability of the client device, and restrictions of the use scenario of the user. The application is not limited in this regard. If all operations are performed in the client device, the client device may further include a processor.
The client device may have a communication module (i.e. a communication unit) and may be connected to a remote server in a communication manner, so as to implement data transmission with the server. The server may include a server on the side of the task scheduling center, and in other implementations may include a server of an intermediate platform, such as a server of a third party server platform having a communication link with the task scheduling center server. The server may include a single computer device, a server cluster formed by a plurality of servers, or a server structure of a distributed device.
Fig. 9 is a schematic block diagram of a system configuration of an electronic device 9600 according to an embodiment of the present application. As shown in fig. 9, the electronic device 9600 can include a central processor 9100 and a memory 9140, the memory 9140 being coupled to the central processor 9100. It is noted that this fig. 9 is exemplary, and that other types of structures may be used in addition to or in place of the structures to implement telecommunications functions or other functions.
In one embodiment, the communication method functions based on graphical modeling may be integrated into the central processor 9100. The central processor 9100 may be configured to perform the following control:
Step S101, a protocol feature vector is built by acquiring historical protocol definition data, the protocol feature vector is transmitted into a deep learning model to generate a protocol template data set, a communication protocol general block and a logic block are extracted from the protocol template data set, a graphical protocol design interface is established to load the communication protocol general block and the logic block, drag operation of the communication protocol general block and the logic block is monitored to generate assembly connection data, a compatibility parameter matrix is calculated according to the assembly connection data, the compatibility parameter matrix is compared with a preset threshold value to generate a connection correction instruction, the assembly connection data is adjusted according to the connection correction instruction to form a protocol hierarchical structure, field attributes of the communication protocol general block and logic attributes of the logic block are read, and the field attributes, the logic attributes and the protocol hierarchical structure are written into a protocol definition file;
Step S102, calling a packing function and an unpacking function from a preset protocol serialization function library, writing the packing function and the unpacking function into the protocol definition file, reading a dynamic reference keyword table to generate a keyword mapping set, writing the keyword mapping set into the protocol definition file, calling a byte length calculation function and a check value calculation function from an algorithm function library, writing the byte length calculation function and the check value calculation function into the protocol definition file, and generating a protocol parser according to the protocol definition file;
step S103, receiving a network data stream, extracting field data from the network data stream by the protocol analyzer according to the protocol hierarchical structure, transmitting the field data into the packing function to generate a serialized data packet, extracting a target field from the serialized data packet, transmitting the target field into the check value calculation function to generate a check code, judging the check code according to a preset check rule to generate a verification mark, and writing the serialized data packet and the verification mark into a network transmission buffer area.
From the above description, it can be seen that the electronic device provided by the embodiment of the application analyzes the historical protocol features and generates the protocol template data set through the deep learning model, thereby realizing the intellectualization of the protocol design. The graphical protocol design interface is innovatively designed, the communication protocol universal block and the logic block are integrated, and the compatibility parameter matrix is introduced to realize intelligent connection correction. The system automatically generates a protocol analyzer, processes the network data flow through a serialization function library and an algorithm function library, and ensures the accuracy and reliability of data transmission. The method breaks through the limitation of the traditional manual coding and provides an efficient and visual visualization solution for the development of the communication protocol.
In another embodiment, the communication device based on graphic modeling may be configured separately from the central processor 9100, for example, the communication device based on graphic modeling may be configured as a chip connected to the central processor 9100, and the communication method function based on graphic modeling is implemented by control of the central processor.
As shown in fig. 9, the electronic device 9600 may further include a communication module 9110, an input unit 9120, an audio processor 9130, a display 9160, and a power supply 9170. It is noted that the electronic device 9600 does not necessarily include all the components shown in fig. 9, and furthermore, the electronic device 9600 may include components not shown in fig. 9, to which reference is made in the prior art.
As shown in fig. 9, the central processor 9100, sometimes referred to as a controller or operational control, may include a microprocessor or other processor device and/or logic device, which central processor 9100 receives inputs and controls the operation of the various components of the electronic device 9600.
The memory 9140 may be, for example, one or more of a buffer, a flash memory, a hard drive, a removable media, a volatile memory, a non-volatile memory, or other suitable device. The information about failure may be stored, and a program for executing the information may be stored. And the central processor 9100 can execute the program stored in the memory 9140 to realize information storage or processing, and the like.
The input unit 9120 provides input to the central processor 9100. The input unit 9120 is, for example, a key or a touch input device. The power supply 9170 is used to provide power to the electronic device 9600. The display 9160 is used for displaying display objects such as images and characters. The display may be, for example, but not limited to, an LCD display.
The memory 9140 may be a solid state memory such as Read Only Memory (ROM), random Access Memory (RAM), SIM card, etc. But also a memory which holds information even when powered down, can be selectively erased and provided with further data, an example of which is sometimes referred to as EPROM or the like. The memory 9140 may also be some other type of device. The memory 9140 includes a buffer memory 9141 (sometimes referred to as a buffer). The memory 9140 may include an application/function storage portion 9142, the application/function storage portion 9142 storing application programs and function programs or a flow for executing operations of the electronic device 9600 by the central processor 9100.
The memory 9140 may also include a data store 9143, the data store 9143 for storing data, such as contacts, digital data, pictures, sounds, and/or any other data used by an electronic device. The driver storage portion 9144 of the memory 9140 may include various drivers of the electronic device for communication functions and/or for performing other functions of the electronic device (e.g., messaging applications, address book applications, etc.).
The communication module 9110 is a transmitter/receiver that transmits and receives signals via the antenna 9111. The communication module 9110 (transmitter/receiver) is coupled to the central processor 9100 to provide input signals and receive output signals, as in the case of conventional mobile communication terminals.
Based on different communication technologies, a plurality of communication modules 9110, such as a cellular network module, a bluetooth module, and/or a wireless local area network module, etc., may be provided in the same electronic device. The communication module 9110 (transmitter/receiver) is also coupled to a speaker 9131 and a microphone 9132 via an audio processor 9130 to provide audio output via the speaker 9131 and to receive audio input from the microphone 9132 to implement usual telecommunications functions. The audio processor 9130 can include any suitable buffers, decoders, amplifiers and so forth. In addition, the audio processor 9130 is also coupled to the central processor 9100 so that sound can be recorded locally through the microphone 9132 and sound stored locally can be played through the speaker 9131.
An embodiment of the present application also provides a computer-readable storage medium capable of implementing all steps in the graph modeling-based communication method in which the execution subject is a server or a client, the computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements all steps in the graph modeling-based communication method in which the execution subject is a server or a client, for example, the processor implements the steps of:
Step S101, a protocol feature vector is built by acquiring historical protocol definition data, the protocol feature vector is transmitted into a deep learning model to generate a protocol template data set, a communication protocol general block and a logic block are extracted from the protocol template data set, a graphical protocol design interface is established to load the communication protocol general block and the logic block, drag operation of the communication protocol general block and the logic block is monitored to generate assembly connection data, a compatibility parameter matrix is calculated according to the assembly connection data, the compatibility parameter matrix is compared with a preset threshold value to generate a connection correction instruction, the assembly connection data is adjusted according to the connection correction instruction to form a protocol hierarchical structure, field attributes of the communication protocol general block and logic attributes of the logic block are read, and the field attributes, the logic attributes and the protocol hierarchical structure are written into a protocol definition file;
Step S102, calling a packing function and an unpacking function from a preset protocol serialization function library, writing the packing function and the unpacking function into the protocol definition file, reading a dynamic reference keyword table to generate a keyword mapping set, writing the keyword mapping set into the protocol definition file, calling a byte length calculation function and a check value calculation function from an algorithm function library, writing the byte length calculation function and the check value calculation function into the protocol definition file, and generating a protocol parser according to the protocol definition file;
step S103, receiving a network data stream, extracting field data from the network data stream by the protocol analyzer according to the protocol hierarchical structure, transmitting the field data into the packing function to generate a serialized data packet, extracting a target field from the serialized data packet, transmitting the target field into the check value calculation function to generate a check code, judging the check code according to a preset check rule to generate a verification mark, and writing the serialized data packet and the verification mark into a network transmission buffer area.
As can be seen from the above description, the computer readable storage medium provided by the embodiments of the present application achieves the intellectualization of protocol design by analyzing the historical protocol features and generating the protocol template data set through the deep learning model. The graphical protocol design interface is innovatively designed, the communication protocol universal block and the logic block are integrated, and the compatibility parameter matrix is introduced to realize intelligent connection correction. The system automatically generates a protocol analyzer, processes the network data flow through a serialization function library and an algorithm function library, and ensures the accuracy and reliability of data transmission. The method breaks through the limitation of the traditional manual coding and provides an efficient and visual visualization solution for the development of the communication protocol.
The embodiments of the present application also provide a computer program product capable of implementing all the steps in the graph modeling-based communication method in which the execution subject is a server or a client, the computer program/instructions implementing the steps of the graph modeling-based communication method when being executed by a processor, for example, the computer program/instructions implementing the steps of:
Step S101, a protocol feature vector is built by acquiring historical protocol definition data, the protocol feature vector is transmitted into a deep learning model to generate a protocol template data set, a communication protocol general block and a logic block are extracted from the protocol template data set, a graphical protocol design interface is established to load the communication protocol general block and the logic block, drag operation of the communication protocol general block and the logic block is monitored to generate assembly connection data, a compatibility parameter matrix is calculated according to the assembly connection data, the compatibility parameter matrix is compared with a preset threshold value to generate a connection correction instruction, the assembly connection data is adjusted according to the connection correction instruction to form a protocol hierarchical structure, field attributes of the communication protocol general block and logic attributes of the logic block are read, and the field attributes, the logic attributes and the protocol hierarchical structure are written into a protocol definition file;
Step S102, calling a packing function and an unpacking function from a preset protocol serialization function library, writing the packing function and the unpacking function into the protocol definition file, reading a dynamic reference keyword table to generate a keyword mapping set, writing the keyword mapping set into the protocol definition file, calling a byte length calculation function and a check value calculation function from an algorithm function library, writing the byte length calculation function and the check value calculation function into the protocol definition file, and generating a protocol parser according to the protocol definition file;
step S103, receiving a network data stream, extracting field data from the network data stream by the protocol analyzer according to the protocol hierarchical structure, transmitting the field data into the packing function to generate a serialized data packet, extracting a target field from the serialized data packet, transmitting the target field into the check value calculation function to generate a check code, judging the check code according to a preset check rule to generate a verification mark, and writing the serialized data packet and the verification mark into a network transmission buffer area.
From the above description, it can be seen that the computer program product provided by the embodiment of the present application achieves the intellectualization of protocol design by analyzing the historical protocol features and generating the protocol template data set through the deep learning model. The graphical protocol design interface is innovatively designed, the communication protocol universal block and the logic block are integrated, and the compatibility parameter matrix is introduced to realize intelligent connection correction. The system automatically generates a protocol analyzer, processes the network data flow through a serialization function library and an algorithm function library, and ensures the accuracy and reliability of data transmission. The method breaks through the limitation of the traditional manual coding and provides an efficient and visual visualization solution for the development of the communication protocol.
It will be apparent to those skilled in the art that embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (devices), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While the principles and embodiments of the present invention have been described in detail in the foregoing application of the principles and embodiments of the present invention, the above examples are provided for the purpose of aiding in the understanding of the principles and concepts of the present invention and may be varied in many ways by those of ordinary skill in the art in light of the teachings of the present invention, and the above descriptions should not be construed as limiting the invention.