Add GNU LGPL headers to all .c .C and .h files
[oweals/cde.git] / cde / lib / tt / lib / mp / mp_auth_functions.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $TOG: mp_auth_functions.h /main/1 1999/08/30 10:55:06 mgreess $ */
24 /******************************************************************************
25
26
27 Copyright 1993, 1998  The Open Group
28
29 All Rights Reserved.
30
31 The above copyright notice and this permission notice shall be included in
32 all copies or substantial portions of the Software.
33
34 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
35 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
36 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
37 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
38 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
39 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
40
41 Except as contained in this notice, the name of The Open Group shall not be
42 used in advertising or otherwise to promote the sale, use or other dealings
43 in this Software without prior written authorization from The Open Group.
44
45 Author: Ralph Mor, X Consortium
46 ******************************************************************************/
47 /*
48  * This file was copied and altered from libICE/ICEutil.h
49  * The 'Ice' prefix has been replaced by tt_ for functions
50  * and by _tt_ for data types.
51  */
52
53 #ifndef MP_AUTH_FUNCTIONS_H
54 #define MP_AUTH_FUNCTIONS_H
55
56 #include <stdio.h>
57
58 /*
59  * Data structure for entry in ICE authority file
60  */
61
62 typedef struct _tt_AuthFileEntry {
63     char            *protocol_name;
64     unsigned short  protocol_data_length;
65     char            *protocol_data;
66     char            *network_id;
67     char            *auth_name;
68     unsigned short  auth_data_length;
69     char            *auth_data;
70 } _tt_AuthFileEntry;
71
72 typedef struct _tt_AuthFileEntryList {
73     struct _tt_AuthFileEntryList        *next;
74     _tt_AuthFileEntry                   *entry;
75 } _tt_AuthFileEntryList;
76
77 /*
78  * Authentication data maintained in memory.
79  */
80
81 typedef struct {
82     char            *protocol_name;
83     char            *network_id;
84     char            *auth_name;
85     unsigned short  auth_data_length;
86     char            *auth_data;
87 } _tt_AuthDataEntry;
88
89 /*
90  * Return values from tt_LockAuthFile
91  */
92
93 #define _tt_AuthLockSuccess     0   /* lock succeeded */
94 #define _tt_AuthLockError       1   /* lock unexpectely failed, check errno */
95 #define _tt_AuthLockTimeout     2   /* lock failed, timeouts expired */
96
97
98 /*
99  * Function Prototypes
100  */
101
102 extern char *_tt_AuthFileName (void);
103
104 extern int _tt_LockAuthFile (
105     char *              /* file_name */,
106     int                 /* retries */,
107     int                 /* timeout */,
108     long                /* dead */
109 );
110
111 extern void _tt_UnlockAuthFile (
112     char *              /* file_name */
113 );
114
115 extern _tt_AuthFileEntry *_tt_ReadAuthFileEntry (
116     FILE *              /* auth_file */
117 );
118
119 extern void _tt_FreeAuthFileEntry (
120     _tt_AuthFileEntry * /* auth */
121 );
122
123 extern int _tt_WriteAuthFileEntry (
124     FILE *              /* auth_file */,
125     _tt_AuthFileEntry * /* auth */
126 );
127
128 extern _tt_AuthFileEntry *_tt_GetAuthFileEntry (
129     char *              /* protocol_name */,
130     char *              /* network_id */,
131     char *              /* auth_name */
132 );
133
134 extern char *_tt_GenerateMagicCookie (
135     int                 /* len */
136 );
137
138
139 #endif /* MP_AUTH_FUNCTIONS_H */