aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssl/doc/src/ssl_session_cache_api.xml
blob: 463cf15309576439e507cb91603e6664cf0ecaac (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
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">

<erlref>
  <header>
    <copyright>
      <year>1999</year><year>2017</year>
      <holder>Ericsson AB. All Rights Reserved.</holder>
    </copyright>
    <legalnotice>
      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
      You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License.

    </legalnotice>
    <title>ssl</title>
    <prepared></prepared>
    <docno></docno>
    <date></date>
    <rev></rev>
    <file>ssl_session_cache_api.xml</file>
  </header>
  <module since="OTP R14B">ssl_session_cache_api</module>
  <modulesummary>TLS session cache API</modulesummary>

  <description>
    <p>
      Defines the API for the TLS session cache so
      that the data storage scheme can be replaced by
      defining a new callback module implementing this API.
    </p>
  </description>
  <section>
    <title>DATA TYPES</title>

    <p>The following data types are used in the functions for
    <c>ssl_session_cache_api</c>:</p>

    <taglist>
      <tag><c>cache_ref() =</c></tag>
      <item><p><c>opaque()</c></p></item>

      <tag><c>key() =</c></tag>
      <item><p><c>{partialkey(), session_id()}</c></p></item>

      <tag><c>partialkey() =</c></tag>
      <item><p><c>opaque()</c></p></item>

      <tag><c>session_id() =</c></tag>
      <item><p><c>binary()</c></p></item>

      <tag><c>session()</c> =</tag>
      <item><p><c>opaque()</c></p></item>
    </taglist>

  </section>

  <funcs>

    <func>
      <name since="OTP R14B">delete(Cache, Key) -> _</name>
      <fsummary>Deletes a cache entry.</fsummary>
      <type>
	<v>Cache = cache_ref()</v>
	<v>Key = key()</v>
      </type>
      <desc>
	<p>Deletes a cache entry. Is only called from the cache
	handling process.
	</p>
      </desc>
    </func>

    <func>
      <name since="OTP R14B">foldl(Fun, Acc0, Cache) -> Acc</name>
      <fsummary></fsummary>
      <type>
	<v></v>
      </type>
      <desc>
	<p>Calls <c>Fun(Elem, AccIn)</c> on successive elements of the
	cache, starting with <c>AccIn == Acc0</c>. <c>Fun/2</c> must
	return a new accumulator, which is passed to the next call.
	The function returns the final value of the accumulator.
	<c>Acc0</c> is returned if the cache is empty.
	</p>
      </desc>
    </func>

    <func>
      <name since="OTP 18.0">init(Args) -> opaque() </name>
      <fsummary>Returns cache reference.</fsummary>
      <type>
	<v>Args = proplists:proplist()</v>
      </type>
      <desc>
	<p>Includes property <c>{role, client | server}</c>.
	Currently this is the only predefined property,
	there can also be user-defined properties. See also
	application environment variable
	<seealso marker="ssl_app">session_cb_init_args</seealso>.
	</p>
	<p>Performs possible initializations of the cache and returns
	a reference to it that is used as parameter to the other
	API functions. Is called by the cache handling processes
	<c>init</c> function, hence putting the same requirements on it
	as a normal process <c>init</c> function. This function is
	called twice when starting the SSL application, once with
	the role client and once with the role server, as the SSL
	application must be prepared to take on both roles.
	</p>
      </desc>
    </func>

    <func>
      <name since="OTP R14B">lookup(Cache, Key) -> Entry</name>
      <fsummary>Looks up a cache entry.</fsummary>
      <type>
	<v>Cache = cache_ref()</v>
	<v>Key = key()</v>
	<v>Entry = session() | undefined</v>
      </type>
      <desc>
	<p>Looks up a cache entry. Is to be callable from any
         process.
         </p>
      </desc>
    </func>

    <func>
      <name since="OTP R14B">select_session(Cache, PartialKey) -> [session()]</name>
      <fsummary>Selects sessions that can be reused.</fsummary>
      <type>
	<v>Cache = cache_ref()</v>
	<v>PartialKey = partialkey()</v>
	<v>Session = session()</v>
      </type>
      <desc>
	<p>Selects sessions that can be reused. Is to be callable
	from any process.
	</p>
      </desc>
    </func>

    <func>
      <name since="OTP 19.3">size(Cache) -> integer()</name>
      <fsummary>Returns the number of sessions in the cache.</fsummary>
      <type>
	<v>Cache = cache_ref()</v>
      </type>
      <desc>
	<p>Returns the number of sessions in the cache. If size
	exceeds the maximum number of sessions, the current cache
	entries will be invalidated regardless of their remaining
	lifetime. Is to be callable from any process.
	</p>
      </desc>
    </func>

    <func>
      <name since="OTP R14B">terminate(Cache) -> _</name>
      <fsummary>Called by the process that handles the cache when it
      is about to terminate.</fsummary>
      <type>
	<v>Cache = term() - as returned by init/0</v>
      </type>
      <desc>
	<p>Takes care of possible cleanup that is needed when the
	cache handling process terminates.
	</p>
      </desc>
    </func>

    <func>
      <name since="OTP R14B">update(Cache, Key, Session) -> _</name>
      <fsummary>Caches a new session or updates an already cached one.</fsummary>
      <type>
	<v>Cache = cache_ref()</v>
	<v>Key = key()</v>
	<v>Session = session()</v>
      </type>
      <desc>
	<p>Caches a new session or updates an already cached one. Is
	only called from the cache handling process.
	</p>
      </desc>
    </func>

  </funcs>

</erlref>