CN103514033A - Function calling method of network equipment - Google Patents

Function calling method of network equipment Download PDF

Info

Publication number
CN103514033A
CN103514033A CN201310420110.9A CN201310420110A CN103514033A CN 103514033 A CN103514033 A CN 103514033A CN 201310420110 A CN201310420110 A CN 201310420110A CN 103514033 A CN103514033 A CN 103514033A
Authority
CN
China
Prior art keywords
function
network equipment
address
calling
attribute information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Withdrawn
Application number
CN201310420110.9A
Other languages
Chinese (zh)
Inventor
李鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
TIANJIN CP-WORLD INFORMATION TECHNOLOGY Co Ltd
Original Assignee
TIANJIN CP-WORLD INFORMATION TECHNOLOGY Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by TIANJIN CP-WORLD INFORMATION TECHNOLOGY Co Ltd filed Critical TIANJIN CP-WORLD INFORMATION TECHNOLOGY Co Ltd
Priority to CN201310420110.9A priority Critical patent/CN103514033A/en
Publication of CN103514033A publication Critical patent/CN103514033A/en
Withdrawn legal-status Critical Current

Links

Images

Landscapes

  • Computer And Data Communications (AREA)

Abstract

The invention provides a function calling method of network equipment. The method includes the following steps of function table generation, function calling instruction issuing, function calling instruction analysis, function address obtaining, pointer variable assignment and function calling. In the function table generation step, a function table enabling function attribute information of the network equipment to correspond to address information of the network equipment in a one-to-one mode is generated in the starting process of systems of the network equipment. In the function calling instruction issuing step, function calling instructions are issued through a user interface. In the function calling instruction analysis step, the instructions issued in the function calling instruction issuing step are analyzed, and the function attribute information related to function calling is extracted from analysis results. In the function address obtaining step, according to the function attribute information extracted in the function calling instruction analysis step, a function address corresponding to the extracted function attribute information is found out based on the function table. In the pointer variable assignment step, a prior stated pointer variable is assigned to the function address obtained in the function address obtaining step. In the function calling step, the corresponding function is called through calling of the pointer variable. According to the method, high normalization is performed on different function calling processes, and workload and maintenance cost in network equipment development are reduced effectively.

Description

