CN1274119C - Method for dynamic modifying one-board IP address and sub-net mask address - Google Patents
Method for dynamic modifying one-board IP address and sub-net mask address Download PDFInfo
- Publication number
- CN1274119C CN1274119C CNB021600627A CN02160062A CN1274119C CN 1274119 C CN1274119 C CN 1274119C CN B021600627 A CNB021600627 A CN B021600627A CN 02160062 A CN02160062 A CN 02160062A CN 1274119 C CN1274119 C CN 1274119C
- Authority
- CN
- China
- Prior art keywords
- address
- veneer
- socket
- subnet mask
- revise
- 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.)
- Expired - Fee Related
Links
Images
Landscapes
- Small-Scale Networks (AREA)
Abstract
The present invention relates to a method for dynamically modifying a single plate IP address and a subnet mask code address. A PNA module for supporting a Socket standard interface under a Psos operation system is used in order to convert a static modification mode of the modification of an IP address into a dynamic modification mode. A single plate IP address and a subnet mask code address are dynamically modified by transferring an ioctl function according to the following steps: a system structure is defined; the system structure which is well defined is cleared; a Socket identifier is obtained; the system structure is evaluated; the ioctl function is invoked to modify parameters of a single plate; the Socket identifier is closed. Compared with the traditional mode for statically modifying an IP address, the method for dynamically modifying the IP address has the maximal advantages that the single plate does not need to be restarted by the present invention, the time for starting the single plate can be saved, the life of the single plate is extended, the modification real-time property of the IP address is enhanced, and the influence of the modification of the IP address on other modules is reduced.
Description
Technical field
The present invention relates to network communication field, more particularly, relate to a kind of method that on-the-fly modifies veneer IP (Internet protocol) address or subnet mask address.
Background technology
General program is that the value that will revise is composed global variable to program, rerun routine then for the modification of IP address and subnet mask address.If rerun routine then when terminal shows that IP address and subnet mask address have been revised, is not in fact really finished modification.The simplest phenomenon can also continue debugging exactly in debugging enironment, because when with single board communication and when debugging, the debugging enironment of main frame is associated with veneer IP address, if veneer IP address modification, getting in touch also of main frame and veneer should disconnect so, just can not operate veneer again,, illustrate that then veneer IP address does not change if in debugging enironment, can also continue debugging.In addition, use ' ping ' order that carries in the Windows operating system that ping bag in IP address is checked, can find out whether contact is interrupted.
As seen, though prior art has been revised veneer IP address, need restart and to use this IP address, so the modification of this IP address is actually a kind of modification of static state, and the user has often forgotten and has restarted, and causes the IP address not revised in fact.In addition,, adopt above-mentioned static alter mode then all will restart at every turn, make operating efficiency reduce greatly if the user need repeatedly revise the IP address.
Summary of the invention
The technical problem to be solved in the present invention is, above-mentioned defective at prior art, a kind of method that on-the-fly modifies veneer IP address and subnet mask address is provided, the modification of IP address become by static alter mode on-the-fly modify mode, make to need not to restart the IP address that just can revise veneer.
The technical solution adopted for the present invention to solve the technical problems is: a kind of method that on-the-fly modifies veneer IP address and subnet mask address, wherein, utilize the network communication module of supporting the Socket standard interface in the embedded OS, by calling the ioctl function, dynamically revise veneer IP address or subnet mask address according to the following steps: system configuration is defined; To the system configuration zero clearing that has defined; Obtain the Socket identifier; System configuration is carried out assignment; Call the ioctl function and revise the IP address or the subnet mask address of veneer; Close Socket.
In method of the present invention, described embedded OS can be Psos (real time operating system), and described network communication module is PNA (Psos network components) module in the Psos operating system.
In method of the present invention, described ioctl function has three parameters, and described parameter is the pointer of described Socket identifier, operating parameter and described system interface structure.
In method of the present invention, described operating parameter is ' SIOCSIFADDR ' or ' SIOCSIFNETMASK '; If operating parameter is ' SIOCSIFADDR ', then revise described veneer IP address; If operating parameter is ' SIOCSIFNETMASK ', then revise described veneer subnet mask address.
Revise the traditional approach of IP address compares with static state, the benefit that on-the-fly modifies IP address maximum just is that it need not to restart veneer, can save the time that veneer spent that starts, prolong the life-span of veneer, and make the modification real-time of IP address, also reduce the IP address and revise influence other module.
Description of drawings
The invention will be further described below in conjunction with drawings and Examples, in the accompanying drawing:
Fig. 1 is the flow chart of the inventive method.
Embodiment
In order to realize such scheme, can adopt Psos operating system among the present invention, this is a kind of embedded OS, is different from the normal operations system, and it has been embedded in the veneer, and running software is based on this system; Embedded OS electronics automatically control, circuit design, we can say that so long as be embedded with the machine (generally being a circuit board) of high-speed CPU use is all arranged, such as PDA.Psos operating system is divided into six main modular according to functional structure, each module is only at its pairing process field, computing unit such as dedicated calculation, be specifically designed to the debugging unit of debugging, PNA module wherein is the unit that is specifically designed to network communication in the Psos operating system, comprises the assembly of network enabled communication among all Psos.About the Psos system configuration, be exactly some structures that system combines with service software for operation, can be understood as the part of Psos system, be similar to the system file that uses in the Windows system, correctly revise this document and can be optimized configuration system.
To dynamically revise IP address and subnet mask address, need directly hardware interface to be operated, adopt the ioctl function to realize on-the-fly modifying among the present invention to IP address and subnet mask address, ioctl is an input in the Socket interface, the function of output function, and it is a very powerful function.Simultaneously, adopt the PNA module (ICP/IP protocol module just) of Psos operating system to support the Socket interface standard among the present invention, just support this ioctl function.About the Socket interface standard, the original meaning of Socket is the meaning of socket, interface, understanding simply is exactly an intermediate layer on bottom and upper strata, bottom software and upper layer software (applications) are all write separately code according to unified standard when software development, when such two softwares merge, just need not to have debugged again.What write among the present invention is exactly top section, and bottom software has been finished according to the unified standard of Socket by the producer of Psos operating system.But when using its interface, what need the differentiation use is the function of Socket standard, simultaneously also a plurality of Socket may appear, in order to distinguish different situations, will use Socket sign, it obtains by the Socket function (being exactly socket function of the same name) of standard, obtains the back and just must be with this to identify as parameter calling the Socket function at every turn, system will know some Socket are being operated, rather than other Socket is operated.
Realize method of the present invention, need utilize some system configuration and the general Socket interface function of bottom of Psos operating system.
The flow process of the inventive method as shown in Figure 1, its process comprises:
(1) system configuration is defined, use the operating system of embedded OS among the present invention as veneer, operating system is actual to be the platform of a running software, it has the different function of each self-supporting of a plurality of modules, must have the part or the module of network enabled, the mode of network support and operation can be by user's modification, and system configuration is exactly a platform of user's modification, and the present invention reaches the purpose of revising network by the parameter of revising this platform;
(2) the system configuration zero clearing to having defined, just the initialization system structure avoids being subjected to other influence;
(3) obtain the Socket identifier;
(4) system configuration is carried out assignment, just revise corresponding system configuration, revise the attribute of embedded OS network configuration;
(5) call the parameter that the ioctl function is revised veneer;
(6) close Socket then, finish and once revise action.
The key component of this method is noticed that the system configuration of interface must have corresponding assignment before this, otherwise is that success will follow ' calling the parameter that the ioctl function is revised veneer '.Call the ioctl function then and can revise the parameter of veneer, the ioctl function with three parameters be the pointer of Socket identifier, operating parameter and system interface structure successively.If operating parameter is ' SIOCSIFADDR ', then the function of whole function call is exactly directly to revise the IP address; If operating parameter is ' SIOCSIFNETMASK ', then the function of whole function call is exactly directly to revise the subnet mask address.
The Psos system can not find that when the using system interface structure parameter that it needs has been changed, and will set up TCP/IP according to new parameter during communication and connect, and so just equals to have on-the-fly modified IP address and subnet mask address.
Debugging acid it should be noted that debugging acid is to be familiar with veneer with the IP address, so after the modification of IP address, will think that corresponding veneer has not existed, so debugging acid can lose connection.But this veneer will use new IP address when connecting with the outside.The processing method that common static state is revised is quite different, and system interface is not modified, and oneself is original IP address so veneer is still thought, has only when veneer restarts by the time, just can revise during the one-writing system interface parameters again.
Among the present invention, what use at the modification of IP address is the SIOCSIFADDR command word, and what use at the modification of subnet mask address is the SIOCSIFNETMASK command word.Directly port is operated by calling the ioctl system function, when calling this function in the main program, the input parameter BoardIP address of function, the value of BoardSubIP address will directly be revised IP address value and subnet mask address value.Revise the traditional approach of IP address compares with static state, the benefit that on-the-fly modifies IP address maximum just is that it need not to restart veneer, can save the time that veneer spent that starts, prolong the life-span of veneer, and make the modification real-time of IP address, also reduce the IP address and revise influence other module.
Claims (4)
1, a kind of method that on-the-fly modifies veneer IP address and subnet mask address, it is characterized in that, utilize the network communication module of supporting the Socket standard interface in the embedded OS,, dynamically revise veneer IP address or subnet mask address according to the following steps by calling the ioctl function:
System configuration is defined;
To the system configuration zero clearing that has defined;
Obtain the Socket identifier;
System configuration is carried out assignment;
Call the ioctl function and revise the IP address or the subnet mask address of veneer;
Close Socket.
2, method according to claim 1 is characterized in that, described embedded OS is the Psos real time operating system, and described network communication module is the Psos network components PNA module in the Psos operating system.
3, method according to claim 2 is characterized in that, described ioctl function has three parameters, and described parameter is the pointer of described Socket identifier, operating parameter and described system interface structure.
4, method according to claim 3 is characterized in that, described operating parameter is ' SIOCSIFADDR ' or ' SIOCSIFNETMASK '; If operating parameter is ' SIOCSIFADDR ', then revise described veneer IP address; If operating parameter is ' SIOCSIFNETMASK ', then revise described veneer subnet mask address.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNB021600627A CN1274119C (en) | 2002-12-26 | 2002-12-26 | Method for dynamic modifying one-board IP address and sub-net mask address |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNB021600627A CN1274119C (en) | 2002-12-26 | 2002-12-26 | Method for dynamic modifying one-board IP address and sub-net mask address |
Publications (2)
Publication Number | Publication Date |
---|---|
CN1510877A CN1510877A (en) | 2004-07-07 |
CN1274119C true CN1274119C (en) | 2006-09-06 |
Family
ID=34237743
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CNB021600627A Expired - Fee Related CN1274119C (en) | 2002-12-26 | 2002-12-26 | Method for dynamic modifying one-board IP address and sub-net mask address |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN1274119C (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7738484B2 (en) * | 2004-12-13 | 2010-06-15 | Intel Corporation | Method, system, and apparatus for system level initialization |
US8412207B2 (en) | 2006-12-21 | 2013-04-02 | Core Wireless Licensing S.A.R.L. | Method of providing a mobility service |
CN107832096A (en) * | 2017-09-29 | 2018-03-23 | 五八有限公司 | URL collocation method and terminal |
CN114697293B (en) * | 2022-03-30 | 2023-11-10 | 西安北方华创微电子装备有限公司 | Data transmission method, lower computer and controller |
-
2002
- 2002-12-26 CN CNB021600627A patent/CN1274119C/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
CN1510877A (en) | 2004-07-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7797449B2 (en) | Virtual endpoint | |
CN1280726C (en) | Virtual machine for embedded systemic software development | |
CA2600503C (en) | Method and system for executing a container-managed application on a processing device | |
CN1825283A (en) | Method for implementing hardware image starting optimizing of embedded operating system | |
US20210191780A1 (en) | Method and apparatus for processing development machine operation task, device and storage medium | |
CN100351785C (en) | Method for debuging embedded system and equipment | |
CN1904842A (en) | Apparatus and method of CMOS parameter setting and maintaining | |
CN1916861A (en) | Method for modifying configuration information of computer | |
CN1274119C (en) | Method for dynamic modifying one-board IP address and sub-net mask address | |
CN100339848C (en) | Method for automatic configuration or restoring of computer system network configuration | |
CN1308278A (en) | IP fault-tolerant method for colony server | |
CN1226028A (en) | Component-based control structure for wireless communication | |
CN1801086A (en) | Equipment support implementing method applied in Java operation system | |
US20090276527A1 (en) | Light Weight Process Abstraction For Distributed Systems | |
CN1315078C (en) | A method for acquiring BIOS information through remote configuration | |
CN1741404A (en) | Method for negat main spare board in communication equipment | |
CN1282921C (en) | Drive program strengthening method for inserting operation system | |
CN113157351B (en) | Voice plug-in construction method for quickly calling form tool | |
CN113485687A (en) | Rapid building method and system based on ICE distributed cross-language application | |
CN1173261C (en) | Method of operating netcard nucleus driving program under user's mode | |
CN1731317A (en) | The instrument keyboard controller of compatible with standard computer keyboard | |
CN111651147B (en) | Method for quickly building assembly by system | |
CN1258155C (en) | Method for replacing functions of system function in operating system | |
CN100350809C (en) | Portable electronic equipment and method for managing electrical source | |
CN1369762A (en) | Dual-purpose computer keyboard and its method for automatically detecting interface state |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20060906 Termination date: 20141226 |
|
EXPY | Termination of patent right or utility model |