updates.
[silc.git] / lib / silcske / silcske_status.h
1 /*
2
3   silcske_status.h 
4
5   Author: Pekka Riikonen <priikone@silcnet.org>
6
7   Copyright (C) 2000 - 2002 Pekka Riikonen
8
9   This program is free software; you can redistribute it and/or modify
10   it under the terms of the GNU General Public License as published by
11   the Free Software Foundation; version 2 of the License.
12
13   This program is distributed in the hope that it will be useful,
14   but WITHOUT ANY WARRANTY; without even the implied warranty of
15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16   GNU General Public License for more details.
17
18 */
19
20 /****h* silcske/SilcSKEStatuses
21  *
22  * DESCRIPTION
23  *
24  * Defines the SilcSKEStatus type, that is returned by all SKE routines,
25  * and a utility interface for handling the status.
26  *
27  ***/
28
29 #ifndef SILCSKE_STATUS_H
30 #define SILCSKE_STATUS_H
31
32 /****d* silcske/SilcSKEStatuses/SilcSKEStatus
33  *
34  * NAME
35  * 
36  *    typedef enum { ... } SilcSKEStatus;
37  *
38  * DESCRIPTION
39  *
40  *    Status types returned by all SKE routines. This tell the status of
41  *    the SKE session, and if an error occurred. 
42  *
43  * SOURCE
44  */
45 typedef enum {
46   /* These are defined by the protocol */
47   SILC_SKE_STATUS_OK                     = 0,  /* No error */
48   SILC_SKE_STATUS_ERROR                  = 1,  /* Unknown error */
49   SILC_SKE_STATUS_BAD_PAYLOAD            = 2,  /* Malformed payload */
50   SILC_SKE_STATUS_UNKNOWN_GROUP          = 3,  /* Unsupported DH group */
51   SILC_SKE_STATUS_UNKNOWN_CIPHER         = 4,  /* Unsupported cipher */
52   SILC_SKE_STATUS_UNKNOWN_PKCS           = 5,  /* Unsupported PKCS algorithm */
53   SILC_SKE_STATUS_UNKNOWN_HASH_FUNCTION  = 6,  /* Unsupported hash function */
54   SILC_SKE_STATUS_UNKNOWN_HMAC           = 7,  /* Unsupported HMAC */
55   SILC_SKE_STATUS_UNSUPPORTED_PUBLIC_KEY = 8,  /* Unsupported/not trusted PK */
56   SILC_SKE_STATUS_INCORRECT_SIGNATURE    = 9,  /* Incorrect signature */
57   SILC_SKE_STATUS_BAD_VERSION            = 10, /* Unsupported version */
58   SILC_SKE_STATUS_INVALID_COOKIE         = 11, /* Cookie was modified */
59
60   /* Implementation specific status types */
61   SILC_SKE_STATUS_PENDING,                     /* SKE library is pending */
62   SILC_SKE_STATUS_PUBLIC_KEY_NOT_PROVIDED,     /* Remote did not send PK */
63   SILC_SKE_STATUS_KEY_EXCHANGE_NOT_ACTIVE,     /* SKE is not started */
64   SILC_SKE_STATUS_BAD_RESERVED_FIELD,          /* Reserved field was not 0 */
65   SILC_SKE_STATUS_BAD_PAYLOAD_LENGTH,          /* Payload includes garbage */
66
67   /* Other internal status types */
68   SILC_SKE_STATUS_FREED,                       /* Internal library status */
69 } SilcSKEStatus;
70 /***/
71
72 /****f* silcske/SilcSKEStatuses/silc_ske_map_status
73  *
74  * SYNOPSIS
75  *
76  *    const char *silc_ske_map_status(SilcSKEStatus status);
77  *
78  * DESCRIPTION
79  *
80  *    Utility function to map the `status' into human readable message.
81  *
82  ***/
83 const char *silc_ske_map_status(SilcSKEStatus status);
84
85 #endif /* SILCSKE_STATUS_H */