The function calling method of the network equipment
Technical field
The present invention relates to a kind of function calling method, relate in particular to the function calling method in a kind of network equipment exploitation or debugging.
Background technology
Current, the development of network technology and service is very fast, and daily life has be unable to do without network.Development along with technology and epoch, people are more and more to the functional requirement of the network equipment, become increasingly complex, and make the function of the network equipment also corresponding more and more diversified and complicated, cause the maintenance difficulties of the network equipment to become more and more higher, debugging and maintenance cost are also more and more higher.
In network equipment performance history, conventionally can directly call by special debugging acid (such as GDB, the program debugging tool under UNIX) certain function of source code.But, therefore in the plant maintenance stage, conventionally there is no debugging acid, need in advance the function that may use be packaged into certain interface, by CLI(dos command line DOS interface) or WEB interface call this interface, so just called the function that need to call.In prior art, no matter adopt CLI(dos command line DOS interface) or WEB interface, its basic ideas are all similar, the function that may call is in advance encapsulated, having 10 functions to call just has 10 interfaces, there are 100 functions to call and just have 100 interfaces, then by user interfaces such as CLI or WEB, send instruction and call concrete interface, thereby allow function really be carried out.
There is following defect in the function calling method of above-mentioned prior art.For example, if corresponding function is not packaged into certain interface, just cannot remove to call related function by user interfaces such as CLI or WEB.Another defect of prior art is, if possible can call 100 functions, will do 100 interfaces, if there are 10,000, workload will be very huge so, safeguards also difficult.In addition, owing to can not predicting on earth to call how many functions, therefore way is that conventional function is encapsulated conventionally, once but when occurring calling some not too conventional function, therefore owing to not encapsulating, just cannot call function.
Summary of the invention
The present invention proposes in view of the above problems, its objective is the function calling method that a kind of network equipment is provided, by this method, can call arbitrary function, not only solve some function and may there is no the problem encapsulating, do not need to encapsulate a large amount of interfaces, reduced workload and maintenance cost simultaneously yet.
According to an aspect of the present invention, a kind of function calling method of the network equipment, comprising following steps:
Function table generates step, in the system starting process of the described network equipment, generates the function attribute information of the described network equipment and address information have been set up to function table one to one;
Step is sent in function call instruction, by user interface, sends function call instruction;
Function call instruction analyzing step, resolves the instruction issuing in step is sent in described function call instruction, therefrom extracts function and calls relevant described function attribute information;
Function address obtaining step, according to the described function attribute information extracting in described function call instruction analyzing step, finds out with extracted function attribute information and has set up corresponding function address with reference to described function table;
Pointer variable assignment step, is assigned to a pointer variable for statement in advance to the function address obtaining in described function address obtaining step; With
Function call step, calls corresponding function by calling described pointer variable.In addition, according to the function calling method of the above-mentioned network equipment of the present invention, at described function table, generate in step, by analyzing the image file moving in network equipment development system, thereby from this document, extract and obtain all function attribute informations.
In addition, according to the function calling method of the above-mentioned network equipment of the present invention, in above-mentioned function call instruction analyzing step, can resolve the instruction issuing in step is sent in described function call instruction, therefrom extract the title of described function and the information of input parameter.
In addition, according to the function calling method of the above-mentioned network equipment of the present invention, described function attribute information can be function name and address information.
In addition, according to the function calling method of the above-mentioned network equipment of the present invention, described pointer variable can be variable element pointer variable.
In addition, according to the function calling method of the above-mentioned network equipment of the present invention, described function can be a plurality of.
Invention effect
Function calling method of the prior art need to be encapsulated the function that may call in advance, there are how many functions will call the interface that just must prepare corresponding number, by user interfaces such as CLI or WEB, send instruction again and call concrete interface, cause the production of the network equipment and debugging work load huge.
Based on function calling method of the present invention, different functions can have been carried out to the normalization of height, thereby realize, can call arbitrary function, not only having solved some function may not have the problem encapsulating, do not need to encapsulate a large amount of interfaces, effectively reduced workload and maintenance cost simultaneously yet.Further, solved in the situation that function corresponding in prior art is not packaged into interface cannot call function problem.
Accompanying drawing explanation
Fig. 1 is the schematic diagram of the function calling method in network equipment exploitation of the prior art;
Fig. 2 is the schematic diagram according to normalized function calling method of the present invention;
Fig. 3 is according to the process flow diagram of the concrete steps of the normalized function calling method of the preferred embodiment of the present invention.
Embodiment
For making the object, technical solutions and advantages of the present invention more cheer and bright, below in conjunction with embodiment and with reference to accompanying drawing, the present invention is described in more detail.Should be appreciated that, these descriptions are exemplary, and do not really want to limit the scope of the invention.In addition, in the following description, omitted the description to known features and technology, to avoid unnecessarily obscuring concept of the present invention.
Fig. 1 is the schematic diagram of function calling method of the network equipment of prior art.
As shown in Figure 1, the function of take describes as example, in the network equipment of prior art, if want by user interface call function, need to, by the function of using, by corresponding interface encapsulation, get up in advance, for example function 1 use interface 1 encapsulation, function 2 use interface 2 encapsulation, etc., make each function corresponding one by one with corresponding interface.When needs call certain function, just by the user interface of CLI or WEB and so on, call the interface that this function is corresponding, thereby call this function.For example, if need call function 2, just need to carry out call function 2 by calling interface 2.
The major defect of this function calling method is, take in the above-mentioned function calling method that function is example, only can call function 1 by interface 1, cannot call function 2, and equally only can call function 2 by interface 2, can not call function 1.If certain function is not encapsulated into corresponding interface in advance, for example function 3 does not have corresponding interface, in the use procedure of equipment, cannot call this function by user interfaces such as CLI or WEB.
As a result, another defect causing is exactly the encapsulation of function and to call workload huge, has 10 functions to call and just has 10 interfaces, and having 100 functions to call just has 100 interfaces.
Fig. 2 has shown the schematic diagram of function calling method of the network equipment of the preferred embodiment of the present invention.
As shown in Figure 2, as a rule, the image file that the network equipment using is at present used is all that ELF form (can be carried out linking format, a kind of executable file format under linux system) file, the various information of source code in this document, have conventionally been preserved, such as the detailed function information such as line number that comprise function name, function address (function operation Shi address) and function place file.
In method of the present invention, when the network equipment need to call certain function, by the function address to certain function, define the pointer of the sensing function of a variable ginseng, just can realize function call.Therefore, adopt method of the present invention, only by function name and function address, just can realize function call, and need not in advance function be packaged into corresponding interface.
Fig. 3 has shown the process flow diagram of the function calling method of the network equipment of the present invention.
In the present embodiment, take and call two functions and describe as example, for example function 1 and function 2, but method of the present invention is not restricted to this, but go for the calling of function of any amount.
As shown in Figure 3, the function calling method of the preferred embodiment of the present invention comprises the steps:
Step S10, obtains function information.
After the system of the network equipment starts, by the image file of the ELF form of operation is analyzed, from the source code of this document, extract relevant information.In the present invention, obtain the information of all functions, comprise function name and function address.In a preferred embodiment of the invention, function name (Func1 or Func2) and the function address of function 1 and function 2 have for example been obtained respectively.
Step S11, generating function table.
As mentioned above, after getting all function names and function address information, the function name obtaining based on this and function address generating function table, set up one-to-one relationship by all function names and function address in this function table, prepare against the follow-up use of searching, as shown in table 1.
Table 1
Sequence number Title Address
1 Function name 1 Function address 1
2 Function name 2 Function address 2
Step S12, sends function call instruction.
In step S12, under the user interfaces such as CLI or WEB, send function name and the parameter information that will call.As example, following two functions (Func1 and Func2) have been enumerated, the parameter information of inclusion function title in the message of sending by user interfaces such as CLI or WEB (Func1 or Func2) and these two functions enters ginseng (input parameter, such as a=100, b=200).By the way, for the ease of understanding, illustrated function is very simple herein, and Func1 enters ginseng by two exactly and is added and then prints, and function F unc2 enters first exactly ginseng and deducts 100 and print.
Figure BDA0000381791570000051
Step S13, analytical function call instruction.
In step S13, parse the instruction issuing in step S12, therefrom extract concrete attribute information, particularly obtain function name and input parameter.For above-named function, function name Func1, Func2 and two input parameters 100,200 have been obtained exactly.
Step S14, obtains function address.
Only, based on the direct call function of function name, need to be addressed to corresponding function address according to function name.In step S14, by the function table generating, carry out to search can get the corresponding function address of certain concrete function name (with reference to above-mentioned table 1) in above-mentioned steps S11.As mentioned above, in the function table generating in step S11, one-to-one relationship has been set up in function name function address, by contrasting this function table, can obtain the corresponding function address of certain concrete function name.In the present embodiment, the function name 1 illustrating is Func1, and its corresponding function address is 0x8123456, and function name 2 is Func2, and its corresponding address is 0x12345678.Shown in table 2 specific as follows.
Table 2
Sequence number Function name Address
1 Fun1 0x8123456
2 Fun2 0x12345678
Step S15, generating function pointer variable.
After getting function address, need to generate the pointer variable of pointing to this function address, so that can call function.In step S15, need to generate the function pointer that points to function address.For example, in the present embodiment, stated a function pointer variable pfunc:
typedefvoid(*pfunc)(__VA_ARGS__)
Wherein _ _ VA_ARGS__ shows that parameter is variable.
Step S16, to function pointer variable assignments.
Particularly, in step S16, by the function address assignment finding in step S14 to function pointer variable pfunc, such as:
Pfunc=0x8123456 or pfunc=0x12345678
Then, in step S17, call function pointer.
In step S17, by direct call function pointer, just can call corresponding function.For example,, if call function Func1 just can realize by calling pointer pfunc (100,200), if call function Func2 just can realize by calling pointer pfunc (100).
As mentioned above, according to function calling method of the present invention, encapsulate under the prerequisite of corresponding interface not needing, having completed the example as function is calling of function.From above-mentioned detailed process, function calling method of the present invention has carried out the normalization of height by calling different functions, do not need as the function calling method of prior art, the function that may call is in advance encapsulated, there are how many each and every one functions will call the interface that just must prepare corresponding number, by user interfaces such as CLI or WEB, send instruction again and call concrete interface, avoided the huge problem of workload often occurring in prior art.And, also solved in the situation that function corresponding in prior art is not packaged into interface cannot call function problem.In a word, effectively reduce workload, and maintenance cost.
With reference to embodiments of the invention, the present invention has been given to explanation above.But these embodiment are only used to the object of explanation, and are not intended to limit the scope of the invention.Scope of the present invention is limited by claims and equivalent thereof.Do not depart from the scope of the present invention, those skilled in the art can make a variety of substitutions and modifications, and these substitutions and modifications all should fall within the scope of the present invention.

