gcredentials: add Solaris support
[platform/upstream/glib.git] / gio / gcredentialsprivate.h
1 /* GIO - GLib Input, Output and Streaming Library
2  *
3  * Copyright 2013 Red Hat, Inc.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General
16  * Public License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20
21 #ifndef __G_CREDENTIALS_PRIVATE_H__
22 #define __G_CREDENTIALS_PRIVATE_H__
23
24 #include "gio/gcredentials.h"
25 #include "gio/gnetworking.h"
26
27 #ifdef __linux__
28 #define G_CREDENTIALS_SUPPORTED 1
29 #define G_CREDENTIALS_USE_LINUX_UCRED 1
30 #define G_CREDENTIALS_NATIVE_TYPE G_CREDENTIALS_TYPE_LINUX_UCRED
31 #define G_CREDENTIALS_NATIVE_SIZE (sizeof (struct ucred))
32 #define G_CREDENTIALS_UNIX_CREDENTIALS_MESSAGE_SUPPORTED 1
33 #define G_CREDENTIALS_SOCKET_GET_CREDENTIALS_SUPPORTED 1
34 #define G_CREDENTIALS_SPOOFING_SUPPORTED 1
35
36 #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__GNU__)
37 #define G_CREDENTIALS_SUPPORTED 1
38 #define G_CREDENTIALS_USE_FREEBSD_CMSGCRED 1
39 #define G_CREDENTIALS_NATIVE_TYPE G_CREDENTIALS_TYPE_FREEBSD_CMSGCRED
40 #define G_CREDENTIALS_NATIVE_SIZE (sizeof (struct cmsgcred))
41 #define G_CREDENTIALS_UNIX_CREDENTIALS_MESSAGE_SUPPORTED 1
42 #define G_CREDENTIALS_SPOOFING_SUPPORTED 1
43
44 #elif defined(__OpenBSD__)
45 #define G_CREDENTIALS_SUPPORTED 1
46 #define G_CREDENTIALS_USE_OPENBSD_SOCKPEERCRED 1
47 #define G_CREDENTIALS_NATIVE_TYPE G_CREDENTIALS_TYPE_OPENBSD_SOCKPEERCRED
48 #define G_CREDENTIALS_NATIVE_SIZE (sizeof (struct sockpeercred))
49 #define G_CREDENTIALS_SOCKET_GET_CREDENTIALS_SUPPORTED 1
50 #define G_CREDENTIALS_SPOOFING_SUPPORTED 1
51
52 #elif defined(__sun__) || defined(__illumos__) || defined (__OpenSolaris_kernel__)
53 #include <ucred.h>
54 #define G_CREDENTIALS_SUPPORTED 1
55 #define G_CREDENTIALS_USE_SOLARIS_UCRED 1
56 #define G_CREDENTIALS_NATIVE_TYPE G_CREDENTIALS_TYPE_SOLARIS_UCRED
57 #define G_CREDENTIALS_NATIVE_SIZE (ucred_size ())
58 #define G_CREDENTIALS_UNIX_CREDENTIALS_MESSAGE_SUPPORTED 1
59 #define G_CREDENTIALS_SOCKET_GET_CREDENTIALS_SUPPORTED 1
60
61 #endif
62
63 #endif /* __G_CREDENTIALS_PRIVATE_H__ */