Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang
erlang
4153-megaco-Types-and-spec-for-megaco-test_repl...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 4153-megaco-Types-and-spec-for-megaco-test_reply-5.patch of Package erlang
From 8ed0de4af70b48bffd199af42f51a2e442297302 Mon Sep 17 00:00:00 2001 From: Micael Karlberg <bmk@erlang.org> Date: Fri, 5 Jan 2024 15:45:06 +0100 Subject: [PATCH 33/46] [megaco] Types and spec for megaco:test_reply/5 OTP-18920 --- lib/megaco/doc/src/megaco.xml | 44 +++++++++++++++++------------------ lib/megaco/src/app/megaco.erl | 19 ++++++++++++++- 2 files changed, 40 insertions(+), 23 deletions(-) diff --git a/lib/megaco/doc/src/megaco.xml b/lib/megaco/doc/src/megaco.xml index 3d38cd52ee..3fdcf05e48 100644 --- a/lib/megaco/doc/src/megaco.xml +++ b/lib/megaco/doc/src/megaco.xml @@ -57,6 +57,17 @@ </desc> </datatype> + <datatype> + <name name="megaco_message"/> + <!-- + <desc> + <p> + TBD. + </p> + </desc> + --> + </datatype> + <datatype> <name name="action_request"/> <!-- @@ -3165,32 +3176,21 @@ megaco_incr_timer() = #megaco_incr_timer{} </func> <func> - <name since="">test_reply(ConnHandle, Version, EncodingMod, EncodingConfig, Reply) -> {MegaMsg, EncodeRes}</name> + <name name="test_reply" arity="5" clause_i="1" since=""/> <fsummary>Tests if the Reply argument is correct</fsummary> - <type> - <v>ConnHandle = conn_handle()</v> - <v>Version = integer()</v> - <v>EncodingMod = atom()</v> - <v>EncodingConfig = A list</v> - <v>Reply = actual_reply()</v> - <v>MegaMsg = #'MegacoMessage'{}</v> - <v>EncodeRes = {ok, Bin} | {error, Reason}</v> - <v>Bin = binary()</v> - <v>Reason = term()</v> - </type> <desc> <p>Tests if the Reply argument is correctly composed.</p> <p>This function is only intended for testing purposes. It's - supposed to test the <c><![CDATA[actual_reply()]]></c> return value of - the callback functions - <seeerl marker="megaco_user#trans_request">handle_trans_request</seeerl> - and - <seeerl marker="megaco_user#trans_long_request">handle_trans_long_request</seeerl> - functions (with the additions of the <c><![CDATA[EncodingMod]]></c> and - <c><![CDATA[EncodingConfig]]></c> arguments). It composes a complete - megaco message end attempts to encode it. The return value, - will be a tuple of the composed megaco message and the - encode result.</p> + supposed to test the <c><![CDATA[actual_reply()]]></c> return value of + the callback functions + <seeerl marker="megaco_user#trans_request">handle_trans_request</seeerl> + and + <seeerl marker="megaco_user#trans_long_request">handle_trans_long_request</seeerl> + functions (with the additions of the <c><![CDATA[EncodingMod]]></c> and + <c><![CDATA[EncodingConfig]]></c> arguments). It composes a complete + megaco message end attempts to encode it. The return value, + will be a tuple of the composed megaco message and the + encode result.</p> </desc> </func> </funcs> diff --git a/lib/megaco/src/app/megaco.erl b/lib/megaco/src/app/megaco.erl index 42547fb773..93806dc8f6 100644 --- a/lib/megaco/src/app/megaco.erl +++ b/lib/megaco/src/app/megaco.erl @@ -130,6 +130,7 @@ megaco_encoder:domainName() | megaco_encoder:deviceName() | megaco_encoder:mtpAddress(). +-type megaco_message() :: megaco_encoder:megaco_message(). -type action_request() :: megaco_encoder:action_request(). -type action_reply() :: megaco_encoder:action_reply(). -type error_desc() :: megaco_encoder:error_desc(). @@ -605,14 +606,30 @@ test_request(ConnHandle, Version, EncodingMod, EncodingConfig, megaco_messenger:test_request(ConnHandle, ActionRequests, Version, EncodingMod, EncodingConfig). + %% This tests the actual_reply() type of return from the %% handle_trans_request function. -%% +%% + +-spec test_reply(ConnHandle, Version, + EncodingMod, EncodingConfig, + Reply) -> {MegaMsg, EncodeRes} when + ConnHandle :: conn_handle(), + Version :: protocol_version(), + EncodingMod :: module(), + EncodingConfig :: list(), + Reply :: error_desc() | [action_reply()], + MegaMsg :: megaco_message(), + EncodeRes :: {ok, Bin} | {error, Reason}, + Bin :: binary(), + Reason :: term(). + test_reply(ConnHandle, Version, EncodingMod, EncodingConfig, Reply) -> megaco_messenger:test_reply(ConnHandle, Version, EncodingMod, EncodingConfig, Reply). + %%----------------------------------------------------------------- %% Func: get_stats/0, get_stats/1, get_stats/2 %% Description: Retreive statistics (counters) for TCP -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor