diff options
author | Ingela Anderton Andin <[email protected]> | 2010-06-21 17:11:47 +0200 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2010-06-22 09:27:05 +0200 |
commit | 74b227c22f05d0580a03d1d5f7fefcb12a18bde5 (patch) | |
tree | 934e680ac574abb4b7f0486dcf8c531bda6ce626 /lib/ssl/src/ssl_alert.erl | |
parent | 150fbc75ca713527faa8dda0dee819f1e06f1ea1 (diff) | |
download | otp-74b227c22f05d0580a03d1d5f7fefcb12a18bde5.tar.gz otp-74b227c22f05d0580a03d1d5f7fefcb12a18bde5.tar.bz2 otp-74b227c22f05d0580a03d1d5f7fefcb12a18bde5.zip |
Added more -spec definitions.
Diffstat (limited to 'lib/ssl/src/ssl_alert.erl')
-rw-r--r-- | lib/ssl/src/ssl_alert.erl | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/lib/ssl/src/ssl_alert.erl b/lib/ssl/src/ssl_alert.erl index db9a883654..eb1228afa4 100644 --- a/lib/ssl/src/ssl_alert.erl +++ b/lib/ssl/src/ssl_alert.erl @@ -32,6 +32,17 @@ -export([alert_txt/1, reason_code/2]). +%%==================================================================== +%% Internal application API +%%==================================================================== +%%-------------------------------------------------------------------- +-spec reason_code(#alert{}, client | server) -> closed | esslconnect | + esslaccept | string(). +%% +%% Description: Returns the error reason that will be returned to the +%% user. +%%-------------------------------------------------------------------- + reason_code(#alert{description = ?CLOSE_NOTIFY}, _) -> closed; reason_code(#alert{description = ?HANDSHAKE_FAILURE}, client) -> @@ -41,10 +52,19 @@ reason_code(#alert{description = ?HANDSHAKE_FAILURE}, server) -> reason_code(#alert{description = Description}, _) -> description_txt(Description). +%%-------------------------------------------------------------------- +-spec alert_txt(#alert{}) -> string(). +%% +%% Description: Returns the error string for given alert. +%%-------------------------------------------------------------------- + alert_txt(#alert{level = Level, description = Description, where = {Mod,Line}}) -> Mod ++ ":" ++ integer_to_list(Line) ++ ":" ++ level_txt(Level) ++" "++ description_txt(Description). +%%-------------------------------------------------------------------- +%%% Internal functions +%%-------------------------------------------------------------------- level_txt(?WARNING) -> "Warning:"; level_txt(?FATAL) -> @@ -96,8 +116,3 @@ description_txt(?USER_CANCELED) -> "user canceled"; description_txt(?NO_RENEGOTIATION) -> "no renegotiation". - - - - - |