Claims (6)

1. a function calling method for the network equipment, comprises the steps:
Function table generates step, in the system starting process of the described network equipment, generates the function attribute information of the described network equipment and address information have been set up to function table one to one;
Step is sent in function call instruction, by user interface, sends function call instruction;
Function call instruction analyzing step, resolves the instruction issuing in step is sent in described function call instruction, therefrom extracts function and calls relevant described function attribute information;
Function address obtaining step, according to the described function attribute information extracting in described function call instruction analyzing step, finds out with extracted function attribute information and has set up corresponding function address with reference to described function table;
Pointer variable assignment step, is assigned to a pointer variable for statement in advance to the function address obtaining in described function address obtaining step; With
Function call step, calls corresponding function by calling described pointer variable.
2. the function calling method of the network equipment according to claim 1, wherein,
At described function table, generate in step, by analyzing the image file moving in network equipment development system, thereby from this document, extract and obtain all function attribute informations in image file, and generating function table.
3. the function calling method of the network equipment according to claim 1, wherein, in above-mentioned function call instruction analyzing step, the instruction issuing in step is sent in described function call instruction is resolved, therefrom extract the information of described function name and input parameter.
4. the function calling method of the network equipment according to claim 2, wherein, described function attribute information inclusion function title and address information.
5. according to the function calling method of the network equipment described in any one in claim 1~3, wherein, described pointer variable is variable element pointer variable.
6. according to the function calling method of the network equipment described in any one in claim 1~4, wherein, described function is a plurality of.
CN201310420110.9A 2013-09-13 2013-09-13 Function calling method of network equipment Withdrawn CN103514033A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310420110.9A CN103514033A (en) 2013-09-13 2013-09-13 Function calling method of network equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310420110.9A CN103514033A (en) 2013-09-13 2013-09-13 Function calling method of network equipment

