Added.
[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/SKE Status Types
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   SILC_SKE_STATUS_SIGNATURE_ERROR,             /* Error computing signature */
67   SILC_SKE_STATUS_OUT_OF_MEMORY,               /* System out of memory */
68
69   /* Other internal status types */
70   SILC_SKE_STATUS_FREED,                       /* Internal library status */
71 } SilcSKEStatus;
72 /***/
73
74 /****f* silcske/SilcSKEStatuses/silc_ske_map_status
75  *
76  * SYNOPSIS
77  *
78  *    const char *silc_ske_map_status(SilcSKEStatus status);
79  *
80  * DESCRIPTION
81  *
82  *    Utility function to map the `status' into human readable message.
83  *
84  ***/
85 const char *silc_ske_map_status(SilcSKEStatus status);
86
87 #endif /* SILCSKE_STATUS_H */