cosnotification_common.erl
来自「OTP是开放电信平台的简称」· ERL 代码 · 共 1,210 行 · 第 1/3 页
ERL
1,210 行
} } }.%%------------------------------------------------------------%% function : 'ConnectionReliability'/6%% Arguments: Req - Requested QoS, #'CosNotification_Property'{}%% Type - Requestee, channel | admin | proxy%% Curr - Current QoS, #'CosNotification_Property'{}%% Parent - false | ObjRef%% Childs - false | [ObjRef1, .., ObjRefN]%% LQS - #qos{} defined in CosNotification_Definitions.hrl%% Returns : %% Exception: %% Effect : %%------------------------------------------------------------%% The most complex QoS to set is ConnectionReliability, and the reason for this%% is that we cannot set the Channel to offer best effort while its children%% offer persistent. A child may only offer Persistent if its parent do, which%% is why we must check the following:%% %% # Persistent Change to Best Effort%% _____%% | | (1) -> Check if children BE%% |Chann| (2) ok <-%% -----%% |%% _____%% | | (3) -> Check if children BE%% |Admin| (4) Check if parent Pers. <- %% -----%% |%% _____%% | | (5) -> ok%% |Proxy| (6) Check if parent Pers. <-%% -----%% NOTE: a parent always exists but we may change the QoS before creating any%% childrens. The cases (2) and (5) is always ok, i.e., no need to confirm%% with parent or children.%%------------------------------------------------------------'ConnectionReliability'(Req, channel, _Curr, _Parent, Childs, LQS) -> case {any:get_value(Req#'CosNotification_Property'.value), ?not_GetConnectionReliability(LQS), ?not_BestEffort, ?not_Persistent} of {Val, Val, _, _} -> %% Is the value requested. ok; {Val, P, Val, P} -> %% Requested is BestEffort, Current Persistent => (1) check_with_relatives(Childs, Req, LQS); {Val, B, B, Val} -> %% Requested is Persistent, Current BestEffort => (2) {ok, Req, LQS}; _-> {unsupported, #'CosNotification_PropertyError'{ code = 'BAD_TYPE', name = Req#'CosNotification_Property'.name, available_range = #'CosNotification_PropertyRange'{ low_val=any:create(orber_tc:null(), null), high_val=any:create(orber_tc:null(), null) } } } end;'ConnectionReliability'(Req, admin, _Curr, Parent, Childs, LQS) -> case {any:get_value(Req#'CosNotification_Property'.value), ?not_GetConnectionReliability(LQS), ?not_BestEffort, ?not_Persistent} of {Val, Val, _, _} -> %% Is the value requested. ok; {Val, P, Val, P} -> %% Requested is BestEffort, Current Persistent => (3) check_with_relatives(Childs, Req, LQS); {Val, B, B, Val} -> %% Requested is Persistent, Current BestEffort => (4) check_with_relatives([Parent], Req, LQS); _-> {unsupported, #'CosNotification_PropertyError'{ code = 'BAD_TYPE', name = Req#'CosNotification_Property'.name, available_range = #'CosNotification_PropertyRange'{ low_val=any:create(orber_tc:null(), null), high_val=any:create(orber_tc:null(), null) } } } end;'ConnectionReliability'(Req, proxy, _Curr, Parent, _Childs, LQS) -> case {any:get_value(Req#'CosNotification_Property'.value), ?not_GetConnectionReliability(LQS), ?not_BestEffort, ?not_Persistent} of {Val, Val, _, _} -> %% Is the value requested. ok; {Val, P, Val, P} -> %% Requested is BestEffort, Current Persistent => (5) {ok, Req, LQS}; {Val, B, B, Val} -> %% Requested is Persistent, Current BestEffort => (6) check_with_relatives([Parent], Req, LQS); _-> {unsupported, #'CosNotification_PropertyError'{ code = 'BAD_TYPE', name = Req#'CosNotification_Property'.name, available_range = #'CosNotification_PropertyRange'{ low_val=any:create(orber_tc:null(), null), high_val=any:create(orber_tc:null(), null) } } } end.%%------------------------------------------------------------%% function : 'Priority'/6%% Arguments: Req - Requested QoS, #'CosNotification_Property'{}%% Type - Requestee, channel | admin | proxy%% Curr - Current QoS, #'CosNotification_Property'{}%% Parent - false | ObjRef%% Childs - false | [ObjRef1, .., ObjRefN]%% LQS - #qos{} defined in CosNotification_Definitions.hrl%% Returns : %% Effect : %%------------------------------------------------------------'Priority'(Req, _Type, _Curr, _Parent, _Childs, LQS) -> case {any:get_value(Req#'CosNotification_Property'.value), ?not_GetPriority(LQS), ?not_HighestPriority, ?not_LowestPriority} of {Val, Val, _, _} -> ok; {Val, _, H, L} when Val =< H, Val >= L -> {ok, Req, LQS}; {_, _, H, L} -> {unsupported, #'CosNotification_PropertyError'{ code = 'BAD_VALUE', name = Req#'CosNotification_Property'.name, available_range = #'CosNotification_PropertyRange'{ low_val=any:create(orber_tc:short(), L), high_val=any:create(orber_tc:short(), H) } } } end.%%------------------------------------------------------------%% function : 'StartTimeSupported'/6%% Arguments: Req - Requested QoS, #'CosNotification_Property'{}%% Type - Requestee, channel | admin | proxy%% Curr - Current QoS, #'CosNotification_Property'{}%% Parent - false | ObjRef%% Childs - false | [ObjRef1, .., ObjRefN]%% LQS - #qos{} defined in CosNotification_Definitions.hrl%% Returns : %% Effect : %%------------------------------------------------------------'StartTimeSupported'(Req, _Type, _Curr, _, _, LQS) -> case {any:get_value(Req#'CosNotification_Property'.value), ?not_GetStartTimeSupported(LQS)} of {Val, Val} -> ok; {Val, _} when Val =/= true, Val =/= false -> {unsupported, #'CosNotification_PropertyError'{ code = 'BAD_VALUE', name = Req#'CosNotification_Property'.name, available_range = #'CosNotification_PropertyRange'{ low_val=any:create(orber_tc:boolean(), false), high_val=any:create(orber_tc:boolean(), true) } } }; _-> {ok, Req, LQS} end.%%------------------------------------------------------------%% function : 'StopTimeSupported'/6%% Arguments: Req - Requested QoS, #'CosNotification_Property'{}%% Type - Requestee, channel | admin | proxy%% Curr - Current QoS, #'CosNotification_Property'{}%% Parent - false | ObjRef%% Childs - false | [ObjRef1, .., ObjRefN]%% LQS - #qos{} defined in CosNotification_Definitions.hrl%% Returns : %% Effect : %%------------------------------------------------------------'StopTimeSupported'(Req, _Type, _Curr, _, _, LQS) -> case {any:get_value(Req#'CosNotification_Property'.value), ?not_GetStopTimeSupported(LQS)} of {Val, Val} -> ok; {Val, _} when Val =/= true, Val =/= false -> {unsupported, #'CosNotification_PropertyError'{ code = 'BAD_VALUE', name = Req#'CosNotification_Property'.name, available_range = #'CosNotification_PropertyRange'{ low_val=any:create(orber_tc:boolean(), false), high_val=any:create(orber_tc:boolean(), true) } } }; _-> {ok, Req, LQS} end.%%------------------------------------------------------------%% function : 'Timeout'/6%% Arguments: Req - Requested QoS, #'CosNotification_Property'{}%% Type - Requestee, channel | admin | proxy%% Curr - Current QoS, #'CosNotification_Property'{}%% Parent - false | ObjRef%% Childs - false | [ObjRef1, .., ObjRefN]%% LQS - #qos{} defined in CosNotification_Definitions.hrl%% Returns : %% Effect : %%------------------------------------------------------------'Timeout'(Req, _Type, _Curr, _Parent, _Childs, LQS) -> case {any:get_value(Req#'CosNotification_Property'.value), ?not_GetTimeout(LQS)} of {Val, Val} -> ok; {Val, _} when Val >= ?not_MinTimeout, Val =< ?not_MaxTimeout -> {ok, Req, LQS}; {Val, _} when integer(Val) -> {unsupported, #'CosNotification_PropertyError'{ code = 'BAD_VALUE', name = Req#'CosNotification_Property'.name, available_range = #'CosNotification_PropertyRange'{ low_val=any:create(orber_tc:unsigned_long_long(), ?not_MinTimeout), high_val=any:create(orber_tc:unsigned_long_long(), ?not_MaxTimeout) } } }; _-> {unsupported, #'CosNotification_PropertyError'{ code = 'BAD_TYPE', name = Req#'CosNotification_Property'.name, available_range = #'CosNotification_PropertyRange'{ low_val=any:create(orber_tc:null(), null), high_val=any:create(orber_tc:null(), null) } } } end.%%------------------------------------------------------------%% function : 'OrderPolicy'/6%% Arguments: Req - Requested QoS, #'CosNotification_Property'{}%% Type - Requestee, channel | admin | proxy%% Curr - Current QoS, #'CosNotification_Property'{}%% Parent - false | ObjRef%% Childs - false | [ObjRef1, .., ObjRefN]%% LQS - #qos{} defined in CosNotification_Definitions.hrl%% Returns : %% Effect : %%------------------------------------------------------------'OrderPolicy'(Req, _Type, _Curr, _Parent, _Childs, LQS) -> case {any:get_value(Req#'CosNotification_Property'.value), ?not_GetOrderPolicy(LQS), 'CosNotification':'AnyOrder'(), 'CosNotification':'PriorityOrder'()} of {Val, Val,_,_} -> ok; {Val, _, L, H} when Val >= L, Val =< H -> {ok, Req, LQS}; {Val, _, L, H} when integer(Val) -> {unsupported, #'CosNotification_PropertyError'{ code = 'BAD_VALUE', name = Req#'CosNotification_Property'.name, available_range = #'CosNotification_PropertyRange'{ low_val=any:create(orber_tc:short(), L), high_val=any:create(orber_tc:short(), H) } } }; _-> {unsupported, #'CosNotification_PropertyError'{ code = 'BAD_TYPE', name = Req#'CosNotification_Property'.name, available_range = #'CosNotification_PropertyRange'{ low_val=any:create(orber_tc:null(), null), high_val=any:create(orber_tc:null(), null) } } } end.%%------------------------------------------------------------%% function : 'DiscardPolicy'/6%% Arguments: Req - Requested QoS, #'CosNotification_Property'{}%% Type - Requestee, channel | admin | proxy%% Curr - Current QoS, #'CosNotification_Property'{}%% Parent - false | ObjRef%% Childs - false | [ObjRef1, .., ObjRefN]%% LQS - #qos{} defined in CosNotification_Definitions.hrl%% Returns : %% Effect : %%------------------------------------------------------------'DiscardPolicy'(Req, _Type, _Curr, _Parent, _Childs, LQS) -> case {any:get_value(Req#'CosNotification_Property'.value), ?not_GetDiscardPolicy(LQS), ?not_AnyOrder, ?not_PriorityOrder} of {Val, Val,_,_} -> ok; {Val, _, L, H} when Val >= L, Val =< H -> {ok, Req, LQS}; {Val, _, L, H} when integer(Val) -> {unsupported, #'CosNotification_PropertyError'{ code = 'BAD_VALUE', name = Req#'CosNotification_Property'.name, available_range = #'CosNotification_PropertyRange'{ low_val=any:create(orber_tc:short(), L), high_val=any:create(orber_tc:short(), H) } } }; _-> {unsupported, #'CosNotification_PropertyError'{ code = 'BAD_TYPE', name = Req#'CosNotification_Property'.name, available_range = #'CosNotification_PropertyRange'{ low_val=any:create(orber_tc:null(), null), high_val=any:create(orber_tc:null(), null) } } } end.%%------------------------------------------------------------%% function : 'DiscardPolicy'/6%% Arguments: Req - Requested QoS, #'CosNotification_Property'{}%% Type - Requestee, channel | admin | proxy%% Curr - Current QoS, #'CosNotification_Property'{}%% Parent - false | ObjRef%% Childs - false | [ObjRef1, .., ObjRefN]%% LQS - #qos{} defined in CosNotification_Definitions.hrl%% Returns : %% Effect : %%------------------------------------------------------------'MaximumBatchSize'(Req, _Type, _Curr, _Parent, _Childs, LQS) -> case {any:get_value(Req#'CosNotification_Property'.value), ?not_GetMaximumBatchSize(LQS)} of {Val, Val} -> ok; {Val, _} when Val >= ?not_MinBatchSize, Val =< ?not_MaxBatchSize -> {ok, Req, LQS}; {Val, _} when integer(Val) -> {unsupported, #'CosNotification_PropertyError'{ code = 'BAD_VALUE', name = Req#'CosNotification_Property'.name, available_range = #'CosNotification_PropertyRange'{ low_val=any:create(orber_tc:unsigned_long_long(), ?not_MinBatchSize), high_val=any:create(orber_tc:unsigned_long_long(), ?not_MaxBatchSize) } } }; _-> {unsupported, #'CosNotification_PropertyError'{ code = 'UNSUPPORTED_VALUE', name = Req#'CosNotification_Property'.name, available_range = #'CosNotification_PropertyRange'{ low_val=any:create(orber_tc:long(), ?not_MinBatchSize), high_val=any:create(orber_tc:long(), ?not_MaxBatchSize) } } } end.%%------------------------------------------------------------%% function : 'PacingInterval'/6%% Arguments: Req - Requested QoS, #'CosNotification_Property'{}%% Type - Requestee, channel | admin | proxy%% Curr - Current QoS, #'CosNotification_Property'{}%% Parent - false | ObjRef%% Childs - false | [ObjRef1, .., ObjRefN]%% LQS - #qos{} defined in CosNotification_Definitions.hrl%% Returns : %% Comment : PacingInterval is defined to be:%% * TimeBase::UtcT (p 57, 2.5.5, OMG TC Document telecom/98-11-01)%% * TimeBase::TimeT (p 189, appendix B, OMG TC Document telecom/98-11-01)%% This implementation use TimeBase::TimeT, especially since%% TimeBase::UtcT contains information which are of no importance.%% When writing this, the OMG homepage contained no information%% regarding this.%%------------------------------------------------------------'PacingInterval'(Req, _Type, _Curr, _Parent, _Childs, LQS) -> case {any:get_value(Req#'CosNotification_Property'.value), ?not_GetPacingInterval(LQS)} of
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?