aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/doc/src/diameter.xml
blob: 6abd1515c98ddd1c19a84b35c221da89e3ac9ccf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
<?xml version="1.0" encoding="latin1" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">

<erlref>
<header>

<copyright>
<year>2011</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
The contents of this file are subject to the Erlang Public License,
Version 1.1, (the "License"); you may not use this file except in
compliance with the License. You should have received a copy of the
Erlang Public License along with this software. If not, it can be
retrieved online at http://www.erlang.org/.
    
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and limitations
under the License.
    
</legalnotice>

<title>diameter(3)</title>

<prepared>Anders Svensson</prepared>
<responsible></responsible>
<docno></docno>
<approved></approved>
<checked></checked>
<date></date>
<rev>%VSN%</rev>
<file>diameter.xml</file>

</header>

<!-- ===================================================================== -->
<!-- ===================================================================== -->

<module>diameter</module>
<modulesummary>Main API of the diameter application.</modulesummary>

<description>
<p>
This module provides the interface with which a user
creates a service that sends and receives messages using the
Diameter protocol as defined in RFC 3588.</p>

<p>
Basic usage consists of creating a representation of a
locally implemented Diameter node and its capabilities with <seealso
marker="#start_service">start_service/2</seealso>, adding transport
capability using <seealso
marker="#add_transport">add_transport/2</seealso> and sending Diameter
requests and receiving Diameter answers with <seealso
marker="#call">call/4</seealso>.
Incoming Diameter requests are communicated as callbacks to a
<seealso
marker="diameter_app">diameter_app(3)</seealso> callback modules as
specified in the service configuration.</p>

<p>
Beware the difference between <em>diameter application</em> and
<em>Diameter application</em>.
The former refers to the Erlang application named diameter whose main
api is defined here, the latter to an application of the Diameter
protocol in the sense of RFC 3588.
More generally, capitalized Diameter refers to the RFC
and diameter to this implementation.</p>

<p>
The diameter application must be started before calling functions in
this module.</p>

</description>

<!-- ===================================================================== -->
<!-- ===================================================================== -->
<section>
<title>DATA TYPES</title>

<taglist>

<tag><c>Address()</c></tag>
<tag><c>DiameterIdentity()</c></tag>
<tag><c>Grouped()</c></tag>
<tag><c>OctetString()</c></tag>
<tag><c>Time()</c></tag>
<tag><c>Unsigned32()</c></tag>
<item>
<p>
Types corresponding to RFC 3588 AVP Data Formats.
Defined in <seealso marker="diameter_dict#DATA_TYPES">diameter_dict(4)</seealso>.</p>

<marker id="application_alias"/>
</item>

<tag><c>application_alias() = term()</c></tag>
<item>
<p>
A name identifying a Diameter application in
service configuration passed to <seealso
marker="#start_service">start_service/2</seealso> and passed to
<seealso marker="#call">call/4</seealso> when sending requests
belonging to the application.</p>

<marker id="application_module"/>
</item>

<tag><c>application_module() = Mod
                             | [Mod | ExtraArgs]
                             | #diameter_callback{}</c></tag>
<item>
<code>
Mod = atom()
ExtraArgs = list()
</code>

<p>
A module implementing the callback interface defined in <seealso
marker="diameter_app">diameter_app(3)</seealso>, along with any
extra arguments to be appended to those documented for the interface.
Any extra arguments are appended to the documented list of arguments for
each function.
Note that additional arguments specific to an outgoing request be
specified to <seealso marker="#call">call/4</seealso>, in which case
the call-specific arguments are appended to any specified with the
callback module.</p>

<p>
Specifying a <c>#diameter_callback{}</c> record allows individual
functions to be configured in place of the usual <seealso
marker="diameter_app">diameter_app(3)</seealso> callbacks, with
default implementations provided by module <c>diameter_callback</c>
unless otherwise specified.
See that module for details.</p>

<marker id="application_opt"/>
</item>

<tag><c>application_opt()</c></tag>
<item>

<p>
Options defining a Diameter application as configured in an
<c>application</c> option passed to
<seealso marker="#start_service">start_service/2</seealso>.</p>

<taglist>

<tag><c>{alias, <seealso marker="#application_alias">application_alias()</seealso>}</c></tag>
<item>
<p>
An unique identifier for the application in the scope of the
service.
Optional, defaults to the value of the <c>dictionary</c> option.</p>
</item>

<tag><c>{dictionary, atom()}</c></tag>
<item>
<p>
The name of an encode/decode module for the Diameter
messages defined by the application.
These modules are generated from a specification file whose format is
documented in <seealso
marker="diameter_dict">diameter_dict(4)</seealso>.</p>
</item>

<tag><c>{module, <seealso marker="#application_module">application_module()</seealso>}</c></tag>
<item>
<p>
A callback module with which messages of the Diameter application are
handled.
See <seealso marker="diameter_app">diameter_app(3)</seealso> for
information on the required interface and semantics.</p>
</item>

<tag><c>{state, term()}</c></tag>
<item>
<p>
The initial callback state.
Defaults to the value of the <c>alias</c> option if unspecified.
The prevailing state is passed to certain
<seealso marker="diameter_app">diameter_app(3)</seealso>
callbacks, which can then return a new state.</p>
</item>

