aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/examples/code
diff options
context:
space:
mode:
Diffstat (limited to 'lib/diameter/examples/code')
-rw-r--r--lib/diameter/examples/code/client.erl15
-rw-r--r--lib/diameter/examples/code/relay.erl11
-rw-r--r--lib/diameter/examples/code/server.erl15
3 files changed, 38 insertions, 3 deletions
diff --git a/lib/diameter/examples/code/client.erl b/lib/diameter/examples/code/client.erl
index 9b0972c8d1..844c9cdbdd 100644
--- a/lib/diameter/examples/code/client.erl
+++ b/lib/diameter/examples/code/client.erl
@@ -41,6 +41,7 @@
-include_lib("diameter/include/diameter_gen_base_rfc6733.hrl").
-export([start/1, %% start a service
+ start/2, %%
connect/2, %% add a connecting transport
call/1, %% send using the record encoding
cast/1, %% send using the list encoding and detached
@@ -77,11 +78,23 @@
start(Name)
when is_atom(Name) ->
- node:start(Name, ?SERVICE(Name)).
+ start(Name, []);
+
+start(Opts)
+ when is_list(Opts) ->
+ start(?DEF_SVC_NAME, Opts).
+
+%% start/0
start() ->
start(?DEF_SVC_NAME).
+%% start/2
+
+start(Name, Opts) ->
+ node:start(Name, Opts ++ [T || {K,_} = T <- ?SERVICE(Name),
+ false == lists:keymember(K, 1, Opts)]).
+
%% connect/2
connect(Name, T) ->
diff --git a/lib/diameter/examples/code/relay.erl b/lib/diameter/examples/code/relay.erl
index e50d1a33f0..7bc46dc68d 100644
--- a/lib/diameter/examples/code/relay.erl
+++ b/lib/diameter/examples/code/relay.erl
@@ -32,6 +32,7 @@
-module(relay).
-export([start/1,
+ start/2,
listen/2,
connect/2,
stop/1]).
@@ -58,11 +59,19 @@
start(Name)
when is_atom(Name) ->
- node:start(Name, ?SERVICE(Name)).
+ start(Name, []).
+
+%% start/1
start() ->
start(?DEF_SVC_NAME).
+%% start/2
+
+start(Name, Opts) ->
+ node:start(Name, Opts ++ [T || {K,_} = T <- ?SERVICE(Name),
+ false == lists:keymember(K, 1, Opts)]).
+
%% listen/2
listen(Name, T) ->
diff --git a/lib/diameter/examples/code/server.erl b/lib/diameter/examples/code/server.erl
index b292c7afdb..f32cec594c 100644
--- a/lib/diameter/examples/code/server.erl
+++ b/lib/diameter/examples/code/server.erl
@@ -35,6 +35,7 @@
-module(server).
-export([start/1, %% start a service
+ start/2, %%
listen/2, %% add a listening transport
stop/1]). %% stop a service
@@ -63,11 +64,23 @@
start(Name)
when is_atom(Name) ->
- node:start(Name, ?SERVICE(Name)).
+ start(Name, []);
+
+start(Opts)
+ when is_list(Opts) ->
+ start(?DEF_SVC_NAME, Opts).
+
+%% start/0
start() ->
start(?DEF_SVC_NAME).
+%% start/2
+
+start(Name, Opts) ->
+ node:start(Name, Opts ++ [T || {K,_} = T <- ?SERVICE(Name),
+ false == lists:keymember(K, 1, Opts)]).
+
%% listen/2
listen(Name, T) ->