551bf16834beaf6697b9b37c447d98ddc97dd3da
[silc.git] / lib / silcske / silcske_groups.h
1 /*
2
3   silcske_groups.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 Diffie Hellman Groups
21  *
22  * DESCRIPTION
23  *
24  * This interface defines the Diffie Hellman group management and utility
25  * functions for the SKE.  They can be used find DH groups by group number,
26  * and group name.  These routines are used during the SKE session by the
27  * SKE library. However, application may use these as well if needed.
28  *
29  ***/
30
31 #ifndef SILCSKE_GROUPS_H
32 #define SILCSKE_GROUPS_H
33
34 #include "silcske_status.h"
35
36 /****s* silcske/SilcSKEGroups/SilcSKEDiffieHellmanGroup
37  *
38  * NAME
39  * 
40  *    typedef struct SilcSKEDiffieHellmanGroupStruct 
41  *                     *SilcSKEDiffieHellmanGroup;
42  *
43  * DESCRIPTION
44  *
45  *    This context represents one Diffie Hellman group, and is returned
46  *    by the utility functions for finding correct groups.  The context
47  *    is freed by calling the silc_ske_group_free function.
48  *
49  ***/
50 typedef struct SilcSKEDiffieHellmanGroupStruct *SilcSKEDiffieHellmanGroup;
51
52 /* Prototypes */
53
54 /****f* silcske/SilcSKEGroups/silc_ske_group_get_by_number
55  *
56  * SYNOPSIS
57  *
58  *    SilcSKEStatus 
59  *    silc_ske_group_get_by_number(int number,
60  *                                 SilcSKEDiffieHellmanGroup *ret);
61  *
62  * DESCRIPTION
63  *
64  *    Returns the Diffie Hellman group into the `ret' pointer by
65  *    group number indicated by the `number'.  Returns error status
66  *    if the group was not found.
67  *
68  ***/
69 SilcSKEStatus silc_ske_group_get_by_number(int number,
70                                            SilcSKEDiffieHellmanGroup *ret);
71
72 /****f* silcske/SilcSKEGroups/silc_ske_group_get_by_name
73  *
74  * SYNOPSIS
75  *
76  *    SilcSKEStatus 
77  *    silc_ske_get_group_by_name(const char *name,
78  *                               SilcSKEDiffieHellmanGroup *ret);
79  *
80  * DESCRIPTION
81  *
82  *    Returns the Diffie Hellman group into the `ret' pointer by
83  *    group name indicated by the `name'.  Returns error status
84  *    if the group was not found.
85  *
86  ***/
87 SilcSKEStatus silc_ske_group_get_by_name(const char *name,
88                                          SilcSKEDiffieHellmanGroup *ret);
89
90 /****f* silcske/SilcSKEGroups/silc_ske_group_free
91  *
92  * SYNOPSIS
93  *
94  *    void silc_ske_group_free(SilcSKEDiffieHellmanGroup group);
95  *
96  * DESCRIPTION
97  *
98  *    Free the Diffie Hellman group indicated by the `group'.
99  *
100  ***/
101 void silc_ske_group_free(SilcSKEDiffieHellmanGroup group);
102
103 /****f* silcske/SilcSKEGroups/silc_ske_get_supported_groups
104  *
105  * SYNOPSIS
106  *
107  *    char *silc_ske_get_supported_groups();
108  *
109  * DESCRIPTION
110  *
111  *    Returns a comma separated list of support Diffie Hellman groups.
112  *    This can be used to get the list of supported groups for SKE
113  *    packets.
114  *
115  ***/
116 char *silc_ske_get_supported_groups();
117
118 /****f* silcske/SilcSKEGroups/silc_ske_group_get_number
119  *
120  * SYNOPSIS
121  *
122  *    int silc_ske_group_get_number(SilcSKEDiffieHellmanGroup group);
123  *
124  * DESCRIPTION
125  *
126  *    Return the group number of the group indicated by the `group'.
127  *
128  ***/
129 int silc_ske_group_get_number(SilcSKEDiffieHellmanGroup group);
130
131 /****f* silcske/SilcSKEGroups/silc_ske_group_get_name
132  *
133  * SYNOPSIS
134  *
135  *    const char *silc_ske_group_get_name(SilcSKEDiffieHellmanGroup group);
136  *
137  * DESCRIPTION
138  *
139  *    Return the group name of the group indicated by the `group'.
140  *
141  ***/
142 const char *silc_ske_group_get_name(SilcSKEDiffieHellmanGroup group);
143
144 #endif /* SILCSKE_GROUPS_H */