<tag><c>{call_mutates_state, true|false}</c></tag>
<item>
<p>
Specifies whether or not the <seealso
marker="diameter_app#pick_peer">pick_peer/4</seealso>
application callback (following from a call to
<seealso marker="#call">call/4</seealso>)
can modifiy state,
Defaults to <c>false</c> if unspecified.</p>

<p>
Note that <seealso
marker="diameter_app#pick_peer">pick_peer</seealso> callbacks are
serialized when these are allowed to modify state, which is a
potential performance bottleneck.
A simple Diameter client may suffer no ill effects from using mutable
state but a server or agent that responds to incoming request but
sending its own requests should probably avoid it.</p>
</item>

<tag><c>{answer_errors, callback|report|discard}</c></tag>
<item>
<p>
Determines the manner in which incoming answer messages containing
decode errors are handled.
If <c>callback</c> then errors result in a <seealso
marker="diameter_app#handle_answer">handle_answer/4</seealso>
callback in the same fashion as for <seealso
marker="diameter_app#handle_request">handle_request/3</seealso>, in the
<c>errors</c> field of the <c>diameter_packet</c> record passed into
the callback.
If <c>report</c> then an answer containing errors is discarded
without a callback and a warning report is written to the log.
If <c>discard</c> then an answer containing errors is silently
discarded without a callback.
In both the <c>report</c> and <c>discard</c> cases the return value
for the <seealso marker="#call">call/4</seealso> invocation in
question is as if a callback had taken place and returned
<c>{error, failure}</c>.</p>

<p>
Defaults to <c>report</c> if unspecified.</p>
</item>

</taglist>

<marker id="call_opt"/>
</item>

<tag><c>call_opt()</c></tag>
<item>

<p>
Options available to <seealso marker="#call">call/4</seealso> when
sending an outgoing Diameter request.</p>

<taglist>

<tag><c>{extra, list()}</c></tag>
<item>
<p>
Extra arguments to append to callbacks to the callback
module in question.
These are appended to any extra arguments configured with the callback
itself.
Multiple options append to the argument list.</p>
</item>

<tag><c>{filter, <seealso marker="#peer_filter">peer_filter()</seealso>}</c></tag>
<item>
<p>
A filter to apply to the list of available peers before passing them to
the <seealso marker="diameter_app#pick_peer">pick_peer/4</seealso>
callback for the application in question.
Multiple options are equivalent a single <c>all</c> filter on the
corresponding list of filters.
Defaults to <c>none</c>.</p>
</item>

<tag><c>{timeout, <seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso>}</c></tag>
<item>
<p>
The number of milliseconds after which the request should
timeout.
Defaults to 5000.</p>
</item>

<tag><c>detach</c></tag>
<item>
<p>
Causes <seealso marker="#call">call/4</seealso> to return <c>ok</c> as
soon as the request in
question has been encoded instead of waiting for and returning
the result from a subsequent
<seealso marker="diameter_app#handle_answer">handle_answer/4</seealso>
or <seealso
marker="diameter_app#handle_error">handle_error/4</seealso>
callback.</p>
</item>

</taglist>

<p>
An invalid option will cause <seealso marker="#call">call/4</seealso>
to fail.</p>

<marker id="capability"/>
</item>

<tag><c>capability()</c></tag>
<item>

<p>
AVP values used in outgoing CER/CEA messages during capabilities exchange.
Can be configured both on a service and a transport, the latter taking
precedence over the former.</p>

<taglist>

<tag><c>{'Origin-Host', <seealso marker="diameter_dict#DATA_TYPES">DiameterIdentity()</seealso>}</c></tag>
<item>
<p>
Value of the Origin-Host AVP in outgoing messages.</p>
</item>

<tag><c>{'Origin-Realm', <seealso marker="diameter_dict#DATA_TYPES">DiameterIdentity()</seealso>}</c></tag>
<item>
<p>
Value of the Origin-Realm AVP in outgoing messages.</p>
</item>

<tag><c>{'Host-IP-Address', [<seealso marker="diameter_dict#DATA_TYPES">Address()</seealso>]}</c></tag>
<item>
<p>
Values of Host-IP-Address AVPs.
Optional.</p>

<p>
The list of addresses is available to the start function of a
transport module, which either uses them as is or returns a new list
in order for the correct list of addresses to be sent in capabilities
exchange messages.</p>
</item>

<tag><c>{'Vendor-Id', <seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso>}</c></tag>
<item>
<p>
Value of the Vendor-Id AVP sent in an outgoing capabilities
exchange message.</p>
</item>

<tag><c>{'Product-Name', <seealso marker="#UTF8String">UTF8String()</seealso>}</c></tag>
<item>
<p>
Value of the Product-Name AVP sent in an outgoing capabilities
exchange message.</p>
</item>

<tag><c>{'Origin-State-Id', <seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso>}</c></tag>
<item>
<p>
Value of Origin-State-Id to be included in outgoing messages sent by
diameter itself.
In particular, the AVP will be included in CER/CEA and DWR/DWA messages.
Optional.</p>

<p>
Setting a value of <c>0</c> (zero) is equivalent to not setting a
value as documented in RFC 3588.
The function <seealso
marker="#origin_state_id">origin_state_id/0</seealso>
can be used as to retrieve a value that is set when the diameter
application is started.</p>
</item>

