X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=lib%2Fsilcske%2Fsilcske_status.h;h=4eb3371998c81f7aadbc974cd97ca7c84ddde8dd;hb=6210937137137fe4019e808686dd1fcf99360af6;hp=f512354f1179aee5c0a0cdcaa0ba50546a2768cd;hpb=62f89b2886bbe9df82d9b2fdabfe707509d9e0fc;p=silc.git diff --git a/lib/silcske/silcske_status.h b/lib/silcske/silcske_status.h index f512354f..4eb33719 100644 --- a/lib/silcske/silcske_status.h +++ b/lib/silcske/silcske_status.h @@ -1,16 +1,15 @@ /* - silcske_status.h + silcske_status.h - Author: Pekka Riikonen + Author: Pekka Riikonen - Copyright (C) 2000 Pekka Riikonen + Copyright (C) 2000 - 2002 Pekka Riikonen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - + the Free Software Foundation; version 2 of the License. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -18,27 +17,71 @@ */ +/****h* silcske/SKE Status Types + * + * DESCRIPTION + * + * Defines the SilcSKEStatus type, that is returned by all SKE routines, + * and a utility interface for handling the status. + * + ***/ + #ifndef SILCSKE_STATUS_H #define SILCSKE_STATUS_H -/* Status flags returned by all SKE routines */ +/****d* silcske/SilcSKEStatuses/SilcSKEStatus + * + * NAME + * + * typedef enum { ... } SilcSKEStatus; + * + * DESCRIPTION + * + * Status types returned by all SKE routines. This tell the status of + * the SKE session, and if an error occurred. + * + * SOURCE + */ typedef enum { /* These are defined by the protocol */ - SILC_SKE_STATUS_OK = 0, - SILC_SKE_STATUS_ERROR = 1, - SILC_SKE_STATUS_BAD_PAYLOAD = 2, - SILC_SKE_STATUS_UNKNOWN_GROUP = 3, - SILC_SKE_STATUS_UNKNOWN_CIPHER = 4, - SILC_SKE_STATUS_UNKNOWN_PKCS = 5, - SILC_SKE_STATUS_UNKNOWN_HASH_FUNCTION = 6, - SILC_SKE_STATUS_UNSUPPORTED_PUBLIC_KEY = 7, - SILC_SKE_STATUS_INCORRECT_SIGNATURE = 8, - - SILC_SKE_STATUS_KEY_EXCHANGE_NOT_ACTIVE, - SILC_SKE_STATUS_BAD_RESERVED_FIELD, - SILC_SKE_STATUS_BAD_PAYLOAD_LENGTH, - SILC_SKE_STATUS_INCORRECT_HASH, - SILC_SKE_STATUS_INCORRECT_PUBLIC_KEY, + SILC_SKE_STATUS_OK = 0, /* No error */ + SILC_SKE_STATUS_ERROR = 1, /* Unknown error */ + SILC_SKE_STATUS_BAD_PAYLOAD = 2, /* Malformed payload */ + SILC_SKE_STATUS_UNKNOWN_GROUP = 3, /* Unsupported DH group */ + SILC_SKE_STATUS_UNKNOWN_CIPHER = 4, /* Unsupported cipher */ + SILC_SKE_STATUS_UNKNOWN_PKCS = 5, /* Unsupported PKCS algorithm */ + SILC_SKE_STATUS_UNKNOWN_HASH_FUNCTION = 6, /* Unsupported hash function */ + SILC_SKE_STATUS_UNKNOWN_HMAC = 7, /* Unsupported HMAC */ + SILC_SKE_STATUS_UNSUPPORTED_PUBLIC_KEY = 8, /* Unsupported/not trusted PK */ + SILC_SKE_STATUS_INCORRECT_SIGNATURE = 9, /* Incorrect signature */ + SILC_SKE_STATUS_BAD_VERSION = 10, /* Unsupported version */ + SILC_SKE_STATUS_INVALID_COOKIE = 11, /* Cookie was modified */ + + /* Implementation specific status types */ + SILC_SKE_STATUS_PENDING, /* SKE library is pending */ + SILC_SKE_STATUS_PUBLIC_KEY_NOT_PROVIDED, /* Remote did not send PK */ + SILC_SKE_STATUS_KEY_EXCHANGE_NOT_ACTIVE, /* SKE is not started */ + SILC_SKE_STATUS_BAD_RESERVED_FIELD, /* Reserved field was not 0 */ + SILC_SKE_STATUS_BAD_PAYLOAD_LENGTH, /* Payload includes garbage */ + SILC_SKE_STATUS_SIGNATURE_ERROR, /* Error computing signature */ + SILC_SKE_STATUS_OUT_OF_MEMORY, /* System out of memory */ + + /* Other internal status types */ + SILC_SKE_STATUS_FREED, /* Internal library status */ } SilcSKEStatus; +/***/ + +/****f* silcske/SilcSKEStatuses/silc_ske_map_status + * + * SYNOPSIS + * + * const char *silc_ske_map_status(SilcSKEStatus status); + * + * DESCRIPTION + * + * Utility function to map the `status' into human readable message. + * + ***/ +const char *silc_ske_map_status(SilcSKEStatus status); -#endif +#endif /* SILCSKE_STATUS_H */