1. Technical Field
Embodiments of the present disclosure relate to function execution, and more particularly to a network unit and method for executing a function of a network termination unit (NTU).
2. Description of Related Art
NTUs are frequently used in home and office applications, such as computers, phones, and digital televisions, for example. Each NTU provides various functions, such as to watch Internet Protocol television (IPTV), dial voice over Internet Protocol (VoIP) phone, for example. Generally, based on a customer premises equipment (CPE) WAN management protocol (e.g., TR-069), an operations support system (OSS) and an automatic configuration server (ACS) may be connected with a network unit (e.g., a home gateway), so as to transmit a configuration command to the NTUs and execute a function corresponding to the configuration command at the NTUs through the network unit. The configuration command may be used to upgrade software and/or hardware of the NTUs, monitor states and capabilities of the NTUs, for example. Thus, it is important to implement the functions or manage configuration parameters corresponding to the functions of the NTUs efficiently and quickly.
What is needed, therefore, is an improved network unit and method for executing a function of a NTU.
The invention is illustrated by way of example and not by way of limitation in the figures of the accompanying drawings in which like references indicate similar elements. It should be noted that references to “an” or “one” embodiment in this disclosure are not necessarily to the same embodiment, and such references mean at least one.
In general, the word “module,” as used herein, refers to logic embodied in hardware or firmware, or to a collection of software instructions, written in a programming language, such as, for example, Java, C, or assembly. One or more software instructions in the modules may be embedded in firmware, such as an EPROM.
It will be appreciated that modules may comprised connected logic units, such as gates and flip-flops, and may comprise programmable units, such as programmable gate arrays or processors. The modules described herein may be implemented as either software and/or hardware modules and may be stored in any type of computer-readable medium or other computer storage device.
The network unit 1 includes an executing system 2. The executing system 2 may be used to execute a function of the configuration command sent to the NTU 6. By utilizing the executing system 2, the function of the NTU 6 may be searched quickly and executed efficiently. Detailed examples are provided as below.
In one embodiment, the network unit 1 may be a home gateway, and the NTU 6 may be a network storage unit, a computer, a telephone adapter, or a set top box (STB), for example. Functions of the configuration command may be operable to configure parameters of the NTU 6, upgrade software and/or hardware of the NTU 6, monitor states and capabilities of the NTU 6, and/or diagnose malfunctions of the NTU 6. The network 5 may be the Internet, or other kinds of communication networks.
In one embodiment, the alarm system 2 includes a computing module 20, a creating module 22, a receiving module 24, a searching module 26, and an executing module 28. The modules 20, 22, 24, 26, and 28 may comprise one or more computerized codes to be executed by the processor 10 to perform one or more operations of the network unit 1. Details of these operations will be provided below.
The creating module 22 creates a hash table. In one embodiment, the hash table is created by using a hashing function/algorithm to hash keys into hash buckets.
Each of the buckets is a list of key-value pairs. Since different keys may hash to a same bucket, the goal of hash table design is to spread out the key-value pairs evenly with each bucket including as few key-value pairs as possible. When an item is looked up, a key of the item is hashed to find an appropriate bucket. Then, the bucket is searched according to the corresponding key-value pair.
The computing module 20 acquires the configuration parameters of the NTU 6, and computes a hash value of each name of the configuration parameters.
In one embodiment, an amount of the key-value pairs of the hash table is not less than the amount of the configuration parameters of the NTU 6. For example, the amount of the configuration parameters of the NTU 6 is 1500. Since 210 (1024)<1500<211 (2048), the amount of the key-value pairs may be determined as 2048. If each value in the hash table is 4 bits, and each key in the hash table is 4 bits, then the size of the hash table is “2048*(4+4)=16384” bits, and the hash value is 11 bits because 211=2048.
According to an example shown in
For example, a name of a configuration parameter is “hello,world” and the length of “hello,world” is 11 bits, and a name of a configuration parameter is “hello,world!” and the length of “hello,world!” is 12 bits.
The computed hash values corresponding to “hello,world” are “0x395815F8” and “0x000001F8.” The hash value of “0x395815F8” is an unabridged result, and the hash value of “0x000001F8” is a result having the designated bits “10” by using “h=(h & hashmask(10)).” In one embodiment, the hash value of “0x000001F8” is a result to be inserted in the hash table.
The creating module 22 confirms a function of each of the configuration parameters in the NTU 6, and acquires a function pointer of the function. The creating module 22 further inserts the hash value and the function pointer corresponding to each of the configuration parameters into the hash table. In one embodiment, the hash value of each name of the configuration parameters in the NTU 6 is regarded as an index in the hash table, so as to locate a corresponding function pointer.
In one embodiment, the functions of the configuration parameters may include, but are not limited to, abilities to access, define, or modify the configuration parameters.
The creating module 22 further stores the hash values, the function pointers, and the hash table in the storage device 12.
The receiving module 24 receives a configuration command from an external device, and acquires one or more configuration parameter names from the configuration command. The external device may be a remote server, or a remote computer, for example. As mentioned above, the configuration command may be used to configure parameters of the NTU 6, upgrade software and/or hardware of the NTU 6, monitor states and capabilities of the NTU 6, and/or diagnose malfunctions of the NTU 6.
The computing module 20 computes a hash value of each of the one or more configuration parameter names acquired from the configuration command. In one embodiment, if the one or more configuration parameter names include a serial number, such as “A.1,” the computing module 20 ignores the serial number, and computes the hash values according to the one or more configuration parameter names.
The searching module 26 determines if the hash table includes the hash value of each of the one or more configuration parameter names.
If the hash table includes the hash value of each of the one or more configuration parameter names, the executing module 28 confirms a function pointer corresponding to the hash value. The executing module 28 further invokes a function corresponding to the function pointer thereby executing the configuration command.
If the hash table does not include the hash value of each of the one or more configuration parameter names, the searching module 26 returns a prompt message to the external device. In one embodiment, the prompt message may be “no corresponding configuration parameter can be located in the NTU 6.”
In block S2, the creating module 22 creates a hash table.
In block S4, the computing module 20 acquires the configuration parameters of the NTU 6.
In block S6, the computing module 20 computes a hash value of each name of the configuration parameters.
In block S8, the creating module 22 confirms a function of each of the configuration parameters in the NTU 6, acquires a function pointer of the function, and inserts the hash value and the function pointer corresponding to each of the configuration parameters into the hash table. In one embodiment, the hash value of each name of the configuration parameters in the NTU 6 is regarded as an index in the hash table, so as to locate a corresponding function pointer.
In block S12, the receiving module 24 receives a configuration command from an external device, and acquires one or more configuration parameter names from the configuration command. As mentioned above, the external device may be a remote server, or a remote computer, for example.
In block S12, the computing module 20 computes a hash value of each of the one or more configuration parameter names acquired from the configuration command.
In block S14, the searching module 26 determines if the hash table includes the hash value of each of the one or more configuration parameter names.
If the hash table includes the hash value of each of the one or more configuration parameter names, in block S16, the executing module 28 confirms a function pointer corresponding to the hash value.
In block S18, the executing module 28 invokes a function corresponding to the function pointer thereby executing the configuration command.
If the hash table does not include the hash value of each of the one or more configuration parameter names, in block S20, the searching module 26 returns a prompt message to the external device. As mentioned above, the prompt message may be “no corresponding configuration parameter can be located in the NTU 6.”
Although certain inventive embodiments of the present disclosure have been specifically described, the present disclosure is not to be construed as being limited thereto. Various changes or modifications may be made to the present disclosure without departing from the scope and spirit of the present disclosure.
| Number | Date | Country | Kind |
|---|---|---|---|
| 200910307987.0 | Sep 2009 | CN | national |