Background technology
At existing PON (Passive Optical Network, passive optical-fiber network) generally include an OLT (Optical Line Terminal who is installed on console for centralized control in network, optical line terminal), and a collection of supporting ONU that is installed on customer site (Optical Network Unit, optical network unit).OLT equipment wherein comprises ONU registed authorization module, ONU registed authorization module can realize ONU registration, go registration and authorize, go authorize.Authorize or when the event such as reach the standard grade/roll off the production line occurs, conventionally need to carry out some relevant processing authorizing/go.In modular design, these relevant processing normally realize in other modules.
In the prior art, a kind of implementation of ONU registed authorization module is to complete some relevant processing by calling call back function by other each modules.Call back function is exactly a function calling by function pointer.If you pass to another function using the pointer of function (address) as parameter, in the time that this pointer is used to call its function pointed, this is just called call back function.Call back function is not directly to be called by the realization side of this function, but called by an other side in the time of specific event or condition generation, for this event or condition are responded.While generation as ONU mandate event, can call a call back function ONU is carried out to some basic default configuration (this call back function is in ONU Configuration Manager), the interface that the completing of these basic default configuration need to be called driving issues hardware handles.
Under this implementation, ONU registed authorization module need to be waited for returning of call back function, the call back function of each module is directly to process in the time receiving message, in fact or carry out in registed authorization module processing procedure, is equivalent to the time still calculate in registed authorization module.So the processing speed of call back function has just affected the operating rate of registed authorization module greatly like this.And registed authorization module has a significant impact the performance of OLT equipment, the slow words of registed authorization resume module will affect the overall rate of OLT equipment, and the operating rate of OLT equipment is reduced.Therefore, how to improve ONU registed authorization speed and become the problem that urgently process this area.
Summary of the invention
The shortcoming of prior art in view of the above, the object of the present invention is to provide a kind of ONU registed authorization method and system, for solving prior art because the processing speed of call back function causes the low problem of ONU registed authorization module efficiency.
For achieving the above object and other relevant objects, the invention provides a kind of ONU registed authorization method, described ONU registed authorization method comprises: in the time that an event occurs, registed authorization module is called call back function described event is carried out to relevant treatment, and the parameter that described call back function receives comprises described event type; Described call back function is realized in module and being realized at call back function; Described call back function sends to described call back function to realize module with message mode described event type; Described call back function is realized module and is received described message and complete corresponding processing according to described event type.
Alternatively, in the time that an event occurs, described registed authorization module is called multiple call back functions and is carried out the relevant treatment to described event, and described multiple call back functions are realized respectively in multiple described call back functions are realized module.
Alternatively, described event comprises mandate event, removes mandate event, registered events and removes any one event in registered events.
Alternatively, described event type correspondence has event id.
Alternatively, described call back function is realized module and is comprised ONU Configuration Manager.
The invention provides a kind of ONU registed authorization system, described ONU registed authorization system comprises: registed authorization module, for in the time that an event occurs, to call call back function described event is carried out to relevant treatment, the parameter that described call back function receives comprises described event type; Call back function is realized module, for realizing the call back function of described registed authorization module; Described call back function sends to described call back function to realize module with message mode described event type; Described call back function is realized module also for receiving described message and completing corresponding processing according to described event type.
Alternatively, described registed authorization module, in the time that an event occurs, is called multiple call back functions and is carried out the relevant treatment to described event, and described multiple call back functions are realized respectively in multiple described call back functions are realized module.
Alternatively, described event comprises mandate event, removes mandate event, registered events and removes any one event in registered events.
Alternatively, described event type correspondence has event id.
Alternatively, described call back function is realized module and is comprised ONU Configuration Manager.
As mentioned above, a kind of ONU registed authorization method and system of the present invention, there is following beneficial effect: process and affect registed authorization resume module speed for the call back function of each module in equipment, adopt the method for message queue to be optimized, what be that the processing function of the call back function of each module in ONU registed authorization only need to do is exactly that the task that this message is sent to this module is processed accordingly, the concrete processing completing by former cause call back function, by the mode of message, allows call back function realize module design task and completes.The processing speed that so just can not affect registed authorization module, improves the speed of registed authorization, thereby improves the operating rate of whole equipment.The solution of the present invention is carried out the processing of call back function by the mode of message queue, call back function is processed function only need to send a message, the object of doing is like this exactly to reduce the impact of other modules on registed authorization module, accomplish that modules is separate, thereby improve the performance of registed authorization module, and then promote the performance of whole system.
Embodiment
Below, by specific instantiation explanation embodiments of the present invention, those skilled in the art can understand other advantages of the present invention and effect easily by the disclosed content of this specification.The present invention can also be implemented or be applied by other different embodiment, and the every details in this specification also can be based on different viewpoints and application, carries out various modifications or change not deviating under spirit of the present invention.
It should be noted that, the diagram providing in the present embodiment only illustrates basic conception of the present invention in a schematic way, satisfy and only show with assembly relevant in the present invention in graphic but not component count, shape and size drafting while implementing according to reality, when its actual enforcement, kenel, quantity and the ratio of each assembly can be a kind of random change, and its assembly layout kenel also may be more complicated.
The invention provides a kind of ONU registed authorization method.As shown in Figure 1, in one embodiment, described ONU registed authorization method comprises:
Step S1, in the time that an event occurs, registed authorization module is called call back function described event is carried out to relevant treatment, and the parameter that described call back function receives comprises described event type.Particularly, registed authorization module can first be stated used call back function, and the parameter that described call back function receives comprises event type; And in the time that event occurs, registed authorization module is called stated call back function, and input parameter using the type of described event (event type) as call back function.Described call back function is for realizing the relevant treatment to described event.In one embodiment, the call back function that described registed authorization module is called has multiple, each call back function is in order to realize the part processing relevant to described event, these call back functions define respectively in other modules, and multiple call back functions are realized in multiple other modules (can be described as call back function and realize module).In one embodiment, described event comprises mandate event, removes mandate event, registered events and removes any one event in registered events.Described event type correspondence has event id, and the value of described event type can be the event id of different event, identifies different event type by different event ID.Mandate event is authorized event also referred to as ONU, goes mandate event to go mandate event also referred to as ONU, and registered events, also referred to as ONU registered events, goes registered events to remove registered events also referred to as ONU.Described event can also comprise ONU up/down line event.
Step S2, described call back function is realized in module and being realized at call back function; Described call back function sends to described call back function to realize module with message mode described event type.Particularly, described call back function is realized in other modules, and we call call back function the module that realizes call back function and realize module.In call back function, the described event type in the parameter of reception is sent in the mode of message after this module (being that call back function is realized module) completing, return.That is to say, in telegram in reply function body, only realize the described event type in the parameter of reception is sent to this module in the mode of message, complete this operation after call back function complete.Like this, the processing speed of call back function just becomes very fast.In one embodiment, described call back function has multiple, realizes respectively in different call back functions is realized module.In one embodiment, described event is that ONU authorizes event, and the call back function A that at this moment registed authorization module is called is for realizing some the basic default configuration to ONU, and this interface that need to call driving issues hardware and processes.This call back function A realizes in ONU Configuration Manager, and this ONU Configuration Manager is also considered to a call back function and realizes modules A.This call back function A authorizes event type (ONU authorizes event id) to send to this module (being ONU Configuration Manager) with message mode ONU.Described registed authorization module also may be called other call back functions, as call back function B, call back function B does not realize in ONU Configuration Manager, can realize module B at call back function and realize, this call back function B authorizes event type (ONU authorizes event id) to send to this module (being that call back function is realized module B) with message mode ONU.
Step S3, described call back function is realized module and is received described message and complete corresponding processing according to described event type.Particularly, described call back function is realized module and is received the message that the call back function in this module sends, and obtains described event type from message, then processes accordingly according to event type.In one embodiment, it is ONU Configuration Manager that described call back function is realized module, event type is that ONU authorizes event type (ONU authorizes event id), it is that ONU authorizes after the message of event id that described ONU Configuration Manager receives described event type, authorize event id to process accordingly according to ONU, realize some basic default configuration of ONU.
The invention provides a kind of ONU registed authorization system.In one embodiment, as shown in Figure 2, described ONU registed authorization system 1 comprises: registed authorization module 11 and call back function are realized module 12.Wherein:
Registed authorization module 11, in the time that an event occurs, calls call back function described event is carried out to relevant treatment, and the parameter that described call back function receives comprises described event type.Particularly, registed authorization module 11 call back function that first statement is used, the parameter that described call back function receives comprises event type; And in the time that event occurs, registed authorization module 11 is called stated call back function, and input parameter using the type of described event as call back function.Described call back function is for realizing the relevant treatment to described event.In one embodiment, the call back function that described registed authorization module 11 is called has multiple, each call back function is in order to realize the part processing relevant to described event, these call back functions define respectively in other modules, and multiple call back functions are realized in multiple other modules (can be described as call back function and realize module 12).In one embodiment, described event comprises mandate event, removes mandate event, registered events and removes any one event in registered events.Described event type correspondence has event id, and the value of described event type can be the event id of different event, identifies different event type by different event ID.Mandate event is authorized event also referred to as ONU, goes mandate event to go mandate event also referred to as ONU, and registered events, also referred to as ONU registered events, goes registered events to remove registered events also referred to as ONU.
Call back function is realized module 12, for realizing the call back function of described registed authorization module 11; Described call back function sends to described call back function to realize module 12 with message mode described event type; Described call back function is realized module 12 also for receiving described message and completing corresponding processing according to described event type.Realize in module 12 complete definition that has comprised call back function or realization at call back function.In the definition of call back function or realizing, call back function sends to the described event type in the parameter of reception after this module (being that call back function is realized module) completing in the mode of message, return.That is to say, in call back function body, only realize the described event type in the parameter of reception is sent to this module in the mode of message, complete this operation after call back function complete.Like this, the processing speed of call back function just becomes very fast.In one embodiment, described call back function has multiple, realizes in module 12 and realizing respectively at different call back functions.In one embodiment, described event is that ONU authorizes event, and the call back function A that at this moment registed authorization module 11 is called is for realizing some the basic default configuration to ONU, and this interface that need to call driving issues hardware and processes.This call back function A realizes in ONU Configuration Manager, and this ONU Configuration Manager is also considered to a call back function and realizes module 12, can be described as call back function and realizes modules A.This call back function A authorizes event type (ONU authorizes event id) to send to this module (being ONU Configuration Manager) with message mode ONU.Described registed authorization module also may be called other call back functions, as call back function B, call back function B does not realize in ONU Configuration Manager, can realize in module 12 and to realize at another call back function, and another call back function is realized module 12 and be can be described as call back function and realize module B.This call back function B authorizes event type (ONU authorizes event id) to send to this module (being that call back function is realized module B) with message mode ONU.Described call back function is realized module 12 and is received the message that the call back function in this module sends, and described call back function is realized module 12 operations message queue Processing tasks.Described message queue Processing tasks takes out message and obtains described event type from message queue, then processes accordingly according to event type.In one embodiment, described call back function is realized module 12 for ONU Configuration Manager, event type is that ONU authorizes event type (ONU authorizes event id), it is that ONU authorizes after the message of event id that described ONU Configuration Manager 12 receives described event type, authorize event id to process accordingly according to ONU, realize some basic default configuration of ONU.
In sum, in the scheme of a kind of ONU registed authorization of the present invention method and system, registed authorization module adopts call back function mode to complete the processing to event, shown in call back function in other modules, realize, and the content of call back function is only for to send to this module by described event type message mode, received after this message by this module, then process accordingly for the event type in message.Adopt this programme, can allow registed authorization module in the processing completing fast event, mainly comprise the calling of call back function, in call back function, send corresponding event type message.Call back function realize module to the processing of event message in, the concrete processing that the event that completes is relevant.Like this, greatly improve the processing speed of registed authorization module to event, meanwhile, also improved the independence between module.Now, other modules to the relevant concrete processing of event to registed authorization module and have no effect.Improve the speed of registed authorization module to events such as ONU registed authorizations in OLT equipment, and then just improved the operating rate of whole OLT equipment.So the present invention has effectively overcome various shortcoming of the prior art and tool high industrial utilization.
Above-described embodiment is illustrative principle of the present invention and effect thereof only, but not for limiting the present invention.Any person skilled in the art scholar all can, under spirit of the present invention and category, modify or change above-described embodiment.Therefore, such as in affiliated technical field, have and conventionally know that the knowledgeable, not departing from all equivalence modifications that complete under disclosed spirit and technological thought or changing, must be contained by claim of the present invention.