Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:26
erlang
2017-megaco-Types-and-spec-for-megaco-conn_info...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 2017-megaco-Types-and-spec-for-megaco-conn_info-1-2.patch of Package erlang
From 8bbe712cf66046cfb706435dce29949a9d893cd3 Mon Sep 17 00:00:00 2001 From: Micael Karlberg <bmk@erlang.org> Date: Thu, 21 Dec 2023 17:40:50 +0100 Subject: [PATCH 07/46] [megaco] Types and spec for megaco:conn_info/1,2 OTP-18920 --- lib/megaco/doc/src/megaco.xml | 97 ++++++++++++++++++++++++++++++----- lib/megaco/src/app/megaco.erl | 73 ++++++++++++++++++++++++-- 2 files changed, 154 insertions(+), 16 deletions(-) diff --git a/lib/megaco/doc/src/megaco.xml b/lib/megaco/doc/src/megaco.xml index ea9e704852..e6437c49d1 100644 --- a/lib/megaco/doc/src/megaco.xml +++ b/lib/megaco/doc/src/megaco.xml @@ -158,6 +158,28 @@ --> </datatype> + <datatype> + <name name="transaction_id"/> + <!-- + <desc> + <p> + TBD. + </p> + </desc> + --> + </datatype> + + <datatype> + <name name="conn_info_item"/> + <desc> + <p> + This type is a basic (atom) lookup key + (for info on an active connection). + The corresponding value can be of any type. + </p> + </desc> + </datatype> + <datatype> <name name="send_handle"/> <desc> @@ -849,25 +871,21 @@ megaco_incr_timer() = #megaco_incr_timer{} about which items and values that are valid.</p> <marker id="conn_info"></marker> + <marker id="conn_info_11"></marker> + <marker id="conn_info_24"></marker> </desc> </func> <func> - <name since="">conn_info(ConnHandle) -> [{Item, Value}]</name> - <name since="">conn_info(ConnHandle, Item) -> Value | exit(Reason)</name> + <name name="conn_info" arity="1" clause_i="1" since=""/> + <name name="conn_info" arity="2" clause_i="4" since=""/> <fsummary>Lookup information about an active connection</fsummary> - <type> - <v>ConnHandle = #megaco_conn_handle{}</v> - <v>Item = conn_info_item()</v> - <v>Value = conn_info_value()</v> - <v>Reason = {no_such_connection, ConnHandle} | term()</v> - </type> <desc> <p>Lookup information about an active connection</p> <p>Requires that the connection is active.</p> - <marker id="ci_control_pid"></marker> - <taglist> + <marker id="ci_control_pid"></marker> + <taglist> <tag><c><![CDATA[control_pid]]></c></tag> <item> <p>The process identifier of the controlling process for a @@ -926,7 +944,7 @@ megaco_incr_timer() = #megaco_incr_timer{} <p>A positive integer or <c><![CDATA[infinity]]></c>, defaults to <c><![CDATA[infinity]]></c>.</p> - <marker id="ci_request_time"></marker> + <marker id="ci_request_timer"></marker> </item> <tag><c><![CDATA[request_timer]]></c></tag> @@ -1347,9 +1365,62 @@ megaco_incr_timer() = #megaco_incr_timer{} <p>A positive integer or <c><![CDATA[infinity]]></c>, defaults to <c><![CDATA[infinity]]></c>. </p> </item> - </taglist> - <marker id="update_conn_info"></marker> + </taglist> + + <p>Failure: <c>exit</c> if, for instance, + <c><anno>ConnHandle</anno></c> refers to a connection + that no longer exists.</p> + + <marker id="conn_info_21"></marker> + </desc> + </func> + + <func> + <name name="conn_info" arity="2" clause_i="1" since=""/> + <fsummary>Lookup information about an active connection</fsummary> + <desc> + <p>Lookup all connection information about an <em>active</em> + connection</p> + + <p>See <seeerl marker="#conn_info_24">conn_info</seeerl> for + more info.</p> + + <p>Failure: <c>exit</c> if, for instance, + <c><anno>ConnHandle</anno></c> refers to a connection + that no longer exists.</p> + + <marker id="conn_info_22"></marker> + </desc> + </func> + + <func> + <name name="conn_info" arity="2" clause_i="2" since=""/> + <fsummary>Lookup information about an active connection</fsummary> + <desc> + <p>Lookup information about currently active requests for an + <em>active</em> connection</p> + + <p>Failure: <c>exit</c> if, for instance, + <c><anno>ConnHandle</anno></c> refers to a connection + that no longer exists.</p> + + <marker id="conn_info_23"></marker> + </desc> + </func> + + <func> + <name name="conn_info" arity="2" clause_i="3" since=""/> + <fsummary>Lookup information about an active connection</fsummary> + <desc> + <p>Lookup information about currently active replies for an + <em>active</em> connection</p> + + <p>Failure: <c>exit</c> if, for instance, + <c><anno>ConnHandle</anno></c> refers to a connection + that no longer exists.</p> + + <marker id="update_conn_info"></marker> </desc> </func> diff --git a/lib/megaco/src/app/megaco.erl b/lib/megaco/src/app/megaco.erl index 1b3a15a414..ab870d0d13 100644 --- a/lib/megaco/src/app/megaco.erl +++ b/lib/megaco/src/app/megaco.erl @@ -125,9 +125,46 @@ -type segment_no() :: megaco_encoder:segment_no(). -type conn_handle() :: megaco_user:conn_handle(). -type megaco_timer() :: megaco_user:megaco_timer(). +-type transaction_id() :: pos_integer(). + +-type action_reqs() :: binary() | [action_request()]. +-type action_reps() :: [action_reply()]. +-type conn_info_item() :: control_pid | + send_handle | + local_mid | + remote_mid | + receive_handle | + trans_id | + max_trans_id | + request_timer | + long_request_timer | + request_keep_alive_timeout | + long_request_resend | + reply_timer | + call_proxy_gc_timeout | + auto_ack | + trans_ack | + trans_ack_maxcount | + trans_req | + trans_req_maxcount | + trans_req_maxsize | + trans_timer | + pending_timer | + sent_pending_limit | + recv_pending_limit | + send_mod | + encoding_mod | + encoding_config | + protocol_version | + strict_version | + reply_data | + threaded | + resend_indication | + segment_reply_ind | + segment_recv_timer | + segment_send | + max_pdu_size. --type action_reqs() :: binary() | [action_request()]. --type action_reps() :: [action_reply()]. -type send_handle() :: term(). @@ -194,14 +231,44 @@ update_user_info(UserMid, Item, Value) -> %% Lookup information about an active connection %%----------------------------------------------------------------- +-spec conn_info(ConnHandle) -> [{Item, Value}] when + ConnHandle :: conn_handle(), + Item :: requests | replies | conn_info_item(), + Value :: term(). + conn_info(ConnHandle) -> [{requests, conn_info(ConnHandle, requests)}, {replies, conn_info(ConnHandle, replies)} | conn_info(ConnHandle, all)]. -conn_info(ConnHandle, requests) -> + +-spec conn_info(ConnHandle, all) -> [{conn_info_item(), term()}] when + ConnHandle :: conn_handle(); + + (ConnHandle, requests) -> [TransId] when + ConnHandle :: conn_handle(), + TransId :: transaction_id(); + + (ConnHandle, replies) -> + [{TransId, ReplyState, Handler}] when + ConnHandle :: conn_handle(), + TransId :: transaction_id(), + ReplyState :: prepare | eval_request | waiting_for_ack | aborted, + Handler :: undefined | pid(); + + (ConnHandle, Item) -> Value when + ConnHandle :: conn_handle(), + Item :: conn_info_item(), + Value :: term(). + +conn_info(ConnHandle, all = Item) -> + megaco_config:conn_info(ConnHandle, Item); + +conn_info(ConnHandle, requests = _Item) -> megaco_messenger:which_requests(ConnHandle); + conn_info(ConnHandle, replies) -> megaco_messenger:which_replies(ConnHandle); + conn_info(ConnHandle, Item) -> megaco_config:conn_info(ConnHandle, Item). -- 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