Publications (1)

Publication Number Publication Date
CN103514033A true CN103514033A (en) 2014-01-15

Family

ID=49896806

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310420110.9A Withdrawn CN103514033A (en) 2013-09-13 2013-09-13 Function calling method of network equipment

Country Status (1)

Country Link
CN (1) CN103514033A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110245027A (en) * 2018-09-21 2019-09-17 浙江大华技术股份有限公司 A kind of method and apparatus of interprocess communication
WO2023165307A1 (en) * 2022-03-01 2023-09-07 阿里巴巴(中国)有限公司 Function calling method and apparatus

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110245027A (en) * 2018-09-21 2019-09-17 浙江大华技术股份有限公司 A kind of method and apparatus of interprocess communication
CN110245027B (en) * 2018-09-21 2024-05-14 浙江大华技术股份有限公司 Inter-process communication method and device
WO2023165307A1 (en) * 2022-03-01 2023-09-07 阿里巴巴(中国)有限公司 Function calling method and apparatus

Similar Documents

Publication Publication Date Title
US20150089415A1 (en) Method of processing big data, apparatus performing the same and storage media storing the same
CN110502520B (en) Method, system and equipment for data warehousing and computer readable storage medium
CN112162915A (en) Test data generation method, device, equipment and storage medium
CN102915344B (en) SQL (structured query language) statement processing method and device
CN108664665A (en) Data format method for transformation, device, equipment and readable storage medium storing program for executing
CN111427784B (en) Data acquisition method, device, equipment and storage medium
CN114064601B (en) Storage process conversion method, device, equipment and storage medium
CN110769002A (en) LabVIEW-based message analysis method, system, electronic device and medium
CN106162576B (en) Mobile terminal network flow display method and device
CN114021156A (en) Method, device and equipment for organizing vulnerability automatic aggregation and storage medium
CN107977419B (en) Nuclear power station DCS operation and maintenance support file identification method and system
CN113760242B (en) Data processing method, device, server and medium
CN103514033A (en) Function calling method of network equipment
CN113296752A (en) Method, system, device and storage medium for generating API document
CN111488286A (en) Method and device for independently developing Android module
CN103914304B (en) Method for converting different structure type parameters on basis of SAP (service access point) platforms
CN108984221B (en) Method and device for acquiring multi-platform user behavior logs
CN115291938A (en) Component configuration method and system for electronic evidence analysis
CN114116712A (en) Extended field processing method and device, electronic equipment and storage medium
CN107977304B (en) System debugging method and device
CN114996758A (en) Data desensitization method and device and electronic equipment
CN114022279A (en) Service data error correction method, device, equipment and readable storage medium
CN111143398B (en) Extra-large set query method and device based on extended SQL function
CN109284097B (en) Method, device, system and storage medium for realizing complex data analysis
CN111459608A (en) Application system deployment method and device, computer equipment and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
WW01 Invention patent application withdrawn after publication
WW01 Invention patent application withdrawn after publication

Application publication date: 20140115