TWI428765B - Electronic system and method thereof capable of sharing application configurations - Google Patents
Electronic system and method thereof capable of sharing application configurations Download PDFInfo
- Publication number
- TWI428765B TWI428765B TW97131181A TW97131181A TWI428765B TW I428765 B TWI428765 B TW I428765B TW 97131181 A TW97131181 A TW 97131181A TW 97131181 A TW97131181 A TW 97131181A TW I428765 B TWI428765 B TW I428765B
- Authority
- TW
- Taiwan
- Prior art keywords
- application
- electronic system
- configuration parameters
- data structure
- configuration
- Prior art date
Links
Landscapes
- Stored Programmes (AREA)
Description
本發明涉及電腦技術,尤其涉及一種可共享應用程式配置參數的電子系統。 The present invention relates to computer technology, and more particularly to an electronic system that can share application configuration parameters.
在程式開發中經常使用延伸標記語言(eXtensible Markup Language,XML)來存貯配置參數(configuration),應用程式調用XML解析庫或利用其解析函數,來解析自已的XML格式的配置文件,以生成配置樹。這方法既簡單又直觀,因此已被廣泛採用。 In the program development, the eXtensible Markup Language (XML) is often used to store configuration parameters. The application calls the XML parsing library or uses its parsing function to parse the configuration file of its own XML format to generate the configuration. tree. This method is simple and intuitive and has been widely adopted.
但是在實踐中應用程式(application)彼此之間、或應用程式與作業系統(operating system)內核(kernel)之間在需要共用配置時,用現有的方法難以完成。詳細情形請參照圖1,記憶體100中包含了用戶空間(user space)及內核空間(kernel space)。應用程式群組10a~10b及記錄配置參數的文件12皆設置於用戶空間;而內核程式位於內核空間。任何的應用程式要存取其配置參數時,會從解析文件12的XML內容以取得配置參數,並依據XML格式的內容中各配置參數的結構關係以建立配置參數的關係樹,或稱為配置樹,例如圖1中的配置樹11a~11c。而配置參數關係樹中的每一個節點記錄配置參數的值。應用程式會將配置參數關係樹設置於記憶體100中其應用程式本身可以存取的位置,而其它的應用程式則不知道其位置,也沒有權限可以存取。這樣會造成各配置樹內的參數值難以同步,也難在程式之間共享。 However, in practice, applications are difficult to complete with existing methods when they need to share a configuration between each other, or between an application and an operating system kernel. For details, please refer to FIG. 1. The memory 100 includes a user space and a kernel space. The application groups 10a-10b and the file 12 for recording configuration parameters are all set in the user space; the kernel program is located in the kernel space. When any application wants to access its configuration parameters, it will parse the XML content of the file 12 to obtain the configuration parameters, and according to the structural relationship of each configuration parameter in the content of the XML format to establish a relationship tree of configuration parameters, or configuration Trees, such as configuration trees 11a-11c in Figure 1. Each node in the configuration parameter relationship tree records the value of the configuration parameter. The application sets the configuration parameter relationship tree to a location in the memory 100 that the application itself can access, while other applications do not know their location and have no access rights. This will make the parameter values in each configuration tree difficult to synchronize, and it is difficult to share between programs.
然而有些參數需要在程式之間共享。舉例來說,在非對稱式數位用戶線(Asymmetric Digital Subscriber Line,簡稱ADSL)數據機中,在利用點對點協定(Point-To-Point Protocol,PPP)或動態主機組態協定(dynamic host configuration protocol,簡稱DHCP)取得網路通訊協定(Internet protocol,簡稱IP)位址後,該數據機中的其它程式例如網路位址變換(network address translation,NAT)或防火牆(Firewall)程式都需要取用上述IP位址。需要共享並同步處理的參數在上述的配置樹目前架構下難以達成其目的。這樣導致的結果是程式之間無法共用配置參數,作業系統的內核程式13也很難使用配置樹或XML配置參數文件。 However, some parameters need to be shared between programs. For example, in an Asymmetric Digital Subscriber Line (ADSL) data machine, a Point-To-Point Protocol (PPP) or a dynamic host configuration protocol ( Referred to as DHCP), after obtaining the Internet Protocol (IP) address, other programs in the modem, such as network address translation (NAT) or firewall (Firewall), need to use the above. IP address. The parameters that need to be shared and synchronized are difficult to achieve in the current architecture of the configuration tree described above. The result of this is that the configuration parameters cannot be shared between programs, and the operating system kernel program 13 is also difficult to use the configuration tree or XML configuration parameter file.
有鑒於此,需提供一種可共享應用程式配置參數的電子系統,包括記憶體、介面模組及裝置驅動程式。上述記憶體,包括用戶空間及內核空間,該用戶空間存儲複數應用程式及文件,該文件記錄複數配置參數,其中上述配置參數由第一應用程式使用。上述介面模組回應上述第一應用程式之請求以解析包含上述配置參數的上述文件,以及取得上述配置參數。上述裝置驅動程式建立上述配置參數的資料結構於上述記憶體中的內核空間,讓上述電子系統的複數應用程式經由上述裝置驅動程式從上述資料結構共同存取上述配置參數,以執行上述電子系統的不同功能。 In view of this, it is desirable to provide an electronic system that can share application configuration parameters, including memory, interface modules, and device drivers. The above memory includes a user space and a kernel space. The user space stores a plurality of applications and files, and the file records a plurality of configuration parameters, wherein the configuration parameters are used by the first application. The interface module responds to the request of the first application to parse the file containing the configuration parameter and obtain the configuration parameter. The device driver establishes the data of the configuration parameter in a kernel space in the memory, and allows the plurality of applications of the electronic system to jointly access the configuration parameter from the data structure via the device driver to execute the electronic system. Different features.
此外,還需提供一種可共享應用程式配置參數的方法,執行於電子系統中。上述電子系統包含應用程式、介面模組及裝置驅動程式。上述應用程式請求上述介面模組以使用上述應用程式的配置參數,其中上述應用程式儲存於上述電子系統的記憶體中的用戶空間。上述介面模組回應上述應用程式之請求以解析包含上述應用程式之配置參數的文件,以及取得上述配置參數。上述裝置驅動程式建立上述配置參數的資料結構於上述記憶體中的內核空間,讓上述電子系統的複數應用程式經由上述裝置驅動程式從上述資料結構共同存取上述配置參數,以執行上述電子系統的不同功能。 In addition, a method of sharing application configuration parameters is required to be implemented in an electronic system. The above electronic system includes an application, an interface module, and a device driver. The application requests the interface module to use the configuration parameters of the application, wherein the application is stored in a user space in the memory of the electronic system. The interface module responds to the request of the application to parse the file containing the configuration parameters of the application and obtain the configuration parameters. The device driver establishes the data of the configuration parameter in a kernel space in the memory, and allows the plurality of applications of the electronic system to jointly access the configuration parameter from the data structure via the device driver to execute the electronic system. Different features.
本發明可以執行於各種電子裝置或系統,例如路由器、非對稱式數位用戶線(Asymmetric Digital Subscriber Line,簡稱ADSL)裝置、纜線數據機(cable modem)、以及機上盒(Set Top Box)。 The present invention can be implemented in various electronic devices or systems, such as routers, Asymmetric Digital Subscriber Line (ADSL) devices, cable modems, and Set Top Boxes.
參閱圖2,電子系統200包含非揮發性記憶體(Nonvolatile Memory)210、處理器220、主記憶體230及通訊單元240。通訊單元240可以包含通訊埠及通訊相關的元件,例如無線通訊的控制器及天線、ADSL裝置中的數位訊號處理器(Digital Signal Processor)及類比至數位轉換器(Analog-to-Digital Converter)、纜線數據機中的調諧器(tuner)、乙太網路(Ethernet)控制器、通用串列匯流排(Universal Serial Bus,USB)控制器及/或週邊元件互聯標準 (Peripheral Component Interconnect,PCI)控制器。處理器220可以由積體電路(Integrated Circuit,簡構IC)組成,用以處理資料及執行程式。處理器10可以是由單顆封裝的IC所組成,或連接多顆封裝的IC而組成。舉例來說,處理器10可以僅包含中央處理器(Central Processing Unit,簡稱CPU),或者是CPU、通訊控制器的組合。所述的通訊控制器用以控制電子系統200中的各元件的通訊,或電子系統200與外部裝置的通訊。在不同的實施方式中,上述各種通訊元件可以整合在通訊單元240或處理器220之中。 Referring to FIG. 2, the electronic system 200 includes a nonvolatile memory 210, a processor 220, a main memory 230, and a communication unit 240. The communication unit 240 can include communication ports and communication related components, such as a controller and an antenna for wireless communication, a Digital Signal Processor in an ADSL device, and an Analog-to-Digital Converter. Tuner, Ethernet controller, Universal Serial Bus (USB) controller and/or peripheral component interconnection standard in cable modem (Peripheral Component Interconnect, PCI) controller. The processor 220 can be composed of an integrated circuit (Simplified IC) for processing data and executing programs. The processor 10 may be composed of a single packaged IC or an IC connected to a plurality of packages. For example, the processor 10 may only include a Central Processing Unit (CPU), or a combination of a CPU and a communication controller. The communication controller is used to control communication of various components in the electronic system 200, or communication between the electronic system 200 and an external device. In various embodiments, the various communication components described above may be integrated into communication unit 240 or processor 220.
主記憶體230可以包含各種隨機存取記憶體(Random Access Memory,簡稱RAM);非揮發性記憶體210的實例如電子可抹除可程式化唯讀記憶體(Electrically Erasable Programmable ROM,簡稱EEPROM)或快閃記憶體(Flash Memory)。非揮發性記憶體210包含電子系統200的作業系統及應用程式。非揮發性記憶體210中的程式及資料可以資料壓縮的形式儲存,待需執行或使用時再解壓縮至主記憶體230。 The main memory 230 can include various Random Access Memory (RAM); an example of the non-volatile memory 210 is an Electronically Erasable Programmable ROM (EEPROM). Or flash memory. The non-volatile memory 210 includes an operating system and an application of the electronic system 200. The programs and data in the non-volatile memory 210 can be stored in a compressed form and decompressed to the main memory 230 when needed or used.
請參照圖3,電子系統200可以包含記憶體100A。記憶體100A可以是虛擬記憶體,實際上可以映射至主記憶體230及/或非揮發性記憶體210。記憶體100A包含用戶空間及內核空間。配置參數文件12具有應用程式10c的複數配置參數,其中上述配置參數至少有二個程式使用。 Referring to FIG. 3, the electronic system 200 can include a memory 100A. The memory 100A may be a virtual memory that may actually be mapped to the main memory 230 and/or the non-volatile memory 210. The memory 100A contains user space and kernel space. The configuration parameter file 12 has a plurality of configuration parameters of the application 10c, wherein the configuration parameters are used by at least two programs.
為了達到配置參數共享及同步化的目的,電子系統200的其中一個應用程式(例如圖3中的應用程式10c)啟動對配 置參數文件12的解析程序後,經由內核程式13根據配置參數文件12中各配置參數的關係,以建立配置參數文件12中各配置參數的配置樹(例如配置樹11d)於記憶體100A的內核空間。所有要使用到配置樹11d中的參數的應用程式皆需透過內核程式13來執行讀取或修改。雖然在此實施方式中,配置參數的資料結構為樹狀結構,但是並非限定於此,也可以利用陣列、鏈結串列(linked list)等資料結構。應用程式10a~10c皆可以透過內核程式13讀取或修改配置樹11d內的參數,藉此達到配置參數共享與同步化的目的。其具體實施方式請參照圖4。 In order to achieve the purpose of configuration parameter sharing and synchronization, one of the applications of the electronic system 200 (for example, the application 10c in FIG. 3) initiates matching. After the parsing program of the parameter file 12 is set, the configuration tree (for example, the configuration tree 11d) of each configuration parameter in the configuration parameter file 12 is established in the kernel of the memory 100A via the kernel program 13 according to the relationship between the configuration parameters in the configuration parameter file 12. space. All applications that want to use the parameters in the configuration tree 11d need to be read or modified by the kernel program 13. Although the data structure of the configuration parameter is a tree structure in this embodiment, the present invention is not limited thereto, and a data structure such as an array or a linked list may be used. The application programs 10a-10c can read or modify the parameters in the configuration tree 11d through the kernel program 13, thereby achieving the purpose of sharing and synchronizing the configuration parameters. Please refer to FIG. 4 for the specific implementation manner.
在圖4中,電子系統200具有應用程式群組10,其中包含複數應用程式A1~An,其中n為大於1的正整數。應用程式A1~An的實例可包含圖3中的應用程式群組10a~10c。電子系統200還具有應用程式介面30、內核程式13提供的系統呼叫32、驅動程式34、及裝置檔案(device file或device special file)36。 In FIG. 4, electronic system 200 has an application group 10 that includes a plurality of applications A1~An, where n is a positive integer greater than one. Examples of applications A1~An may include application groups 10a-10c in FIG. The electronic system 200 also has an application interface 30, a system call 32 provided by the kernel program 13, a driver 34, and a device file or device special file 36.
應用程式介面30包含函式庫(library),其中包含複數用以解析配置參數文件(例如配置參數文件12)的函式(function),根據上述解析結果以建立對應配置樹的函式、以及修改及讀取配置樹及其中參數值的函式。由於配置樹在內核空間中,應用程式介面30的函式可以利用內核程式13提供的系統呼叫(system call,例如“ioctl”),以驅使內核程式13致動驅動程式34以完成建立或修改配置樹群組38中的配置樹的動作。配置樹群組38包含複數配置樹T1~Tm,其中m為大於1的正整數。舉 例來說,配置樹群組38包含圖3中的配置樹11d。 The application interface 30 includes a library containing a function for parsing a configuration parameter file (for example, the configuration parameter file 12), a function for establishing a corresponding configuration tree according to the above analysis result, and a modification. And a function that reads the configuration tree and its parameter values. Since the configuration tree is in kernel space, the application interface 30 function can utilize the system call (such as "ioctl") provided by the kernel program 13 to drive the kernel program 13 to actuate the driver 34 to complete the setup or modify configuration. The action of the configuration tree in tree group 38. The configuration tree group 38 includes a complex configuration tree T1~Tm, where m is a positive integer greater than one. Lift For example, configuration tree group 38 includes configuration tree 11d in FIG.
裝置檔案在Unix、Linux等以及相類似的作業系統中用以代表特定裝置驅動程式及其對應的裝置,例如儲存於/dev的目錄下,使應用程式可以透過標準的輸出/輸入系統呼叫來與該裝置檔案代表的驅動程式互動。在本實施方式中,裝置檔案36的檔名為“xmlconf”,並且利用裝置檔案36對應配置樹群組38,以代表中的複數配置樹。圖4中,裝置檔案36中的設備主代碼(major number)N1為代表驅動程式34的一個號碼,而設備次代碼(minor number)N2包含了代表配置樹T1~Tm的複數筆號碼,每一筆設備次代碼代表一個配置樹。應用程式群組10中的應用程式、應用程式介面30中的函式或驅動程式34皆能夠透過裝置檔案36以指定配置樹群組38中的特定配置樹,並予以讀取或修改。 Device files are used in Unix, Linux, etc. and similar operating systems to represent specific device drivers and their corresponding devices, such as in the /dev directory, so that applications can be called through standard output/input system calls. The device file represents the driver interaction. In the present embodiment, the file name of the device file 36 is "xmlconf", and the device file 36 is used to correspond to the configuration tree group 38 to represent the complex configuration tree. In FIG. 4, the device major number N1 in the device file 36 is a number representing the driver 34, and the device minor code N2 includes a plurality of pen numbers representing the configuration trees T1 to Tm, each pen. The device minor code represents a configuration tree. The application in application group 10, the function or driver 34 in application interface 30, can be accessed through device file 36 to specify and configure or modify a particular configuration tree in configuration tree group 38.
應用程式開啟設備文檔/dev/xmlconf就可以找到設備主代碼N1,透過設備號就可以請求內核程式13找到並利用驅動程式34。驅動程式34利用一筆設備次代碼就可以找到其對應的特定配置樹,並根據上述應用程式的請求以修改上述配置樹或讀取並回傳配置參數值給上述應用程式。 The application can open the device file /dev/xmlconf to find the device main code N1. Through the device number, the kernel program 13 can be requested to find and utilize the driver 34. The driver 34 can find a corresponding specific configuration tree by using a device code, and modify the configuration tree or read and return the configuration parameter value to the application according to the request of the application.
裝置檔案的實例包含字元裝置檔案(character special file或character device)及區塊裝置檔案(block special file或block device)。字元裝置檔案對應的字元裝置與作業系統以字元為單位來交換資料,而區塊裝置與作業系統則以較大的資料區塊為單位 來交換資料。字元裝置的實例包含數據機(modem)及電話通訊相關的裝置。區塊裝置的實例包含硬式磁碟機及光碟機。驅動程式34每次讀取配置樹上一個節點的配置參數值,所以裝置檔案36可以是字元裝置檔案。 Examples of device files include a character special file or a character device and a block special file or block device. The character device corresponding to the character device file and the operating system exchange data in units of characters, and the block device and the operating system are in units of larger data blocks. To exchange information. Examples of character devices include modems and telephony related devices. Examples of block devices include hard disk drives and optical disk drives. The driver 34 reads the configuration parameter values of one node on the configuration tree each time, so the device file 36 can be a character device file.
圖5顯示配置參數文件12的實例,其對應的配置樹的一部分顯示於圖6。配置參數文件12a,其中的配置參數包含在<ConfigTree>與</ConfigTree>之間。<AtmCfg>與</AtmCfg>中間包含非同步傳輸模式(asynchronous transfer mode,簡稱ATM)相關的設置。<AtmCfgTd>與</AtmCfgTd>之間包含關于ATM連接類型(Link Type)的設置,比如"CBR"表示用恆定的速率連接。<AtmCfgVcc>與</AtmCfgVcc>之間主要包含ATM層的持久虛擬線路(permanent virtual circuit,簡稱PVC)參數。<SecCfg>與</SecCfg>之間主要包含網路安全的相關設置。<WirelessCfg>與</WirelessCfg>之間是Wi-Fi(IEEE 802.11)相關的設置。<RouteCfg>與</RouteCfg>之間主要設置電子系統200的靜態路由表。<PMapCfg>與</PMapCfg>之間主要是做埠對應(Port Map)用的設置。<SNTPCfg>與</SNTPCfg>之間是設置時間伺服器的參數,即與簡單網路時間協定(Simple Network Time Protocol,SNTP)伺服器相關的參數。<Voice>與</Voice>之間是網路電話(Voice Over Internet Protocol,簡稱VoIP)相關的設置。<pppsrv_8_35>與</pppsrv_8_35>之間是點對點協定 (Point-To-Point Protocol,PPP)連接PPP伺服器時的相關設置。<wan_8_35>與</wan_8_35>之間的配置參數主要用于建立廣域網路(Wide Area Network,簡稱WAN)端的介面有關,它和ATM PVC是緊密相關的。 Figure 5 shows an example of a configuration parameter file 12, a portion of its corresponding configuration tree being shown in Figure 6. Configuration parameter file 12a, where the configuration parameters are contained between <ConfigTree> and </ConfigTree>. <AtmCfg> and </AtmCfg> contain settings related to asynchronous transfer mode (ATM). <AtmCfgTd> and </AtmCfgTd> contain settings regarding the ATM connection type (Link Type), such as "CBR" means to connect at a constant rate. The <AtmCfgVcc> and </AtmCfgVcc> mainly contain the persistent virtual circuit (PVC) parameters of the ATM layer. The relationship between <SecCfg> and </SecCfg> mainly includes network security. Between [WirelessCfg> and </WirelessCfg> is a Wi-Fi (IEEE 802.11) related setting. A static routing table of the electronic system 200 is mainly set between <RouteCfg> and </RouteCfg>. The relationship between <PMapCfg> and </PMapCfg> is mainly used for Port Map. Between <SNTPCfg> and </SNTPCfg> is a parameter for setting the time server, that is, a parameter related to a Simple Network Time Protocol (SNTP) server. Between <Voice> and </Voice> is a setting related to Voice Over Internet Protocol (VoIP). Between <pppsrv_8_35> and </pppsrv_8_35> is a point-to-point protocol (Point-To-Point Protocol, PPP) Related settings when connecting to a PPP server. The configuration parameters between <wan_8_35> and </wan_8_35> are mainly used to establish the interface of the Wide Area Network (WAN), which is closely related to ATM PVC.
電子系統200中的內核程式13或應用程式皆可以啟動配置參數文件12a轉換成配置樹的工作。舉例來說,內核程式13在電子系統200開機時啟動配置樹的建立。或者,應用程式Ai(其中i為正整數,且1≦i≦n)啟動配置樹的建立。電子系統200內執行的內核程式13或應用程式A1~An可以利用應用程式介面30將配置參數文件12a轉換成特定的資料格式,再交給驅動程式34以建立配置參數文件12a的對應配置樹。 The kernel program 13 or the application in the electronic system 200 can initiate the conversion of the configuration parameter file 12a into a configuration tree. For example, the kernel program 13 initiates the establishment of a configuration tree when the electronic system 200 is powered on. Alternatively, the application Ai (where i is a positive integer and 1≦i≦n) initiates the establishment of the configuration tree. The kernel program 13 or the application programs A1 to An executed in the electronic system 200 can convert the configuration parameter file 12a into a specific data format by using the application interface 30, and then hand it to the driver 34 to establish a corresponding configuration tree of the configuration parameter file 12a.
請參照圖7,當電子系統200內的程式需要建立配置樹時,請求執行應用程式介面30中用來建立配置樹的函式(步驟700)。其中上述請求中包對應驅動程式34之裝置檔案36的名稱。上述函式回應上述程式的請求以分析配置參數文件12a來產生代表配置參數文件12a之結構及其內配置參數值的資料結構(步驟702)。<protocol>標籤中的autoScan屬性值可以在步驟702的資料結構中以“protocol.autoScan=enable”來表示。上述函式再透過電子系統200之作業系統的系統呼叫32以傳遞上述裝置檔案36的檔名、上述資料結構及其它資料至內核程式13(步驟704)。內核程式13根據上述檔名取得裝置檔案36中的設備主代碼N1,再根據設備主代碼N1取得驅動程式34,並將上述資料結構交給驅動程式34,使驅動程式34開 始建立上述資料結構對應的配置樹(步驟706)。驅動程式34新增設備次代碼N2以作為將要建立之配置樹的代碼(步驟708),並根據上述資料結構以建立配置參數文件12a對應的配置樹Tj(其中j為正整數,且1≦i≦m)(步驟710)。 Referring to FIG. 7, when a program in the electronic system 200 needs to establish a configuration tree, it requests to execute a function in the application interface 30 for establishing a configuration tree (step 700). The name of the device file 36 corresponding to the driver 34 is included in the above request. The above function responds to the request of the above program to analyze the configuration parameter file 12a to generate a data structure representing the structure of the configuration parameter file 12a and its configuration parameter values (step 702). The autoScan attribute value in the <protocol> tag can be represented by "protocol.autoScan=enable" in the data structure of step 702. The above function is further transmitted through the system call 32 of the operating system of the electronic system 200 to transfer the file name of the device file 36, the data structure and other data to the kernel program 13 (step 704). The kernel program 13 obtains the device main code N1 in the device file 36 according to the above file name, and then obtains the driver 34 according to the device main code N1, and passes the data structure to the driver 34 to cause the driver 34 to open. A configuration tree corresponding to the above data structure is established (step 706). The driver 34 adds the device minor code N2 as the code of the configuration tree to be established (step 708), and according to the above data structure, establishes the configuration tree Tj corresponding to the configuration parameter file 12a (where j is a positive integer, and 1≦i ≦m) (step 710).
圖6顯示配置參數文件12a中的區塊B1轉換成配置樹的示意圖。區塊B1中<SystemInfo>與</SystemInfo>標籤以“SystemInfo”為名,其間包含了以“protocol”、“sysLog”及“sysUserName”為名的標籤。因此,在被程式請求的情況下,驅動程式34會在配置參數文件12a對應的配置樹中建立“SystemInfo”、“protocol”、“sysLog”及“sysUserName”對應的節點,且“SystemInfo”為“protocol”、“sysLog”及“sysUserName”等節點的父節點。“protocol”標籤包含“autoScan”、“upnp”、“igmpSnp”、“igmpMode”、macFilterPolicy”、“encodePassword”及“enetwan”的屬性,相應地,驅動程式34會建立“autoScan”、“upnp”、“igmpSnp”、“igmpMode”、“macFilterPolicy”、“encodePassword”及“enetwan”等節點作為“protocol”節點的子節點,且每個屬性對應的節點中包含其屬性值。同理,驅動程式34也會建立“sysLog”及“sysUserName”節點的子節點,以及上述配置樹的其它節點。 Fig. 6 shows a schematic diagram of the conversion of the block B1 in the configuration parameter file 12a into a configuration tree. The <SystemInfo> and </SystemInfo> tags in block B1 are named "SystemInfo" and contain tags named "protocol", "sysLog", and "sysUserName". Therefore, in the case of being requested by the program, the driver 34 establishes nodes corresponding to "SystemInfo", "protocol", "sysLog", and "sysUserName" in the configuration tree corresponding to the configuration parameter file 12a, and "SystemInfo" is " The parent node of nodes such as protocol, sysLog, and sysUserName. The "protocol" tag contains attributes of "autoScan", "upnp", "igmpSnp", "igmpMode", macFilterPolicy", "encodePassword", and "enetwan". Accordingly, the driver 34 will create "autoScan", "upnp", Nodes such as "igmpSnp", "igmpMode", "macFilterPolicy", "encodePassword", and "enetwan" are children of the "protocol" node, and the node corresponding to each attribute contains its attribute value. Similarly, the driver 34 also The child nodes of the "sysLog" and "sysUserName" nodes are established, as well as other nodes of the above configuration tree.
在配置樹Tj建立之後,其它的程式就可以讀取或修改配 置樹Tj的節點內的配置參數值。請參照圖8,當電子系統200內的程式需要修改配置樹中的特定節點(以下稱為目標節點)時,請求執行應用程式介面30中用來修改配置樹的函式(步驟800)。其中上述請求中包含對應驅動程式34之裝置檔案36的名稱、新的配置參數值及其它資料。舉例來說,執行PPP的程式或動態主機組態協定(Dynamic Host Configuration Protocol,簡稱DHCP)的程式從WAN取得電子系統200的新的IP位址作為新的配置參數值,隨後更新配置樹Tj中用來記錄電子系統200的IP位址的目標節點中的IP位址。應用程式可以在步驟800的上述請求中指明上述目標節點的名稱及從配置樹Tj至上述目標節點的路徑,其中上述路徑包含目標節點的父節點及祖先節點的名稱。 After the configuration tree Tj is created, other programs can read or modify the configuration. Set the configuration parameter value in the node of Tj. Referring to FIG. 8, when a program in the electronic system 200 needs to modify a specific node (hereinafter referred to as a target node) in the configuration tree, it requests to execute a function in the application interface 30 for modifying the configuration tree (step 800). The request includes the name of the device file 36 corresponding to the driver 34, new configuration parameter values, and other materials. For example, a program that executes PPP or a Dynamic Host Configuration Protocol (DHCP) program retrieves a new IP address of the electronic system 200 from the WAN as a new configuration parameter value, and then updates the configuration tree Tj. The IP address in the target node used to record the IP address of the electronic system 200. The application may indicate the name of the target node and the path from the configuration tree Tj to the target node in the above request in step 800, wherein the path includes the name of the parent node and the ancestor node of the target node.
上述函式回應上述程式的請求,透過電子系統200之作業系統的系統呼叫將上述請求中的檔名、目標節點名稱及新的配置參數值傳遞給內核程式13(步驟802)。內核程式13根據上述檔名取得裝置檔案36中的設備主代碼N1,再根據設備主代碼N1取得驅動程式34,並將上述新的配置參數值交給驅動程式34,使驅動程式34更新配置樹Tj中目標節點內的配置參數值(步驟804)。驅動程式34取得配置樹Tj中的上述目標節點(步驟806),並以上述新的配置參數值來更新目標節點內的配置參數值(步驟808)。步驟806中,驅動程式34可以根據上述目標節點的路徑以取得上述目標節點,或搜尋配置樹Tj以取得。 The function in response to the request of the program transmits a file name, a target node name, and a new configuration parameter value in the request to the kernel program 13 via a system call of the operating system of the electronic system 200 (step 802). The kernel program 13 obtains the device main code N1 in the device file 36 according to the above file name, and then obtains the driver 34 according to the device main code N1, and passes the new configuration parameter value to the driver 34, so that the driver 34 updates the configuration tree. The configuration parameter value within the target node in Tj (step 804). The driver 34 retrieves the target node in the configuration tree Tj (step 806), and updates the configuration parameter value in the target node with the new configuration parameter value (step 808). In step 806, the driver 34 may obtain the target node according to the path of the target node or search the configuration tree Tj for acquisition.
在圖6中配置樹Tj的例子上,電子系統200之IP位址是從 區塊B2中的“entry1”標籤的address=“192.168.1.1”的屬性取得的。在上述IP位址更新後,電子系統200中的防火牆程式可以從配置樹Tj讀取電子系統200的IP位址,並根據上述節點中新的IP位址以執行其任務。電子系統200的網路位址變換(network address translation,NAT)程式根據上述節點中新的IP位址以執行NAT。 In the example of configuring the tree Tj in FIG. 6, the IP address of the electronic system 200 is from The address of the "entry1" tag in block B2 is obtained by the attribute of "192.168.1.1". After the above IP address is updated, the firewall program in the electronic system 200 can read the IP address of the electronic system 200 from the configuration tree Tj and perform its task according to the new IP address in the above node. The network address translation (NAT) program of the electronic system 200 performs NAT based on the new IP address in the above node.
請參照圖9,當電子系統200內的程式需要讀取配置樹中的特定節點(以下稱為目標節點)時,請求執行應用程式介面30中用來讀取配置樹的函式(步驟900)。其中上述請求中包對應驅動程式34之裝置檔案36的名稱及目標節點的名稱。應用程式可以在步驟900的上述請求中指明從配置樹Tj至上述目標節點的路徑,其中上述路徑包含目標節點的父節點及祖先節點的名稱。 Referring to FIG. 9, when a program in the electronic system 200 needs to read a specific node (hereinafter referred to as a target node) in the configuration tree, request to execute a function in the application interface 30 for reading the configuration tree (step 900). . The request contains the name of the device file 36 corresponding to the driver 34 and the name of the target node. The application may indicate the path from the configuration tree Tj to the target node in the above request of step 900, wherein the path includes the name of the parent node and the ancestor node of the target node.
上述函式回應上述程式的請求,透過電子系統200之作業系統的系統呼叫將上述請求中的檔名及目標節點的名稱傳遞給內核程式13(步驟902)。內核程式13根據上述檔名取得裝置檔案36中的設備主代碼N1,再根據設備主代碼N1取得驅動程式34,並將目標節點的名稱交給驅動程式34,使驅動程式34取得配置樹Tj中上述目標節點內的配置參數值(步驟904)。驅動程式34根據目標節點的名稱取得配置樹Tj中的上述目標節點(步驟906),並將目標節點內的配置參數值回傳給內核程式13(步驟908)。內核程式13再將目標節點內的配置參數值回傳給請求讀取的程式(步驟910)。步驟906中,驅動程式34可以根據上述目 標節點的路徑以取得上述目標節點,或搜尋配置樹Tj以取得。 The above function responds to the request of the program, and transmits the file name and the name of the target node in the request to the kernel program 13 via the system call of the operating system of the electronic system 200 (step 902). The kernel program 13 obtains the device main code N1 in the device file 36 according to the above file name, and then obtains the driver 34 according to the device main code N1, and passes the name of the target node to the driver 34, so that the driver 34 obtains the configuration tree Tj. The configuration parameter value within the target node above (step 904). The driver 34 retrieves the target node in the configuration tree Tj based on the name of the target node (step 906), and passes back the configuration parameter values in the target node to the kernel program 13 (step 908). The kernel program 13 then passes back the configuration parameter values in the target node to the program requesting the read (step 910). In step 906, the driver 34 can be based on the above items. The path of the target node is obtained to obtain the above target node, or the configuration tree Tj is searched for.
利用上述系統結構及方法,電子系統200內的應用程式A1~An及內核程式13可以共享並同步配置參數。其它的實例如,電子系統200包含系統設定程式。系統設定程式允許的用戶名稱記錄在圖6中“sysUserName”節點的子節點“value”中,用戶名稱為“admin”。系統設定程式提供使用者介面讓使用者設定圖6中配置樹的配置參數值。電子系統200中的每個程式記錄其執行時期相關的事件於記錄檔。電子系統200可以將上述記錄檔發送至外部伺服器供分析之用。電子系統200中的每個程式根據圖6中logLevel節點的配置參數值以決定記錄於上述記錄檔的事件類別。換言之,logLevel的配置參數值決定電子系統200中的複數程式記錄事件的詳細程度。“sysUserName”及“logLevel”節點的配置參數值可以利用上述方法被修改及讀取。 With the above system structure and method, the application programs A1 to An and the kernel program 13 in the electronic system 200 can share and synchronize configuration parameters. As another example, electronic system 200 includes a system setup program. The user name allowed by the system setting program is recorded in the child node "value" of the "sysUserName" node in Figure 6, and the user name is "admin". The system setting program provides a user interface for the user to set the configuration parameter values of the configuration tree in FIG. 6. Each program in electronic system 200 records events related to its execution period in a log file. The electronic system 200 can send the above log file to an external server for analysis. Each program in the electronic system 200 determines the event category recorded in the above log file based on the configuration parameter values of the logLevel node in FIG. In other words, the logLevel configuration parameter value determines the level of detail of the complex program recorded events in the electronic system 200. The configuration parameter values of the "sysUserName" and "logLevel" nodes can be modified and read using the above methods.
電子系統200更包含用戶認證程式。系統設定程式提供使用者介面讓使用者設定可以從遠端存取電子系統200的用戶的遠端裝置的網路通訊協定(Internet Protocol,簡稱IP)位址,並記錄於配置參數文件12a中的區塊B3,即<TelnetAcl>與</TelnetAcl>之間。區塊B3中的配置參數轉換成配置樹Tj中的節點後,系統設定程式可以增加、刪除或修改上述節點中的IP位址。用戶認證程式利用配置樹Tj的上述節點(未圖示)中的IP位址以容許或拒絕用戶使用的遠端裝置連接至電子系統200。 The electronic system 200 further includes a user authentication program. The system setting program provides a user interface for the user to set an Internet Protocol (IP) address of the remote device of the user who can access the electronic system 200 from the remote end, and records it in the configuration parameter file 12a. Block B3, which is between <TelnetAcl> and </TelnetAcl>. After the configuration parameters in block B3 are converted into nodes in the configuration tree Tj, the system setting program can add, delete or modify the IP addresses in the above nodes. The user authentication program utilizes the IP address in the above-described node (not shown) of the configuration tree Tj to allow or deny the remote device used by the user to connect to the electronic system 200.
本發明提供的方法可以克服現有方法的不足。利用上述系統結構及方法,電子系統內的應用程式及內核程式可以共享並同步配置參數。上述方法可以廣泛應用於Linux/Unix環境下或其它的作業系統環境下的程式開發。 The method provided by the present invention can overcome the deficiencies of the prior methods. With the above system structure and method, applications and kernel programs in the electronic system can share and synchronize configuration parameters. The above method can be widely applied to program development in a Linux/Unix environment or other operating system environment.
綜上所述,本發明符合發明專利要件,爰依法提出專利申請。惟,以上所述者僅為本發明之較佳實施例,舉凡熟悉本案技藝之人士,在爰依本案發明精神所作之等效修飾或變化,皆應包含於以下之申請專利範圍內。 In summary, the present invention complies with the requirements of the invention patent and submits a patent application according to law. The above description is only the preferred embodiment of the present invention, and equivalent modifications or variations made by those skilled in the art of the present invention should be included in the following claims.
A1~An‧‧‧應用程式 A1~An‧‧‧App
B1~B3‧‧‧配置參數區塊 B1~B3‧‧‧ configuration parameter block
N1‧‧‧設備主代碼 N1‧‧‧ device master code
N2‧‧‧設備次代碼 N2‧‧‧ device minor code
T1~Tm‧‧‧配置樹 T1~Tm‧‧‧ configuration tree
10‧‧‧應用程式群組 10‧‧‧Application Group
10a,10b,10c‧‧‧應用程式 10a, 10b, 10c‧‧‧ applications
11a,11b,11c,11d‧‧‧配置樹 11a, 11b, 11c, 11d‧‧‧ configuration tree
12,12a‧‧‧配置參數文件 12,12a‧‧‧Configuration parameter file
13‧‧‧內核程式 13‧‧‧ kernel program
30‧‧‧應用程式介面 30‧‧‧Application interface
32‧‧‧系統呼叫 32‧‧‧System Call
34‧‧‧驅動程式 34‧‧‧Driver
36‧‧‧裝置檔案 36‧‧‧Device files
38‧‧‧配置樹群組 38‧‧‧Configuration Tree Group
100,100A‧‧‧記憶體 100,100A‧‧‧ memory
200‧‧‧電子系統 200‧‧‧Electronic system
210‧‧‧非揮發性記憶體 210‧‧‧ Non-volatile memory
220‧‧‧處理器 220‧‧‧ processor
230‧‧‧主記憶體 230‧‧‧ main memory
240‧‧‧通訊單元 240‧‧‧Communication unit
圖1為配置樹在記憶體中的傳統設置示意圖。 Figure 1 is a schematic diagram of a conventional setup of a configuration tree in a memory.
圖2為電子系統之結構方塊圖。 2 is a block diagram showing the structure of an electronic system.
圖3為配置樹在記憶體中的新設置示意圖。 Figure 3 is a schematic diagram of the new configuration of the configuration tree in the memory.
圖4為上述電子系統的模組示意圖。 4 is a schematic diagram of a module of the above electronic system.
圖5顯示配置參數文件的實例示意圖。 Figure 5 shows an example of a configuration parameter file.
圖6顯示配置參數文件中的區塊B1轉換成配置樹的部分的示意圖。 Figure 6 shows a schematic diagram of a portion of the configuration parameter file in which the block B1 is converted into a configuration tree.
圖7顯示電子系統內的配置樹的建立流程圖。 Figure 7 shows a flow chart for establishing a configuration tree within an electronic system.
圖8顯示電子系統內的配置樹的修改流程圖。 Figure 8 shows a modified flow diagram of a configuration tree within an electronic system.
圖9顯示電子系統內的配置樹中特定節點的讀取流程圖。 Figure 9 shows a flow chart for reading a particular node in a configuration tree within an electronic system.
10a,10b,10c‧‧‧應用程式 10a, 10b, 10c‧‧‧ applications
11d‧‧‧配置樹 11d‧‧‧Configuration Tree
12‧‧‧配置參數文件 12‧‧‧Configuration parameter file
13‧‧‧內核程式 13‧‧‧ kernel program
100A‧‧‧記憶體 100A‧‧‧ memory
Claims (21)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW97131181A TWI428765B (en) | 2008-08-15 | 2008-08-15 | Electronic system and method thereof capable of sharing application configurations |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW97131181A TWI428765B (en) | 2008-08-15 | 2008-08-15 | Electronic system and method thereof capable of sharing application configurations |
Publications (2)
Publication Number | Publication Date |
---|---|
TW201007475A TW201007475A (en) | 2010-02-16 |
TWI428765B true TWI428765B (en) | 2014-03-01 |
Family
ID=44827066
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
TW97131181A TWI428765B (en) | 2008-08-15 | 2008-08-15 | Electronic system and method thereof capable of sharing application configurations |
Country Status (1)
Country | Link |
---|---|
TW (1) | TWI428765B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2014123307A (en) * | 2012-12-21 | 2014-07-03 | Nec System Technologies Ltd | Terminal device, data cooperation method, and program |
-
2008
- 2008-08-15 TW TW97131181A patent/TWI428765B/en active
Also Published As
Publication number | Publication date |
---|---|
TW201007475A (en) | 2010-02-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8375398B2 (en) | Method and system for sharing configuration parameters among processes of an electronic device | |
BRPI0714116A2 (en) | mapping discovered items by connection and universal execution in an smb location | |
CN108964968A (en) | Service access management method and system under a kind of container cloud environment | |
CN113301116A (en) | Cross-network communication method, device, system and equipment for microservice application | |
CN106648838B (en) | Resource pool management configuration method and device | |
US10499311B2 (en) | Method and apparatus for implementing network sharing | |
JP2014531818A (en) | Method and apparatus for controlling contents of digital living network alliance | |
WO2020038443A1 (en) | Bridging communication method and device | |
WO2024012001A1 (en) | Method and system for implementing access to open source community in multi-modal network | |
WO2015074391A1 (en) | Method and apparatus for mounting peripheral components on multiple virtual machines | |
RU2636700C1 (en) | Method for eliminating vulnerabilities of devices having access to internet | |
US20060129700A1 (en) | Bridging a local bus with a data network | |
WO2023246486A1 (en) | Method and apparatus for creating connector | |
WO2014005268A1 (en) | Resource access method and device | |
TWI428765B (en) | Electronic system and method thereof capable of sharing application configurations | |
CN105871676B (en) | The method for connecting network and system of distal end virtual machine in a kind of desktop cloud | |
Gigan et al. | Sensor Abstraction Layer: a unique software interface to effectively manage sensor networks | |
CN112910910B (en) | Method, device, equipment and storage medium for processing OPCDA protocol message | |
CN115002840A (en) | Equipment data transmission method and device, electronic equipment and storage medium | |
TWI540861B (en) | Management system and management method | |
WO2020221033A1 (en) | Method for managing remote storage device by means of management device | |
JP5870804B2 (en) | Communication control system, communication control method, and communication control program | |
CN109257264B (en) | System and method for opening Ethernet virtual private network service | |
JP6539497B2 (en) | Communication relay system, device accommodation terminal, server side computer, program, and communication relay method | |
RU2614559C1 (en) | Remedial method for router vulnerabilities |