<tag><c>{'Supported-Vendor-Id', [<seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso>]}</c></tag>
<item>
<p>
Values of Supported-Vendor-Id AVPs sent in an outgoing
capabilities exchange message.
Optional, defaults to the empty list.</p>
</item>

<tag><c>{'Auth-Application-Id', [<seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso>]}</c></tag>
<item>
<p>
Values of Auth-Application-Id AVPs sent in an outgoing
capabilities exchange message.
Optional, defaults to the empty list.</p>
</item>

<tag><c>{'Inband-Security-Id', [<seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso>]}</c></tag>
<item>
<p>
Values of Inband-Security-Id AVPs sent in an outgoing
capabilities exchange message.
Optional, defaults to the empty list, which is equivalent to a
list containing only 0 (= NO_INBAND_SECURITY).</p>

<p>
If 1 (= TLS) is specified then TLS is selected if the CER/CEA received
from the peer offers it.</p>
</item>

<tag><c>{'Acct-Application-Id', [<seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso>]}</c></tag>
<item>
<p>
Values of Acct-Application-Id AVPs sent in an outgoing
capabilities exchange message.
Optional, defaults to the empty list.</p>
</item>

<tag><c>{'Vendor-Specific-Application-Id', [<seealso marker="diameter_dict#DATA_TYPES">Grouped()</seealso>]}</c></tag>
<item>
<p>
Values of Vendor-Specific-Application-Id AVPs sent in
an outgoing capabilities exchange message.
Optional, defaults to the empty list.</p>
</item>

<tag><c>{'Firmware-Revision', <seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso>}</c></tag>
<item>
<p>
Value of the Firmware-Revision AVP sent in an outgoing capabilities
exchange message.
Optional.</p>
</item>

</taglist>

<p>
Note that each tuple communicates one or more AVP values.
It is an error to specify duplicate tuples.</p>

<marker id="evaluable"/>
</item>

<tag><c>evaluable() = {M,F,A} | fun() | [evaluable() | A]</c></tag>
<item>
<p>
An expression that can be evaluated as a function in the following
sense.</p>

<code>
eval([{M,F,A} | T]) ->
    apply(M, F, T ++ A);
eval([[F|A] | T]) ->
    eval([F | T ++ A]);
eval([F|A]) ->
    apply(F, A);
eval(F) ->
    eval([F]).
</code>

<p>
Applying an evaluable() <c>E</c> to an argument list <c>A</c>
is meant in the sense of <c>eval([E|A])</c>.</p>

<p>
Beware of using local funs (that is, fun expressions not of the
form <c>fun Module:Name/Arity</c>) in situations in which the fun is
not short-lived and code is to be upgraded at runtime since any
processes retaining such a fun will have a reference to old code.</p>

<marker id="peer_filter"/>
</item>

<tag><c>peer_filter() = term()</c></tag>
<item>
<p>
A filter passed to <seealso marker="#call">call/4</seealso>
in order to select candidate peers for a 
<seealso marker="diameter_app#pick_peer">pick_peer/4</seealso>
callback.
Has one of the following types.</p>

<taglist>

<tag><c>none</c></tag>
<item>
<p>
Matches any peer.
This is a convenience that provides a filter equivalent to no
filter at all.</p>
</item>

<tag><c>host</c></tag>
<item>
<p>
Matches only those peers whose <c>Origin-Host</c> has the same value
as <c>Destination-Host</c> in the outgoing request in question,
or any peer if the request does not contain
a <c>Destination-Host</c> AVP.</p>
</item>

<tag><c>realm</c></tag>
<item>
<p>
Matches only those peers whose <c>Origin-Realm</c> has the same value
as <c>Destination-Realm</c> in the outgoing request in question,
or any peer if the request does not contain
a <c>Destination-Realm</c> AVP.</p>
</item>

<tag><c>{host, any|<seealso marker="diameter_dict#DATA_TYPES">DiameterIdentity()</seealso>}</c></tag>
<item>
<p>
Matches only those peers whose <c>Origin-Host</c> has the
specified value, or all peers if the atom <c>any</c>.</p>
</item>

