Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:26
erlang
1751-dia-Add-callback-attributes-to-diameter_ap...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 1751-dia-Add-callback-attributes-to-diameter_app.patch of Package erlang
From 5840899f21b8e524156499eb3cf5b12773e8458b Mon Sep 17 00:00:00 2001 From: Lukas Larsson <lukas@erlang.org> Date: Wed, 27 Sep 2023 16:07:06 +0200 Subject: [PATCH 1/2] dia: Add callback attributes to diameter_app --- lib/diameter/src/base/diameter_app.erl | 83 +++++++++++++++++++++++- lib/diameter/src/base/diameter_codec.erl | 8 +++ 2 files changed, 89 insertions(+), 2 deletions(-) diff --git a/lib/diameter/src/base/diameter_app.erl b/lib/diameter/src/base/diameter_app.erl index 122f60dd88..39e33d9bc4 100644 --- a/lib/diameter/src/base/diameter_app.erl +++ b/lib/diameter/src/base/diameter_app.erl @@ -23,8 +23,87 @@ -behaviour(application). %% application callbacks --export([start/2, - stop/1]). +-export([start/2, stop/1]). + +-include_lib("diameter/include/diameter.hrl"). + +-type peer_ref() :: term(). +-type capabilities() :: #diameter_caps{}. +-type peer() :: {peer_ref(), capabilities()}. +-type packet() :: diameter_codec:packet(). +-type state() :: term(). +-type message() :: diameter_codec:message(). + +-callback handle_request(Packet, SvcName, Peer) -> Action when + Packet :: packet(), + SvcName :: term(), + Peer :: peer(), + Action :: Reply | + {relay, [Opt]} | + discard | + {eval | eval_packet, Action, PostF}, + Reply :: {reply, packet() | message()} | + {answer_message, + 3000..3999 | 5000..5999} | + {protocol_error, 3000..3999}, + Opt :: diameter:call_opt(), + PostF :: diameter:eval(). + +-callback handle_error(Reason, Request, SvcName, Peer) -> Result when + Reason :: timeout | failover | term(), + Request :: message(), + SvcName :: diameter:service_name(), + Peer :: peer(), + Result :: term(). + +-callback handle_answer(Packet, Request, SvcName, Peer) -> Result when + Packet :: packet(), + Request :: message(), + SvcName :: diameter:service_name(), + Peer :: peer(), + Result :: term(). + +-callback prepare_retransmit(Packet, SvcName, Peer) -> Action when + Packet :: packet(), + SvcName :: diameter:service_name(), + Peer :: peer(), + Action :: Send | Discard | + {eval_packet, Action, PostF}, + Send :: {send, packet() | message()}, + Discard :: {discard, Reason :: term()} | discard, + PostF :: diameter:eval(). + +-callback prepare_request(Packet, SvcName, Peer) -> Action when + Packet :: packet(), + SvcName :: diameter:service_name(), + Peer :: peer(), + Action :: Send | Discard | + {eval_packet, Action, PostF}, + Send :: {send, packet() | message()}, + Discard :: {discard, Reason :: term()} | discard, + PostF :: diameter:eval(). + +-callback pick_peer(LocalCandidates, RemoteCandidates, SvcName, State) -> + Selection | false when + LocalCandidates :: [peer()], + RemoteCandidates :: [peer()], + SvcName :: diameter:service_name(), + State :: state(), + NewState :: state(), + Selection :: {ok, Peer} | {Peer, NewState}, + Peer :: peer() | false. + +-callback peer_down(SvcName, Peer, State) -> NewState when + SvcName :: diameter:service_name(), + Peer :: peer(), + State :: state(), + NewState :: state(). + +-callback peer_up(SvcName, Peer, State) -> NewState when + SvcName :: diameter:service_name(), + Peer :: peer(), + State :: state(), + NewState :: state(). %% start/2 diff --git a/lib/diameter/src/base/diameter_codec.erl b/lib/diameter/src/base/diameter_codec.erl index f3f677295b..33caa5afca 100644 --- a/lib/diameter/src/base/diameter_codec.erl +++ b/lib/diameter/src/base/diameter_codec.erl @@ -42,6 +42,14 @@ -define(FLAGS(R,P,E,T), ?BIT(R):1, ?BIT(P):1, ?BIT(E):1, ?BIT(T):1, 0:4). -define(FLAG(B,D), (if is_boolean(B) -> B; true -> 0 /= (D) end)). +%% A diameter record created by the diameter compiler +-type record() :: term(). + +-type message() :: record() | maybe_improper_list(). +-type packet() :: #diameter_packet{}. + +-export_type([message/0, packet/0]). + -type u32() :: 0..16#FFFFFFFF. -type u24() :: 0..16#FFFFFF. -type u1() :: 0..1. -- 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