<tag><c>{realm, any|<seealso marker="diameter_dict#DATA_TYPES">DiameterIdentity()</seealso></c></tag>
<item>
<p>
Matches only those peers whose <c>Origin-Realm</c> has the
value, or all peers if the atom <c>any</c>.</p>
</item>

<tag><c>{eval, <seealso marker="#evaluable">evaluable()</seealso>}</c></tag>
<item>
<p>
Matches only those peers for which the specified <seealso
marker="evaluable">#evaluable()</seealso> returns
<c>true</c> on the connection's <c>diameter_caps</c> record.
Any other return value or exception is equivalent to <c>false</c>.</p>
</item>

<tag><c>{neg, <seealso marker="#peer_filter">peer_filter()</seealso>}</c></tag>
<item>
<p>
Matches only those peers not matched by the specified filter.</p>
</item>

<tag><c>{all, [<seealso marker="#peer_filter">peer_filter()</seealso>]}</c></tag>
<item>
<p>
Matches only those peers matched by each filter of the specified list.</p>
</item>

<tag><c>{any, [<seealso marker="#peer_filter">peer_filter()</seealso>]}</c></tag>
<item>
<p>
Matches only those peers matched by at least one filter of the
specified list.</p>
</item>

</taglist>

<p>
Note that the <c>host</c> and <c>realm</c> filters examine the
outgoing request as passed to <seealso marker="#call">call/4</seealso>,
assuming that this is a record- or list-valued <seealso
marker="diameter_app#message">diameter_app:message()</seealso>, and that
the message contains at most one of each AVP.
If this is not the case then the <c>{host|realm, <seealso
marker="diameter_dict#DATA_TYPES">DiameterIdentity()</seealso>}</c>
filters must be used to achieve the desired result.
Note also that an empty host/realm (which should not be typical)
is equivalent to an unspecified one for the purposes of filtering.</p>

<p>
An invalid filter is equivalent to <c>{any, []}</c>, a filter
that matches no peer.</p>

<marker id="service_event"/>
</item>

<tag><c>service_event() = #diameter_event{}</c></tag>
<item>
<p>
Event message sent to processes that have subscribed using <seealso
marker="#subscribe">subscribe/1</seealso>.</p>

<p>
The <c>info</c> field of the event record can be one of the
following.</p>

<taglist>

<tag><c>{up, Ref, Peer, Config, Pkt}</c></tag>
<tag><c>{up, Ref, Peer, Config}</c></tag>
<tag><c>{down, Ref, Peer, Config}</c></tag>
<item>
<code>
Ref    = <seealso marker="#transport_ref">transport_ref()</seealso>
Peer   = <seealso marker="diameter_app#peer">diameter_app:peer()</seealso>
Config = {connect|listen, [<seealso marker="#transport_opt">transport_opt()</seealso>]}
Pkt    = #diameter_packet{}
</code>

<p>
The RFC 3539 watchdog state machine has
transitioned into (<c>up</c>) or out of (<c>down</c>) the open
state.
If a <c>diameter_packet</c> record is present in an <c>up</c> tuple
then there has been an exchange of capabilities exchange messages and
the record contains the received CER or CEA, otherwise the
connection has reestablished without the loss or transport
connectivity.</p>

<p>
Note that a single up/down event for a given peer corresponds to
as many <seealso marker="diameter_app#peer_up">peer_up/peer_down</seealso>
callbacks as there are Diameter applications that have been negotiated
during capablilities exchange.
That is, the event communicates connectivity with the
peer as a whole while the callbacks communicate connectivity with
respect to individual Diameter applications.</p>
</item>

<tag><c>{reconnect, Ref, Opts}</c></tag>
<item>
<code>
Ref  = <seealso marker="#transport_ref">transport_ref()</seealso>
Opts = [<seealso marker="#transport_opt">transport_opt()</seealso>]
</code>

<p>
A connecting transport is attempting to establish/reestablish a
transport connection with a peer following <c>reconnect_timer</c> or
<c>watchdog_timer</c> expiry.</p>
</item>

<tag><c>{closed, Ref, Reason, Config}</c></tag>
<item>
<code>
Ref = <seealso marker="#transport_ref">transport_ref()</seealso>
Config = {connect|listen, [<seealso marker="#transport_opt">transport_opt()</seealso>]}
</code>

<p>
Capabilities exchange has failed. <c>Reason</c> can be one of
the following.</p>

<taglist>

<tag><c>{'CER', Result, Caps, Pkt}</c></tag>
<item>
<code>
Result = ResultCode | {capabilities_cb, CB, ResultCode|discard}
Caps = #diameter_caps{}
Pkt  = #diameter_packet{}
ResultCode = integer()
CB = <seealso marker="#evaluable">evaluable()</seealso>
</code>

<p>
An incoming CER has been answered with the indicated result code or
discarded.
The capabilities record contains pairs of values for the the local
node and remote peer.
The packet record contains the CER in question.
In the case of rejection by a capabilities callback, the tuple
indicates the rejecting callback.</p>
</item>

<tag><c>{'CER', Caps, {ResultCode, Pkt}}</c></tag>
<item>
<code>
ResultCode = integer()
Caps = #diameter_caps{}
Pkt  = #diameter_packet{}
</code>

<p>
An incoming CER contained errors and has been answered with the
indicated result code.
The capabilities record contains only values for the the local
node.
The packet record contains the CER in question.</p>
</item>

<tag><c>{'CEA', Result, Caps, Pkt}</c></tag>
<item>
<code>
Result = integer() | atom() | {capabilities_cb, CB, ResultCode|discard}
Caps = #diameter_caps{}
Pkt  = #diameter_packet{}
ResultCode = integer()
</code>

<p>
An incoming CEA has been rejected for the indicated reason.
An integer-valued <c>Result</c> indicates the result code sent
by the peer.
The capabilities record contains pairs of values for the the local
node and remote peer.
The packet record contains the CEA in question.
In the case of rejection by a capabilities callback, the tuple
indicates the rejecting callback.</p>
</item>

<tag><c>{'CEA', Caps, Pkt}</c></tag>
<item>
<code>
Caps = #diameter_caps{}
Pkt  = #diameter_packet{}
</code>

<p>
An incoming CER contained errors and has been rejected.
The capabilities record contains only values for the the local node.
The packet record contains the CEA in question.</p>
</item>

</taglist>
</item>

<tag><c>{watchdog, Ref, PeerRef, {From, To}, Config}</c></tag>
<item>
<code>
Ref = transport_ref()
PeerRef = diameter_app:peer_ref()
From, To = initial | okay | suspect | down | reopen
Config = {connect|listen, [transport_opt()]}
</code>

<p>
An RFC 3539 watchdog state machine has changed state.</p>
</item>

</taglist>

<p>
For forward compatibility, a subscriber should be prepared to receive
info fields of forms other than the above.</p>

<marker id="service_name"/>
</item>

<tag><c>service_name() = term()</c></tag>
<item>
<p>
The name of a service as passed to <seealso
marker="#start_service">start_service/2</seealso> and with which the
service is identified.
There can be at most one service with a given name on a given node.
Note that <c>erlang:make_ref/0</c> can be used to generate a service name
that is somewhat unique.</p>

<marker id="service_opt"/>
</item>

<tag><c>service_opt()</c></tag>
<item>
<p>
Options accepted by <seealso
marker="#start_service">start_service/2</seealso>.
Can be any <seealso marker="#capability"><c>capability()</c></seealso> tuple as
well as the following.</p>

<taglist>

<tag><c>{application, [<seealso marker="#application_opt">application_opt()</seealso>]}</c></tag>
<item>
<p>
Defines a Diameter application supported by the service.</p>

<p>
A service must define one application for each Diameter application it
intends to support.
For an outgoing Diameter request, the application is specified by
passing the desired application's <seealso
marker="#application_alias"><c>application_alias()</c></seealso> to
<seealso marker="#call">call/4</seealso>, while for an
incoming request the application identifier in the message
header determines the application (and callback module), the
application identifier being specified in the <seealso
marker="diameter_dict">dictionary</seealso> file defining the
application.</p>
</item>

</taglist>

<marker id="transport_opt"/>
</item>

<tag><c>transport_opt()</c></tag>
<item>
<p>
Options accepted by <seealso
marker="#add_transport">add_transport/2</seealso>.</p>

<taglist>
<tag><c>{transport_module, atom()}</c></tag>
<item>
<p>
A module implementing a transport process as defined in <seealso
marker="diameter_transport">diameter_transport(3)</seealso>.
Defaults to <c>diameter_tcp</c> if unspecified.</p>

<p>
The interface required of a transport module is documented in <seealso
marker="diameter_transport">diameter_transport(3)</seealso>.</p>

<p>
Multiple <c>transport_module</c> and <c>transport_config</c>
options are allowed.
The order of these is significant in this case (and only in this case),
a <c>transport_module</c> being paired with the first
<c>transport_config</c> following it in the options list, or the
default value for trailing modules.
Transport starts will be attempted with each of the
modules in order until one establishes a connection within the
corresponding timeout (see <c>transport_config</c> below) or all fail.</p>
</item>

<tag><c>{transport_config, term()}</c></tag>
<tag><c>{transport_config, term(), <seealso marker="#diameter_dict#DATA_TYPES">Unsigned32()</seealso>}</c></tag>
<item>
<p>
A term passed as the third argument to the <seealso
marker="diameter_transport#start">start/3</seealso> function of
the relevant <c>transport_module</c> in order to start a transport process.
Defaults to the empty list if unspecified.</p>

<p>
The 3-tuple form additionally specifies an interval, in milliseconds,
after which a started transport process should be terminated if it has
not yet established a connection.
For example, the following options on a connecting transport
request a connection with one peer over SCTP or another
(typically the same) over TCP.</p>

<code>
{transport_module, diameter_sctp}
{transport_config, SctpOpts, 5000}
{transport_module, diameter_tcp}
{transport_config, TcpOpts}
</code>

<p>
To listen on both SCTP and TCP, define one transport for each.</p>
</item>

<tag><c>{applications, [<seealso marker="#application_alias">application_alias()</seealso>]}</c></tag>
<item>
<p>
The list of Diameter applications to which usage of the transport
should be restricted.
Defaults to all applications configured on the service
in question.
Must only specify applications defined on the service to which
the transport is added.</p>
</item>

<tag><c>{capabilities, [<seealso marker="#capability">capability()</seealso>]}</c></tag>
<item>
<p>
AVP's used to construct outgoing CER/CEA messages.
Any AVP specified takes precedence over a corresponding value specified
for the service in question.</p>

<p>
Specifying a capability as a transport option
may be particularly appropriate for Inband-Security-Id in case
TLS is desired over TCP as implemented by
<seealso marker="diameter_tcp">diameter_tcp(3)</seealso> but
not over SCTP as implemented by
<seealso marker="diameter_sctp">diameter_sctp(3)</seealso>.</p>
</item>

<tag><c>{capabilities_cb, <seealso marker="#evaluable">evaluable()</seealso>}</c></tag>
<item>
<p>
A callback invoked upon reception of CER/CEA during capabilities
exchange in order to ask whether or not the connection should
be accepted.
Applied to the transport reference (as returned by <seealso
marker="#add_transport">add_transport/2</seealso>) and
<c>diameter_caps</c> record of the connection.
Returning <c>ok</c> accepts the connection.
Returning <c>integer()</c> causes an incoming
CER to be answered with the specified Result-Code.
Returning <c>discard</c> causes an incoming CER to
be discarded.
Returning <c>unknown</c> is equivalent to returning <c>3010</c>,
DIAMETER_UNKNOWN_PEER.
Returning anything but <c>ok</c> or a 2xxx series result
code causes the transport connection to be broken.</p>

<p>
Multiple <c>capabilities_cb</c> options can be specified, in which
case the corresponding callbacks are applied until either all return
<c>ok</c> or one does not.</p>
</item>

<tag><c>{watchdog_timer, TwInit}</c></tag>
<item>
<code>
TwInit = <seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso>
       | {M,F,A}
</code>

<p>
The RFC 3539 watchdog timer.
An integer value is interpreted as the RFC's TwInit in milliseconds,
a jitter of &plusmn; 2 seconds being added at each rearming of the
timer to compute the RFC's Tw.
An MFA is expected to return the RFC's Tw directly, with jitter
applied, allowing the jitter calculation to be performed by
the callback.</p>

<p>
An integer value must be at least 6000 as required by RFC 3539.
Defaults to 30000 if unspecified.</p>
</item>

<tag><c>{reconnect_timer, Tc}</c></tag>
<item>
<code>
Tc = <seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso>
</code>

<p>
For a connecting transport, the RFC 3588 Tc timer, in milliseconds.
Note that this timer determines the frequency with which the transport
will attempt to establish a connection with its peer only <em>before</em>
an initial connection is established: once there is an initial
connection it's watchdog_timer that determines the frequency of
reconnection attempts, as required by RFC 3539.</p>

<p>
For a listening transport, the timer specifies the time after which a
previously connected peer will be forgotten: a connection after this time is
regarded as an initial connection rather than a reestablishment,
causing the RFC 3539 state machine to pass to state OPEN rather than
REOPEN.
Note that these semantics are not goverened by the RFC and
that a listening transport's reconnect_timer should be greater than its
peer's Tc plus jitter.</p>

<p>
Defaults to 30000 for a connecting transport and 60000 for a listening
transport.</p>

</item>

</taglist>

<p>
Unrecognized options are silently ignored but are returned unmodified
by <seealso
marker="#service_info">service_info/2</seealso> and can be referred to
in predicate functions passed to <seealso
marker="#remove_transport">remove_transport/2</seealso>.</p>

<marker id="transport_ref"/>
</item>

<tag><c>transport_ref() = reference()</c></tag>
<item>
<p>
An reference returned by <seealso
marker="#add_transport">add_transport/2</seealso> that
identifies the configuration.</p>
</item>

</taglist>

</section>

<marker id="add_transport"/>
<funcs>

<!-- ===================================================================== -->

<func>
<name>add_transport(SvcName, {connect|listen, Options})
        -> {ok, Ref} | {error, Reason}</name>
<fsummary>Add transport capability to a service.</fsummary>
<type>
<v>SvcName = <seealso marker="#service_name">service_name()</seealso></v>
<v>Options = [<seealso marker="#transport_opt">transport_opt()</seealso>]</v>
<v>Ref = <seealso marker="#transport_ref">transport_ref()</seealso></v>
<v>Reason = term()</v>
</type>
<desc>
<p>
Add transport capability to a service.</p>

<p>
The service will start transport processes as required in order to
establish a connection with the peer, either by connecting to the peer
(<c>connect</c>) or by  accepting incoming connection requests
(<c>listen</c>).
A connecting transport establishes transport connections with at most
one peer, an listening transport potentially with many.</p>

<p>
The diameter application takes responsibility for exchanging
CER/CEA with the peer.
Upon successful completion of capabilities exchange the service
calls each relevant application module's <seealso
marker="diameter_app#peer_up">peer_up/3</seealso> callback
after which the caller can exchange Diameter messages with the peer over
the transport.
In addition to CER/CEA, the service takes responsibility for the
handling of DWR/DWA and required by RFC 3539 as well as for DPR/DPA.</p>

<p>
The returned reference uniquely identifies the transport within the
scope of the service.
Note that the function returns before a transport connection has been
established.
It is not an error to add a transport to a service that has not yet
been configured: a service can be started after configuring
transports.</p>

<marker id="call"/>
</desc>
</func>

<!-- ===================================================================== -->

<func>
<name>call(SvcName, App, Request, Options) -> ok | Answer | {error, Reason}</name>
<fsummary>Send a Diameter request message.</fsummary>
<type>
<v>SvcName = <seealso marker="#service_name">service_name()</seealso></v>
<v>App = <seealso marker="#application_alias">application_alias()</seealso></v>
<v>Request = <seealso marker="diameter_app#message">diameter_app:message()</seealso></v>
<v>Answer = term()</v>
<v>Options = [<seealso marker="#call_opt">call_opt()</seealso>]</v>
</type>
<desc>
<p>
Send a Diameter request message and possibly return the answer or error.</p>

<p>
<c>App</c> identifies the Diameter application in which the request is
defined and callbacks to the corresponding callback module
will follow as described below and in <seealso
marker="diameter_app">diameter_app(3)</seealso>.
Unless the <c>detach</c> option has been specified to cause an earlier
return, the call returns either when an answer message is received
from the peer or an error occurs.
In the case of an answer, the return value is as returned by a
<seealso
marker="diameter_app#handle_answer">handle_answer/4</seealso>
callback.
In the case of an error, whether or not the error is returned directly
by diameter or from a <seealso
marker="diameter_app#handle_error">handle_error/4</seealso>
callback depends on whether or not the outgoing request is
successfully encoded for transmission from the peer, the cases being
documented below.</p>

<p>
If there are no suitable peers, or if
<seealso marker="diameter_app#pick_peer">pick_peer/4</seealso>
rejects them by returning 'false', then <c>{error, no_connection}</c>
is returned.
Otherwise <seealso marker="diameter_app#pick_peer">pick_peer/4</seealso>
is followed by a
<seealso
marker="diameter_app#prepare_request">prepare_request/3</seealso>
callback, the message is encoded and sent.</p>

<p>
There are several error cases which may prevent an
answer from being received and passed to a
<seealso marker="diameter_app#handle_answer">handle_answer/4</seealso>
callback:</p>

<list>

<item>
<p>
If the initial encode of the outgoing request
fails, then the request process fails and <c>{error, encode}</c>
is returned.</p>
</item>

<item>
<p>
If the request is successfully encoded and sent but
the answer times out then a
<seealso marker="diameter_app#handle_error">handle_error/4</seealso>
callback takes place with <c>Reason = timeout</c>.</p>
</item>

<item>
<p>
If the request is successfully encoded and sent but the service in
question is stopped before an answer is received then a
<seealso marker="diameter_app#handle_error">handle_error/4</seealso>
callback takes place <c>Reason = cancel</c>.</p>
</item>

<item>
<p>
If the transport connection with the peer goes down after the request
has been sent but before an answer has been received then an attempt
is made to resend the request to an alternate peer.
If no such peer is available, or if the subsequent
<seealso marker="diameter_app#pick_peer">pick_peer/4</seealso>
callback rejects the candidates, then a
<seealso marker="diameter_app#handle_error">handle_error/4</seealso>
callback takes place with <c>Reason = failover</c>.
If a peer is selected then a
<seealso
marker="diameter_app#prepare_retransmit">prepare_retransmit/3</seealso>
callback takes place, after which the semantics are the same as
following an initial
<seealso marker="diameter_app#prepare_request">
prepare_request/3</seealso>
callback.</p>
</item>

<item>
<p>
If an encode error takes place during
retransmission then the request process fails and
<c>{error, failure}</c> is returned.</p>
</item>

<item>
<p>
If an application callback made in processing the request fails
(pick_peer, prepare_request, prepare_retransmit,
handle_answer or handle_error) then either
<c>{error, encode}</c> or <c>{error, failure}</c>
is returned depending on whether or not there has been an
attempt to send the request over the transport.</p>
</item>

</list>

<p>
Note that <c>{error, encode}</c> is the only return value which
guarantees that the request has <em>not</em> been sent over the
transport.</p>

<marker id="origin_state_id"/>
</desc>
</func>

<!-- ===================================================================== -->

<func>
<name>origin_state_id() -> <seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso></name>
<fsummary>Returns a reasonable Origin-State-Id.</fsummary>
<desc>
<p>
Return a reasonable value for use as Origin-State-Id in
outgoing messages.</p>

<p>
The value returned is the number of seconds since 19680120T031408Z,
the first value that can be encoded as a Diameter <seealso marker="diameter_dict#DATA_TYPES">Time()</seealso>,
at the time the diameter application was started.</p>

<marker id="remove_transport"/>
</desc>
</func>

<!-- ===================================================================== -->

<func>
<name>remove_transport(SvcName, Pred) -> ok</name>
<fsummary>Remove previously added transports.</fsummary>
<type>
<v>SvcName = <seealso marker="#service_name">service_name()</seealso></v>
<v>Pred = Fun | MFA | <seealso marker="#transport_ref">transport_ref()</seealso> | list() | true | false</v>
<v></v>
<v>Fun = fun((<seealso marker="#transport_ref">transport_ref()</seealso>, connect|listen, list()) -> boolean())</v>
<v>&nbsp;&nbsp;&nbsp; | fun((<seealso marker="#transport_ref">transport_ref()</seealso>, list()) -> boolean())</v>
<v>&nbsp;&nbsp;&nbsp; | fun((list()) -> boolean())</v>
<v>MFA = {atom(), atom(), list()}</v>
</type>
<desc>
<p>
Remove previously added transports.</p>

<p>
<c>Pred</c> determines which transports to remove.
An arity-3-valued <c>Pred</c> removes all transports for which
<c>Pred(Ref, Type, Opts)</c> returns <c>true</c>, where <c>Type</c> and
<c>Opts</c> are as passed to <seealso
marker="#add_transport">add_transport/2</seealso> and <c>Ref</c> is
as returned by the corresponding call.
The remaining forms are equivalent to an arity-3 fun as follows.</p>

<code>
Pred = fun(transport_ref(), list()):  fun(Ref, _, Opts) -> Pred(Ref, Opts) end
Pred = fun(list()):                   fun(_, _, Opts) -> Pred(Opts) end
Pred = transport_ref():               fun(Ref, _, _)  -> Pred == Ref end
Pred = list():                        fun(_, _, Opts) -> [] == Pred -- Opts end
Pred = true:                          fun(_, _, _) -> true end
Pred = false:                         fun(_, _, _) -> false end
Pred = {M,F,A}:  fun(Ref, Type, Opts) -> apply(M, F, [Ref, Type, Opts | A]) end
</code>

<p>
Removing a transport causes all associated transport connections to
be broken.
A base application DPR message with
Disconnect-Cause <c>DO_NOT_WANT_TO_TALK_TO_YOU</c> will be sent
to each connected peer before disassociating the transport configuration
from the service and terminating the transport upon reception of
DPA or timeout.</p>

<!-- TODO: document the timeout value, possibly make configurable. -->

<marker id="service_info"/>
</desc>
</func>

<!-- ===================================================================== -->

<func>
<name>service_info(SvcName, Item) -> Value</name>
<fsummary>Return specific information about a started service.</fsummary>
<type>
<v>SvcName = <seealso marker="#service_name">service_name()</seealso></v>
<v>Value = term()</v>
</type>
<desc>
<p>
Return information about a started service.</p>

<marker id="services"/>
</desc>
</func>

<!-- ===================================================================== -->

<func>
<name>services() -> [SvcName]</name>
<fsummary>Return the list of started services.</fsummary>
<type>
<v>SvcName = <seealso marker="#service_name">service_name()</seealso></v>
</type>
<desc>
<p>
Return the list of started services.</p>

<marker id="session_id"/>
</desc>
</func>

<!-- ===================================================================== -->

<func>
<name>session_id(Ident) -> <seealso marker="diameter_dict#DATA_TYPES">OctetString()</seealso></name>
<fsummary>Return a value for a Session-Id AVP.</fsummary>
<type>
<v>Ident = <seealso marker="diameter_dict#DATA_TYPES">DiameterIdentity()</seealso></v>
</type>
<desc>
<p>
Return a value for a Session-Id AVP.</p>

<p>
The value has the form required by section 8.8 of RFC 3588.
Ident should be the Origin-Host of the peer from which
the message containing the returned value will be sent.</p>

<marker id="start"/>
</desc>
</func>

<!-- ===================================================================== -->
<func>
<name>start() -> ok | {error, Reason}</name>
<fsummary>Start the diameter application.</fsummary>
<desc>
<p>
Start the diameter application.</p>

<p>
The diameter application must be started before starting a service.
In a production system this is typically accomplished by a boot
file, not by calling <c>start/0</c> explicitly.</p>

<marker id="start_service"/>
</desc>
</func>

<!-- ===================================================================== -->
<func>
<name>start_service(SvcName, Options) -> ok | {error, Reason}</name>
<fsummary>Start a Diameter service.</fsummary>
<type>
<v>SvcName = <seealso marker="#service_name">service_name()</seealso></v>
<v>Options = [<seealso marker="#service_opt">service_opt()</seealso>]</v>
<v>Reason  = term()</v>
</type>
<desc>
<p>
Start a diameter service.</p>

<p>
A service defines a locally-implemented Diameter node, specifying the
capabilities of the node to be used during capabilities exchange and
the Diameter applications that it supports.
Transports are added to a service using <seealso
marker="#add_transport">add_transport/2</seealso>.
</p>

<note>
<p>
A transport can both override its service's
capabilities and restrict its supported Diameter applications so
"service = Diameter node as identified by Origin-Host" is not
necessarily the case.</p>
</note>

<marker id="stop_service"/>
</desc>
</func>

<!-- ===================================================================== -->
<func>
<name>stop() -> ok | {error, Reason}</name>
<fsummary>Stop the diameter application.</fsummary>
<desc>
<p>
Stop the diameter application.</p>

<p>
</p>

<marker id="stop_service"/>
</desc>
</func>

<!-- ===================================================================== -->
<func>
<name>stop_service(SvcName) -> ok | {error, Reason}</name>
<fsummary>Stop a Diameter service.</fsummary>
<type>
<v>SvcName = <seealso marker="#service_name">service_name()</seealso></v>
<v>Reason = term()</v>
</type>
<desc>
<p>
Stop a diameter service.</p>

<marker id="subscribe"/>
</desc>
</func>

<!-- ===================================================================== -->

<func>
<name>subscribe(SvcName) -> true</name>
<fsummary>Subscribe to event messages.</fsummary>
<type>
<v>SvcName = <seealso marker="#service_name">service_name()</seealso></v>
</type>
<desc>
<p>
Subscribe to <seealso
marker="#service_event"><c>service_event()</c></seealso> messages from
a service.</p>

<p>
It is not an error to subscribe to events from a service
that does not yet exist.
Doing so before adding transports is required to guarantee the
reception of all related events.</p>

<marker id="unsubscribe"/>
</desc>
</func>

<!-- ===================================================================== -->

<func>
<name>unsubscribe(SvcName) -> true</name>
<fsummary>Unsubscribe to event messages.</fsummary>
<type>
<v>SvcName = <seealso marker="#service_name">service_name()</seealso></v>
</type>
<desc>
<p>
Unsubscribe to event messages from a service.</p>

</desc>
</func>

</funcs>

<!-- ===================================================================== -->
<!-- ===================================================================== -->
<section>
<title>SEE ALSO</title>

<p>
<seealso marker="diameter_app">diameter_app(3)</seealso>,
<seealso marker="diameter_transport">diameter_transport(3)</seealso>,
<seealso marker="diameter_dict">diameter_dict(4)</seealso></p>

</section>

</erlref>